v2DM-DOCI
1.0
|
#include <TPM.h>
Public Member Functions | |
TPM (int L, int N) | |
TPM (const TPM &)=default | |
TPM (TPM &&)=default | |
virtual | ~TPM ()=default |
TPM & | operator= (const TPM &)=default |
TPM & | operator= (TPM &&)=default |
double | operator() (int a, int b, int c, int d) const |
int | gN () const |
int | gL () const |
int | gn () const |
void | HF_molecule (std::string filename) |
void | ham (std::function< double(int, int)> &T, std::function< double(int, int, int, int)> &V) |
void | WriteToFile (hid_t &group_id) const |
void | WriteToFile (std::string filename) const |
void | ReadFromFile (std::string filename) |
void | ReadFromFile (hid_t &group_id) |
double | S_2 () const |
void | unit () |
void | init (const Lineq &) |
void | Proj_Tr () |
void | collaps (const SUP &, const Lineq &) |
void | constr_grad (double t, const SUP &, const TPM &, const Lineq &) |
void | Q (const TPM &) |
void | Q (double a, double b, double c, const TPM &, bool=false) |
int | solve (double t, const SUP &, TPM &, const Lineq &) |
void | H (double t, const TPM &, const SUP &, const Lineq &) |
double | line_search (double t, SUP &, const TPM &) const |
double | line_search (double t, const TPM &, const TPM &) const |
void | ReadFromFileFull (std::string filename) |
void | Proj_E (const Lineq &, int option=0) |
std::vector< TPM > | DOCI_constrains () const |
std::vector< TPM > | singlet_constrains () const |
void | S (const TPM &) |
int | InverseS (TPM &, const Lineq &) |
double | getDiag (int, int) const |
void | G (const PHM &) |
void | pairing (double) |
void | rotate_doci (int, int, double) |
double | calc_rotate_doci (const TPM &, int, int, double) const |
double | calc_rotate_slow_doci (const TPM &, int, int, double) const |
std::pair< double, bool > | find_min_angle_doci (const TPM &, int, int, double=0) 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 |
double | calc_rotate_slow (int k, int l, double theta, std::function< double(int, int)> &T, std::function< double(int, int, int, int)> &V) 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 |
void | rotate (int, int, double, std::function< double(int, int)> &, std::function< double(int, int, int, int)> &) |
void | WriteFullToFile (std::string filename) const |
void | WriteFullToFile (hid_t &group) const |
void | setMatrixDim (int, int, int) |
void | setVectorDim (int, int, int) |
Container & | operator+= (const Container &) |
Container & | operator-= (const Container &) |
Container & | daxpy (double alpha, const Container &) |
Container & | operator*= (double) |
Container & | operator/= (double) |
Container & | mprod (const Container &, const Container &) |
double & | operator() (int block, int i, int j) |
double | operator() (int block, int i, int j) const |
double & | operator() (int block, int i) |
double | operator() (int block, int i) const |
Matrix & | getMatrix (int) |
const Matrix & | getMatrix (int) const |
Vector & | getVector (int) |
const Vector & | getVector (int) const |
BlockMatrix & | getMatrices () |
const BlockMatrix & | getMatrices () const |
BlockVector & | getVectors () |
const BlockVector & | getVectors () const |
int | gnr () const |
int | gnMatrix () const |
int | gnVector () const |
int | gdimMatrix (int) const |
int | gdimVector (int) const |
int | gdegMatrix (int) const |
int | gdegVector (int) const |
double | trace () const |
double | ddot (const Container &) const |
void | invert () |
void | dscal (double) |
void | fill_Random () |
void | fill_Random (int) |
void | sqrt (int) |
void | L_map (const Container &, const Container &) |
void | symmetrize () |
void | sep_pm (Container &, Container &) |
Static Public Member Functions | |
static TPM | CreateFromFile (std::string filename) |
Private Member Functions | |
void | constr_lists (int L) |
Private Attributes | |
int | N |
number of particles More... | |
int | L |
the size of the sp DOCI space (there are 2*L sp states) More... | |
int | n |
dimension of the full TPM More... | |
Static Private Attributes | |
static std::unique_ptr< helpers::tmatrix< unsigned int > > | s2t = nullptr |
table translating single particles indices to two particle indices More... | |
static std::unique_ptr< helpers::tmatrix< unsigned int > > | t2s = nullptr |
table translating two particles indices to single particle indices More... | |
Friends | |
std::ostream & | operator<< (std::ostream &output, doci2DM::TPM &tpm) |
TPM::TPM | ( | int | L, |
int | N | ||
) |
|
default |
|
default |
|
virtualdefault |
double TPM::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.
k | the first orbital |
l | the second orbital |
theta | the angle to rotate over |
T | function that returns the one-particle matrix elements |
V | function that returns the two-particle matrix elements |
double TPM::calc_rotate_doci | ( | const TPM & | ham, |
int | k, | ||
int | l, | ||
double | theta | ||
) | const |
Calculate the energy change when you rotate orbital k and l over an angle of theta in the DOCI space.
ham | the hamiltonian to use |
k | the first orbital |
l | the second orbital |
theta | the angle to rotate over |
Definition at line 1223 of file TPM.cpp.
double TPM::calc_rotate_slow | ( | int | k, |
int | l, | ||
double | theta, | ||
std::function< double(int, int)> & | T, | ||
std::function< double(int, int, int, int)> & | V | ||
) | const |
The slow version of TPM::calc_rotate()
k | the first orbital |
l | the second orbital |
theta | the angle to rotate over |
T | function that returns the one-particle matrix elements |
V | function that returns the two-particle matrix elements |
Definition at line 1383 of file TPM.cpp.
double TPM::calc_rotate_slow_doci | ( | const TPM & | ham, |
int | k, | ||
int | l, | ||
double | theta | ||
) | const |
The slow version of TPM::calc_rotate_doci()
ham | the hamiltonian to use |
k | the first orbital |
l | the second orbital |
theta | the angle to rotate over |
Definition at line 1265 of file TPM.cpp.
|
private |
|
static |
Create a TPM object from a file. You don't need to know L or N for this. You cannot read a file with different dimensions and the already created TPM's.
filename | the file to use |
Definition at line 1825 of file TPM.cpp.
|
inherited |
std::vector< TPM > TPM::DOCI_constrains | ( | ) | const |
|
inherited |
|
inherited |
Definition at line 272 of file Container.cpp.
|
inherited |
Definition at line 278 of file Container.cpp.
std::pair< double, bool > TPM::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.
k | the first orbital |
l | the second orbital |
start_angle | the starting point for the Newton-Raphson (defaults to zero) |
T | function that returns the one-particle matrix elements |
V | function that returns the two-particle matrix elements |
Definition at line 1577 of file TPM.cpp.
std::pair< double, bool > TPM::find_min_angle_doci | ( | const TPM & | ham, |
int | k, | ||
int | l, | ||
double | start_angle = 0 |
||
) | const |
Find the minimum with Newton-Raphson for the angle of a jacobi rotation between orbitals k and l in the DOCI space.
ham | the hamiltonian to use |
k | the first orbital |
l | the second orbital |
start_angle | the starting point for the Newton-Raphson (defaults to zero) |
Definition at line 1317 of file TPM.cpp.
void TPM::G | ( | const PHM & | phm | ) |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
double TPM::getDiag | ( | int | a, |
int | b | ||
) | const |
|
inherited |
Definition at line 195 of file Container.cpp.
|
inherited |
Definition at line 200 of file Container.cpp.
|
inherited |
|
inherited |
Definition at line 179 of file Container.cpp.
|
inherited |
|
inherited |
Definition at line 189 of file Container.cpp.
|
inherited |
Definition at line 205 of file Container.cpp.
|
inherited |
Definition at line 210 of file Container.cpp.
int TPM::gL | ( | ) | const |
int TPM::gN | ( | ) | const |
|
inherited |
|
inherited |
Definition at line 215 of file Container.cpp.
|
inherited |
void TPM::ham | ( | std::function< double(int, int)> & | T, |
std::function< double(int, int, int, int)> & | V | ||
) |
Build the reduced hamiltonian using 2 function objects: one for the one particles integrals, one for the two particle integrals. The functions should accept the spatial orbitals as argument.
T | a function that accepts 2 orbitals a and b and returns the <a|T|b> matrix element |
V | a function that accepts 4 orbitals a, b, c and d and returns the <ab|V|cd> matrix element |
Definition at line 183 of file TPM.cpp.
void TPM::HF_molecule | ( | std::string | filename | ) |
void TPM::init | ( | const Lineq & | lineq | ) |
Calculate the inverse Overlap matrix S^-1 a = b by solving S b = a with conjugate gradient. Store the result in *this.
b | the input matrix |
lineq | the constrains to use |
Definition at line 981 of file TPM.cpp.
|
inherited |
Definition at line 260 of file Container.cpp.
General matrix matrix product of A and B. Stores result in *this.
A | matrix A |
B | matrix B |
Definition at line 146 of file Container.cpp.
double TPM::operator() | ( | int | a, |
int | b, | ||
int | c, | ||
int | d | ||
) | const |
|
inherited |
Definition at line 154 of file Container.cpp.
|
inherited |
Definition at line 159 of file Container.cpp.
|
inherited |
Definition at line 164 of file Container.cpp.
|
inherited |
Definition at line 169 of file Container.cpp.
|
inherited |
Definition at line 124 of file Container.cpp.
Definition at line 99 of file Container.cpp.
Definition at line 108 of file Container.cpp.
|
inherited |
Definition at line 132 of file Container.cpp.
void TPM::pairing | ( | double | g | ) |
void TPM::Proj_E | ( | const Lineq & | lineq, |
int | option = 0 |
||
) |
void TPM::Proj_Tr | ( | ) |
void TPM::Q | ( | const TPM & | tpm | ) |
void TPM::Q | ( | double | a, |
double | b, | ||
double | c, | ||
const TPM & | tpm, | ||
bool | inverse = false |
||
) |
void TPM::ReadFromFile | ( | std::string | filename | ) |
void TPM::ReadFromFile | ( | hid_t & | group_id | ) |
void TPM::ReadFromFileFull | ( | std::string | filename | ) |
void TPM::rotate | ( | int | k, |
int | l, | ||
double | angle, | ||
std::function< double(int, int)> & | T, | ||
std::function< double(int, int, int, int)> & | V | ||
) |
Rotate this TPM object with a jacobi rotation between orbitals k and l over angle in the full space.
k | the first orbital |
l | the second orbital |
angle | the angle to rotate over |
T | function that returns the one-particle matrix elements |
V | function that returns the two-particle matrix elements |
Definition at line 1684 of file TPM.cpp.
void TPM::rotate_doci | ( | int | k, |
int | l, | ||
double | angle | ||
) |
void TPM::S | ( | const TPM & | tpm_d | ) |
( Overlapmatrix of the U-basis ) - map, maps a TPM onto a different TPM, this map is actually a Q-like map for which the paramaters a,b and c are calculated in primal_dual.pdf. Since it is a Q-like map the inverse can be taken as well.
tpm_d | the input TPM |
Definition at line 922 of file TPM.cpp.
double TPM::S_2 | ( | ) | const |
Definition at line 302 of file Container.cpp.
|
inherited |
Set dimension and degeneracy for a Matrix
block | which matrix |
dim | the dimensions |
degen | the degeneracy of the matrix |
Definition at line 59 of file Container.cpp.
|
inherited |
Set dimension and degeneracy for a Vector
block | which vector |
dim | the dimensions |
degen | the degeneracy of the vector |
Definition at line 70 of file Container.cpp.
std::vector<TPM> doci2DM::TPM::singlet_constrains | ( | ) | const |
|
inherited |
Definition at line 285 of file Container.cpp.
|
inherited |
Definition at line 297 of file Container.cpp.
|
inherited |
void TPM::unit | ( | ) |
void TPM::WriteFullToFile | ( | hid_t & | group | ) | const |
void TPM::WriteToFile | ( | hid_t & | group_id | ) | const |
void TPM::WriteToFile | ( | std::string | filename | ) | const |
|
friend |
|
private |
|
staticprivate |
|
staticprivate |