TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::PropertyExtractor::Diagonalizer Class Reference

Extracts physical properties from the Solver::Diagonalizer. More...

#include <Diagonalizer.h>

Inheritance diagram for TBTK::PropertyExtractor::Diagonalizer:
TBTK::PropertyExtractor::PropertyExtractor

Public Member Functions

 Diagonalizer (Solver::Diagonalizer &solver)
 
Property::EigenValues getEigenValues ()
 
double getEigenValue (int state)
 
const std::complex< double > getAmplitude (int state, const Index &index)
 
Property::WaveFunctions calculateWaveFunctions (std::vector< Index > patterns, std::vector< Subindex > states)
 
Property::GreensFunction calculateGreensFunction (const std::vector< Index > &patterns, Property::GreensFunction::Type type=Property::GreensFunction::Type::Retarded)
 
virtual Property::DOS calculateDOS ()
 
virtual std::complex< double > calculateExpectationValue (Index to, Index from)
 
virtual Property::Density calculateDensity (Index pattern, Index ranges)
 
virtual Property::Density calculateDensity (std::vector< Index > patterns)
 
virtual Property::Magnetization calculateMagnetization (Index pattern, Index ranges)
 
virtual Property::Magnetization calculateMagnetization (std::vector< Index > patterns)
 
virtual Property::LDOS calculateLDOS (Index pattern, Index ranges)
 
virtual Property::LDOS calculateLDOS (std::vector< Index > patterns)
 
virtual Property::SpinPolarizedLDOS calculateSpinPolarizedLDOS (Index pattern, Index ranges)
 
virtual Property::SpinPolarizedLDOS calculateSpinPolarizedLDOS (std::vector< Index > patterns)
 
virtual double calculateEntropy ()
 
- Public Member Functions inherited from TBTK::PropertyExtractor::PropertyExtractor
 PropertyExtractor ()
 
virtual ~PropertyExtractor ()
 
virtual void setEnergyWindow (double lowerBound, double upperBound, int energyResolution)
 
virtual void setEnergyWindow (int lowerFermionicMatsubaraEnergyIndex, int upperFermionicMatsubaraEnergyIndex, int lowerBosonicMatsubaraEnergyIndex, int upperBosonicMatsubaraEnergyIndex)
 
virtual void setEnergyInfinitesimal (double energyInfinitesimal)
 
virtual Property::DOS sampleDOS (unsigned int numSamples, const std::vector< Index > &patterns={}, unsigned int seed=time(nullptr))
 

Additional Inherited Members

- Protected Types inherited from TBTK::PropertyExtractor::PropertyExtractor
enum  EnergyType { Real, Matsubara }
 
- Protected Member Functions inherited from TBTK::PropertyExtractor::PropertyExtractor
EnergyType getEnergyType () const
 
int getEnergyResolution () const
 
double getLowerBound () const
 
double getUpperBound () const
 
int getLowerFermionicMatsubaraEnergyIndex () const
 
int getUpperFermionicMatsubaraEnergyIndex () const
 
int getLowerBosonicMatsubaraEnergyIndex () const
 
int getUpperBosonicMatsubaraEnergyIndex () const
 
double getEnergyInfinitesimal () const
 
template<typename DataType >
void calculate (void(*callback)(PropertyExtractor *cb_this, Property::Property &property, const Index &index, int offset, Information &information), Property::AbstractProperty< DataType > &property, Index pattern, const Index &ranges, int currentOffset, int offsetMultiplier, Information &information)
 
template<typename DataType >
void calculate (void(*callback)(PropertyExtractor *cb_this, Property::Property &property, const Index &index, int offset, Information &information), const IndexTree &allIndices, const IndexTree &memoryLayout, Property::AbstractProperty< DataType > &abstractProperty, Information &information)
 
void ensureCompliantRanges (const Index &pattern, Index &ranges)
 
std::vector< int > getLoopRanges (const Index &pattern, const Index &ranges)
 
IndexTree generateIndexTree (std::vector< Index > patterns, const HoppingAmplitudeSet &hoppingAmplitudeSet, bool keepSummationWildcards, bool keepSpinWildcards)
 

Detailed Description

Extracts physical properties from the Solver::Diagonalizer.

The PropertyExtractor::Diagonalizer extracts Properties from the Solver::Diagonalizer.

Example

#include "TBTK/Model.h"
#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 int SIZE_X = 40;
const 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 = -10;
const double UPPER_BOUND = 10;
const int RESOLUTION = 200;
PropertyExtractor::Diagonalizer propertyExtractor(solver);
propertyExtractor.setEnergyWindow(
LOWER_BOUND,
UPPER_BOUND,
RESOLUTION
);
Plotter plotter;
const double SMOOTHING_SIGMA = 0.2;
const unsigned int SMOOTHING_WINDOW = 51;
Property::DOS dos = propertyExtractor.calculateDOS();
dos = Smooth::gaussian(dos, SMOOTHING_SIGMA, SMOOTHING_WINDOW);
Streams::out << dos << "\n";
plotter.plot(dos);
plotter.save("figures/DOS.png");
Property::Density density = propertyExtractor.calculateDensity({
{_a_, 0}, //All points of the form {x, 0}
{20, _a_}, //All points of the form {20, y}
{10, 10},
{10, 11},
{11, 10},
{11, 11}
});
Streams::out << density << "\n";
plotter.clear();
plotter.plot({_a_, _a_}, density);
plotter.save("figures/Density.png");
Property::LDOS ldos = propertyExtractor.calculateLDOS({{_a_, 20}});
ldos = Smooth::gaussian(ldos, SMOOTHING_SIGMA, SMOOTHING_WINDOW);
Streams::out << ldos << "\n";
plotter.clear();
plotter.plot({_a_, 20}, ldos);
plotter.save("figures/LDOS.png");
}

Output

DOS
Lower bound: -10 eV (-10 n.u.)
Upper bound: 10 eV (10 n.u.)
Resolution: 200
Density
Number of sites: 83
LDOS
Number of sites: 40
Lower bound: -10 eV (-10 n.u.)
Upper bound: 10 eV (10 n.u.)
Resolution: 200
PropertyExtractorDiagonalizerDOS.png
PropertyExtractorDiagonalizerDensity.png
PropertyExtractorDiagonalizerLDOS.png

Constructor & Destructor Documentation

◆ Diagonalizer()

TBTK::PropertyExtractor::Diagonalizer::Diagonalizer ( Solver::Diagonalizer solver)

Constructs a PropertyExtractor::Diagonalizer.

Parameters
solverThe Solver to use.

Member Function Documentation

◆ calculateDensity() [1/2]

virtual Property::Density TBTK::PropertyExtractor::Diagonalizer::calculateDensity ( Index  pattern,
Index  ranges 
)
virtual

◆ calculateDensity() [2/2]

virtual Property::Density TBTK::PropertyExtractor::Diagonalizer::calculateDensity ( std::vector< Index patterns)
virtual

◆ calculateDOS()

virtual Property::DOS TBTK::PropertyExtractor::Diagonalizer::calculateDOS ( )
virtual

◆ calculateEntropy()

virtual double TBTK::PropertyExtractor::Diagonalizer::calculateEntropy ( )
virtual

◆ calculateExpectationValue()

virtual std::complex<double> TBTK::PropertyExtractor::Diagonalizer::calculateExpectationValue ( Index  to,
Index  from 
)
virtual

Calculate expectation value.

Reimplemented from TBTK::PropertyExtractor::PropertyExtractor.

◆ calculateGreensFunction()

Property::GreensFunction TBTK::PropertyExtractor::Diagonalizer::calculateGreensFunction ( const std::vector< Index > &  patterns,
Property::GreensFunction::Type  type = Property::GreensFunction::Type::Retarded 
)

Calculate Green's function. Calculate Green's function.

◆ calculateLDOS() [1/2]

virtual Property::LDOS TBTK::PropertyExtractor::Diagonalizer::calculateLDOS ( Index  pattern,
Index  ranges 
)
virtual

◆ calculateLDOS() [2/2]

virtual Property::LDOS TBTK::PropertyExtractor::Diagonalizer::calculateLDOS ( std::vector< Index patterns)
virtual

◆ calculateMagnetization() [1/2]

virtual Property::Magnetization TBTK::PropertyExtractor::Diagonalizer::calculateMagnetization ( Index  pattern,
Index  ranges 
)
virtual

◆ calculateMagnetization() [2/2]

virtual Property::Magnetization TBTK::PropertyExtractor::Diagonalizer::calculateMagnetization ( std::vector< Index patterns)
virtual

◆ calculateSpinPolarizedLDOS() [1/2]

virtual Property::SpinPolarizedLDOS TBTK::PropertyExtractor::Diagonalizer::calculateSpinPolarizedLDOS ( Index  pattern,
Index  ranges 
)
virtual

◆ calculateSpinPolarizedLDOS() [2/2]

virtual Property::SpinPolarizedLDOS TBTK::PropertyExtractor::Diagonalizer::calculateSpinPolarizedLDOS ( std::vector< Index patterns)
virtual

◆ calculateWaveFunctions()

Property::WaveFunctions TBTK::PropertyExtractor::Diagonalizer::calculateWaveFunctions ( std::vector< Index patterns,
std::vector< Subindex states 
)

Calculate WaveFunction on the Custom format. [See AbstractProperty for detailed information about the Custom format. See PropertyExtractor for detailed information about the patterns argument.]

Parameters
patternThe pattern to use.
statesThe states to extract the wave functions for. Can be set to {IDX_ALL} to get all states.
Returns
A WaveFunctions object containing the wave functions values for the Indices that satisfies the given patterns and state numbers.

◆ getAmplitude()

const std::complex< double > TBTK::PropertyExtractor::Diagonalizer::getAmplitude ( int  state,
const Index index 
)
inline

Get amplitude for given eigenvector \(n\) and physical index \(x\): \(\Psi_{n}(x)\).

Parameters
stateEigenstate number \(n\)
indexPhysical index \(x\).

◆ getEigenValue()

double TBTK::PropertyExtractor::Diagonalizer::getEigenValue ( int  state)
inline

Get a single eigenvalue.

Parameters
stateThe state (in accendingorder) to get the eigen value for.

◆ getEigenValues()

Property::EigenValues TBTK::PropertyExtractor::Diagonalizer::getEigenValues ( )

Get eigenvalues.

Returns
A Property::EigenValues containing all the eigen values in accending order.

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