TBTK
ZFactorCalculator.h
Go to the documentation of this file.
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_Z_FACTOR_CALCULATOR
24 #define COM_DAFER45_TBTK_Z_FACTOR_CALCULATOR
25 
26 #include "TBTK/BrillouinZone.h"
27 #include "TBTK/IndexedDataTree.h"
29 
30 namespace TBTK{
31 
33 public:
36  const MomentumSpaceContext &momentumSpaceContext,
37  unsigned int numWorkers = 1
38  );
39 
42 
44  void setNumSummationEnergies(unsigned int numSummationEnergies);
45 
47  void init();
48 
50  std::vector<std::complex<double>> calculateZFactor(
51  const std::vector<double> &k
52  );
53 
55 /* std::vector<std::complex<double>> calculateZFactor2(
56  const std::vector<double> &k
57  );*/
58 
60  void setU(std::complex<double> U);
61 
63  void setUp(std::complex<double> Up);
64 
66  void setJ(std::complex<double> J);
67 
69  void setJp(std::complex<double> Jp);
70 
72 // void precomputeSusceptibilities(unsigned int numWorkers = 128);
73 
75  void saveSusceptibilities(const std::string &filename) const;
76 
78  void loadSusceptibilities(const std::string &filename);
79 private:
81  SelfEnergyCalculator selfEnergyCalculator;
82 
84  unsigned int numSummationEnergies;
85 
87  bool isInitialized;
88 
90  void invertMatrix(
91  std::complex<double> *matrix,
92  unsigned int dimensions
93  );
94 
96  void multiplyMatrices(
97  std::complex<double> *matrix1,
98  std::complex<double> *matrix2,
99  std::complex<double> *result,
100  unsigned int dimensions
101  );
102 
104  void printMatrix(
105  std::complex<double> *matrix,
106  unsigned int dimensions
107  );
108 
110  std::complex<double> U, Up, J, Jp;
111 };
112 
114  unsigned int numSummationEnergies
115 ){
116  this->numSummationEnergies = numSummationEnergies;
117 }
118 
119 inline void ZFactorCalculator::setU(std::complex<double> U){
120  this->U = U;
121  selfEnergyCalculator.setU(U);
122 }
123 
124 inline void ZFactorCalculator::setUp(std::complex<double> Up){
125  this->Up = Up;
126  selfEnergyCalculator.setUp(Up);
127 }
128 
129 inline void ZFactorCalculator::setJ(std::complex<double> J){
130  this->J = J;
131  selfEnergyCalculator.setJ(J);
132 }
133 
134 inline void ZFactorCalculator::setJp(std::complex<double> Jp){
135  this->Jp = Jp;
136  selfEnergyCalculator.setJp(Jp);
137 }
138 
139 /*inline void ZFactorCalculator::precomputeSusceptibilities(
140  unsigned int numWorkers
141 ){
142  selfEnergyCalculator.precomputeSusceptibilities(numWorkers);
143 }*/
144 
146  const std::string &filename
147 ) const{
148  selfEnergyCalculator.saveSusceptibilities(filename);
149 }
150 
152  const std::string &filename
153 ){
154  selfEnergyCalculator.loadSusceptibilities(filename);
155 }
156 
157 }; //End of namespace TBTK
158 
159 #endif
void setU(std::complex< double > U)
Definition: ZFactorCalculator.h:119
ZFactorCalculator(const MomentumSpaceContext &momentumSpaceContext, unsigned int numWorkers=1)
Definition: SelfEnergyCalculator.h:32
void saveSusceptibilities(const std::string &filename) const
Definition: SelfEnergyCalculator.h:239
void saveSusceptibilities(const std::string &filename) const
Definition: ZFactorCalculator.h:145
void setJ(std::complex< double > J)
Definition: SelfEnergyCalculator.h:205
Brillouin zone.
Data structure for storing data associated with an index.
Definition: ZFactorCalculator.h:32
void setU(std::complex< double > U)
Definition: SelfEnergyCalculator.h:177
void setUp(std::complex< double > Up)
Definition: SelfEnergyCalculator.h:191
void setJp(std::complex< double > Jp)
Definition: SelfEnergyCalculator.h:219
void setNumSummationEnergies(unsigned int numSummationEnergies)
Definition: ZFactorCalculator.h:113
Definition: MomentumSpaceContext.h:32
void setUp(std::complex< double > Up)
Definition: ZFactorCalculator.h:124
Calculates the self-energy using the RPA approximation.
Definition: ModelFactory.h:35
std::vector< std::complex< double > > calculateZFactor(const std::vector< double > &k)
void setJ(std::complex< double > J)
Definition: ZFactorCalculator.h:129
void loadSusceptibilities(const std::string &filename)
Definition: SelfEnergyCalculator.h:261
void loadSusceptibilities(const std::string &filename)
Definition: ZFactorCalculator.h:151
void setJp(std::complex< double > Jp)
Definition: ZFactorCalculator.h:134