TBTK
TBTK::SusceptibilityCalculator Class Referenceabstract
Inheritance diagram for TBTK::SusceptibilityCalculator:
TBTK::LindhardSusceptibilityCalculator TBTK::MatsubaraSusceptibilityCalculator

Public Types

enum  Algorithm { Lindhard = 0, Matsubara = 1 }
 
enum  EnergyType { Real, Imaginary, Complex }
 

Public Member Functions

 SusceptibilityCalculator (Algorithm algorithm, const MomentumSpaceContext &momentumSpaceContext)
 
virtual ~SusceptibilityCalculator ()
 
virtual SusceptibilityCalculatorcreateSlave ()=0
 
virtual std::complex< double > calculateSusceptibility (const std::vector< double > &k, const std::vector< int > &orbitalIndices, std::complex< double > energy)=0
 
virtual std::vector< std::complex< double > > calculateSusceptibility (const DualIndex &kDual, const std::vector< int > &orbitalIndices)=0
 
std::vector< std::complex< double > > calculateSusceptibility (const std::vector< double > &k, const std::vector< int > &orbitalIndices)
 
const MomentumSpaceContextgetMomentumSpaceContext () const
 
void generateKPlusQLookupTable ()
 
Algorithm getAlgorithm () const
 
void setEnergyType (EnergyType energyType)
 
EnergyType getEnergyType () const
 
void setEnergies (const std::vector< std::complex< double >> &energies)
 
const std::vector< std::complex< double > > & getEnergies () const
 
void setEnergiesAreInversionSymmetric (bool energiesAreInversionSymmetric)
 
bool getEnergiesAreInversionSymmetric () const
 
void saveSusceptibilities (const std::string &filename) const
 
void loadSusceptibilities (const std::string &filename)
 

Protected Member Functions

 SusceptibilityCalculator (Algorithm algorithm, const MomentumSpaceContext &momentumSpaceContext, int *kPlusQLookupTable)
 
bool getIsMaster () const
 
int * getKPlusQLookupTable ()
 
const int * getKPlusQLookupTable () const
 
Index getSusceptibilityResultIndex (const Index &kIndex, const std::vector< int > &orbitalIndices) const
 
const IndexedDataTree< SerializableVector< std::complex< double > > > & getSusceptibilityTree () const
 
template<bool useKPlusQLookupTable>
int getKPlusQLinearIndex (unsigned int meshIndex, const std::vector< double > &k, int kLinearIndex) const
 
void cacheSusceptibility (const std::vector< std::complex< double >> &result, const std::vector< double > &k, const std::vector< int > &orbitalIndices, const Index &kIndex, const Index &resultIndex)
 
void clearCache ()
 
template<>
int getKPlusQLinearIndex (unsigned int meshIndex, const std::vector< double > &k, int kLinearIndex) const
 
template<>
int getKPlusQLinearIndex (unsigned int meshIndex, const std::vector< double > &k, int kLinearIndex) const
 

Member Enumeration Documentation

