TBTK
Need a break? Support the development by playing Polarity Puzzles
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 
17 
24 #ifndef COM_DAFER45_TBTK_RPA_SUSCEPTIBILITY_CALCULATOR
25 #define COM_DAFER45_TBTK_RPA_SUSCEPTIBILITY_CALCULATOR
26 
27 #include "TBTK/InteractionAmplitude.h"
28 #include "TBTK/Property/Susceptibility.h"
29 #include "TBTK/MomentumSpaceContext.h"
30 #include "TBTK/SerializableVector.h"
31 #include "TBTK/Solver/Solver.h"
32 
33 #include <complex>
34 
35 namespace TBTK{
36 namespace Solver{
37 
38 class RPASusceptibility : public Solver, public Communicator{
39 public:
41  RPASusceptibility(
42  const MomentumSpaceContext &momentumSpaceContext,
43  const Property::Susceptibility &susceptibility
44  );
45 
47  const Property::Susceptibility& getBareSusceptibility() const;
48 
52  RPASusceptibility* createSlave();
53 
55  void setInteractionAmplitudes(
56  const std::vector<InteractionAmplitude> &interactionAmplitudes
57  );
58 
61  virtual std::vector<std::complex<double>> calculateSusceptibility(
62  const Index &index,
63  const std::vector<std::complex<double>> &energies
64  );
65 
67  IndexedDataTree<
68  std::vector<std::complex<double>>
69  > calculateRPASusceptibility(
70  const Index &index
71  );
72 private:
74  const Property::Susceptibility &bareSusceptibility;
75 
77  std::vector<InteractionAmplitude> interactionAmplitudes;
78 
80  const MomentumSpaceContext &momentumSpaceContext;
81 
83  void invertMatrix(
84  std::complex<double> *matrix,
85  unsigned int dimensions
86  );
87 
89  std::vector<std::vector<std::vector<
90  std::vector<std::vector<std::complex<double>>>
91  >>> rpaSusceptibilityMainAlgorithm(
92  const Index &index,
93  const std::vector<InteractionAmplitude> &interactionAmpltiudes
94  );
95 };
96 
97 inline const Property::Susceptibility&
98 RPASusceptibility::getBareSusceptibility() const{
99  return bareSusceptibility;
100 }
101 
102 inline void RPASusceptibility::setInteractionAmplitudes(
103  const std::vector<InteractionAmplitude> &interactionAmplitudes
104 ){
105  this->interactionAmplitudes = interactionAmplitudes;
106 }
107 
108 inline std::vector<std::complex<double>>
109 RPASusceptibility::calculateSusceptibility(
110  const Index &index,
111  const std::vector<std::complex<double>> &energies
112 ){
113  TBTKExit(
114  "Solver::RPSSusceptibility::calculateSusceptibility()",
115  "This function is not supported by this Solver.",
116  ""
117  );
118 }
119 
120 }; //End of namespace Solver
121 }; //End of namespace TBTK
122 
123 #endif
124 
Base class for Solvers.
Definition: Boolean.h:32