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

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

#include <BlockDiagonalizer.h>

Inheritance diagram for TBTK::PropertyExtractor::BlockDiagonalizer:
TBTK::PropertyExtractor::PropertyExtractor

Public Member Functions

 BlockDiagonalizer (Solver::BlockDiagonalizer &solver)
 
Property::EigenValues getEigenValues ()
 
double getEigenValue (int state) const
 
double getEigenValue (const Index &blockIndex, int state) const
 
const std::complex< double > getAmplitude (int state, const Index &index)
 
const std::complex< double > getAmplitude (const Index &blockIndex, int state, const Index &intraBlockIndex) const
 
Property::WaveFunctions calculateWaveFunctions (std::vector< Index > patterns, std::vector< Subindex > states)
 
Property::GreensFunction calculateGreensFunction (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 (std::vector< Index > patterns)
 
virtual Property::Magnetization calculateMagnetization (std::vector< Index > patterns)
 
virtual Property::LDOS calculateLDOS (std::vector< Index > patterns)
 
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::Density calculateDensity (Index pattern, Index ranges)
 
virtual Property::Magnetization calculateMagnetization (Index pattern, Index ranges)
 
virtual Property::LDOS calculateLDOS (Index pattern, Index ranges)
 
virtual Property::SpinPolarizedLDOS calculateSpinPolarizedLDOS (Index pattern, Index ranges)
 
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::BlockDiagonalizer.

The PropertyExtractor::Diagonalizer extracts Property::AbstractProperty from the Solver::BlockDiagonalizer.

Example

#include "TBTK/Model.h"
#include "TBTK/PropertyExtractor/BlockDiagonalizer.h"
#include "TBTK/Range.h"
#include "TBTK/Smooth.h"
#include "TBTK/Solver/BlockDiagonalizer.h"
#include "TBTK/Streams.h"
#include "TBTK/TBTK.h"
#include "TBTK/Visualization/MatPlotLib/Plotter.h"
#include <complex>
#include <cmath>
using namespace std;
using namespace TBTK;
using namespace Visualization::MatPlotLib;
int main(){
const int NUM_K_POINTS = 10000;
double a = 1;
Model model;
Range K(0, 2*M_PI, NUM_K_POINTS);
for(int k = 0; k < NUM_K_POINTS; k++)
model << HoppingAmplitude(cos(K[k]*a), {k, 0}, {k, 1}) + HC;
model.setChemicalPotential(-0.5);
model.setTemperature(300);
model.construct();
solver.setModel(model);
solver.run();
const double LOWER_BOUND = -5;
const double UPPER_BOUND = 5;
const int RESOLUTION = 200;
PropertyExtractor::BlockDiagonalizer propertyExtractor(solver);
propertyExtractor.setEnergyWindow(
LOWER_BOUND,
UPPER_BOUND,
RESOLUTION
);
Plotter plotter;
const double SMOOTHING_SIGMA = 0.01;
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({
//All k-points, summing over the second subindex.
{_a_, IDX_SUM_ALL}
});
Streams::out << density << "\n";
plotter.clear();
plotter.setAxes({{0, {0, 2*M_PI}}});
plotter.plot({_a_, IDX_SUM_ALL}, density);
plotter.setLabelX("k");
plotter.save("figures/Density.png");
}

Output

DOS
Lower bound: -5 eV (-5 n.u.)
Upper bound: 5 eV (5 n.u.)
Resolution: 200
Density
Number of sites: 10000
PropertyExtractorBlockDiagonalizerDOS.png
PropertyExtractorBlockDiagonalizerDensity.png

Constructor & Destructor Documentation

◆ BlockDiagonalizer()

TBTK::PropertyExtractor::BlockDiagonalizer::BlockDiagonalizer ( Solver::BlockDiagonalizer solver)

Constructs a PropertyExtractor::BlockDiagonalizer.

Parameters
solverThe Solver to use.

Member Function Documentation

◆ calculateDensity()

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

◆ calculateDOS()

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

◆ calculateEntropy()

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

◆ calculateExpectationValue()

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

Calculate expectation value.

Reimplemented from TBTK::PropertyExtractor::PropertyExtractor.

◆ calculateGreensFunction()

Property::GreensFunction TBTK::PropertyExtractor::BlockDiagonalizer::calculateGreensFunction ( std::vector< Index patterns,
Property::GreensFunction::Type  type = Property::GreensFunction::Type::Retarded 
)

Calculate the Green's function on the Custom format. [See AbstractProperty for detailed information about the Custom format. See PropertyExtractor for detailed information about the patterns argument.]

Parameters
patternsThe pattern to use.
typeThe Green's function type.
Returns
A GreensFunction for the given patterns.

◆ calculateLDOS()

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

◆ calculateMagnetization()

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

◆ calculateSpinPolarizedLDOS()

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

◆ calculateWaveFunctions()

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

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

Parameters
patternsThe pattern to use
statesThe states to extract the wave function 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() [1/2]

const std::complex< double > TBTK::PropertyExtractor::BlockDiagonalizer::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\).
Returns
The amplitude \(\Psi_{n}(\mathbf{x})\).

◆ getAmplitude() [2/2]

const std::complex< double > TBTK::PropertyExtractor::BlockDiagonalizer::getAmplitude ( const Index blockIndex,
int  state,
const Index intraBlockIndex 
) const
inline

Get amplitude for given eigenvector \(n\), block index \(b\), and physical Index \(x\): \(\Psi_{nb}(\mathbf{x})\).

Parameters
blockIndexBlock Index \(b\).
stateEigenstate number \(n\) relative to the given block.
indexPhysical Index \(x\).
Returns
The amplitude \(\Psi_{nb}(\mathbf{x})\).

◆ getEigenValue() [1/2]

double TBTK::PropertyExtractor::BlockDiagonalizer::getEigenValue ( int  state) const
inline

Get eigenvalue. The eigenvalues are ordered first by block, and then in accending order. This means that eigenvalues for blocks with smaller Indices comes before eigenvalues for blocks with larger Indices , while inside each block the eigenvalues are in accending order.

Parameters
stateThe state number.
Returns
The eigenvalue for the given state.

◆ getEigenValue() [2/2]

double TBTK::PropertyExtractor::BlockDiagonalizer::getEigenValue ( const Index blockIndex,
int  state 
) const
inline

Get eigenvalue. The eigenvalues are ordered in accending order.

Parameters
blockIndexThe block Index to get the eigenvalue for.
stateThe intra block state index starting from zero for the lowest eigenvalue in the block.
Returns
The eigenvalue for the given block and state.

◆ getEigenValues()

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

Get eigenvalues. The eigenvalues are ordered first by block, and then in accending order. This means that eigenvalues for blocks with smaller Indices comes before eigenvalues for blocks with larger Indices , while inside each block the eigenvalues are in accending order.

Returns
A Property::EigenValues containing all the eigenvalues.

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