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

Property container for wave function. More...

#include <WaveFunctions.h>

Inheritance diagram for TBTK::Property::WaveFunctions:
TBTK::Property::AbstractProperty< std::complex< double > > TBTK::Property::Property TBTK::Serializable TBTK::Streamable

Public Member Functions

 WaveFunctions ()
 
 WaveFunctions (const IndexTree &indexTree, const std::vector< unsigned int > &states)
 
 WaveFunctions (const IndexTree &indexTree, const std::vector< unsigned int > &states, const std::complex< double > *data)
 
 WaveFunctions (const std::string &serialization, Mode mode)
 
const std::vector< unsigned int > & getStates () const
 
const std::complex< double > & operator() (const Index &index, unsigned int state) const
 
std::complex< double > & operator() (const Index &index, unsigned int state)
 
double getMinAbs () const
 
double getMaxAbs () const
 
double getMinArg () const
 
double getMaxArg () const
 
virtual std::string toString () const
 
virtual std::string serialize (Mode mode) const
 
- Public Member Functions inherited from TBTK::Property::AbstractProperty< std::complex< double > >
unsigned int getBlockSize () const
 
unsigned int getSize () const
 
const std::vector< std::complex< double > > & getData () const
 
std::vector< std::complex< 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< std::complex< double > > > toSparseMatrices (const Model &model) const
 
std::complex< double > & operator() (const std::initializer_list< Subindex > &index)
 
const std::complex< double > & operator() (const std::initializer_list< Subindex > &index) const
 
virtual const std::complex< double > & operator() (unsigned int offset) const
 
virtual std::complex< double > & operator() (unsigned int offset)
 
void setAllowIndexOutOfBoundsAccess (bool allowIndexOutOfBoundsAccess)
 
void setDefaultValue (const std::complex< double > &defaultValue)
 
void replaceValues (const std::complex< double > &targetValue, const std::complex< double > &replacementValue)
 
virtual std::string toString () const
 
- 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)
 

Additional Inherited Members

- 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::AbstractProperty< std::complex< double > >
 AbstractProperty ()
 
 AbstractProperty (unsigned int blockSize)
 
 AbstractProperty (unsigned int blockSize, const std::complex< double > *data)
 
 AbstractProperty (const std::vector< int > &ranges, unsigned int blockSize)
 
 AbstractProperty (const std::vector< int > &ranges, unsigned int blockSize, const std::complex< double > *data)
 
 AbstractProperty (const IndexTree &indexTree, unsigned int blockSize)
 
 AbstractProperty (const IndexTree &indexTree, unsigned int blockSize, const std::complex< 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 std::complex< double > &rhs)
 
