TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::Property::LDOS Class Reference

Property container for the local density of states (LDOS). More...

#include <LDOS.h>

Inheritance diagram for TBTK::Property::LDOS:
TBTK::Property::EnergyResolvedProperty< double > TBTK::Property::AbstractProperty< double > TBTK::Property::Property TBTK::Serializable TBTK::Streamable

Public Member Functions

 LDOS ()
 
 LDOS (const std::vector< int > &ranges, double lowerBound, double upperBound, int resolution)
 
 LDOS (const std::vector< int > &ranges, double lowerBound, double upperBound, int resolution, const double *data)
 
 LDOS (const IndexTree &indexTree, double lowerBound, double upperBound, int resolution)
 
 LDOS (const IndexTree &indexTree, double lowerBound, double upperBound, int resolution, const double *data)
 
 LDOS (const std::string &serialization, Mode mode)
 
LDOSoperator+= (const LDOS &rhs)
 
LDOS operator+ (const LDOS &rhs) const
 
LDOSoperator-= (const LDOS &rhs)
 
LDOS operator- (const LDOS &rhs) const
 
LDOSoperator*= (const double &rhs)
 
LDOS operator* (const double &rhs) const
 
LDOSoperator/= (const double &rhs)
 
LDOS operator/ (const double &rhs) const
 
virtual std::string toString () const
 
virtual std::string serialize (Mode mode) const
 
- Public Member Functions inherited from TBTK::Property::EnergyResolvedProperty< double >
 EnergyResolvedProperty ()
 
 EnergyResolvedProperty (double lowerBound, double upperBound, unsigned int resolution)
 
 EnergyResolvedProperty (double lowerBound, double upperBound, unsigned int resolution, const double *data)
 
 EnergyResolvedProperty (const std::vector< int > &ranges, double lowerBound, double upperBound, unsigned int resolution)
 
 EnergyResolvedProperty (const std::vector< int > &ranges, double lowerBound, double upperBound, unsigned int resolution, const double *data)
 
 EnergyResolvedProperty (const IndexTree &indexTree, double lowerBound, double upperBound, unsigned int resolution)
 
 EnergyResolvedProperty (const IndexTree &indexTree, double lowerBound, double upperBound, unsigned int resolution, const double *data)
 
 EnergyResolvedProperty (EnergyType energyType, const IndexTree &indexTree, int lowerMatsubaraEnergyIndex, int upperMatsubaraEnergtIndex, double fundamentalMatsubaraEnergy)
 
 EnergyResolvedProperty (EnergyType energyType, const IndexTree &indexTree, int lowerMatsubaraEnergyIndex, int upperMatsubaraEnergtIndex, double fundamentalMatsubaraEnergy, const double *data)
 
 EnergyResolvedProperty (const std::string &serialization, Serializable::Mode mode)
 
EnergyType getEnergyType () const
 
double getLowerBound () const
 
double getUpperBound () const
 
unsigned int getResolution () const
 
double getDeltaE () const
 
double getEnergy (unsigned int n) const
 
int getLowerMatsubaraEnergyIndex () const
 
int getUpperMatsubaraEnergyIndex () const
 
unsigned int getNumMatsubaraEnergies () const
 
double getFundamentalMatsubaraEnergy () const
 
double getLowerMatsubaraEnergy () const
 
double getUpperMatsubaraEnergy () const
 
std::complex< double > getMatsubaraEnergy (unsigned int n) const
 
unsigned int getNumEnergies () const
 
bool energyWindowsAreEqual (const EnergyResolvedProperty &energyResolvedProperty, double precision=1e-1) const
 
- Public Member Functions inherited from TBTK::Property::AbstractProperty< double >
unsigned int getBlockSize () const
 
unsigned int getSize () const
 
const std::vector< double > & getData () const
 
std::vector< double > & getDataRW ()
 
unsigned int getDimensions () const
 
std::vector< int > getRanges () const
 
int getOffset (const Index &index) const
 
const IndexDescriptorgetIndexDescriptor () const
 
bool contains (const Index &index) const
 
