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

Property container for magnetization. More...

#include <Magnetization.h>

Inheritance diagram for TBTK::Property::Magnetization:
TBTK::Property::AbstractProperty< SpinMatrix > TBTK::Property::Property TBTK::Serializable TBTK::Streamable

Public Member Functions

 Magnetization (const std::vector< int > &ranges)
 
 Magnetization (const std::vector< int > &ranges, const SpinMatrix *data)
 
 Magnetization (const IndexTree &indexTree)
 
 Magnetization (const IndexTree &indexTree, const SpinMatrix *data)
 
 Magnetization (const std::string &serialization, Mode mode)
 
std::string serialize (Mode mode) const
 
- Public Member Functions inherited from TBTK::Property::AbstractProperty< SpinMatrix >
unsigned int getBlockSize () const
 
unsigned int getSize () const
 
const std::vector< SpinMatrix > & getData () const
 
std::vector< SpinMatrix > & 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< SpinMatrix > > toSparseMatrices (const Model &model) const
 
virtual const SpinMatrixoperator() (const Index &index, unsigned int offset=0) const
 
virtual SpinMatrixoperator() (const Index &index, unsigned int offset=0)
 
SpinMatrixoperator() (const std::initializer_list< Subindex > &index)
 
const SpinMatrixoperator() (const std::initializer_list< Subindex > &index) const
 
virtual const SpinMatrixoperator() (unsigned int offset) const
 
virtual SpinMatrixoperator() (unsigned int offset)
 
void setAllowIndexOutOfBoundsAccess (bool allowIndexOutOfBoundsAccess)
 
void setDefaultValue (const SpinMatrix &defaultValue)
 
void replaceValues (const SpinMatrix &targetValue, const SpinMatrix &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)
 
- Public Member Functions inherited from TBTK::Streamable
virtual std::string toString () const =0
 

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

The Magnetization is a Property with DataType SpinMatrix.

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 = 11;
const unsigned int SIZE_Y = 11;
double t = 1;
double J = 1;
Model model
= Models::SquareLattice({SIZE_X, SIZE_Y, IDX_SPIN}, {0, t});
model << HoppingAmplitude(
J,
{SIZE_X/2, SIZE_Y/2, 0},
{SIZE_X/2, SIZE_Y/2, 0}
);
model << HoppingAmplitude(
-J,
{SIZE_X/2, SIZE_Y/2, 1},
{SIZE_X/2, SIZE_Y/2, 1}
);
model.construct();
solver.setModel(model);
solver.run();
PropertyExtractor::Diagonalizer propertyExtractor(solver);
= propertyExtractor.calculateMagnetization({
{_a_, _a_, IDX_SPIN}
});
Streams::out << "magnetization({5, 5, IDX_SPIN}) = "
<< magnetization({5, 5, IDX_SPIN}) << "\n";
Plotter plotter;
plotter.setTitle("Magnetization projected on the z-axis");
plotter.plot({_a_, _a_, IDX_SPIN}, {0, 0, 1}, magnetization);
plotter.save("figures/MagnetizationZ.png");
}

Output

magnetization({5, 5, IDX_SPIN}) = SpinMatrix
(0.0930429,0) (-4.07175e-17,0)
(-4.07175e-17,0) (0.394725,0)

Constructor & Destructor Documentation

◆ Magnetization() [1/5]

TBTK::Property::Magnetization::Magnetization ( const std::vector< int > &  ranges)

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

Parameters
rangesThe upper limit (exclusive) for the corresponding dimensions.

◆ Magnetization() [2/5]

TBTK::Property::Magnetization::Magnetization ( const std::vector< int > &  ranges,
const SpinMatrix data 
)

Constructs Magnetization 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.
dataRaw data to initialize the Magnetization with.

◆ Magnetization() [3/5]

TBTK::Property::Magnetization::Magnetization ( const IndexTree indexTree)

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

Parameters
indexTreeIndexTree containing the Indeices for which the Magnetization should be contained.

◆ Magnetization() [4/5]

TBTK::Property::Magnetization::Magnetization ( const IndexTree indexTree,
const SpinMatrix data 
)

Constructs Magnetization 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 Indeices for which the Magnetization should be contained.
dataRaw data to initialize the Magnetization with.

◆ Magnetization() [5/5]

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

Constructor. Constructs the Magnetization from a serialization string.

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

Member Function Documentation

◆ serialize()

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

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::Model::setChemicalPotential
void setChemicalPotential(double chemicalPotential)
Definition: Model.h:347
TBTK::PropertyExtractor::Diagonalizer
Extracts physical properties from the Solver::Diagonalizer.
Definition: Diagonalizer.h:55
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.
Magnetization.h
Property container for magnetization.
TBTK::HoppingAmplitude
Hopping amplitude from state 'from' to state 'to'.
Definition: HoppingAmplitude.h:53
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::Magnetization
Property container for magnetization.
Definition: Magnetization.h:44