 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: ## 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

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/PropertyExtractor/ChebyshevExpander.h"
#include "TBTK/Solver/ChebyshevExpander.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)

## ◆ Type

 strong

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

## ◆ ChebyshevExpander()

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

## ◆ ~ChebyshevExpander()

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

Destructor.

## ◆ calculateCoefficients() [1/2]

 std::vector > > 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
 to vector of 'to'-indeces, or $$i$$'s. from 'From'-index, or $$j$$. coefficients Pointer to array able to hold numCoefficients $$\times$$toIndeices.size() coefficients. numCoefficients Number of coefficients to calculate for each to-index. broadening Broadening to use in convolusion of coefficients to remedy Gibb's osciallations.

## ◆ calculateCoefficients() [2/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$$. coefficients Pointer to array able to hold numCoefficients coefficients. numCoefficients Number of coefficients to calculate. broadening Broadening 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
 greensFunction Pointer to array able to hold Green's function. Has to be able to hold energyResolution elements. coefficients Chebyshev coefficients calculated by ChebyshevExpander::calculateCoefficients.

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

 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.

inline

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

Parameters

## ◆ setCalculateCoefficientsOnGPU()

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

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

Parameters
 calculateCoefficientsOnGPU True 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
 energyResolution The 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
 generateGreensFunctionsOnGPU True 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
 lowerBound The 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
 numCoefficients The 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
 scaleFactor The 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
 upperBound The 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
 useLookupTable True to use a lookup table.

The documentation for this class was generated from the following file:
• /home/kristofer.bjornson/SecondQuantizationCom/TBTK/Lib/include/TBTK/Solver/ChebyshevExpander.h