void reduce (const std::vector< Index > &targetPatterns, const std::vector< Index > &newPatterns)
 
void hermitianConjugate ()
 
std::vector< SparseMatrix< double > > toSparseMatrices (const Model &model) const
 
virtual const double & operator() (const Index &index, unsigned int offset=0) const
 
virtual double & operator() (const Index &index, unsigned int offset=0)
 
double & operator() (const std::initializer_list< Subindex > &index)
 
const double & operator() (const std::initializer_list< Subindex > &index) const
 
virtual const double & operator() (unsigned int offset) const
 
virtual double & operator() (unsigned int offset)
 
void setAllowIndexOutOfBoundsAccess (bool allowIndexOutOfBoundsAccess)
 
void setDefaultValue (const double &defaultValue)
 
void replaceValues (const double &targetValue, const double &replacementValue)
 
- Public Member Functions inherited from TBTK::Serializable
template<>
std::string serialize (const bool &data, Mode mode)
 
template<>
std::string serialize (const double &data, Mode mode)
 
template<>
std::string serialize (const std::complex< double > &data, Mode mode)
 
template<>
std::string serialize (const int &data, Mode mode)
 
template<>
std::string serialize (const unsigned int &data, Mode mode)
 
template<>
std::string serialize (const SpinMatrix &data, Mode mode)
 
template<>
std::string serialize (const Statistics &data, Mode mode)
 
template<>
std::string serialize (const std::vector< std::complex< double >> &data, Mode mode)
 
template<>
int deserialize (const std::string &serialization, Mode mode)
 
template<>
unsigned int deserialize (const std::string &serialization, Mode mode)
 
template<>
double deserialize (const std::string &serialization, Mode mode)
 
template<>
std::complex< double > deserialize (const std::string &serialization, Mode mode)
 
template<>
SpinMatrix deserialize (const std::string &serialization, Mode mode)
 
template<>
Statistics deserialize (const std::string &serialization, Mode mode)
 
template<>
std::vector< std::complex< double > > deserialize (const std::string &serialization, Mode mode)
 

Friends

LDOS operator* (const double &lhs, const LDOS &rhs)
 

Additional Inherited Members

- Public Types inherited from TBTK::Property::EnergyResolvedProperty< double >
enum  EnergyType
 
- Public Types inherited from TBTK::Serializable
enum  Mode { Debug, Binary, XML, JSON }
 
- Static Public Member Functions inherited from TBTK::Serializable
static bool hasID (const std::string &serialization, Mode mode)
 
static std::string getID (const std::string &serialization, Mode mode)
 
static std::string extractComponent (const std::string &serialization, const std::string &containerID, const std::string &componentID, const std::string &componentName, Mode mode)
 
- Protected Member Functions inherited from TBTK::Property::EnergyResolvedProperty< double >
EnergyResolvedPropertyoperator+= (const EnergyResolvedProperty &rhs)
 
EnergyResolvedPropertyoperator-= (const EnergyResolvedProperty &rhs)
 
EnergyResolvedPropertyoperator*= (const double &rhs)
 
EnergyResolvedPropertyoperator/= (const double &rhs)
 
- Protected Member Functions inherited from TBTK::Property::AbstractProperty< double >
 AbstractProperty ()
 
 AbstractProperty (unsigned int blockSize)
 
 AbstractProperty (unsigned int blockSize, const double *data)
 
 AbstractProperty (const std::vector< int > &ranges, unsigned int blockSize)
 
 AbstractProperty (const std::vector< int > &ranges, unsigned int blockSize, const double *data)
 
 AbstractProperty (const IndexTree &indexTree, unsigned int blockSize)
 
 AbstractProperty (const IndexTree &indexTree, unsigned int blockSize, const double *data)
 
 AbstractProperty (const AbstractProperty &abstractProperty)
 
 AbstractProperty (AbstractProperty &&abstractProperty)
 
 AbstractProperty (const std::string &serialization, Mode mode)
 
virtual ~AbstractProperty ()
 
AbstractPropertyoperator= (const AbstractProperty &abstractProperty)
 
AbstractPropertyoperator= (AbstractProperty &&abstractProperty)
 
AbstractPropertyoperator+= (const AbstractProperty &rhs)
 
AbstractPropertyoperator-= (const AbstractProperty &rhs)
 
AbstractPropertyoperator*= (const double &rhs)
 
AbstractPropertyoperator/= (const double &rhs)
 
- Protected Member Functions inherited from TBTK::Property::Property
 Property ()
 
virtual ~Property ()
 
- Static Protected Member Functions inherited from TBTK::Serializable
static bool validate (const std::string &serialization, const std::string &id, Mode mode)
 
static std::string getContent (const std::string &serialization, Mode mode)
 
static std::vector< std::string > split (const std::string &content, Mode mode)
 
template<typename DataType >
static std::enable_if<!std::is_pointer< DataType >::value, std::string >::type serialize (const DataType &data, Mode mode)
 
template<typename DataType >
static std::enable_if< std::is_pointer< DataType >::value, std::string >::type serialize (const DataType &data, Mode mode)
 
template<typename DataType >
static DataType deserialize (const std::string &serialization, Mode mode)
 
static std::string extract (const std::string &serialization, Mode mode, std::string component)
 

Detailed Description

Property container for the local density of states (LDOS).

The LDOS is an EnergyResolvedProperty with DataType double.

Convention

LDOS extracted by native PropertyExtractors satisfies the following convention.

  • The LDOS is normalized such that, if it covers the full energy range, it integrates to one for any given Index. \(\sum_n LDOS(n)\Delta E = 1\).

Example

#include "TBTK/PropertyExtractor/Diagonalizer.h"
#include "TBTK/Smooth.h"
#include "TBTK/Solver/Diagonalizer.h"
#include "TBTK/Streams.h"
#include "TBTK/TBTK.h"
#include "TBTK/Visualization/MatPlotLib/Plotter.h"
using namespace TBTK;
using namespace Visualization::MatPlotLib;
int main(){
const unsigned int SIZE_X = 40;
const unsigned int SIZE_Y = 40;
double t = 1;
Model model = Models::SquareLattice({SIZE_X, SIZE_Y}, {0, t});
model.construct();
solver.setModel(model);
solver.run();
const double LOWER_BOUND = -5;
const double UPPER_BOUND = 5;
const unsigned int RESOLUTION = 100;
PropertyExtractor::Diagonalizer propertyExtractor(solver);
propertyExtractor.setEnergyWindow(
LOWER_BOUND,
UPPER_BOUND,
RESOLUTION
);
Property::LDOS ldos = propertyExtractor.calculateLDOS({{_a_, _a_}});
Streams::out << ldos << "\n";
Streams::out << "ldos({20, 20}, 50) = " << ldos({20, 20}, 50) << "\n";
double integratedLDOS = 0;
double dE = ldos.getDeltaE();
for(unsigned int n = 0; n < ldos.getResolution(); n++)
integratedLDOS += ldos({20, 20}, n)*dE;
Streams::out << "Integrated LDOS: " << integratedLDOS << "\n";
const double SMOOTHING_SIGMA = 0.2;
const unsigned int SMOOTHING_WINDOW = 51;
ldos = Smooth::gaussian(ldos, SMOOTHING_SIGMA, SMOOTHING_WINDOW);
Plotter plotter;
plotter.plot({_a_, 20}, ldos);
plotter.save("figures/LDOS0.png");
plotter.clear();
plotter.plot({20, 20}, ldos);
plotter.save("figures/LDOS1.png");
}

Output

Number of sites: 1600
Lower bound: -5 eV (-5 n.u.)
Upper bound: 5 eV (5 n.u.)
Resolution: 100
ldos({20, 20}, 50) = 0.338382
Integrated LDOS: 1
PropertyLDOSLDOS0.png
PropertyLDOSLDOS1.png

Constructor & Destructor Documentation

◆ LDOS() [1/6]

TBTK::Property::LDOS::LDOS ( )
inline

Constructs an uninitialized LDOS.

◆ LDOS() [2/6]

