TBTK
RPASusceptibility.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_RPA_SUSCEPTIBILITY_CALCULATOR
24 #define COM_DAFER45_TBTK_RPA_SUSCEPTIBILITY_CALCULATOR
25 
26 #include "TBTK/InteractionAmplitude.h"
27 #include "TBTK/Property/Susceptibility.h"
30 #include "TBTK/Solver/Susceptibility.h"
31 
32 #include <complex>
33 
34 //#include <omp.h>
35 
36 namespace TBTK{
37 namespace Solver{
38 
40 public:
43  const MomentumSpaceContext &momentumSpaceContext,
44  const Property::Susceptibility &susceptibility
45  );
46 
49 
54 
57  const std::vector<InteractionAmplitude> &interactionAmplitudes
58  );
59 
62  virtual std::vector<std::complex<double>> calculateSusceptibility(
63  const Index &index,
64  const std::vector<std::complex<double>> &energies
65  );
66 
69  std::vector<std::complex<double>>
71  const Index &index
72  );
73 
76  std::vector<std::complex<double>>
78  const Index &index
79  );
80 
83  std::vector<std::complex<double>>
85  const Index &index
86  );
87 
89  void setU(std::complex<double> U);
90 
92  void setUp(std::complex<double> Up);
93 
95  void setJ(std::complex<double> J);
96 
98  void setJp(std::complex<double> Jp);
99 private:
101  const Property::Susceptibility &bareSusceptibility;
102 
104  std::vector<InteractionAmplitude> interactionAmplitudes;
105 
107  std::vector<InteractionAmplitude> interactionAmplitudesCharge;
108 
110  std::vector<InteractionAmplitude> interactionAmplitudesSpin;
111 
114  bool interactionAmplitudesAreGenerated;
115 
117  void invertMatrix(
118  std::complex<double> *matrix,
119  unsigned int dimensions
120  );
121 
123  void multiplyMatrices(
124  std::complex<double> *matrix1,
125  std::complex<double> *matrix2,
126  std::complex<double> *result,
127  unsigned int dimensions
128  );
129 
131  std::vector<
132  std::vector<std::vector<std::complex<double>>>
133  > rpaSusceptibilityMainAlgorithm(
134  const Index &index,
135  const std::vector<InteractionAmplitude> &interactionAmpltiudes
136  );
137 
139  std::complex<double> U, Up, J, Jp;
140 
144  void generateInteractionAmplitudes();
145 };
146 
147 inline const Property::Susceptibility&
149  return bareSusceptibility;
150 }
151 
153  const std::vector<InteractionAmplitude> &interactionAmplitudes
154 ){
155  this->interactionAmplitudes = interactionAmplitudes;
156 }
157 
158 inline std::vector<std::complex<double>>
160  const Index &index,
161  const std::vector<std::complex<double>> &energies
162 ){
163  TBTKExit(
164  "Solver::RPSSusceptibility::calculateSusceptibility()",
165  "This function is not supported by this Solver.",
166  ""
167  );
168 }
169 
170 inline void RPASusceptibility::setU(std::complex<double> U){
171  this->U = U;
172  interactionAmplitudesAreGenerated = false;
173 }
174 
175 inline void RPASusceptibility::setUp(std::complex<double> Up){
176  this->Up = Up;
177  interactionAmplitudesAreGenerated = false;
178 }
179 
180 inline void RPASusceptibility::setJ(std::complex<double> J){
181  this->J = J;
182  interactionAmplitudesAreGenerated = false;
183 }
184 
185 inline void RPASusceptibility::setJp(std::complex<double> Jp){
186  this->Jp = Jp;
187  interactionAmplitudesAreGenerated = false;
188 }
189 
190 }; //End of namespace Solver
191 }; //End of namespace TBTK
192 
193 #endif
virtual std::vector< std::complex< double > > calculateSusceptibility(const Index &index, const std::vector< std::complex< double >> &energies)
Definition: RPASusceptibility.h:159
const Property::Susceptibility & getBareSusceptibility() const
Definition: RPASusceptibility.h:148
RPASusceptibility * createSlave()
void setU(std::complex< double > U)
Definition: RPASusceptibility.h:170
void setJ(std::complex< double > J)
Definition: RPASusceptibility.h:180
void setJp(std::complex< double > Jp)
Definition: RPASusceptibility.h:185
Property container for density.
Definition: Susceptibility.h:42
void setUp(std::complex< double > Up)
Definition: RPASusceptibility.h:175
Definition: IndexedDataTree.h:43
Definition: MomentumSpaceContext.h:32
Flexible physical index.
Definition: Index.h:69
Definition: ModelFactory.h:35
Definition: RPASusceptibility.h:39
RPASusceptibility(const MomentumSpaceContext &momentumSpaceContext, const Property::Susceptibility &susceptibility)
Property container for the Susceptibility.
Definition: Susceptibility.h:36
IndexedDataTree< std::vector< std::complex< double > > > calculateSpinRPASusceptibility(const Index &index)
IndexedDataTree< std::vector< std::complex< double > > > calculateRPASusceptibility(const Index &index)
Serializable wrapper of std::vector.
IndexedDataTree< std::vector< std::complex< double > > > calculateChargeRPASusceptibility(const Index &index)
void setInteractionAmplitudes(const std::vector< InteractionAmplitude > &interactionAmplitudes)
Definition: RPASusceptibility.h:152