ergo
|
Iterative Set Of Linear Equations solver, extending the generic LRSolver. More...
#include <slr.h>
Public Member Functions | |
SetOfEqSolver (int nbast, int nocc, const ergo_real *fock_matrix, const ergo_real *s, ergo_real freq) | |
Creates the set-of-equations solver. More... | |
void | setRHS (OneElOperator &op) |
initializes the rhs field More... | |
virtual | ~SetOfEqSolver () |
virtual ergo_real | getPreconditionerShift (int) const |
returns the preconditioning shift. More... | |
virtual int | getInitialGuess (VarVectorCollection &vecs) |
returns the initial guess for the linear set of equations. More... | |
virtual bool | getResidual (VarVectorCollection &residualv) |
get the residual of the set of linear equations. More... | |
virtual void | increaseSubspaceLimit (int newSize) |
expands above the default limit More... | |
ergo_real | getPolarisability (OneElOperator &oper) |
computes polarizability by contracting the response vector with specified operator More... | |
![]() | |
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. More... | |
virtual | ~LRSolver () |
bool | solve (E2Evaluator &e, bool diskMode=false) |
Solves the problem defined by the subclass. More... | |
void | computeExactE2Diag (E2Evaluator &e2) |
Protected Member Functions | |
virtual void | addToSpace (VarVectorCollection &vecs, E2Evaluator &e2) |
extends the subspace with v and its transformed vector Av. More... | |
ergo_real | multiplyXtimesVec (const VarVector &rhs) |
multiplies current solution by some vector. More... | |
![]() | |
void | getAvMinusFreqSv (ergo_real f, ergo_real *weights, VarVector &r) |
Computes a vector built of base vectors with specified vectors. More... | |
void | projectOnSubspace (const VarVector &full, ergo_real *w) |
Projects vector. More... | |
void | buildVector (const ergo_real *w, VarVector &full) |
Build full fector from the reduced form. More... | |
void | operToVec (OneElOperator &oper, VarVector &res) const |
Transform square operator to the vector form. More... | |
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. More... | |
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 More... | |
Protected Attributes | |
ergo_real * | rhsSub |
RHS vector projected onto subspace. More... | |
ergo_real | xTimesRHS |
![]() | |
VarVector | e2diag |
approximation to the diagonal of E2 operator More... | |
int | subspaceSize |
current subspace size More... | |
SmallMatrix | eSub |
E[2] matrix projected onto subspace. More... | |
SmallMatrix | sSub |
S[2] matrix projected onto subspace. More... | |
ergo_real * | xSub |
solution vector projected onto subspace More... | |
int | nbast |
number of basis functions More... | |
int | nocc |
number of occupied orbitals More... | |
VarVectorCollection | vects |
base vectors More... | |
Private Attributes | |
ergo_real | frequency |
frequency for which the SOE is to be solved. More... | |
VarVector | rhs |
RHS of the SOE. More... | |
Additional Inherited Members | |
![]() | |
ergo_real | convThreshold |
iterative method convergence threshold More... | |
int | maxSubspaceSize |
current subspace size limit. More... | |
![]() | |
static const int | MVEC = 200 |
default limit for subspace size More... | |
Iterative Set Of Linear Equations solver, extending the generic LRSolver.
|
inline |
Creates the set-of-equations solver.
The KS and overlap matrix may be deleted immediately after the object creation.
|
inlinevirtual |
References rhsSub.
|
protectedvirtual |
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 from LR::LRSolver.
References LR::LRSolver::addToSpace(), LR::dot(), LR::VarVector::nvar, rhs, rhsSub, LR::LRSolver::subspaceSize, LR::LRSolver::vects, LR::VarVector::x(), and LR::VarVector::y().
|
virtual |
returns the initial guess for the linear set of equations.
The explicit value is obtained from the diagonal assumption for the E[2] operator and is: (E[2]- freq*S[2])*g = Y -> g = Y./(E[2]-freq*S[2])
Implements LR::LRSolver.
References LR::LRSolver::e2diag, LR::VarVector::nvar, rhs, LR::VarVector::setSize(), and LR::VarVectorCollection::setSize().
ergo_real LR::SetOfEqSolver::getPolarisability | ( | OneElOperator & | oper | ) |
computes polarizability by contracting the response vector with specified operator
References multiplyXtimesVec(), and LR::LRSolver::operToVec().
Referenced by solveForRHS().
|
inlinevirtual |
returns the preconditioning shift.
Proper preconditioning is vital for the quick convergence.
Implements LR::LRSolver.
References frequency.
|
virtual |
get the residual of the set of linear equations.
This is done in two steps: Solution in the subspace: Xsub = (eSub-freq*Ssub)\Ysub; Residual vector is: residualv= (Av-freq*Sv)*Xsub - Y;
Implements LR::LRSolver.
References A, LR::LRSolver::convThreshold, do_output(), LR::LRSolver::eSub, frequency, LR::LRSolver::getAvMinusFreqSv(), LOG_AREA_LR, LOG_CAT_INFO, multiplyXtimesVec(), LR::VarVector::nvar, rhs, rhsSub, LR::VarVectorCollection::setSize(), solve_linear_equation_system(), LR::LRSolver::sSub, LR::LRSolver::subspaceSize, template_blas_sqrt(), LR::LRSolver::xSub, and xTimesRHS.
|
virtual |
expands above the default limit
Reimplemented from LR::LRSolver.
References LR::LRSolver::increaseSubspaceLimit(), LR::LRSolver::maxSubspaceSize, and rhsSub.
Referenced by es_get_polarisability().
multiplies current solution by some vector.
If such contractions are to be done several times, perhaps a single vector solution should be created and only then contracted with rhs vector.
References LR::LRSolver::projectOnSubspace(), rhs, LR::LRSolver::subspaceSize, and LR::LRSolver::xSub.
Referenced by getPolarisability(), and getResidual().
void LR::SetOfEqSolver::setRHS | ( | OneElOperator & | op | ) |
initializes the rhs field
References LR::LRSolver::ao2mo(), LR::commuteWithDMO(), LR::OneElOperator::getOper(), LR::LRSolver::nbast, LR::LRSolver::nocc, rhs, and LR::VarVector::setFromFull().
Referenced by solveForRHS().
|
private |
frequency for which the SOE is to be solved.
Referenced by getPreconditionerShift(), and getResidual().
|
private |
RHS of the SOE.
Referenced by addToSpace(), getInitialGuess(), getResidual(), multiplyXtimesVec(), and setRHS().
|
protected |
RHS vector projected onto subspace.
Referenced by addToSpace(), getResidual(), increaseSubspaceLimit(), and ~SetOfEqSolver().
|
protected |
Referenced by getResidual().