v2DM-DOCI  1.0
CheMPS2::Hamiltonian Class Reference

#include <Hamiltonian.h>

+ Collaboration diagram for CheMPS2::Hamiltonian:

Public Member Functions

 Hamiltonian (const int Norbitals, const int nGroup, const int *OrbIrreps)
 Constructor. More...
 
 Hamiltonian (const string file_psi4text)
 Constructor which loads a Psi4 text dump of the Hamiltonian from disk. A Psi4 text dump can be generated with the plugin psi4plugins/mointegrals.cc_PRINT. More...
 
 Hamiltonian (const bool fileh5, const string main_file=HAMILTONIAN_ParentStorageName, const string file_tmat=HAMILTONIAN_TmatStorageName, const string file_vmat=HAMILTONIAN_VmatStorageName)
 Constructor which loads a Hamiltonian from disk which was previously saved as a Psi4 text dump or in HDF5 format. A Psi4 text dump can be generated with the plugin psi4plugins/mointegrals.cc_PRINT. An HDF5 dump can be generated with the plugin psi4plugins/mointegrals.cc_SAVEHAM; or by (1) creating a Hamiltonian with one of the other constructors, (2) filling it with setEconst(), setTmat() and setVmat(), and (3) calling save(). More...
 
 Hamiltonian (const Hamiltonian &)
 
 Hamiltonian (Hamiltonian &&)=default
 
Hamiltonianoperator= (const Hamiltonian &)
 
Hamiltonianoperator= (Hamiltonian &&)=default
 
virtual ~Hamiltonian ()=default
 Destructor. More...
 
int getL () const
 Get the number of orbitals. More...
 
int getNGroup () const
 Get the group number. More...
 
int getOrbitalIrrep (const int nOrb) const
 Get an orbital irrep number. More...
 
void setEconst (const double val)
 Set the constant energy. More...
 
void setTmat (const int index1, const int index2, const double val)
 Set a Tmat element. More...
 
void setVmat (const int index1, const int index2, const int index3, const int index4, const double val)
 Set a Vmat element. More...
 
void addToVmat (const int index1, const int index2, const int index3, const int index4, const double val)
 Add to Vmat element. More...
 
double getEconst () const
 Get the constant energy. More...
 
double getTmat (const int index1, const int index2) const
 Get a Tmat element. More...
 
double getVmat (const int index1, const int index2, const int index3, const int index4) const
 Get a Vmat element. More...
 
void save (const string file_parent=HAMILTONIAN_ParentStorageName, const string file_tmat=HAMILTONIAN_TmatStorageName, const string file_vmat=HAMILTONIAN_VmatStorageName) const
 Save the Hamiltonian. More...
 
void read (const string file_parent=HAMILTONIAN_ParentStorageName, const string file_tmat=HAMILTONIAN_TmatStorageName, const string file_vmat=HAMILTONIAN_VmatStorageName)
 Load the Hamiltonian. More...
 
void save2 (const string filename) const
 
void read2 (const string filename)
 
void setNe (int)
 
int getNe () const
 
void debugcheck () const
 Debug check certain elements and sums. More...
 
void reset ()
 set everything to zero More...
 

Static Public Member Functions

static Hamiltonian CreateFromH5 (const string filename)
 

Private Member Functions

void CreateAndFillFromH5 (const string file_parent, const string file_tmat, const string file_vmat)
 
void CreateAndFillFromPsi4dump (const string filename)
 

Private Attributes

int L
 
int Ne
 
Irreps SymmInfo
 
std::unique_ptr< int[]> orb2irrep
 
std::unique_ptr< int[]> irrep2num_orb
 
std::unique_ptr< int[]> orb2indexSy
 
std::unique_ptr< TwoIndexTmat
 
std::unique_ptr< FourIndexVmat
 
double Econst
 

Friends

class simanneal::OptIndex
 

Detailed Description

Hamiltonian class.

Author
Sebastian Wouters sebas.nosp@m.tian.nosp@m.woute.nosp@m.rs@g.nosp@m.mail..nosp@m.com
Date
February 8, 2013

Container class for the Hamiltonian matrix elements.

Specific Hamiltonian information

Class containing all Hamiltonian information:

  • L: the number of orbitals
  • groupNumber (in SymmInfo): the number of the Abelian point group symmetry with real-valued character table (see Irreps.h)
  • orb2irrep: array with the irrep number for each orbital
  • Econst: nuclear repulsion energy; or any constant part of the energy not contained in the 1- or 2-particle matrix elements
  • Tmat: 1-particle matrix elements; Tmat \(_{a,b}\) = 0 if \(I_a\) is different from \(I_b\)
  • Vmat: 2-particle matrix elements; Vmat \(_{a,b,c,d}\) = 0 if \(I_a \otimes I_b\) is not equal to \(I_c \otimes I_d\); the matrix elements are not antisymmetrized and are stored with the convention that both (a & c) and (b & d) have the same spatial variable for the nuclear repulsion integral (physics notation).