List of algorithm identifiers. Officilly supported algorithms are given unique identifiers. Algorithms not (yet) supported should make sure they use an identifier that does not clash with the officially supported ones. [ideally a large random looking number (magic number) to also minimize accidental clashes with other algorithms that are not (yet) supported.

Enum class for indicating whether the energy is an arbitrary comlex number, or if it is restricted to the real or imaginary axis.

Constructor & Destructor Documentation

TBTK::SusceptibilityCalculator::SusceptibilityCalculator ( Algorithm  algorithm,
const MomentumSpaceContext momentumSpaceContext 
)

Constructor.

virtual TBTK::SusceptibilityCalculator::~SusceptibilityCalculator ( )
virtual

Destructor.

TBTK::SusceptibilityCalculator::SusceptibilityCalculator ( Algorithm  algorithm,
const MomentumSpaceContext momentumSpaceContext,
int *  kPlusQLookupTable 
)
protected

Slave constructor.

Member Function Documentation

void TBTK::SusceptibilityCalculator::cacheSusceptibility ( const std::vector< std::complex< double >> &  result,
const std::vector< double > &  k,
const std::vector< int > &  orbitalIndices,
const Index kIndex,
const Index resultIndex 
)
protected

Cache susceptibility.

virtual std::complex<double> TBTK::SusceptibilityCalculator::calculateSusceptibility ( const std::vector< double > &  k,
const std::vector< int > &  orbitalIndices,
std::complex< double >  energy 
)
pure virtual

Calculate the susceptibility.

Implemented in TBTK::LindhardSusceptibilityCalculator, and TBTK::MatsubaraSusceptibilityCalculator.

virtual std::vector<std::complex<double> > TBTK::SusceptibilityCalculator::calculateSusceptibility ( const DualIndex kDual,
const std::vector< int > &  orbitalIndices 
)
pure virtual

Calculate the susceptibility.

Implemented in TBTK::LindhardSusceptibilityCalculator, and TBTK::MatsubaraSusceptibilityCalculator.

std::vector< std::complex< double > > TBTK::SusceptibilityCalculator::calculateSusceptibility ( const std::vector< double > &  k,
const std::vector< int > &  orbitalIndices 
)
inline

Calculate the susceptibility.

void TBTK::SusceptibilityCalculator::clearCache ( )
inlineprotected

Clear cache.

virtual SusceptibilityCalculator* TBTK::SusceptibilityCalculator::createSlave ( )
pure virtual

Create slave SusceptibilityCalcuator. The slave reuses internal lookup tables used to speed up the calculations and should not be used after the generating master have been destructed.

Implemented in TBTK::LindhardSusceptibilityCalculator, and TBTK::MatsubaraSusceptibilityCalculator.

void TBTK::SusceptibilityCalculator::generateKPlusQLookupTable ( )

Generate lookup table for the k+q linear index. Can be called repeatedly, and the lookup table is only generated the first time.

SusceptibilityCalculator::Algorithm TBTK::SusceptibilityCalculator::getAlgorithm ( ) const
inline

Get the algorithm used to calculate the susceptibility.

const std::vector< std::complex< double > > & TBTK::SusceptibilityCalculator::getEnergies ( ) const
inline

Get the energies for which the susceptibility should be calculated.

bool TBTK::SusceptibilityCalculator::getEnergiesAreInversionSymmetric ( ) const
inline

Get whether the susceptibility energies are inversion symmetric.

SusceptibilityCalculator::EnergyType TBTK::SusceptibilityCalculator::getEnergyType ( ) const
inline

Get energy type.

bool TBTK::SusceptibilityCalculator::getIsMaster ( ) const
inlineprotected

Returns true if the SusceptibilityCalculator is a master.

template<bool useKPlusQLookupTable>
int TBTK::SusceptibilityCalculator::getKPlusQLinearIndex ( unsigned int  meshIndex,
const std::vector< double > &  k,
int  kLinearIndex 
) const
protected

Returns the linear index for k+q.

int * TBTK::SusceptibilityCalculator::getKPlusQLookupTable ( )
inlineprotected

Returns the k+q lookup table.

const int * TBTK::SusceptibilityCalculator::getKPlusQLookupTable ( ) const
inlineprotected

Returns the k+q lookup table.

const MomentumSpaceContext & TBTK::SusceptibilityCalculator::getMomentumSpaceContext ( ) const
inline

Precompute susceptibilities. Will calculate the susceptibility for all values using a parallel algorithm. Can speed up calculations if most of the susceptibilities are needed.

Index TBTK::SusceptibilityCalculator::getSusceptibilityResultIndex ( const Index kIndex,
const std::vector< int > &  orbitalIndices 
) const
inlineprotected

Get Susceptibility result Index.

const IndexedDataTree< SerializableVector< std::complex< double > > > & TBTK::SusceptibilityCalculator::getSusceptibilityTree ( ) const
inlineprotected

Get susceptibility tree.

void TBTK::SusceptibilityCalculator::loadSusceptibilities ( const std::string &  filename)
inline

Load susceptibilities.

void TBTK::SusceptibilityCalculator::saveSusceptibilities ( const std::string &  filename) const
inline

Save susceptibilities.

void TBTK::SusceptibilityCalculator::setEnergies ( const std::vector< std::complex< double >> &  energies)
inline

Set the energies for which the susceptibility should be calculated.

void TBTK::SusceptibilityCalculator::setEnergiesAreInversionSymmetric ( bool  energiesAreInversionSymmetric)
inline

Set to true if the susceptibility energies can be assumed to be inversion symmetric in the complex plane.

Important note: Only set this to true if the energies passed to setSusceptibilityEnergies() are on the form (-E_n, -E_{n-1}, ..., E_{n-1}, E_n). Setting this flag to true without fullfilling this condition will result in undefined behavior.

void TBTK::SusceptibilityCalculator::setEnergyType ( EnergyType  energyType)
inline

Set energy type.


The documentation for this class was generated from the following file: