TBTK
ChebyshevSolver.h
Go to the documentation of this file.
1 /* Copyright 2016 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 
25 #ifndef COM_DAFER45_TBTK_CHEBYSHEV_SOLVER
26 #define COM_DAFER45_TBTK_CHEBYSHEV_SOLVER
27 
28 #include "Model.h"
29 #include <complex>
30 #include <omp.h>
31 
32 namespace TBTK{
33 
44 public:
47 
50 
52  void setModel(Model *model);
53 
55  Model* getModel();
56 
58  void setScaleFactor(double scaleFactor);
59 
61  double getScaleFactor();
62 
76  std::vector<Index> &to,
77  Index from,
78  std::complex<double> *coefficients,
79  int numCoefficients,
80  double broadening = 0.0001
81  );
82 
93  Index to,
94  Index from,
95  std::complex<double> *coefficients,
96  int numCoefficients,
97  double broadening = 0.0001
98  );
99 
113  std::vector<Index> &to,
114  Index from,
115  std::complex<double> *coefficients,
116  int numCoefficients,
117  double broadening = 0.0001
118  );
119 
130  Index to,
131  Index from,
132  std::complex<double> *coefficients,
133  int numCoefficients,
134  double broadening = 0.0001
135  );
136 
139  Index to,
140  Index from,
141  std::complex<double> *coefficients,
142  int numCoefficients,
143  double componentCutoff,
144  double broadening = 0.0001
145  );
146 
155  void generateLookupTable(
156  int numCoefficeints,
157  int energyResolution,
158  double lowerBound = -1.,
159  double upperBound = 1.
160  );
161 
164  void loadLookupTableGPU();
165 
168  void destroyLookupTableGPU();
169 
171  enum class GreensFunctionType{
172  Advanced,
173  Retarded,
174  Principal,
175  NonPrincipal
176  };
177 
192  std::complex<double> *greensFunction,
193  std::complex<double> *coefficients,
194  int numCoefficients,
195  int energyResolution,
196  double lowerBound = -1.,
197  double upperBound = 1.,
198  GreensFunctionType type = GreensFunctionType::Retarded
199  );
200 
212  std::complex<double> *greensFunction,
213  std::complex<double> *coefficients,
214  GreensFunctionType type = GreensFunctionType::Retarded
215  );
216 
228  std::complex<double> *greensFunction,
229  std::complex<double> *coefficients,
230  GreensFunctionType type = GreensFunctionType::Retarded
231  );
232 
244  std::complex<double> getMonolopoulosABCDamping(
245  double distanceToEdge,
246  double boundarySize,
247  double e = 1.,
248  double c = 2.62
249  );
250 
255  void setDamping(std::complex<double> *damping);
256 
257  void setTalkative(bool isTalkative);
258 private:
260  Model *model;
261 
263  double scaleFactor;
264 
266  std::complex<double> *damping;
267 
270  std::complex<double> **generatingFunctionLookupTable;
271 
273  std::complex<double> ***generatingFunctionLookupTable_device;
274 
277  int lookupTableNumCoefficients;
278 
281  int lookupTableResolution;
282 
285  bool isTalkative;
286 
289 // static int numChebyshevSolvers;
290 
292 // static int numDevices;
293 
295 // static bool *busyDevices;
296 
298 // static omp_lock_t busyDevicesLock;
299 
301 // static void createDeviceTableGPU();
302 
304 // static void destroyDeviceTableGPU();
305 
307 // static int allocateDeviceGPU();
308 
310 // static void freeDeviceGPU(int device);
311 
314 /* static class StaticConstructor{
315  public:
316  StaticConstructor();
317  } staticConstructor;*/
318 };
319 
321  return model;
322 }
323 
324 inline void ChebyshevSolver::setScaleFactor(double scaleFactor){
325  this->scaleFactor = scaleFactor;
326 }
327 
329  return scaleFactor;
330 }
331 
332 inline void ChebyshevSolver::setDamping(std::complex<double> *damping){
333  this->damping = damping;
334 }
335 
336 inline void ChebyshevSolver::setTalkative(bool isTalkative){
337  this->isTalkative = isTalkative;
338 }
339 
340 }; //End of namespace TBTK
341 
342 #endif
void calculateCoefficients(std::vector< Index > &to, Index from, std::complex< double > *coefficients, int numCoefficients, double broadening=0.0001)
Definition: ChebyshevSolver.h:43
void generateGreensFunctionGPU(std::complex< double > *greensFunction, std::complex< double > *coefficients, GreensFunctionType type=GreensFunctionType::Retarded)
Model * getModel()
Definition: ChebyshevSolver.h:320
Model Hamiltonian.
void calculateCoefficientsWithCutoff(Index to, Index from, std::complex< double > *coefficients, int numCoefficients, double componentCutoff, double broadening=0.0001)
Definition: ChebyshevSolver.cpp:408
double getScaleFactor()
Definition: ChebyshevSolver.h:328
void generateLookupTable(int numCoefficeints, int energyResolution, double lowerBound=-1., double upperBound=1.)
Definition: ChebyshevSolver.cpp:578
void generateGreensFunction(std::complex< double > *greensFunction, std::complex< double > *coefficients, int numCoefficients, int energyResolution, double lowerBound=-1., double upperBound=1., GreensFunctionType type=GreensFunctionType::Retarded)
void setModel(Model *model)
Definition: ChebyshevSolver.cpp:86
void setDamping(std::complex< double > *damping)
Definition: ChebyshevSolver.h:332
~ChebyshevSolver()
Definition: ChebyshevSolver.cpp:67
Definition: Index.h:44
Definition: AbstractOperator.h:26
std::complex< double > getMonolopoulosABCDamping(double distanceToEdge, double boundarySize, double e=1., double c=2.62)
Definition: ChebyshevSolver.cpp:797
void setScaleFactor(double scaleFactor)
Definition: ChebyshevSolver.h:324
ChebyshevSolver()
Definition: ChebyshevSolver.cpp:46
Definition: Model.h:40
GreensFunctionType
Definition: ChebyshevSolver.h:171
void calculateCoefficientsGPU(std::vector< Index > &to, Index from, std::complex< double > *coefficients, int numCoefficients, double broadening=0.0001)