TBTK
Need a break? Support the development by playing Polarity Puzzles
GreensFunction.h
Go to the documentation of this file.
1 /* Copyright 2018 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_GREENS_FUNCTION
24 #define COM_DAFER45_TBTK_PROPERTY_GREENS_FUNCTION
25 
27 #include "TBTK/TBTKMacros.h"
28 
29 #include <complex>
30 #include <vector>
31 
32 namespace TBTK{
33 namespace Property{
34 
44 class GreensFunction : public EnergyResolvedProperty<std::complex<double>>{
45 public:
47  enum class Type{
48  TimeOrdered,
49  Advanced,
50  Retarded,
51  Principal,
52  NonPrincipal,
53  Matsubara
54  };
55 
58 
70  const IndexTree &indexTree,
71  Type type,
72  double lowerBound,
73  double upperBound,
74  unsigned int resolution
75  );
76 
89  const IndexTree &indexTree,
90  Type type,
91  double lowerBound,
92  double upperBound,
93  unsigned int resolution,
94  const std::complex<double> *data
95  );
96 
108  const IndexTree &indexTree,
109  int lowerMatsubaraEnergyIndex,
110  int upperMatsubaraEnergyIndex,
111  double fundamentalMatsubaraEnergy
112  );
113 
127  const IndexTree &indexTree,
128  int lowerMatsubaraEnergyIndex,
129  int upperMatsubaraEnergyIndex,
130  double fundamentalMatsubaraEnergy,
131  const std::complex<double> *data
132  );
133 
136 
143  GreensFunction operator+(const GreensFunction &rhs) const;
144 
147 
154  GreensFunction operator-(const GreensFunction &rhs) const;
155 
157  GreensFunction& operator*=(const std::complex<double> &rhs);
158 
165  GreensFunction operator*(const std::complex<double> &rhs) const;
166 
175  const std::complex<double> &lhs,
176  const GreensFunction &rhs
177  ){
178  return rhs*lhs;
179  }
180 
182  GreensFunction& operator/=(const std::complex<double> &rhs);
183 
190  GreensFunction operator/(const std::complex<double> &rhs) const;
191 
195  Type getType() const;
196 
198  std::string toString() const;
199 private:
201  Type type;
202 };
203 
205  TBTKAssert(
206  type == rhs.type,
207  "GreensFunction::operator+=()",
208  "Incompatible Green's function types.",
209  ""
210  );
211 
213 
214  return *this;
215 }
216 
218  GreensFunction greensFunction = *this;
219 
220  return greensFunction += rhs;
221 }
222 
224  TBTKAssert(
225  type == rhs.type,
226  "GreensFunction::operator-=()",
227  "Incompatible Green's function types.",
228  ""
229  );
230 
232 
233  return *this;
234 }
235 
237  GreensFunction greensFunction = *this;
238 
239  return greensFunction -= rhs;
240 }
241 
242 inline GreensFunction& GreensFunction::operator*=(const std::complex<double> &rhs){
244 
245  return *this;
246 }
247 
248 inline GreensFunction GreensFunction::operator*(const std::complex<double> &rhs) const{
249  GreensFunction greensFunction = *this;
250 
251  return greensFunction *= rhs;
252 }
253 
254 inline GreensFunction& GreensFunction::operator/=(const std::complex<double> &rhs){
256 
257  return *this;
258 }
259 
260 inline GreensFunction GreensFunction::operator/(const std::complex<double> &rhs) const{
261  GreensFunction greensFunction = *this;
262 
263  return greensFunction /= rhs;
264 }
265 
267  return type;
268 }
269 
270 }; //End namespace Property
271 }; //End namespace TBTK
272 
273 #endif
TBTK::Property::GreensFunction::getType
Type getType() const
Definition: GreensFunction.h:266
TBTK::Property::GreensFunction::operator*
friend GreensFunction operator*(const std::complex< double > &lhs, const GreensFunction &rhs)
Definition: GreensFunction.h:174
TBTK::Property::EnergyResolvedProperty
Base class for energy resolved Properties.
Definition: EnergyResolvedProperty.h:83
TBTK::Property::EnergyResolvedProperty::operator+=
EnergyResolvedProperty & operator+=(const EnergyResolvedProperty &rhs)
Definition: EnergyResolvedProperty.h:1195
EnergyResolvedProperty.h
Base class for energy resolved Properties.
TBTK::Property::EnergyResolvedProperty::operator-=
EnergyResolvedProperty & operator-=(const EnergyResolvedProperty &rhs)
Definition: EnergyResolvedProperty.h:1287
TBTK::Property::GreensFunction::operator-
GreensFunction operator-(const GreensFunction &rhs) const
Definition: GreensFunction.h:236
TBTK::Property::GreensFunction::operator/=
GreensFunction & operator/=(const std::complex< double > &rhs)
Definition: GreensFunction.h:254
TBTK::Property::GreensFunction::operator+
GreensFunction operator+(const GreensFunction &rhs) const
Definition: GreensFunction.h:217
TBTK::Property::GreensFunction::operator/
GreensFunction operator/(const std::complex< double > &rhs) const
Definition: GreensFunction.h:260
TBTK::Property::GreensFunction::Type
Type
Definition: GreensFunction.h:47
TBTK::Property::GreensFunction::GreensFunction
GreensFunction()
TBTK::Property::GreensFunction::toString
std::string toString() const
TBTK::Property::GreensFunction
Property container for the Green's function.
Definition: GreensFunction.h:44
TBTK::Property::GreensFunction::operator-=
GreensFunction & operator-=(const GreensFunction &rhs)
Definition: GreensFunction.h:223
TBTK::Property::GreensFunction::operator+=
GreensFunction & operator+=(const GreensFunction &rhs)
Definition: GreensFunction.h:204
TBTK::Property::EnergyResolvedProperty::operator/=
EnergyResolvedProperty & operator/=(const DataType &rhs)
Definition: EnergyResolvedProperty.h:1389
TBTK::IndexTree
Data structure for mapping physical indices to linear indices.
Definition: IndexTree.h:35
TBTK::Property::GreensFunction::operator*=
GreensFunction & operator*=(const std::complex< double > &rhs)
Definition: GreensFunction.h:242
TBTK::Property::EnergyResolvedProperty::operator*=
EnergyResolvedProperty & operator*=(const DataType &rhs)
Definition: EnergyResolvedProperty.h:1379
TBTKMacros.h
Precompiler macros.
TBTK::Property::GreensFunction::operator*
GreensFunction operator*(const std::complex< double > &rhs) const
Definition: GreensFunction.h:248