DOCI-Exact  1.0
doci::DM2 Class Reference

#include <DM2.h>

Public Member Functions

 DM2 (unsigned int, unsigned int)
 
 DM2 (const Molecule &)
 
 DM2 (const DM2 &)
 
 DM2 (DM2 &&)
 
virtual ~DM2 ()=default
 
DM2operator= (const DM2 &)
 
DM2operator= (DM2 &&)
 
DM2operator= (double)
 
double operator() (int, int, int, int) const
 
DM2operator+= (const DM2 &)
 
void WriteToFile (const std::string) const
 
unsigned int get_n_electrons () const
 
unsigned int get_n_sp () const
 
void Build (Permutation &, std::vector< double > &)
 
void BuildHamiltonian (const Molecule &)
 
double Dot (const DM2 &) const
 
double Trace () const
 
std::pair< double, bool > find_min_angle (int k, int l, double start_angle, std::function< double(int, int)> &T, std::function< double(int, int, int, int)> &V) const
 
double calc_rotate (int k, int l, double theta, std::function< double(int, int)> &T, std::function< double(int, int, int, int)> &V) const
 
 DM2 (unsigned int, unsigned int)
 
 DM2 (const Molecule &)
 
 DM2 (const DM2 &)
 
 DM2 (DM2 &&)
 
virtual ~DM2 ()=default
 
DM2operator= (const DM2 &)
 
DM2operator= (DM2 &&)
 
DM2operator= (double)
 
double operator() (int, int, int, int) const
 
DM2operator+= (const DM2 &)
 
void WriteToFile (const std::string) const
 
unsigned int get_n_electrons () const
 
unsigned int get_n_sp () const
 
void Build (Permutation &, std::vector< double > &)
 
void BuildHamiltonian (const Molecule &)
 
double Dot (const DM2 &) const
 
double Trace () const
 
std::pair< double, bool > find_min_angle (int k, int l, double start_angle, std::function< double(int, int)> &T, std::function< double(int, int, int, int)> &V) const
 
double calc_rotate (int k, int l, double theta, std::function< double(int, int)> &T, std::function< double(int, int, int, int)> &V) const
 

Static Public Member Functions

static DM2 ReadFromFile (const std::string)
 
static DM2 ReadFromFile (const std::string)
 

Friends

std::ostream & operator<< (std::ostream &, doci::DM2 &)
 
std::ostream & operator<< (std::ostream &, doci::DM2 &)
 

Detailed Description

This will store an second order density matrix from a DOCI wavefunction. It only stores the non-zero elements, meaning: a block with dimension of the sp levels and a diagonal that is four fold degenerate.

Definition at line 24 of file DM2.h.

Constructor & Destructor Documentation

DM2::DM2 ( unsigned int  n_sp,
unsigned int  n 
)

Create second order density matrix for n_sp single particle levels (with spin degeneracy), meaning: n_sp doci levels.

Parameters
n_spthe number of doci levels
nthe number of particles

Definition at line 26 of file DM2.cpp.

+ Here is the caller graph for this function:

DM2::DM2 ( const Molecule mol)

Create second order density matrix for a DOCI wavefunction based on the Molecule in mol

Parameters
molthe molecule to use

Definition at line 43 of file DM2.cpp.

+ Here is the call graph for this function:

DM2::DM2 ( const DM2 orig)

Definition at line 55 of file DM2.cpp.

DM2::DM2 ( DM2 &&  orig)

Definition at line 64 of file DM2.cpp.

virtual doci::DM2::~DM2 ( )
virtualdefault
doci::DM2::DM2 ( unsigned  int,
unsigned  int 
)
doci::DM2::DM2 ( const Molecule )
doci::DM2::DM2 ( const DM2 )
doci::DM2::DM2 ( DM2 &&  )
virtual doci::DM2::~DM2 ( )
virtualdefault

Member Function Documentation

void DM2::Build ( Permutation perm,
std::vector< double > &  eigv 
)

Build the second order density matrix from a DOCI wavefunction using the Permutation object and the ground state eigen vector

Parameters
permthe Permutation object to use
eigvthe eigenvector to build the DM2 from

Definition at line 373 of file DM2.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void doci::DM2::Build ( Permutation ,
std::vector< double > &   
)
void DM2::BuildHamiltonian ( const Molecule mol)

Build the reducted hamiltonian for Molecule mol

Parameters
molthe molecule to use

Definition at line 537 of file DM2.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void doci::DM2::BuildHamiltonian ( const Molecule )
double DM2::calc_rotate ( int  k,
int  l,
double  theta,
std::function< double(int, int)> &  T,
std::function< double(int, int, int, int)> &  V 
) const

