TBTK
DPropertyExtractor.h
Go to the documentation of this file.
1 /* Copyright 2016 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
23 #ifndef COM_DAFER45_TBTK_D_PROPERTY_EXTRACTOR
24 #define COM_DAFER45_TBTK_D_PROPERTY_EXTRACTOR
25 
26 #include "DiagonalizationSolver.h"
27 #include "EigenValues.h"
28 #include "DOS.h"
29 #include "Density.h"
30 #include "Magnetization.h"
31 #include "SpinPolarizedLDOS.h"
32 
33 #include <complex>
34 
35 namespace TBTK{
36 
41 public:
44 
47 
49  void saveEigenValues(
50  std::string path = "./",
51  std::string filename = "EV.dat"
52  );
53 
56  std::complex<double> **amplitudes,
57  int **indices,
58  int *numHoppingAmplitudes,
59  int *maxIndexSize
60  );
61 
63 // double* getEigenValues();
65 
67  double getEigenValue(int state);
68 
74  const std::complex<double> getAmplitude(int state, const Index &index);
75 
81 // double* calculateDOS(double l_lim, double u_lim, int resolution);
83  double l_lim,
84  double u_lim,
85  int resolution
86  );
87 
112 // double* calculateDensity(Index pattern, Index ranges);
113  Property::Density* calculateDensity(Index pattern, Index ranges);
114 
149 // double* calculateMAG(Index pattern, Index ranges);
150 // std::complex<double>* calculateMAG(Index pattern, Index ranges);
152  Index pattern,
153  Index ranges
154  );
155 
196 // double* calculateSP_LDOS(Index pattern, Index ranges, double u_lim, double l_lim, int resolution);
197 // std::complex<double>* calculateSP_LDOS(Index pattern, Index ranges, double l_lim, double u_lim, int resolution);
199  Index pattern,
200  Index ranges,
201  double l_lim,
202  double u_lim,
203  int resolution
204  );
205 
206 /* void save(int *memory, int size, int columns, std::string filename, std::string path = "./");
207  void save(double *memory, int size, int columns, std::string filename, std::string path = "./");
208  void save(std::complex<double> *memory, int size, int columns, std::string filename, std::string path = "./");
209  void save2D(int *memory, int size_x, int size_y, int columns, std::string filename, std::string path = "./");
210  void save2D(double *memory, int size_x, int size_y, int columns, std::string filename, std::string path = "./");
211  void save2D(std::complex<double> *memory, int size_x, int size_y, int columns, std::string filename, std::string path = "./");*/
212 private:
215  void calculate(
216  void (*callback)(
217  DPropertyExtractor *cb_this,
218  void *memory,
219  const Index &index,
220  int offset
221  ),
222  void *memory,
223  Index pattern,
224  const Index &ranges,
225  int currentOffset,
226  int offsetMultiplier
227  );
228 
230  static void calculateDensityCallback(
231  DPropertyExtractor *cb_this,
232  void *density,
233  const Index &index,
234  int offset
235  );
236 
238  static void calculateMAGCallback(
239  DPropertyExtractor *cb_this,
240  void *mag,
241  const Index &index,
242  int offset
243  );
244 
247  static void calculateSP_LDOSCallback(
248  DPropertyExtractor *cb_this,
249  void *sp_ldos,
250  const Index &index,
251  int offset
252  );
253 
255  DiagonalizationSolver *dSolver;
256 
259  void *hint;
260 
263  void ensureCompliantRanges(const Index &pattern, Index &ranges);
264 
266  void getLoopRanges(
267  const Index &pattern,
268  const Index &ranges,
269  int *lDimensions,
270  int **lRanges
271  );
272 };
273 
274 inline double DPropertyExtractor::getEigenValue(int state){
275  return dSolver->getEigenValue(state);
276 }
277 
278 inline const std::complex<double> DPropertyExtractor::getAmplitude(
279  int state,
280  const Index &index
281 ){
282  return dSolver->getAmplitude(state, index);
283 }
284 
285 }; //End of namespace TBTK
286 
287 #endif
DPropertyExtractor(DiagonalizationSolver *dSolver)
Definition: DPropertyExtractor.cpp:31
Property::EigenValues * getEigenValues()
Definition: DPropertyExtractor.cpp:66
Definition: EigenValues.h:33
Property::Density * calculateDensity(Index pattern, Index ranges)
Definition: DPropertyExtractor.cpp:95
Definition: Magnetization.h:35
Property container for eigen values.
Definition: DiagonalizationSolver.h:36
Solves a Model using diagonalization.
Property container for spin-polarized local density of states (spin-polarized LDOS) ...
Property::DOS * calculateDOS(double l_lim, double u_lim, int resolution)
Definition: DPropertyExtractor.cpp:77
Property container for density.
const std::complex< double > getAmplitude(int state, const Index &index)
Definition: DiagonalizationSolver.h:151
const double getEigenValue(int state)
Definition: DiagonalizationSolver.h:158
Property container for magnetization.
void getTabulatedAmplitudeSet(std::complex< double > **amplitudes, int **indices, int *numHoppingAmplitudes, int *maxIndexSize)
Definition: DPropertyExtractor.cpp:52
double getEigenValue(int state)
Definition: DPropertyExtractor.h:274
Definition: Index.h:44
Definition: AbstractOperator.h:26
Definition: DPropertyExtractor.h:40
Definition: SpinPolarizedLDOS.h:37
Definition: Density.h:33
Property container for density of states (DOS)
Property::SpinPolarizedLDOS * calculateSpinPolarizedLDOS(Index pattern, Index ranges, double l_lim, double u_lim, int resolution)
Definition: DPropertyExtractor.cpp:145
~DPropertyExtractor()
Definition: DPropertyExtractor.cpp:35
Definition: DOS.h:33
const std::complex< double > getAmplitude(int state, const Index &index)
Definition: DPropertyExtractor.h:278
Property::Magnetization * calculateMagnetization(Index pattern, Index ranges)
Definition: DPropertyExtractor.cpp:111
void saveEigenValues(std::string path="./", std::string filename="EV.dat")
Definition: DPropertyExtractor.cpp:38