The targeted spin, particle number and point group symmetry are not defined here. For convenience, the second quantized formulation of the Hamiltonian is given here:
\( \hat{H} = E_{const} + \sum\limits_{ij\sigma} T_{ij} \delta_{I_i,I_j} \hat{a}_{i \sigma}^{\dagger} \hat{a}_{j \sigma} + \frac{1}{2} \sum\limits_{ijkl\sigma\tau} V_{ijkl} \delta_{I_i \otimes I_j \otimes I_k \otimes I_l, I_{trivial}} \hat{a}_{i \sigma}^{\dagger} \hat{a}_{j \tau}^{\dagger} \hat{a}_{l \tau} \hat{a}_{k \sigma} \)
where the latin letters denote site-indices and the greek letters spin projections. This Hamiltonian preserves spin, spin projection, particle number, and Abelian point group symmetry (if its character table is real at least).

Definition at line 56 of file Hamiltonian.h.

Constructor & Destructor Documentation

CheMPS2::Hamiltonian::Hamiltonian ( const int  Norbitals,
const int  nGroup,
const int *  OrbIrreps 
)

Constructor.

Parameters
NorbitalsThe number of orbitals (L)
nGroupThe group number
OrbIrrepsPointer to array containing the orbital irreps

Definition at line 38 of file Hamiltonian.cpp.

+ Here is the call graph for this function:

CheMPS2::Hamiltonian::Hamiltonian ( const string  file_psi4text)

Constructor which loads a Psi4 text dump of the Hamiltonian from disk. A Psi4 text dump can be generated with the plugin psi4plugins/mointegrals.cc_PRINT.

Parameters
file_psi4textThe filename of the Psi4 text dump of the Hamiltonian

Definition at line 106 of file Hamiltonian.cpp.

CheMPS2::Hamiltonian::Hamiltonian ( const bool  fileh5,
const string  main_file = HAMILTONIAN_ParentStorageName,
const string  file_tmat = HAMILTONIAN_TmatStorageName,
const string  file_vmat = HAMILTONIAN_VmatStorageName 
)

Constructor which loads a Hamiltonian from disk which was previously saved as a Psi4 text dump or in HDF5 format. A Psi4 text dump can be generated with the plugin psi4plugins/mointegrals.cc_PRINT. An HDF5 dump can be generated with the plugin psi4plugins/mointegrals.cc_SAVEHAM; or by (1) creating a Hamiltonian with one of the other constructors, (2) filling it with setEconst(), setTmat() and setVmat(), and (3) calling save().

Parameters
fileh5If true, attempt to load a Hamiltonian in HDF5 format. All three filenames should be set then! If false, attempt to load a Hamiltonian which was previously saved as a Psi4 text dump. Only the first filename should be set then!
main_fileIf fileh5, the HDF5 Hamiltonian parent filename. If not fileh5, the filename of the Psi4 text dump of the Hamiltonian.
file_tmatThe HDF5 Hamiltonian Tmat filename
file_vmatThe HDF5 Hamiltonian Vmat filename

Definition at line 112 of file Hamiltonian.cpp.

CheMPS2::Hamiltonian::Hamiltonian ( const Hamiltonian orig)

Definition at line 64 of file Hamiltonian.cpp.

CheMPS2::Hamiltonian::Hamiltonian ( Hamiltonian &&  )
default
virtual CheMPS2::Hamiltonian::~Hamiltonian ( )
virtualdefault

Destructor.

Member Function Documentation

void CheMPS2::Hamiltonian::addToVmat ( const int  index1,
const int  index2,
const int  index3,
const int  index4,
const double  val 
)

Add to Vmat element.

Parameters
index1The first index
index2The second index
index3The third index
index4The fourth index
valThe value which should be added

Definition at line 170 of file Hamiltonian.cpp.

+ Here is the call graph for this function:

void CheMPS2::Hamiltonian::CreateAndFillFromH5 ( const string  file_parent,
const string  file_tmat,
const string  file_vmat 
)
private

Definition at line 287 of file Hamiltonian.cpp.

void CheMPS2::Hamiltonian::CreateAndFillFromPsi4dump ( const string  filename)
private

Definition at line 341 of file Hamiltonian.cpp.

CheMPS2::Hamiltonian CheMPS2::Hamiltonian::CreateFromH5 ( const string  filename)
static

Definition at line 631 of file Hamiltonian.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CheMPS2::Hamiltonian::debugcheck ( ) const

Debug check certain elements and sums.

Definition at line 472 of file Hamiltonian.cpp.

double CheMPS2::Hamiltonian::getEconst ( ) const

Get the constant energy.

Returns
The constant part of the Hamiltonian (nuclear repulsion & condensed orbitals)

Definition at line 144 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

int CheMPS2::Hamiltonian::getL ( ) const

Get the number of orbitals.

Returns
The number of orbitals

Definition at line 136 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

