TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::Solver::ChebyshevExpander Class Reference

Solves a Model using the Chebyshev method. More...

#include <ChebyshevExpander.h>

Inheritance diagram for TBTK::Solver::ChebyshevExpander:
TBTK::Solver::Solver TBTK::Communicator

Public Types

enum  Type { Advanced, Retarded, Principal, NonPrincipal }
 

Public Member Functions

 ChebyshevExpander ()
 
virtual ~ChebyshevExpander ()
 
void setScaleFactor (double scaleFactor)
 
double getScaleFactor ()
 
void setNumCoefficients (int numCoefficients)
 
int getNumCoefficients () const
 
void setBroadening (double broadening)
 
double getBroadening () const
 
void setEnergyResolution (int energyResolution)
 
int getEnergyResolution () const
 
void setLowerBound (double lowerBound)
 
double getLowerBound () const
 
void setUpperBound (double upperBound)
 
double getUpperBound () const
 
void setCalculateCoefficientsOnGPU (bool calculateCoefficientsOnGPU)
 
bool getCalculateCoefficientsOnGPU () const
 
void setGenerateGreensFunctionsOnGPU (bool generateGreensFunctionsOnGPU)
 
bool getGenerateGreensFunctionsOnGPU () const
 
void setUseLookupTable (bool useLookupTable)
 
bool getUseLookupTable () const
 
std::vector< std::vector< std::complex< double > > > calculateCoefficients (std::vector< Index > &to, Index from)
 
std::vector< std::complex< double > > calculateCoefficients (Index to, Index from)
 
std::vector< std::complex< double > > generateGreensFunction (const std::vector< std::complex< double >> &coefficients, Type type=Type::Retarded)
 
- Public Member Functions inherited from TBTK::Solver::Solver
 Solver ()
 
virtual ~Solver ()
 
virtual void setModel (Model &model)
 
ModelgetModel ()
 
const ModelgetModel () const
 
- Public Member Functions inherited from TBTK::Communicator
 Communicator (bool verbose)
 
void setVerbose (bool verbose)
 
bool getVerbose () const
 

Additional Inherited Members

- Static Public Member Functions inherited from TBTK::Communicator
static void setGlobalVerbose (bool globalVerbose)
 
static bool getGlobalVerbose ()
 

Detailed Description

Solves a Model using the Chebyshev method.

The ChebyshevExpander can be used to calculate Green's function for a given Model using an expansion of the form

\( G_{\mathbf{i}\mathbf{j}}(E) = \frac{1}{\sqrt{s^2 - E^2}} \sum_{m=0}^{\infty} \frac{b_{\mathbf{i}\mathbf{j}}^{(m)}}{1 + \delta_{0m}} F(m\textrm{acos}(E/s)), \)


where \(F(x)\) is one of the functions \(\cos(x)\), \(\sin(x)\), \(e^{ix}\), and \(e^{-ix}\). The implementation is based on PhysRevLett.105.167006. The ChebyshevExpander can be run on CPU, GPU, or a mixture of both. The calculation of Chebyshev coefficients scales as \(O(n)\) with each of the following: dimension of the Hilbert space and number of Chebyshev coefficients. The generation of Green's functions scales as \(O(n)\) with the following: Number of coefficients, energy resolution, and the number of Green's functions.

Use the PropertyExtractor::ChebyshevExpander to calculate Properties.

Example

#include "TBTK/Model.h"
#include "TBTK/Streams.h"
#include "TBTK/TBTK.h"
using namespace TBTK;
int main(){
Model model;
for(int x = 0; x < 10; x++){
for(int y = 0; y < 10; y++){
model << HoppingAmplitude(1, {x+1, y}, {x, y}) + HC;
model << HoppingAmplitude(1, {x, y+1}, {x, y}) + HC;
}
}
model.construct();
solver.setModel(model);
solver.setScaleFactor(10);
solver.setUseLookupTable(true);
solver.setNumCoefficients(10);
const double LOWER_BOUND = -1;
const double UPPER_BOUND = 1;
const int RESOLUTION = 10;
PropertyExtractor::ChebyshevExpander propertyExtractor(solver);
propertyExtractor.setEnergyWindow(
LOWER_BOUND,
UPPER_BOUND,
RESOLUTION
);
Property::GreensFunction greensFunction
= propertyExtractor.calculateGreensFunction({
{{5, 5}, {5, 5}},
{{2, 4}, {2, 4}}
});
for(unsigned int n = 0; n < greensFunction.getResolution(); n++)
Streams::out << greensFunction({{5, 5}, {5, 5}}, n) << "\t";
Streams::out << "\n";
for(unsigned int n = 0; n < greensFunction.getResolution(); n++)
Streams::out << greensFunction({{2, 4}, {2, 4}}, n) << "\t";
Streams::out << "\n";
}

Output