TBTK::Property::LDOS::LDOS ( const std::vector< int > &  ranges,
double  lowerBound,
double  upperBound,
int  resolution 
)

Constructs LDOS on the Ranges format. [See AbstractProperty for detailed information about the Ranges format.]

Parameters
rangesThe upper limit (exclusive) for the corresponding dimensions.
lowerBoundLower bound for the energy.
upperBoundUpper bound for the energy
resolutionNumber of points to use for the energy.

◆ LDOS() [3/6]

TBTK::Property::LDOS::LDOS ( const std::vector< int > &  ranges,
double  lowerBound,
double  upperBound,
int  resolution,
const double *  data 
)

Constructs LDOS on the Ranges format and initializes it with data. [See AbstractProperty for detailed information about the Ranges format and the raw data format.]

Parameters
rangesThe upper limit (exclusive) for the corresponding dimensions.
lowerBoundLower bound for the energy.
upperBoundUpper bound for the energy
resolutionNumber of points to use for the energy.
dataRaw data to initialize the LDOS with.

◆ LDOS() [4/6]

TBTK::Property::LDOS::LDOS ( const IndexTree indexTree,
double  lowerBound,
double  upperBound,
int  resolution 
)

Constructs LDOS on the Custom format. [See AbstractProperty for detailed information about the Custom format.]

Parameters
indexTreeIndexTree containing the Indices for which the LDOS should be contained.
lowerBoundLower bound for the energy.
upperBoundUpper bound for the energy
resolutionNumber of points to use for the energy.

◆ LDOS() [5/6]

TBTK::Property::LDOS::LDOS ( const IndexTree indexTree,
double  lowerBound,
double  upperBound,
int  resolution,
const double *  data 
)

Constructs LDOS on the Custom format and initializes it with data. [See AbstractProperty for detailed information about the Custom format and the raw data format.]

Parameters
indexTreeIndexTree containing the Indices for which the LDOS should be contained.
lowerBoundLower bound for the energy.
upperBoundUpper bound for the energy
resolutionNumber of points to use for the energy.
dataRaw data to initialize the LDOS with.

◆ LDOS() [6/6]

TBTK::Property::LDOS::LDOS ( const std::string &  serialization,
Mode  mode 
)

Constructor. Construct the LDOS from a serialization string.

Parameters
serializationSerialization string from which to construct the LDOS.
modeMode with which the string has been serialized.

Member Function Documentation

◆ operator*()

LDOS TBTK::Property::LDOS::operator* ( const double &  rhs) const
inline

Multiplication operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new LDOS that is product of this LDOS and the right hand side.

◆ operator*=()

LDOS & TBTK::Property::LDOS::operator*= ( const double &  rhs)
inline

◆ operator+()

LDOS TBTK::Property::LDOS::operator+ ( const LDOS rhs) const
inline

Addition operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new LDOS that is the sum of this LDOS and the right hand side.

◆ operator+=()

LDOS & TBTK::Property::LDOS::operator+= ( const LDOS rhs)
inline

◆ operator-()

LDOS TBTK::Property::LDOS::operator- ( const LDOS rhs) const
inline

Subtraction operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new LDOS that is the difference between this LDOS and the right hand side.

◆ operator-=()

LDOS & TBTK::Property::LDOS::operator-= ( const LDOS rhs)
inline

◆ operator/()

LDOS TBTK::Property::LDOS::operator/ ( const double &  rhs) const
inline

Division operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new LDOS that is quotient between this LDOS and the right hand side.

◆ operator/=()

LDOS & TBTK::Property::LDOS::operator/= ( const double &  rhs)
inline

◆ serialize()

virtual std::string TBTK::Property::LDOS::serialize ( Mode  mode) const
virtual

◆ toString()

virtual std::string TBTK::Property::LDOS::toString ( ) const
virtual

Friends And Related Function Documentation

◆ operator*

LDOS operator* ( const double &  lhs,
const LDOS rhs 
)
friend

Multiplication operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new LDOS that is product of the left hand side and the LDOS.

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