AbstractPropertyoperator/= (const std::complex< 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 wave function.

The WaveFunctions is a Property with DataType std::complex<double>. It contains the wave function for a number of states.

Example

#include "TBTK/PropertyExtractor/Diagonalizer.h"
#include "TBTK/Streams.h"
#include "TBTK/TBTK.h"
using namespace TBTK;
using namespace Visualization::MatPlotLib;
int main(){
const unsigned int SIZE_X = 41;
const unsigned int SIZE_Y = 41;
double t = 1;
Model model = Models::SquareLattice({SIZE_X, SIZE_Y}, {0, -t});
model.construct();
solver.setModel(model);
solver.run();
PropertyExtractor::Diagonalizer propertyExtractor(solver);
= propertyExtractor.calculateWaveFunctions(
{{_a_, _a_}},
{_a_}
);
Streams::out << "waveFunctions({20, 20}, 100) = "
<< waveFunctions({20, 20}, 100) << "\n";
const unsigned int STATE = 4;
Plotter plotter;
plotter.plot({_a_, 20}, STATE, waveFunctions);
plotter.save("figures/WaveFunction1D.png");
plotter.clear();
plotter.plot({_a_, _a_}, STATE, waveFunctions);
plotter.save("figures/WaveFunction2D.png");
}

Output

waveFunctions({20, 20}, 100) = (1.42061e-15,0)

Constructor & Destructor Documentation

◆ WaveFunctions() [1/4]

TBTK::Property::WaveFunctions::WaveFunctions ( )
inline

Constructs an uninitialized WaveFunctions.

◆ WaveFunctions() [2/4]

TBTK::Property::WaveFunctions::WaveFunctions ( const IndexTree indexTree,
const std::vector< unsigned int > &  states 
)

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

Parameters
indexTreeIndexTree containing the Indices for which the WaveFunctions should be constructed.
statesA list of the states for which the correspinding wavefunctions should be contained.

◆ WaveFunctions() [3/4]

TBTK::Property::WaveFunctions::WaveFunctions ( const IndexTree indexTree,
const std::vector< unsigned int > &  states,
const std::complex< double > *  data 
)

Constructs WaveFunctions 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 WaveFunctions should be constructed.
statesA list of the states for which the correspinding wavefunctions should be contained.
dataRaw data to initialize the WaveFunctions with.

◆ WaveFunctions() [4/4]

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

Constructor. Constructs the WaveFunctions from a serialization string.

Parameters
serializationSerialization string from which to construct the WaveFunctions.

Member Function Documentation

◆ getMaxAbs()

double TBTK::Property::WaveFunctions::getMaxAbs ( ) const

Get the maximum absolute value.

Returns
The maximum absolute value.

◆ getMaxArg()

double TBTK::Property::WaveFunctions::getMaxArg ( ) const

Get the maximum argument value.

Returns
The maximum argument value.

◆ getMinAbs()

double TBTK::Property::WaveFunctions::getMinAbs ( ) const

Get the minimum absolute value.

Returns
The minimum absolute value.

◆ getMinArg()

double TBTK::Property::WaveFunctions::getMinArg ( ) const

Get the minimum argument value.

Returns
The minimum argument value.

◆ getStates()

const std::vector< unsigned int > & TBTK::Property::WaveFunctions::getStates ( ) const
inline

Get the contained states.

*

Returns
A vector with the state indices for which the wave function is contained.

◆ operator()() [1/2]

std::complex<double>& TBTK::Property::WaveFunctions::operator() ( const Index index,
unsigned int  state 
)
virtual

Overrides AbstractProperty::operator().

Reimplemented from TBTK::Property::AbstractProperty< std::complex< double > >.

◆ operator()() [2/2]

const std::complex<double>& TBTK::Property::WaveFunctions::operator() ( const Index index,
unsigned int  state 
) const
virtual

Overrides AbstractProperty::operator().

Reimplemented from TBTK::Property::AbstractProperty< std::complex< double > >.

◆ serialize()

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

◆ toString()

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

Overrides Streamable::toString().

Implements TBTK::Streamable.


The documentation for this class was generated from the following file:
Plotter.h
Plots data.
TBTK::Model
Container of Model related information.
Definition: Model.h:57
TBTK::Solver::Diagonalizer
Solves a Model using diagonalization.
Definition: Diagonalizer.h:52
Streams.h
Streams for TBTK output.
TBTK::PropertyExtractor::Diagonalizer
Extracts physical properties from the Solver::Diagonalizer.
Definition: Diagonalizer.h:55
WaveFunctions.h
Property container for wave functions.
TBTK::Solver::Diagonalizer::run
void run()
Diagonalizer.h
Solves a Model using diagonalization.
TBTK::Initialize
void Initialize()
TBTK::Solver::Solver::setModel
virtual void setModel(Model &model)
Definition: Solver.h:69
SquareLattice.h
Square lattice model.
TBTK::Streams::out
static std::ostream out
Definition: Streams.h:70
TBTK.h
TBTK initialization.
TBTK::Model::construct
void construct()
TBTK::Models::SquareLattice
Square lattice model.
Definition: SquareLattice.h:60
TBTK::Property::WaveFunctions
Property container for wave function.
Definition: WaveFunctions.h:45