(-0.0885539,-0.358951) (-0.0715352,-0.364819) (-0.0540579,-0.369434) (-0.0362332,-0.372757) (-0.0181752,-0.374762) (5.57054e-17,-0.375432) (0.0181752,-0.374762) (0.0362332,-0.372757) (0.0540579,-0.369434) (0.0715352,-0.364819)
(-0.0885604,-0.358958) (-0.0715405,-0.364827) (-0.054062,-0.369442) (-0.036236,-0.372766) (-0.0181766,-0.374771) (5.57097e-17,-0.375442) (0.0181766,-0.374771) (0.036236,-0.372766) (0.054062,-0.369442) (0.0715405,-0.364827)

Member Enumeration Documentation

◆ Type

Enum class describing the type of Green's function to calculate.

Constructor & Destructor Documentation

◆ ChebyshevExpander()

TBTK::Solver::ChebyshevExpander::ChebyshevExpander ( )

◆ ~ChebyshevExpander()

virtual TBTK::Solver::ChebyshevExpander::~ChebyshevExpander ( )
virtual

Destructor.

Member Function Documentation

◆ calculateCoefficients() [1/2]

std::vector< std::complex< double > > TBTK::Solver::ChebyshevExpander::calculateCoefficients ( Index  to,
Index  from 
)
inline

Calculates the Chebyshev coefficients for \( G_{ij}(E)\), where \(i = \textrm{to}\) and \(j = \textrm{from}\).

Parameters
to'To'-index, or \(i\).
from'From'-index, or \(j\).
coefficientsPointer to array able to hold numCoefficients coefficients.
numCoefficientsNumber of coefficients to calculate.
broadeningBroadening to use in convolusion of coefficients to remedy Gibb's osciallations.

◆ calculateCoefficients() [2/2]

std::vector<std::vector<std::complex<double> > > TBTK::Solver::ChebyshevExpander::calculateCoefficients ( std::vector< Index > &  to,
Index  from 
)

Calculates the Chebyshev coefficients for \( G_{ij}(E)\), where \(i = \textrm{to}\) is a set of indices and \(j = \textrm{from}\).

Parameters
tovector of 'to'-indeces, or \(i\)'s.
from'From'-index, or \(j\).
coefficientsPointer to array able to hold numCoefficients \(\times\)toIndeices.size() coefficients.
numCoefficientsNumber of coefficients to calculate for each to-index.
broadeningBroadening to use in convolusion of coefficients to remedy Gibb's osciallations.

◆ generateGreensFunction()

std::vector< std::complex< double > > TBTK::Solver::ChebyshevExpander::generateGreensFunction ( const std::vector< std::complex< double >> &  coefficients,
Type  type = Type::Retarded 
)
inline

Genererate Green's function. Uses lookup table generated by ChebyshevExpander::generateLookupTable. Runs on CPU.

Parameters
greensFunctionPointer to array able to hold Green's function. Has to be able to hold energyResolution elements.
coefficientsChebyshev coefficients calculated by ChebyshevExpander::calculateCoefficients.

numCoefficients and energyResolution are here the values specified in the call to ChebyshevExpander::generateLookupTable

◆ getBroadening()

double TBTK::Solver::ChebyshevExpander::getBroadening ( ) const
inline

Get the broadening to use in convolusion of coefficients to remedy Gibb's osciallations.

Returns
The broadening parameter used.

◆ getCalculateCoefficientsOnGPU()

bool TBTK::Solver::ChebyshevExpander::getCalculateCoefficientsOnGPU ( ) const
inline

Get whether Chebyshev coefficients are set to be calculated on GPU.

Returns
True if GPU is used.

◆ getEnergyResolution()

int TBTK::Solver::ChebyshevExpander::getEnergyResolution ( ) const
inline

Get the number of energy point to use when generating Green's functions.

Returns
The number of energy points to use.

◆ getGenerateGreensFunctionsOnGPU()

bool TBTK::Solver::ChebyshevExpander::getGenerateGreensFunctionsOnGPU ( ) const
inline

Get whether Green's functions are set to be generated on GPU.

Returns
True if GPU is used.

◆ getLowerBound()

double TBTK::Solver::ChebyshevExpander::getLowerBound ( ) const
inline

Get the lower bound to use for the energy when generating the Green's function.

Returns
The lower bound for the energy.

◆ getNumCoefficients()

int TBTK::Solver::ChebyshevExpander::getNumCoefficients ( ) const
inline

Get the number of Chebyshev coefficients to use during calculations.

Returns
The number of Chebyshev coefficients.

◆ getScaleFactor()

double TBTK::Solver::ChebyshevExpander::getScaleFactor ( )
inline

Get scale factor.

Returns
The scale factor that is used to rescale the Hamiltonian.

◆ getUpperBound()

double TBTK::Solver::ChebyshevExpander::getUpperBound ( ) const
inline

Get the upper bound to use for the energy when generating the Green's function.

Returns
The upper bound for the energy.

◆ getUseLookupTable()

bool TBTK::Solver::ChebyshevExpander::getUseLookupTable ( ) const
inline

Set whether a lookup table should be used to when generating Green's functions.

Returns
True if a lookup table is used.

◆ setBroadening()

void TBTK::Solver::ChebyshevExpander::setBroadening ( double  broadening)
inline

