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

Hopping amplitude from state 'from' to state 'to'. More...

#include <HoppingAmplitude.h>

Classes

class  AmplitudeCallback
 

Public Member Functions

 HoppingAmplitude ()
 
 HoppingAmplitude (std::complex< double > amplitude, Index toIndex, Index fromIndex)
 
 HoppingAmplitude (const AmplitudeCallback &callback, Index toIndex, Index fromIndex)
 
 HoppingAmplitude (const HoppingAmplitude &ha)
 
 HoppingAmplitude (const std::string &serialization, Serializable::Mode mode)
 
HoppingAmplitude getHermitianConjugate () const
 
void print () const
 
std::complex< double > getAmplitude () const
 
std::tuple< HoppingAmplitude, HoppingAmplitudeoperator+ (const HermitianConjugate hc)
 
const IndexgetToIndex () const
 
const IndexgetFromIndex () const
 
bool getIsCallbackDependent () const
 
const AmplitudeCallbackgetAmplitudeCallback () const
 
std::string toString () const
 
std::string serialize (Serializable::Mode mode) const
 
unsigned int getSizeInBytes () const
 

Friends

std::ostream & operator<< (std::ostream &stream, const HoppingAmplitude &hoppingAmplitude)
 

Detailed Description

Hopping amplitude from state 'from' to state 'to'.

A hopping amplitude is a coefficeint \(a_{ij}\) in a bilinear Hamiltonian \(H = \sum_{ij}a_{ij}c_{i}^{\dagger}c_{j}\), where \(i\) and \(j\) are reffered to using 'to' and 'from' respectively. The constructors can be called with the parameters either in the order (from, to, value) or the order (value, to, from). The former follows the order in which the process can be thought of as happening, while the later corresponds to the order in which values and operators stands in the Hamiltonian.

Example

#include "TBTK/Streams.h"
#include "TBTK/TBTK.h"
#include <complex>
using namespace std;
using namespace TBTK;
int main(){
HoppingAmplitude hoppingAmplitude(1, {1, 2, 3}, {4, 5});
Streams::out << hoppingAmplitude << "\n";
std::complex<double> amplitude = hoppingAmplitude.getAmplitude();
Index toIndex = hoppingAmplitude.getToIndex();
Index fromIndex = hoppingAmplitude.getFromIndex();
Streams::out << amplitude << "\n";
Streams::out << toIndex.toString() << "\n";
Streams::out << fromIndex.toString() << "\n";
}

Output

Is callback dependent: False
Amplitude: (1,0)
To-Index: {1, 2, 3}
From-Index: {4, 5}
(1,0)
{1, 2, 3}
{4, 5}

Constructor & Destructor Documentation

◆ HoppingAmplitude() [1/5]

TBTK::HoppingAmplitude::HoppingAmplitude ( )

Constructs an uninitialized HoppingAmplitude.

◆ HoppingAmplitude() [2/5]

TBTK::HoppingAmplitude::HoppingAmplitude ( std::complex< double >  amplitude,
Index  toIndex,
Index  fromIndex 
)

Constructs a HoppingAmplitude from a value and two Indices.

Parameters
amplitudeThe amplitude value.
toIndexThe left index (i or to-Index) on the HoppingAmplitude.
fromIndexThe right index (j or from-Index) on the HoppingAmplitude.

◆ HoppingAmplitude() [3/5]

TBTK::HoppingAmplitude::HoppingAmplitude ( const AmplitudeCallback callback,
Index  toIndex,
Index  fromIndex 
)

Constructor. Takes an AmplitudeCallback rather than a paramater value. The AmplitudeCallback has to be defined such that it returns a value for the given indices when called at run time.

Parameters
amplitudeCallbackAn AmplitudeCallback that is able to return a value when passed toIndex and fromIndex.
toIndexThe left index (i or to-Index) on the HoppingAmplitude.
fromIndexThe right index (j or from-Index) on the HoppingAmplitude.

◆ HoppingAmplitude() [4/5]

TBTK::HoppingAmplitude::HoppingAmplitude ( const HoppingAmplitude ha)

Copy constructor.

Parameters
haHoppingAmplitude to copy.

◆ HoppingAmplitude() [5/5]

TBTK::HoppingAmplitude::HoppingAmplitude ( const std::string &  serialization,
Serializable::Mode  mode 
)

Constructor. Constructs the HoppingAmplitude from a serialization string.

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

Member Function Documentation

◆ getAmplitude()

std::complex< double > TBTK::HoppingAmplitude::getAmplitude ( ) const
inline

Get the amplitude value \(a_{ij}\).

Returns
The value of the amplitude.

◆ getAmplitudeCallback()

const HoppingAmplitude::AmplitudeCallback & TBTK::HoppingAmplitude::getAmplitudeCallback ( ) const
inline

Get the AmplitudeCallback that is used to determine the value of the HoppingAmplitude. This function stops execution if no AmplitudeCallback is used for the HoppingAmplitude. Therefore always first check whether the HoppingAmplitude is callback dependent with getIsCallbackDependent().

Returns
The AmplitudeCallback that is used to determine the value of the HoppingAmplitude.

◆ getFromIndex()

const Index & TBTK::HoppingAmplitude::getFromIndex ( ) const
inline

Get from index.

Returns
The from Index.

◆ getHermitianConjugate()

HoppingAmplitude TBTK::HoppingAmplitude::getHermitianConjugate ( ) const

Get the Hermitian cojugate of the HoppingAmplitude.

Returns
The Hermitian conjugate of the HoppingAmplitude.

◆ getIsCallbackDependent()

bool TBTK::HoppingAmplitude::getIsCallbackDependent ( ) const
inline

Get whether the value of the HoppingAmplitude is determined through an AmplitudeCallback.

Returns
True if the value of the HoppingAmplitude is determined through an AmplitudeCallback.

◆ getSizeInBytes()

unsigned int TBTK::HoppingAmplitude::getSizeInBytes ( ) const
inline

Get size in bytes.

Returns
Memory size required to store the HoppingAmplitude.

◆ getToIndex()

const Index & TBTK::HoppingAmplitude::getToIndex ( ) const
inline

Get to index.

Returns
The to-Index.

◆ operator+()

std::tuple< HoppingAmplitude, HoppingAmplitude > TBTK::HoppingAmplitude::operator+ ( const HermitianConjugate  hc)
inline

Addition operator. Creates a tuple containing the HoppingAmplitude and its Hermitian conjugate. Used to allow the syntax
model << hoppingAmplitude + HC.

Parameters
hcShould be HC.
Returns
HoppingAmplitude tuple containing the original HoppingAmplitude and its Hermitian conjugate.

◆ print()

void TBTK::HoppingAmplitude::print ( ) const

Print HoppingAmplitude. Mainly for debugging.

◆ serialize()

std::string TBTK::HoppingAmplitude::serialize ( Serializable::Mode  mode) const

Serialize HoppingAmplitude. Note that HoppingAmplitude is pseudo-Serializable in that it implements the Serializable interface, but does so non-virtually.

Parameters
modeSerialization mode to use.
Returns
Serialized string representation of the HoppingAmplitude.

◆ toString()

std::string TBTK::HoppingAmplitude::toString ( ) const
inline

Get string representation of the HoppingAmplitude.

Returns
A string representation of the HoppingAmplitude.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const HoppingAmplitude hoppingAmplitude 
)
friend

Writes the HoppingAmplitudes toString()-representation to a stream.

Parameters
streamThe stream to write to.
hoppingAmplitudeThe HoppingAmplitude to write.
Returns
Reference to the output stream just written to.

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