#include <slr.h>
Inheritance diagram for LR::LRSolver:
Public Member Functions | |
LRSolver (int nbast, int nocc, const ergo_real *fock_matrix, const ergo_real *s) | |
Initialize the solver by computing the diagonal of the E2 operator as needed for preconditioning. | |
virtual | ~LRSolver () |
virtual bool | getResidual (VarVectorCollection &residualv)=0 |
Computes the residual vector. | |
virtual int | getInitialGuess (VarVectorCollection &vecs)=0 |
Computes the initial vector the subspace is to be seeded with. | |
virtual ergo_real | getPreconditionerShift (int i) const =0 |
returns the preconditioning shift. | |
virtual void | increaseSubspaceLimit (int newSize) |
expands above the default limit | |
bool | solve (E2Evaluator &e, bool diskMode=false) |
solve the problem as defined by the subclass. | |
void | computeExactE2Diag (E2Evaluator &e2) |
Public Attributes | |
ergo_real | convThreshold |
iterative method convergence threshold | |
int | maxSubspaceSize |
current subspace size limit. | |
Protected Member Functions | |
void | getAvMinusFreqSv (ergo_real f, ergo_real *weights, VarVector &r) |
get_av_minus_freq_sv scans through transformed vectors creating their linear combination and returning r := Av - f*Sv | |
void | projectOnSubspace (const VarVector &full, ergo_real *w) |
Projects a full vector onto the reduced space. | |
void | buildVector (const ergo_real *w, VarVector &full) |
Build full fector from the reduced form. | |
void | operToVec (OneElOperator &oper, VarVector &res) const |
Transform square operator to the vector form. | |
ergo_real | setE2diag (int nbast, int nocc, const ergo_real *fock_matrix, const ergo_real *s) |
setE2diag is called by the constructor to fill in the approximation of the E[2] operator diagonal. | |
virtual void | addToSpace (VarVectorCollection &vecs, E2Evaluator &e2) |
extends the subspace with v and its transformed vector Av. | |
void | mo2ao (int nbast, const ergo_real *mo, ergo_real *ao) const |
void | ao2mo (int nbast, const ergo_real *ao, ergo_real *mo) const |
computes mo := cmo'*ao*cmo | |
Protected Attributes | |
VarVector | e2diag |
approximation to the diagonal of E2 operator | |
int | subspaceSize |
current subspace size | |
SmallMatrix | eSub |
E[2] matrix projected onto subspace. | |
SmallMatrix | sSub |
S[2] matrix projected onto subspace. | |
ergo_real * | xSub |
solution vector projected onto subspace | |
int | nbast |
number of basis functions | |
int | nocc |
number of occupied orbitals | |
VarVectorCollection | vects |
base vectors | |
Static Protected Attributes | |
static const int | MVEC = 200 |
default limit for subspace size | |
Private Member Functions | |
void | load_F_MO (ergo_real *fmat) const |
bool | lintrans (E2Evaluator &e2, const VarVector &v, VarVector &Av) const |
performs the linear transformation of the vector with E[2] operator. | |
Private Attributes | |
VarVectorCollection | Avects |
vects and Avects members store the trial vectors and their transformed versions. transformed base vectors | |
ergo_real * | fdiag |
the eigenvalues of the Fock matrix. | |
ergo_real * | cmo |
the MO coefficients. |
Initialize the solver by computing the diagonal of the E2 operator as needed for preconditioning.
virtual LR::LRSolver::~LRSolver | ( | ) | [inline, virtual] |
void LR::LRSolver::addToSpace | ( | VarVectorCollection & | v, | |
E2Evaluator & | e2 | |||
) | [protected, virtual] |
extends the subspace with v and its transformed vector Av.
The eSub and sSub projected matrices are modified as well. We do not store explicitely the swapped vectors (y x), only the (x y) combination.
Reimplemented in LR::SetOfEqSolver.
computes mo := cmo'*ao*cmo
Build full fector from the reduced form.
void LR::LRSolver::computeExactE2Diag | ( | E2Evaluator & | e2 | ) |
get_av_minus_freq_sv scans through transformed vectors creating their linear combination and returning r := Av - f*Sv
r := Av - f*Sv
virtual int LR::LRSolver::getInitialGuess | ( | VarVectorCollection & | vecs | ) | [pure virtual] |
Computes the initial vector the subspace is to be seeded with.
Allocates
vecs | and returns the number of vectors. |
Implemented in LR::SetOfEqSolver, and LR::EigenSolver.
virtual ergo_real LR::LRSolver::getPreconditionerShift | ( | int | i | ) | const [pure virtual] |
returns the preconditioning shift.
Proper preconditioning is vital for the quick convergence.
Implemented in LR::SetOfEqSolver, and LR::EigenSolver.
virtual bool LR::LRSolver::getResidual | ( | VarVectorCollection & | residualv | ) | [pure virtual] |
Computes the residual vector.
The residual vector is created by solving the problem in the subspace and then using the solution coefficients to form the approximate solution vector. This trial vector is then substituted to the equation and the residual is defined as the difference between the transformed trial vector and the expected solution.
Implemented in LR::SetOfEqSolver, and LR::EigenSolver.
void LR::LRSolver::increaseSubspaceLimit | ( | int | newSize | ) | [virtual] |
bool LR::LRSolver::lintrans | ( | E2Evaluator & | e2, | |
const VarVector & | v, | |||
VarVector & | Av | |||
) | const [private] |
performs the linear transformation of the vector with E[2] operator.
void LR::LRSolver::load_F_MO | ( | ergo_real * | fmat | ) | const [private] |
void LR::LRSolver::operToVec | ( | OneElOperator & | oper, | |
VarVector & | res | |||
) | const [protected] |
Transform square operator to the vector form.
Projects a full vector onto the reduced space.
full | on the reduced subspace, returns the result in | |
w | which is a preallocated vector of projection coefficients (weights) with size equal at least to the subspace size. |
ergo_real LR::LRSolver::setE2diag | ( | int | nbast, | |
int | nocc, | |||
const ergo_real * | fock_matrix, | |||
const ergo_real * | s | |||
) | [protected] |
setE2diag is called by the constructor to fill in the approximation of the E[2] operator diagonal.
It returns E_LUMO-E_HOMO which is useful for other things.
bool LR::LRSolver::solve | ( | E2Evaluator & | e2, | |
bool | diskMode = false | |||
) |
solve the problem as defined by the subclass.
This involves generation of the initial guess, symmetric orthogonalization, subspace extension routines, etc.
VarVectorCollection LR::LRSolver::Avects [private] |
vects and Avects members store the trial vectors and their transformed versions. transformed base vectors
Only every second vector is stored, the paired vectors are recovered with help of swapXY() function.
ergo_real* LR::LRSolver::cmo [private] |
the MO coefficients.
iterative method convergence threshold
VarVector LR::LRSolver::e2diag [protected] |
approximation to the diagonal of E2 operator
SmallMatrix LR::LRSolver::eSub [protected] |
E[2] matrix projected onto subspace.
ergo_real* LR::LRSolver::fdiag [private] |
the eigenvalues of the Fock matrix.
Used by load_F_MO.
current subspace size limit.
const int LR::LRSolver::MVEC = 200 [static, protected] |
default limit for subspace size
int LR::LRSolver::nbast [protected] |
number of basis functions
int LR::LRSolver::nocc [protected] |
number of occupied orbitals
SmallMatrix LR::LRSolver::sSub [protected] |
S[2] matrix projected onto subspace.
int LR::LRSolver::subspaceSize [protected] |
current subspace size
VarVectorCollection LR::LRSolver::vects [protected] |
base vectors
ergo_real* LR::LRSolver::xSub [protected] |
solution vector projected onto subspace