TBTK
BlockDiagonalizer.h
1 /* Copyright 2017 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_PROPERTY_EXTRACTOR_BLOCK_DIAGONALIZER
24 #define COM_DAFER45_TBTK_PROPERTY_EXTRACTOR_BLOCK_DIAGONALIZER
25 
26 #include "TBTK/Solver/BlockDiagonalizer.h"
27 #include "TBTK/Property/DOS.h"
28 #include "TBTK/Property/Density.h"
31 #include "TBTK/Property/LDOS.h"
36 
37 #include <complex>
38 #include <initializer_list>
39 
40 namespace TBTK{
41 namespace PropertyExtractor{
42 
47 public:
50 
52  virtual ~BlockDiagonalizer();
53 
55 /* void saveEigenValues(
56  std::string path = "./",
57  std::string filename = "EV.dat"
58  );*/
59 
62 /* void getTabulatedHoppingAmplitudeSet(
63  std::complex<double> **amplitudes,
64  int **indices,
65  int *numHoppingAmplitudes,
66  int *maxIndexSize
67  );*/
68 
71 
73  double getEigenValue(int state) const;
74 
76  double getEigenValue(const Index &blockIndex, int state) const;
77 
82  const std::complex<double> getAmplitude(int state, const Index &index);
83 
85  const std::complex<double> getAmplitude(
86  const Index &blockIndex,
87  int state,
88  const Index &intraBlockIndex
89  ) const;
90 
93  std::initializer_list<Index> patterns,
94  std::initializer_list<int> states
95  );
96 
98 /* Property::GreensFunction* calculateGreensFunction(
99  Index to,
100  Index from,
101  Property::GreensFunction::Type type = Property::GreensFunction::Type::Retarded
102  );*/
103 
105  virtual Property::DOS calculateDOS();
106 
108  virtual std::complex<double> calculateExpectationValue(
109  Index to,
110  Index from
111  );
112 
114 /* virtual Property::Density calculateDensity(
115  Index pattern,
116  Index ranges
117  );*/
118 
121  std::initializer_list<Index> patterns
122  );
123 
125 /* virtual Property::Magnetization calculateMagnetization(
126  Index pattern,
127  Index ranges
128  );*/
129 
132  std::initializer_list<Index> patterns
133  );
134 
136 /* virtual Property::LDOS calculateLDOS(
137  Index pattern,
138  Index ranges
139  );*/
140 
143  std::initializer_list<Index> patterns
144  );
145 
147 /* virtual Property::SpinPolarizedLDOS calculateSpinPolarizedLDOS(
148  Index pattern,
149  Index ranges
150  );*/
151 
154  std::initializer_list<Index> patterns
155  );
156 
158  virtual double calculateEntropy();
159 private:
162  static void calculateWaveFunctionsCallback(
163  PropertyExtractor *cb_this,
164  void *waveFunctions,
165  const Index &index,
166  int offset
167  );
168 
170  static void calculateDensityCallback(
171  PropertyExtractor *cb_this,
172  void *density,
173  const Index &index,
174  int offset
175  );
176 
178  static void calculateMagnetizationCallback(
179  PropertyExtractor *cb_this,
180  void *mag,
181  const Index &index,
182  int offset
183  );
184 
187  static void calculateLDOSCallback(
188  PropertyExtractor *cb_this,
189  void *ldos,
190  const Index &index,
191  int offset
192  );
193 
196  static void calculateSP_LDOSCallback(
197  PropertyExtractor *cb_this,
198  void *sp_ldos,
199  const Index &index,
200  int offset
201  );
202 
204  Solver::BlockDiagonalizer *bSolver;
205 };
206 
207 inline double BlockDiagonalizer::getEigenValue(int state) const{
208  return bSolver->getEigenValue(state);
209 }
210 
212  const Index &blockIndex,
213  int state
214 ) const{
215  return bSolver->getEigenValue(blockIndex, state);
216 }
217 
218 inline const std::complex<double> BlockDiagonalizer::getAmplitude(
219  int state,
220  const Index &index
221 ){
222  return bSolver->getAmplitude(state, index);
223 }
224 
225 inline const std::complex<double> BlockDiagonalizer::getAmplitude(
226  const Index &blockIndex,
227  int state,
228  const Index &intraBlockIndex
229 ) const{
230  return bSolver->getAmplitude(blockIndex, state, intraBlockIndex);
231 }
232 
233 }; //End of namespace PropertyExtractor
234 }; //End of namespace TBTK
235 
236 #endif
BlockDiagonalizer(Solver::BlockDiagonalizer &bSolver)
Property container for local density of states (LDOS).
Definition: LDOS.h:33
const std::complex< double > getAmplitude(int state, const Index &index)
Definition: BlockDiagonalizer.h:167
Property container for eigen values..
Definition: EigenValues.h:32
virtual std::complex< double > calculateExpectationValue(Index to, Index from)
Property container for magnetization.
Definition: Magnetization.h:35
Property container for eigen values.
Definition: BlockDiagonalizer.h:46
Property container for local density of states (LDOS).
const double getEigenValue(int state)
Definition: BlockDiagonalizer.h:211
virtual Property::LDOS calculateLDOS(std::initializer_list< Index > patterns)
Property::WaveFunctions calculateWaveFunctions(std::initializer_list< Index > patterns, std::initializer_list< int > states)
virtual Property::Magnetization calculateMagnetization(std::initializer_list< Index > patterns)
double getEigenValue(int state) const
Definition: BlockDiagonalizer.h:207
Base class PropertyExtractors.
Property container for spin-polarized local density of states (spin-polarized LDOS).
Property container for density.
Property container for Green&#39;s function.
const std::complex< double > getAmplitude(int state, const Index &index)
Definition: BlockDiagonalizer.h:218
Property container for magnetization.
Flexible physical index.
Definition: Index.h:70
virtual Property::Density calculateDensity(std::initializer_list< Index > patterns)
Definition: PropertyExtractor.h:44
Definition: ModelFactory.h:35
Property container for wave function.
Definition: WaveFunctions.h:34
Property container for spin-polarized local density of states (spin-polarized LDOS).
Definition: SpinPolarizedLDOS.h:37
Property container for density.
Definition: Density.h:33
Property container for density of states (DOS).
Solves a block diagonal Model using diagonalization.
Definition: BlockDiagonalizer.h:43
Property container for density of states (DOS).
Definition: DOS.h:32
virtual Property::SpinPolarizedLDOS calculateSpinPolarizedLDOS(std::initializer_list< Index > patterns)
Property container for wave functions.