CheMPS2
|
#include <DMRGSCFunitary.h>
Public Member Functions | |
DMRGSCFunitary (const DMRGSCFindices *iHandler) | |
Constructor. More... | |
virtual | ~DMRGSCFunitary () |
Destructor. | |
int | getNumVariablesX () const |
Get the number of variables in the x-parametrization of the unitary update. More... | |
void | updateUnitary (double *workmem1, double *workmem2, double *vector, const bool multiply, const bool compact) |
Update the unitary transformation. More... | |
void | rotateActiveSpaceVectors (double *eigenvecs, double *work) |
Rotate the unitary matrix. More... | |
void | CheckDeviationFromUnitary (double *work) const |
Calculate the two-norm of U^T*U - I. More... | |
void | getLog (double *vector, double *temp1, double *temp2) const |
Obtain the logarithm of the unitary matrix. More... | |
void | makeSureAllBlocksDetOne (double *temp1, double *temp2) |
Orbitals are defined up to a phase factor. Make sure that the logarithm of each block of the unitary has determinant 1. More... | |
void | saveU (const string filename=DMRGSCF_unitary_storage_name) const |
Save the unitary to disk. More... | |
void | loadU (const string filename=DMRGSCF_unitary_storage_name) |
Load the unitary from disk. More... | |
Public Member Functions inherited from CheMPS2::DMRGSCFmatrix | |
DMRGSCFmatrix (const DMRGSCFindices *iHandler) | |
Constructor. More... | |
virtual | ~DMRGSCFmatrix () |
Destructor. | |
void | clear () |
Clear the matrix. | |
void | identity () |
Make this matrix the identity matrix. | |
void | set (const int irrep, const int p, const int q, const double val) |
Set an element. More... | |
double | get (const int irrep, const int p, const int q) const |
Get an element. More... | |
double * | getBlock (const int irrep) |
Get a matrix block. More... | |
double | rms_deviation (const DMRGSCFmatrix *other) const |
Get the RMS deviation with another DMRGSCFmatrix. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from CheMPS2::DMRGSCFmatrix | |
static void | write (const string filename, const DMRGSCFindices *idx, double **storage) |
Write a DMRGSCFmatrix to disk. More... | |
static void | read (const string filename, const int n_irreps, double **storage) |
Read the DMRGSCFmatrix from disk. More... | |
Protected Attributes inherited from CheMPS2::DMRGSCFmatrix | |
const DMRGSCFindices * | iHandler |
The information on the occupied, active, and virtual spaces. | |
double ** | entries |
The matrix entries. | |
int | num_irreps |
The number of irreps. | |
DMRGSCFunitary class.
The DMRGSCFunitary class is a storage and manipulation class for the DMRGSCF orthogonal orbital rotation matrix. This matrix is blockdiagonal in the irreducible representations, and is formed by stepwise multiplying in new unitary rotations due to the augmented Hessian Newton-Raphson algorithm, see CheMPS2::CASSCF.
The exponential of a real-valued skew-symmetric matrix is an orthogonal matrix :
A real-valued skew-symmetric matrix has purely imaginary eigenvalues, which come in complex conjugate pairs . For matrices of odd dimension, there should hence always be one eigenvalue . is then a symmetric matrix with nonpositive real-valued eigenvalues . Nonzero eigenvalues of occur twice. The eigenvectors of allow to make block-diagonal. is skew-symmetric. Moreover, is diagonal: . is hence block-diagonal with blocks and blocks
The exponential of the block is , and the exponential of the block is
The matrix can hence be easily calculated blockwise. The exponential of is then obtained as . It is calculated by the function CheMPS2::DMRGSCFunitary::updateUnitary.
The reverse problem of finding a (nonunique) real-valued logarithm of a special orthogonal matrix can be performed similarly. Since is orthogonal (and hence norm-preserving), its eigenvalues all have norm 1:
For the second equalities, complex conjugation of the real-valued matrices and is used. The eigenvalues of hence come in complex conjugate pairs . Consider the symmetric matrix . If , the eigenvalue occurs twice. For matrices of odd dimension always occurs an odd number of times. Construct the symmetric matrix and diagonalize it (real-valued) as . The matrix is also a special orthogonal matrix with blocks and blocks
Because we consider special orthogonal matrices, the blocks always occur an even number of times, and they can hence be considered as a special case of the blocks. If we choose the branchcut for the logarithm on the negative real axis, the logarithm of the block is and the logarithm of the block is
with . The matrix can hence be easily calculated blockwise. The logarithm of is then obtained as . It is calculated by the function CheMPS2::DMRGSCFunitary::getLog.
Definition at line 70 of file DMRGSCFunitary.h.
CheMPS2::DMRGSCFunitary::DMRGSCFunitary | ( | const DMRGSCFindices * | iHandler | ) |
Constructor.
iHandler | The DMRGSCF indices |
Definition at line 31 of file DMRGSCFunitary.cpp.
void CheMPS2::DMRGSCFunitary::CheckDeviationFromUnitary | ( | double * | work | ) | const |
Calculate the two-norm of U^T*U - I.
work | Work memory |
Definition at line 244 of file DMRGSCFunitary.cpp.
void CheMPS2::DMRGSCFunitary::getLog | ( | double * | vector, |
double * | temp1, | ||
double * | temp2 | ||
) | const |
Obtain the logarithm of the unitary matrix.
vector | Where the logarithm should be stored |
temp1 | Work memory of at least 4*max(dim(irrep(Ham)))^2 |
temp2 | Work memory of at least 4*max(dim(irrep(Ham)))^2 |
Definition at line 319 of file DMRGSCFunitary.cpp.
int CheMPS2::DMRGSCFunitary::getNumVariablesX | ( | ) | const |
Get the number of variables in the x-parametrization of the unitary update.
Definition at line 60 of file DMRGSCFunitary.cpp.
void CheMPS2::DMRGSCFunitary::loadU | ( | const string | filename = DMRGSCF_unitary_storage_name | ) |
Load the unitary from disk.
filename | Filename to load the unitary from |
Definition at line 437 of file DMRGSCFunitary.cpp.
void CheMPS2::DMRGSCFunitary::makeSureAllBlocksDetOne | ( | double * | temp1, |
double * | temp2 | ||
) |
Orbitals are defined up to a phase factor. Make sure that the logarithm of each block of the unitary has determinant 1.
temp1 | Work memory of at least 4*max(dim(irrep(Ham)))^2 |
temp2 | Work memory of at least 4*max(dim(irrep(Ham)))^2 |
Definition at line 403 of file DMRGSCFunitary.cpp.
void CheMPS2::DMRGSCFunitary::rotateActiveSpaceVectors | ( | double * | eigenvecs, |
double * | work | ||
) |
Rotate the unitary matrix.
eigenvecs | The rotation vectors, in a memory block of size nOrbDMRG^2 |
work | Work memory, with size 2*max(dim(irrep(Ham)))^2 |
Definition at line 210 of file DMRGSCFunitary.cpp.
void CheMPS2::DMRGSCFunitary::saveU | ( | const string | filename = DMRGSCF_unitary_storage_name | ) | const |
Save the unitary to disk.
filename | Filename to store the unitary to |
Definition at line 431 of file DMRGSCFunitary.cpp.
void CheMPS2::DMRGSCFunitary::updateUnitary | ( | double * | workmem1, |
double * | workmem2, | ||
double * | vector, | ||
const bool | multiply, | ||
const bool | compact | ||
) |
Update the unitary transformation.
workmem1 | Work memory of at least 4*max(dim(irrep(Ham)))^2 |
workmem2 | Work memory of at least 4*max(dim(irrep(Ham)))^2 |
vector | The elements in X |
multiply | Boolean whether exp(X)*U or exp(X) should become the new U. If multiply==true, U <– exp(X)*U. If multiply==false, U <– exp(X). |
compact | Boolean which indicates how the elements X are stored |
Definition at line 117 of file DMRGSCFunitary.cpp.