int CheMPS2::Hamiltonian::getNe ( ) const

Definition at line 511 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

int CheMPS2::Hamiltonian::getNGroup ( ) const

Get the group number.

Returns
The group number

Definition at line 138 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

int CheMPS2::Hamiltonian::getOrbitalIrrep ( const int  nOrb) const

Get an orbital irrep number.

Parameters
nOrbThe orbital number
Returns
The irrep of orbital nOrb

Definition at line 140 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

double CheMPS2::Hamiltonian::getTmat ( const int  index1,
const int  index2 
) const

Get a Tmat element.

Parameters
index1The first index
index2The second index
Returns
\(T_{index1,index2}\)

Definition at line 153 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

double CheMPS2::Hamiltonian::getVmat ( const int  index1,
const int  index2,
const int  index3,
const int  index4 
) const

Get a Vmat element.

Parameters
index1The first index
index2The second index
index3The third index
index4The fourth index
Returns
\(V_{index1,index2,index3,index4}\)

Definition at line 177 of file Hamiltonian.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CheMPS2::Hamiltonian & CheMPS2::Hamiltonian::operator= ( const Hamiltonian orig)

Definition at line 84 of file Hamiltonian.cpp.

Hamiltonian& CheMPS2::Hamiltonian::operator= ( Hamiltonian &&  )
default
void CheMPS2::Hamiltonian::read ( const string  file_parent = HAMILTONIAN_ParentStorageName,
const string  file_tmat = HAMILTONIAN_TmatStorageName,
const string  file_vmat = HAMILTONIAN_VmatStorageName 
)

Load the Hamiltonian.

Parameters
file_parentThe HDF5 Hamiltonian parent filename
file_tmatThe HDF5 Hamiltonian Tmat filename
file_vmatThe HDF5 Hamiltonian Vmat filename

Definition at line 238 of file Hamiltonian.cpp.

void CheMPS2::Hamiltonian::read2 ( const string  filename)

Definition at line 572 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

void CheMPS2::Hamiltonian::reset ( )

set everything to zero

Definition at line 669 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

void CheMPS2::Hamiltonian::save ( const string  file_parent = HAMILTONIAN_ParentStorageName,
const string  file_tmat = HAMILTONIAN_TmatStorageName,
const string  file_vmat = HAMILTONIAN_VmatStorageName 
) const

Save the Hamiltonian.

Parameters
file_parentThe HDF5 Hamiltonian parent filename
file_tmatThe HDF5 Hamiltonian Tmat filename
file_vmatThe HDF5 Hamiltonian Vmat filename

Definition at line 187 of file Hamiltonian.cpp.

void CheMPS2::Hamiltonian::save2 ( const string  filename) const

Definition at line 516 of file Hamiltonian.cpp.

void CheMPS2::Hamiltonian::setEconst ( const double  val)

Set the constant energy.

Parameters
valThe new constant energy

Definition at line 142 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

void CheMPS2::Hamiltonian::setNe ( int  ne)

Definition at line 625 of file Hamiltonian.cpp.

void CheMPS2::Hamiltonian::setTmat ( const int  index1,
const int  index2,
const double  val 
)

Set a Tmat element.

Parameters
index1The first index
index2The second index
valThe new Tmat element

Definition at line 146 of file Hamiltonian.cpp.

+ Here is the caller graph for this function:

void CheMPS2::Hamiltonian::setVmat ( const int  index1,
const int  index2,
const int  index3,
const int  index4,
const double  val 
)

Set a Vmat element.

Parameters
index1The first index
index2The second index
index3The third index
index4The fourth index
valThe new Vmat element

Definition at line 163 of file Hamiltonian.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class simanneal::OptIndex
friend

Definition at line 58 of file Hamiltonian.h.

Member Data Documentation

double CheMPS2::Hamiltonian::Econst
private

Definition at line 202 of file Hamiltonian.h.

std::unique_ptr<int []> CheMPS2::Hamiltonian::irrep2num_orb
private

Definition at line 190 of file Hamiltonian.h.

int CheMPS2::Hamiltonian::L
private

Definition at line 178 of file Hamiltonian.h.

int CheMPS2::Hamiltonian::Ne
private

Definition at line 181 of file Hamiltonian.h.

std::unique_ptr<int []> CheMPS2::Hamiltonian::orb2indexSy
private

Definition at line 193 of file Hamiltonian.h.

std::unique_ptr<int []> CheMPS2::Hamiltonian::orb2irrep
private

Definition at line 187 of file Hamiltonian.h.

Irreps CheMPS2::Hamiltonian::SymmInfo
private

Definition at line 184 of file Hamiltonian.h.

std::unique_ptr<TwoIndex> CheMPS2::Hamiltonian::Tmat
private

Definition at line 196 of file Hamiltonian.h.

std::unique_ptr<FourIndex> CheMPS2::Hamiltonian::Vmat
private

Definition at line 199 of file Hamiltonian.h.


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