TBTK
LindhardSusceptibilityCalculator.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_LINDHARD_SUSCEPTIBILITY_CALCULATOR
24 #define COM_DAFER45_TBTK_LINDHARD_SUSCEPTIBILITY_CALCULATOR
25 
27 #include "TBTK/RPA/SusceptibilityCalculator.h"
28 
29 #include <complex>
30 
31 //#include <omp.h>
32 
33 namespace TBTK{
34 
36 public:
39  const MomentumSpaceContext &momentumSpaceContext
40  );
41 
44 
49 
51  virtual std::complex<double> calculateSusceptibility(
52  const std::vector<double> &k,
53  const std::vector<int> &orbitalIndices,
54  std::complex<double> energy
55  );
56 
58  virtual std::vector<std::complex<double>> calculateSusceptibility(
59  const DualIndex &kDual,
60  const std::vector<int> &orbitalIndices
61  );
62 
66  void precompute(unsigned int numWorkers = 129);
67 
71  bool susceptibilityIsSafeFromPoles
72  );
73 
77 private:
80  bool susceptibilityIsSafeFromPoles;
81 
83  double *fermiDiracLookupTable;
84 
87  const MomentumSpaceContext &momentumSpaceContext,
88  int *kPlusQLookupTable,
89  double *fermiDiracLookupTable
90  );
91 
93  std::complex<double> calculateSusceptibilityLindhard(
94  const std::vector<double> &k,
95  const std::vector<int> &orbitalIndices,
96  std::complex<double> energy
97  );
98 
100  template<bool useKPlusQLookupTable, bool isSafeFromPoles>
101  std::vector<std::complex<double>> calculateSusceptibilityLindhard(
102  const DualIndex &kDual,
103  const std::vector<int> &orbitalIndices
104  );
105 
108  std::complex<double> getPoleTimesTwoFermi(
109  std::complex<double> energy,
110  double e2,
111  double e1,
112  double chemicalPotential,
113  double temperature,
114  int kPlusQLinearIndex,
115  unsigned int meshPoint,
116  unsigned int state2,
117  unsigned int state1,
118  unsigned int numOrbitals
119  ) const;
120 };
121 
123  bool susceptibilityIsSafeFromPoles
124 ){
125  this->susceptibilityIsSafeFromPoles = susceptibilityIsSafeFromPoles;
126 }
127 
129  return susceptibilityIsSafeFromPoles;
130 }
131 
132 }; //End of namespace TBTK
133 
134 #endif
LindhardSusceptibilityCalculator(const MomentumSpaceContext &momentumSpaceContext)
Definition: LindhardSusceptibilityCalculator.h:35
bool getSusceptibilityIsSafeFromPoles() const
Definition: LindhardSusceptibilityCalculator.h:128
void precompute(unsigned int numWorkers=129)
Property container for density.
Definition: DualIndex.h:33
void setSusceptibilityIsSafeFromPoles(bool susceptibilityIsSafeFromPoles)
Definition: LindhardSusceptibilityCalculator.h:122
Definition: SusceptibilityCalculator.h:41
Definition: MomentumSpaceContext.h:32
Definition: ModelFactory.h:35
virtual std::complex< double > calculateSusceptibility(const std::vector< double > &k, const std::vector< int > &orbitalIndices, std::complex< double > energy)
virtual LindhardSusceptibilityCalculator * createSlave()