Set the broadening to use in convolusion of coefficients to remedy Gibb's osciallations.

Parameters
broadeningThe broadening parameter to use.

◆ setCalculateCoefficientsOnGPU()

void TBTK::Solver::ChebyshevExpander::setCalculateCoefficientsOnGPU ( bool  calculateCoefficientsOnGPU)
inline

Set whether Chebyshev coefficients should be calculated on GPU. The default value is false.

Parameters
calculateCoefficientsOnGPUTrue to use GPU, false to use CPU.

◆ setEnergyResolution()

void TBTK::Solver::ChebyshevExpander::setEnergyResolution ( int  energyResolution)
inline

Set the number of energy point to use when generating Green's functions. The default value is 1000.

Parameters
energyResolutionThe number of energy points to use.

◆ setGenerateGreensFunctionsOnGPU()

void TBTK::Solver::ChebyshevExpander::setGenerateGreensFunctionsOnGPU ( bool  generateGreensFunctionsOnGPU)
inline

Set whether Green's functions should be generated on GPU. The default value is false.

Parameters
generateGreensFunctionsOnGPUTrue to use GPU, false to use CPU.

◆ setLowerBound()

void TBTK::Solver::ChebyshevExpander::setLowerBound ( double  lowerBound)
inline

Set the lower bound to use for the energy when generating the Green's function. The default value is -1.

Parameters
lowerBoundThe lower bound for the energy.

◆ setNumCoefficients()

void TBTK::Solver::ChebyshevExpander::setNumCoefficients ( int  numCoefficients)
inline

Set the number of Chebyshev coefficients to use during calculations. The default value is 1000.

Parameters
numCoefficientsThe number of Chebyshev coefficients.

◆ setScaleFactor()

void TBTK::Solver::ChebyshevExpander::setScaleFactor ( double  scaleFactor)
inline

Overrides Solver::setModel(). Sets the scale factor that rescales the Hamiltonian to ensure that the energy spectrum of the Hamiltonian is bounded on the interval (-1, 1).

Parameters
scaleFactorThe scale factor.

◆ setUpperBound()

void TBTK::Solver::ChebyshevExpander::setUpperBound ( double  upperBound)
inline

Set the upper bound to use for the energy when generating the Green's function. The default value is 1.

Parameters
upperBoundThe upper bound for the energy.

◆ setUseLookupTable()

void TBTK::Solver::ChebyshevExpander::setUseLookupTable ( bool  useLookupTable)
inline

Set whether a lookup table should be used to when generating Green's functions.

Parameters
useLookupTableTrue to use a lookup table.

The documentation for this class was generated from the following file:
TBTK::Solver::ChebyshevExpander::setCalculateCoefficientsOnGPU
void setCalculateCoefficientsOnGPU(bool calculateCoefficientsOnGPU)
Definition: ChebyshevExpander.h:565
TBTK::Model
Container of Model related information.
Definition: Model.h:57
TBTK::Solver::ChebyshevExpander::setScaleFactor
void setScaleFactor(double scaleFactor)
Definition: ChebyshevExpander.h:492
Model.h
Container of Model related information.
Streams.h
Streams for TBTK output.
TBTK::Solver::ChebyshevExpander::setUseLookupTable
void setUseLookupTable(bool useLookupTable)
Definition: ChebyshevExpander.h:585
TBTK::Initialize
void Initialize()
TBTK::Solver::Solver::setModel
virtual void setModel(Model &model)
Definition: Solver.h:69
ChebyshevExpander.h
Solves a Model using the Chebyshev method.
TBTK::Property::EnergyResolvedProperty::getResolution
unsigned int getResolution() const
Definition: EnergyResolvedProperty.h:881
TBTK::PropertyExtractor::ChebyshevExpander
Extracts physical properties from Solver::ChebyshevExpander.
Definition: ChebyshevExpander.h:51
TBTK::Property::GreensFunction
Property container for the Green's function.
Definition: GreensFunction.h:44
TBTK::Solver::ChebyshevExpander
Solves a Model using the Chebyshev method.
Definition: ChebyshevExpander.h:69
TBTK::HoppingAmplitude
Hopping amplitude from state 'from' to state 'to'.
Definition: HoppingAmplitude.h:53
TBTK::Streams::out
static std::ostream out
Definition: Streams.h:70
TBTK::Solver::ChebyshevExpander::setNumCoefficients
void setNumCoefficients(int numCoefficients)
Definition: ChebyshevExpander.h:505
ChebyshevExpander.h
Extracts physical properties from the ChebyshevExpander.
TBTK.h
TBTK initialization.
TBTK::Model::construct
void construct()
TBTK::Solver::ChebyshevExpander::setGenerateGreensFunctionsOnGPU
void setGenerateGreensFunctionsOnGPU(bool generateGreensFunctionsOnGPU)
Definition: ChebyshevExpander.h:575
TBTK::PropertyExtractor::PropertyExtractor::setEnergyWindow
virtual void setEnergyWindow(double lowerBound, double upperBound, int energyResolution)