Calculate the energy change when you rotate orbital k and l over an angle of theta with the rotation in the full space of the orbitals.

Parameters
kthe first orbital
lthe second orbital
thetathe angle to rotate over
Tfunction that returns the one-particle matrix elements
Vfunction that returns the two-particle matrix elements
Returns
the new energy

Definition at line 740 of file DM2.cpp.

double doci::DM2::calc_rotate ( int  k,
int  l,
double  theta,
std::function< double(int, int)> &  T,
std::function< double(int, int, int, int)> &  V 
) const
double doci::DM2::Dot ( const DM2 ) const
double DM2::Dot ( const DM2 x) const

Calculate the dot product with this DM2 and other one.

Parameters
xthe other DM2
Returns
the dot product between this and x

Definition at line 593 of file DM2.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::pair< double, bool > DM2::find_min_angle ( int  k,
int  l,
double  start_angle,
std::function< double(int, int)> &  T,
std::function< double(int, int, int, int)> &  V 
) const

Find the minimum with Newton-Raphson for the angle of a jacobi rotation between orbitals k and l in the DOCI space.

Parameters
kthe first orbital
lthe second orbital
start_anglethe starting point for the Newton-Raphson (defaults to zero)
Tfunction that returns the one-particle matrix elements
Vfunction that returns the two-particle matrix elements
Returns
pair of the angle with the lowest energy and boolean, true => minimum, false => maximum

Definition at line 630 of file DM2.cpp.

std::pair<double,bool> doci::DM2::find_min_angle ( int  k,
int  l,
double  start_angle,
std::function< double(int, int)> &  T,
std::function< double(int, int, int, int)> &  V 
) const
unsigned int DM2::get_n_electrons ( ) const
Returns
number of particles

Definition at line 354 of file DM2.cpp.

unsigned int doci::DM2::get_n_electrons ( ) const
unsigned int DM2::get_n_sp ( ) const
Returns
number of DOCI levels

Definition at line 362 of file DM2.cpp.

+ Here is the caller graph for this function:

unsigned int doci::DM2::get_n_sp ( ) const
double DM2::operator() ( int  a,
int  b,
int  c,
int  d 
) const

Access the element \(\hat a^+_a \hat a^+_b \hat a_d \hat a_c\) of the second order density matrix

Parameters
athe first sp index
bthe second sp index
cthe thirth sp index
dthe fourth sp index
Returns
the corresponding DM2 value

Definition at line 111 of file DM2.cpp.

double doci::DM2::operator() ( int  ,
int  ,
int  ,
int   
) const
DM2 & DM2::operator+= ( const DM2 a)

Add two DM2 object elementwise

Parameters
athe other DM2 object
Returns
the sum of *this and a

Definition at line 140 of file DM2.cpp.

+ Here is the call graph for this function:

DM2& doci::DM2::operator+= ( const DM2 )
DM2& doci::DM2::operator= ( const DM2 )
DM2 & DM2::operator= ( const DM2 orig)

Definition at line 71 of file DM2.cpp.

DM2 & DM2::operator= ( DM2 &&  orig)

Definition at line 80 of file DM2.cpp.

DM2& doci::DM2::operator= ( DM2 &&  )
DM2& doci::DM2::operator= ( double  )
DM2 & DM2::operator= ( double  val)

Put all elements equal to the same value

Parameters
valthe value to use
Returns
*this

Definition at line 94 of file DM2.cpp.

DM2 DM2::ReadFromFile ( const std::string  filename)
static

Read a DM2 in from a HDF5 file.

Parameters
filenamethe file to use
Returns
a new DM2 object with the data from the HDF5 file

Definition at line 291 of file DM2.cpp.

static DM2 doci::DM2::ReadFromFile ( const std::string  )
static
double DM2::Trace ( ) const
Returns
the trace of the this DM2 object

Definition at line 611 of file DM2.cpp.

+ Here is the caller graph for this function:

double doci::DM2::Trace ( ) const
void doci::DM2::WriteToFile ( const std::string  ) const
void DM2::WriteToFile ( const std::string  filename) const

Write the current DM2 to a HDF5 file

Parameters
filenamethe name of the file

Definition at line 213 of file DM2.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
doci::DM2  
)
friend

Definition at line 516 of file DM2.cpp.

std::ostream& operator<< ( std::ostream &  ,
doci::DM2  
)
friend

Definition at line 516 of file DM2.cpp.


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