ergo
|
PurificationGeneral is an abstract class which provides an interface for SP2, SP2ACC and possibly other recursive expansions. More...
#include <purification_general.h>
Public Types | |
typedef ergo_real | real |
typedef intervalType | IntervalType |
typedef mat::normType | NormType |
typedef std::vector< int > | VectorTypeInt |
typedef std::vector< real > | VectorTypeReal |
typedef generalVector | VectorType |
typedef MatrixType | MatrixTypeWrapper |
Public Member Functions | |
PurificationGeneral () | |
virtual void | initialize (const MatrixType &F_, const IntervalType &lumo_bounds_, const IntervalType &homo_bounds_, int maxit_, real error_sub_, real error_eig_, bool use_new_stopping_criterion_, NormType norm_truncation, NormType norm_stop_crit, int nocc_) |
Set imporatant parameters for the recursive expansion. More... | |
virtual void | PurificationStart () |
Start recursive expansion. More... | |
virtual void | clear () |
Clear all matrices in the class. More... | |
void | set_spectrum_bounds (real eigmin, real eigmax) |
Set spectrum bounds. More... | |
void | get_spectrum_bounds (real &eigmin, real &eigmax) |
Get spectrum bounds. More... | |
int | get_exact_number_of_puri_iterations () |
int | get_est_number_of_puri_iterations () |
virtual real | total_subspace_error (int it) |
void | set_eigenvectors_params (string eigenvectors_method_, string eigenvectors_iterative_method_, real eigensolver_accuracy_, int eigensolver_maxiter_, int scf_step_, bool try_eigv_on_next_iteration_if_fail_) |
Set parameters for computing eigenvectors. More... | |
void | set_eigenvectors_params (string eigenvectors_method_, string eigenvectors_iterative_method_, real eigensolver_accuracy_, int eigensolver_maxiter_, int scf_step_, bool try_eigv_on_next_iteration_if_fail_, bool use_prev_vector_as_initial_guess_, const std::vector< VectorType > &eigVecOCCRef, const std::vector< VectorType > &eigVecUNOCCRef) |
Set parameters for computing eigenvectors - long version. More... | |
void | extract_computed_eigenpairs (std::vector< VectorType > &eigVecUNOCCref, std::vector< VectorType > &eigVecOCCref, std::vector< real > &eigValUNOCCref, std::vector< real > &eigValOCCref) |
void | set_compute_eigenvectors_in_each_iteration () |
void | unset_compute_eigenvectors_in_each_iteration () |
void | set_number_of_eigenvectors_to_compute (const int occ, const int unocc) |
int | get_number_of_occ_eigenvectors_to_compute () const |
int | get_number_of_unocc_eigenvectors_to_compute () const |
void | set_jump_over_X_iter_proj_method (int val) |
int | get_jump_over_X_iter_proj_method () const |
void | set_go_back_X_iter_proj_method (int val) |
int | get_go_back_X_iter_proj_method () const |
void | compute_eigenvectors_without_diagonalization_on_F (const MatrixType &F, int eigensolver_maxiter_for_F) |
void | gen_matlab_file_norm_diff (const char *filename) const |
Create MATLAB .m file which plots the idempotency error in each recursive expansion iteration. More... | |
void | gen_matlab_file_threshold (const char *filename) const |
Create MATLAB .m file which plots the actual introduced error after truncation of the matrix X_i in each recursive expansion iteration. More... | |
void | gen_matlab_file_nnz (const char *filename) const |
Create MATLAB .m file which plots the number of non-zero elements in matrices X_i and X_i^2 in each recursive expansion iteration. More... | |
void | gen_matlab_file_eigs (const char *filename) const |
Create MATLAB .m file which plots the homo and lumo bounds in each recursive expansion iteration. More... | |
void | gen_matlab_file_time (const char *filename) const |
Create MATLAB .m file which creates a bar plot presenting time spent on various parts of the iteration (such as matrix square and computation of eigenvectors) in each recursive expansion iteration. More... | |
virtual | ~PurificationGeneral () |
Create MATLAB .m file which plots a condition number of a problem of computing the density matrix in each recursive expansion iteration. More... | |
Static Public Member Functions | |
static real | get_epsilon () |
Get machine epsilon. More... | |
static real | get_max_double () |
Get largest number. More... | |
static real | get_min_double () |
Get smallest number. More... | |
Public Attributes | |
PuriInfo | info |
Fill in during purification with useful information. More... | |
MatrixType | X |
Matrix X. More... | |
MatrixType | Xsq |
Matrix X^2. More... | |
Protected Member Functions | |
virtual bool | is_initialized () const |
Check is function initialize() is already called. More... | |
virtual bool | puri_is_prepared () const |
Check is function prepare_to_purification() is already called. More... | |
virtual void | prepare_to_purification () |
Prepare data for recursive expansion. More... | |
virtual void | prepare_to_purification_eigenvectors () |
Prepare data related to the eigenvectors computations. More... | |
virtual void | purification_process () |
Run recursive expansion. More... | |
virtual void | eigenvalue_bounds_estimation () |
Estimate eigenvalues near homo-lumo gap. More... | |
void | save_matrix_now (string str) |
void | save_matrix_A_now (const MatrixType &A, string str) |
virtual void | compute_spectrum_bounds () |
Compute spectrum bounds. More... | |
virtual void | compute_X () |
Get matrix X0 by mapping spectrum of F into [0,1] in reverse order. More... | |
void | map_bounds_to_0_1 () |
Get eigenvalue bounds for X0. More... | |
virtual void | check_standard_stopping_criterion (const real XmX2_norm, int &stop) |
Check stopping criterion (obsolete). More... | |
virtual void | check_new_stopping_criterion (const int it, const real XmX2_norm_it, const real XmX2_norm_itm2, const real XmX2_trace, int &stop, real &estim_order) |
Check stopping criterion. More... | |
virtual void | stopping_criterion (IterationInfo &iter_info, int &stop, real &estim_order) |
Choose stopping criterion and check it. More... | |
int | get_int_eig_iter_method (string eigenvectors_iterative_method) |
int | get_int_eig_method (string eigenvectors_method) |
void | compute_eigenvectors_without_diagonalization (int it, IterationInfo &iter_info) |
Compute HOMO and LUMO eigenvalues and eigenvectors of the matrix F. More... | |
void | compute_eigenvectors_without_diagonalization_last_iter_proj () |
void | projection_method_one_puri_iter (int current_iteration) |
void | compute_eigenvector (MatrixType const &M, std::vector< VectorType > &eigVec, std::vector< real > &eigVal, int it, bool is_homo) |
void | set_eigenvectors_params_basic (string eigenvectors_method_, string eigenvectors_iterative_method_, real eigensolver_accuracy_, int eigensolver_maxiter_, int scf_step_, bool try_eigv_on_next_iteration_if_fail_, bool use_prev_vector_as_initial_guess_) |
Set parameters for computing eigenvectors. More... | |
double | get_nnz_X (size_t &nnzX) |
Get nnz of X in %. More... | |
double | get_nnz_X () |
Get nnz of X in %. More... | |
double | get_nnz_Xsq (size_t &nnzXsq) |
Get nnz of X^2 in %. More... | |
double | get_nnz_Xsq () |
Get nnz of X^2 in %. More... | |
void | estimate_homo_lumo (const VectorTypeReal &XmX2_norm_mixed, const VectorTypeReal &XmX2_norm_frob, const VectorTypeReal &XmX2_trace) |
Get homo and lumo bounds from traces and norms of Xi-Xi^2. More... | |
void | get_eigenvalue_estimates (const VectorTypeReal &XmX2_norm_mixed, const VectorTypeReal &XmX2_norm_frob, const VectorTypeReal &XmX2_trace) |
Get homo and lumo bounds from traces and norms of Xi-Xi^2. More... | |
virtual void | determine_iteration_for_eigenvectors () |
Determine in which iterations will be computed homo and lumo eigenvectors. More... | |
virtual void | get_iterations_for_lumo_and_homo (int &chosen_iter_lumo, int &chosen_iter_homo) |
Find the best iterations for computing eigenvectors. More... | |
virtual void | check_eigenvectors_at_the_end () |
virtual void | discard_homo_eigenvector () |
virtual void | discard_lumo_eigenvector () |
void | output_norms_and_traces (IterationInfo &iter_info) const |
void | output_separate_total_times (PuriInfo &info) const |
void | output_time_WriteAndReadAll () const |
void | check_homo_lumo_eigenvalues (real &eigVal, VectorType &eigVec, bool &is_homo, bool &is_lumo, const int iter) |
void | get_eigenvalue_of_F_from_eigv_of_Xi (real &eigVal, const VectorType &eigVec) |
void | save_selected_eigenvector_to_file (const VectorType &v, int num, bool is_homo, int it=-1) |
virtual void | truncate_matrix (real &thresh, int it) |
virtual void | set_truncation_parameters () |
void | find_shifts_every_iter () |
/brief Find shifts sigma which will be used for construction of the filtering polynomial for computing eigenvectors. More... | |
void | writeToTmpFile (MatrixType &A) const |
void | readFromTmpFile (MatrixType &A) const |
virtual void | set_init_params ()=0 |
virtual void | estimate_number_of_iterations (int &estim_num_iter)=0 |
virtual void | purify_X (const int it)=0 |
virtual void | purify_bounds (const int it)=0 |
virtual void | save_other_iter_info (IterationInfo &iter_info, int it)=0 |
virtual void | apply_inverse_poly_vector (const int it, VectorTypeReal &bounds_from_it)=0 |
virtual void | return_constant_C (const int it, real &Cval)=0 |
virtual real | apply_poly (const int it, real x)=0 |
virtual real | compute_derivative (const int it, real x, real &DDf)=0 |
Protected Attributes | |
MatrixType | F |
Matrix F. More... | |
std::vector< MatrixType > | vec_matrices_Xi |
Save matrices Xi in each iteration (if used projection method for computing eigenvectors). More... | |
bool | initialized_flag |
bool | puri_is_prepared_flag |
bool | use_new_stopping_criterion |
True for new stopping criterion. More... | |
int | additional_iterations |
Do a few more iterations after convergence. More... | |
int | maxit |
Maximum number of iterations. More... | |
int | check_stopping_criterion_iter |
Iteration when to start to check stopping criterion. More... | |
int | nocc |
Number of occupied orbitals. More... | |
NormType | normPuriTrunc |
Norm used for the truncation of matrices. More... | |
NormType | normPuriStopCrit |
Norm used in the stopping criterion Can be mat::frobNorm, mat::mixedNorm, or mat::euclNorm. More... | |
real | error_sub |
Allowed error in invariant subspaces. More... | |
real | error_eig |
Error in eigenvalues (used just in old stopping criterion). More... | |
real | error_per_it |
Error allowed in each iteration due to truncation. More... | |
real | constant_C |
Asymptotic constant C needed for the new stopping criterion. More... | |
real | gammaStopEstim |
Used on the stopping criterion for estimation of eigenvalues from purification. More... | |
VectorTypeInt | VecPoly |
Polynomials computed in the function estimated_number_of_iterations() VecPoly[i] = 1 if we use X=X^2 VecPoly[i] = 0 if we use X=2X-X^2 (or their accelerated versions) More... | |
VectorTypeReal | VecGap |
Gap computed using inner homo and lumo bounds on each iteration. More... | |
VectorTypeReal | ITER_ERROR_VEC |
(Eigenvectors) Maximum error introduced in each iteration. More... | |
VectorTypeReal | SIGMA_HOMO_VEC |
VectorTypeReal | SIGMA_LUMO_VEC |
(Eigenvectors) Approximation of shifts in each iteration. More... | |
VectorTypeReal | EIG_ABS_GAP_LUMO_VEC |
VectorTypeReal | EIG_ABS_GAP_HOMO_VEC |
(Eigenvectors) Absolute and relative gap in filter for lumo eigenvalue. More... | |
VectorTypeReal | EIG_REL_GAP_LUMO_VEC |
VectorTypeReal | EIG_REL_GAP_HOMO_VEC |
(Eigenvectors) Absolute and relative gap in filter for homo eigenvalue. More... | |
int | number_of_occ_eigenvectors |
int | number_of_unocc_eigenvectors |
int | jump_over_X_iter_proj_method |
int | go_back_X_iter_proj_method |
IntervalType | homo_bounds |
(1-homo) bounds for Xi in iteration i More... | |
IntervalType | lumo_bounds |
Lumo bounds for Xi in iteration i. More... | |
IntervalType | homo_bounds_X0 |
Initial lumo bounds for X. More... | |
IntervalType | lumo_bounds_X0 |
Initial lumo bounds for X. More... | |
IntervalType | homo_bounds_F |
Initial lumo bounds for F. More... | |
IntervalType | lumo_bounds_F |
Initial homo bounds for F. More... | |
IntervalType | homo_bounds_F_new |
IntervalType | lumo_bounds_F_new |
IntervalType | spectrum_bounds |
Outer bounds for the whole spectrum of F/Xi. More... | |
bool | computed_spectrum_bounds |
int | eigenvectors_method |
Chosen method for computing eigenvectors. More... | |
int | eigenvectors_iterative_method |
Chosen eigensolver. More... | |
real | eigensolver_accuracy |
Accuracy of the eigenvalue problem solver. More... | |
int | eigensolver_maxiter |
Maximum number of iterations for eigensolver. More... | |
string | eigenvectors_method_str |
string | eigenvectors_iterative_method_str |
bool | use_prev_vector_as_initial_guess |
bool | compute_eigenvectors_in_this_SCF_cycle |
bool | try_eigv_on_next_iteration_if_fail |
VectorType | eigVecLUMORef |
VectorType | eigVecHOMORef |
std::vector< VectorType > | eigVecOCC |
Here we save eigenvectors corresponding to the occupied orbitals. More... | |
std::vector< VectorType > | eigVecUNOCC |
Here we save eigenvectors corresponding to the unoccupied orbitals. More... | |
std::vector< real > | eigValOCC |
Here we save eigenvalues corresponding to the occupied orbitals. More... | |
std::vector< real > | eigValUNOCC |
Here we save eigenvalues corresponding to the unoccupied orbitals. More... | |
real | eigValLUMO |
real | eigValHOMO |
int | iter_for_homo |
int | iter_for_lumo |
VectorTypeInt | good_iterations_homo |
Iterations where homo eigenvector can be computed. More... | |
VectorTypeInt | good_iterations_lumo |
Iterations where homo eigenvector can be computed. More... | |
VectorTypeInt | really_good_iterations_homo |
Iterations where homo eigenvector is actually computed. More... | |
VectorTypeInt | really_good_iterations_lumo |
Iterations where lumo eigenvector is actually computed. More... | |
int | scf_step |
bool | compute_eigenvectors_in_each_iteration |
Compute homo and lumo eigenpairs in every iteration and save eigenvectors in txt files. More... | |
PurificationGeneral is an abstract class which provides an interface for SP2, SP2ACC and possibly other recursive expansions.
MatrixType | Type of a matrix (ex. symmMatrix). |
typedef intervalType PurificationGeneral< MatrixType >::IntervalType |
typedef MatrixType PurificationGeneral< MatrixType >::MatrixTypeWrapper |
typedef mat::normType PurificationGeneral< MatrixType >::NormType |
typedef ergo_real PurificationGeneral< MatrixType >::real |
typedef generalVector PurificationGeneral< MatrixType >::VectorType |
typedef std::vector<int> PurificationGeneral< MatrixType >::VectorTypeInt |
typedef std::vector<real> PurificationGeneral< MatrixType >::VectorTypeReal |
|
inline |
References PurificationGeneral< MatrixType >::compute_eigenvectors_in_each_iteration, PurificationGeneral< MatrixType >::computed_spectrum_bounds, PurificationGeneral< MatrixType >::go_back_X_iter_proj_method, PurificationGeneral< MatrixType >::initialized_flag, PurificationGeneral< MatrixType >::jump_over_X_iter_proj_method, PurificationGeneral< MatrixType >::number_of_occ_eigenvectors, PurificationGeneral< MatrixType >::number_of_unocc_eigenvectors, PurificationGeneral< MatrixType >::puri_is_prepared_flag, and PurificationGeneral< MatrixType >::use_new_stopping_criterion.
|
inlinevirtual |
Create MATLAB .m file which plots a condition number of a problem of computing the density matrix in each recursive expansion iteration.
The condition number is equal to inverse of the homo-lumo gap approximation. Create PYTHON .py file which plots number of non-zero elements in matrices X_i and X_i^2 in each recursive expansion iteration.
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
protectedvirtual |
References do_output(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, LOG_CAT_WARNING, THRESHOLD_EIG_TOLERANCE, and UNIT_one_eV.
|
protected |
References do_output(), EIG_PROJECTION_INT, EIG_SQUARE_INT, LOG_AREA_DENSFROMF, LOG_CAT_INFO, and THRESHOLD_EIG_TOLERANCE.
|
protectedvirtual |
Check stopping criterion.
The new stopping criterion based on the order of convergence is used, see article "Parameterless Stopping Criteria for Recursive Density Matrix Expansions", J. Chem. Theory Comput., 2016, 12 (12), pp 5788–5802 DOI: 10.1021/acs.jctc.6b00626
References do_output(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, ORDER, template_blas_log(), template_blas_pow(), and template_blas_sqrt().
|
protectedvirtual |
Check stopping criterion (obsolete).
Use stopping criterion based on user defined threshold values.
References do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
inlinevirtual |
Clear all matrices in the class.
Needed to be called if Chunks and Tasks are used, since we need to delete all ChunkIDs before exiting the program.
References PurificationGeneral< MatrixType >::X, and PurificationGeneral< MatrixType >::Xsq.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), and main().
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
protected |
|
protected |
Compute HOMO and LUMO eigenvalues and eigenvectors of the matrix F.
The method uses the polynomial constructed during the recursive expansion, so no additional matrix multiplications are required. See article J. Chem. Theory Comput., Just Accepted Manuscript, DOI: 10.1021/acs.jctc.7b00968
References do_output(), EIG_PROJECTION_INT, EIG_SQUARE_INT, Util::TimeMeter::get_elapsed_wall_seconds(), IterationInfo::homo_eig_solver_time, LOG_AREA_DENSFROMF, LOG_CAT_INFO, IterationInfo::lumo_eig_solver_time, IterationInfo::orbital_homo_time, IterationInfo::orbital_lumo_time, output_current_memory_usage(), Util::TimeMeter::print(), and rows.
|
protected |
References do_output(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, max, min(), and output_current_memory_usage().
void PurificationGeneral< MatrixType >::compute_eigenvectors_without_diagonalization_on_F | ( | const MatrixType & | F, |
int | eigensolver_maxiter_for_F | ||
) |
References eigvec::computeEigenvectors(), do_output(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, and rows.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), test1(), and test4().
|
protectedvirtual |
Compute spectrum bounds.
References do_output(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, Util::TimeMeter::print(), and template_blas_sqrt().
|
protectedvirtual |
Get matrix X0 by mapping spectrum of F into [0,1] in reverse order.
References do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
protectedvirtual |
Determine in which iterations will be computed homo and lumo eigenvectors.
Calling get_iterations_for_lumo_and_homo().
References do_output(), EIG_SQUARE_INT, LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Estimate eigenvalues near homo-lumo gap.
References do_output(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, and mat::mixedNorm.
|
protected |
Get homo and lumo bounds from traces and norms of Xi-Xi^2.
Called by get_eigenvalue_estimates().
Used at the end of the recursive expansion. See article SIAM J. Sci. Comput., 36(2), B147–B170.
References min(), and template_blas_sqrt().
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
inline |
References PurificationGeneral< MatrixType >::eigValOCC, PurificationGeneral< MatrixType >::eigValUNOCC, PurificationGeneral< MatrixType >::eigVecOCC, and PurificationGeneral< MatrixType >::eigVecUNOCC.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), main(), test1(), test2(), and test3().
|
protected |
/brief Find shifts sigma which will be used for construction of the filtering polynomial for computing eigenvectors.
void PurificationGeneral< MatrixType >::gen_matlab_file_eigs | ( | const char * | filename | ) | const |
Create MATLAB .m file which plots the homo and lumo bounds in each recursive expansion iteration.
References do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), and plot_results().
void PurificationGeneral< MatrixType >::gen_matlab_file_nnz | ( | const char * | filename | ) | const |
Create MATLAB .m file which plots the number of non-zero elements in matrices X_i and X_i^2 in each recursive expansion iteration.
References do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), and plot_results().
void PurificationGeneral< MatrixType >::gen_matlab_file_norm_diff | ( | const char * | filename | ) | const |
Create MATLAB .m file which plots the idempotency error in each recursive expansion iteration.
References do_output(), mat::euclNorm, mat::frobNorm, LOG_AREA_DENSFROMF, LOG_CAT_INFO, and mat::mixedNorm.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), and plot_results().
void PurificationGeneral< MatrixType >::gen_matlab_file_threshold | ( | const char * | filename | ) | const |
Create MATLAB .m file which plots the actual introduced error after truncation of the matrix X_i in each recursive expansion iteration.
References do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), and plot_results().
void PurificationGeneral< MatrixType >::gen_matlab_file_time | ( | const char * | filename | ) | const |
Create MATLAB .m file which creates a bar plot presenting time spent on various parts of the iteration (such as matrix square and computation of eigenvectors) in each recursive expansion iteration.
References do_output(), EIG_SQUARE_INT, LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), and plot_results().
|
protected |
Get homo and lumo bounds from traces and norms of Xi-Xi^2.
Used at the end of the recursive expansion. See article SIAM J. Sci. Comput., 36(2), B147–B170.
|
protected |
|
inlinestatic |
Get machine epsilon.
int PurificationGeneral< MatrixType >::get_est_number_of_puri_iterations |
int PurificationGeneral< MatrixType >::get_exact_number_of_puri_iterations |
|
inline |
|
protected |
References EIG_EMPTY, EIG_LANCZOS_INT, and EIG_POWER_INT.
|
protected |
References EIG_EMPTY, EIG_PROJECTION_INT, and EIG_SQUARE_INT.
|
protectedvirtual |
Find the best iterations for computing eigenvectors.
The best iteration defined by both a small error in the eigenvector and a small number of iterations of an iterative method.
References template_blas_fabs().
|
inline |
|
inlinestatic |
Get largest number.
References max.
|
inlinestatic |
Get smallest number.
References min().
|
inlineprotected |
Get nnz of X in %.
References PurificationGeneral< MatrixType >::X.
|
inlineprotected |
Get nnz of X in %.
nnzX | Number of nz of X |
References PurificationGeneral< MatrixType >::X.
|
inlineprotected |
Get nnz of X^2 in %.
References PurificationGeneral< MatrixType >::Xsq.
|
inlineprotected |
Get nnz of X^2 in %.
nnzXsq | Number of nz of X^2 |
References PurificationGeneral< MatrixType >::Xsq.
|
inline |
|
inline |
void PurificationGeneral< MatrixType >::get_spectrum_bounds | ( | real & | eigmin, |
real & | eigmax | ||
) |
Get spectrum bounds.
Return spectrum bounds for the matrix F. If not computed before, compute them.
|
virtual |
Set imporatant parameters for the recursive expansion.
[in] | F_ | [in] Effective Hamiltonian matrix. |
[in] | lumo_bounds_ | [in] Bounds for lumo eigenvalue. |
[in] | homo_bounds_ | [in] Bounds for homo eigenvalue. |
[in] | maxit_ | [in] Maximum number of recursive expansion iterations. |
[in] | error_sub_ | [in] Allowed error in invariant subspaces. |
[in] | error_eig_ | [in] Error in eigenvalues (used just in old stopping criterion). |
[in] | use_new_stopping_criterion_ | [in] Set if want to use new stopping criterion. |
[in] | norm_truncation | [in] Truncation norm. |
[in] | norm_stop_crit | [in] Stopping criterion norm. |
[in] | nocc_ | [in] Number of occupied orbitals. |
References do_output(), enable_printf_output(), mat::euclNorm, mat::frobNorm, LOG_AREA_DENSFROMF, LOG_CAT_INFO, mat::mixedNorm, and NUM_ADDITIONAL_ITERATIONS.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), main(), test1(), test2(), test3(), and test4().
|
inlineprotectedvirtual |
Check is function initialize() is already called.
References PurificationGeneral< MatrixType >::initialized_flag.
|
protected |
Get eigenvalue bounds for X0.
References do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
protected |
|
protected |
References do_output(), PuriInfo::get_total_eucl_diff_time(), PuriInfo::get_total_frob_diff_time(), PuriInfo::get_total_inf_diff_time(), PuriInfo::get_total_mixed_diff_time(), PuriInfo::get_total_nnz_time(), PuriInfo::get_total_purify_time(), PuriInfo::get_total_stopping_criterion_time(), PuriInfo::get_total_trace_diff_time(), PuriInfo::get_total_Xsquare_time(), PuriInfo::get_total_Xtrunc_time(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
protected |
|
protectedvirtual |
Prepare data for recursive expansion.
References do_output(), Util::TimeMeter::get_elapsed_wall_seconds(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, and Util::TimeMeter::print().
|
protectedvirtual |
Prepare data related to the eigenvectors computations.
References do_output(), EIG_PROJECTION_INT, LOG_AREA_DENSFROMF, LOG_CAT_INFO, max, and TOL_OVERLAPPING_BOUNDS.
|
protected |
|
inlineprotectedvirtual |
Check is function prepare_to_purification() is already called.
References PurificationGeneral< MatrixType >::puri_is_prepared_flag.
|
protectedvirtual |
Run recursive expansion.
References IterationInfo::constantC, do_output(), eucl_acc, IterationInfo::eucl_diff_time, mat::euclNorm, IterationInfo::frob_diff_time, IterationInfo::gap, Util::TimeMeter::get_elapsed_wall_seconds(), IterationInfo::homo_bound_low, IterationInfo::homo_bound_upp, IterationInfo::inf_diff_time, IterationInfo::it, LOG_AREA_DENSFROMF, LOG_CAT_INFO, IterationInfo::lumo_bound_low, IterationInfo::lumo_bound_upp, mixed_acc, IterationInfo::mixed_diff_time, mat::mixedNorm, IterationInfo::nnz_time, IterationInfo::NNZ_X, IterationInfo::NNZ_X2, IterationInfo::order, output_current_memory_usage(), Util::TimeMeter::print(), IterationInfo::purify_time, IterationInfo::stopping_criterion_time, IterationInfo::threshold_X, IterationInfo::total_time, IterationInfo::trace_diff_time, IterationInfo::trunc_time, IterationInfo::XmX2_eucl, IterationInfo::XmX2_fro_norm, IterationInfo::XmX2_infty_norm, IterationInfo::XmX2_mixed_norm, IterationInfo::XmX2_trace, and IterationInfo::Xsquare_time.
|
virtual |
Start recursive expansion.
References do_output(), EIG_PROJECTION_INT, Util::TimeMeter::get_elapsed_wall_seconds(), LOG_AREA_DENSFROMF, LOG_CAT_INFO, and Util::TimeMeter::print().
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), main(), test1(), test2(), test3(), and test4().
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
protected |
References A.
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
protected |
References A, and write_matrix_to_mtx().
|
protected |
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
protected |
References mat::VectorGeneral< Treal, Tvector >::fullvector(), and write_vector().
|
inline |
References PurificationGeneral< MatrixType >::compute_eigenvectors_in_each_iteration.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), test1(), and test4().
void PurificationGeneral< MatrixType >::set_eigenvectors_params | ( | string | eigenvectors_method_, |
string | eigenvectors_iterative_method_, | ||
real | eigensolver_accuracy_, | ||
int | eigensolver_maxiter_, | ||
int | scf_step_, | ||
bool | try_eigv_on_next_iteration_if_fail_ | ||
) |
void PurificationGeneral< MatrixType >::set_eigenvectors_params | ( | string | eigenvectors_method_, |
string | eigenvectors_iterative_method_, | ||
real | eigensolver_accuracy_, | ||
int | eigensolver_maxiter_, | ||
int | scf_step_, | ||
bool | try_eigv_on_next_iteration_if_fail_, | ||
bool | use_prev_vector_as_initial_guess_, | ||
const std::vector< VectorType > & | eigVecOCCRef, | ||
const std::vector< VectorType > & | eigVecUNOCCRef | ||
) |
Set parameters for computing eigenvectors - long version.
References cols, do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
protected |
Set parameters for computing eigenvectors.
References do_output(), EIG_EMPTY, LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
inline |
References PurificationGeneral< MatrixType >::go_back_X_iter_proj_method.
Referenced by GetDensFromFock::get_dens_from_fock_sparse().
|
protectedpure virtual |
Implemented in Purification_sp2acc< MatrixType >, and Purification_sp2< MatrixType >.
|
inline |
References PurificationGeneral< MatrixType >::jump_over_X_iter_proj_method.
Referenced by GetDensFromFock::get_dens_from_fock_sparse().
|
inline |
void PurificationGeneral< MatrixType >::set_spectrum_bounds | ( | real | eigmin, |
real | eigmax | ||
) |
Set spectrum bounds.
Used if we know spectrum bounds or want to compute them outside the class.
|
protectedvirtual |
References do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
protectedvirtual |
Choose stopping criterion and check it.
References mat::euclNorm, mat::frobNorm, IterationInfo::it, mat::mixedNorm, IterationInfo::XmX2_eucl, IterationInfo::XmX2_fro_norm, IterationInfo::XmX2_mixed_norm, and IterationInfo::XmX2_trace.
|
virtual |
|
protectedvirtual |
References do_output(), LOG_AREA_DENSFROMF, and LOG_CAT_INFO.
|
inline |
|
protected |
References A.
|
protected |
Do a few more iterations after convergence.
|
protected |
Iteration when to start to check stopping criterion.
Referenced by Purification_sp2acc< MatrixType >::set_init_params().
|
protected |
Compute homo and lumo eigenpairs in every iteration and save eigenvectors in txt files.
NOTE: if we are computing eigenvector in every iteration, we will save eigenvector computed in the last iteration, and it is most probably the wrong eigenvector.
Referenced by PurificationGeneral< MatrixType >::PurificationGeneral(), PurificationGeneral< MatrixType >::set_compute_eigenvectors_in_each_iteration(), and PurificationGeneral< MatrixType >::unset_compute_eigenvectors_in_each_iteration().
|
protected |
|
protected |
Referenced by PurificationGeneral< MatrixType >::PurificationGeneral().
|
protected |
Asymptotic constant C needed for the new stopping criterion.
|
protected |
(Eigenvectors) Absolute and relative gap in filter for lumo eigenvalue.
|
protected |
|
protected |
(Eigenvectors) Absolute and relative gap in filter for homo eigenvalue.
|
protected |
|
protected |
Accuracy of the eigenvalue problem solver.
When residual is less then this value, stop.
|
protected |
Maximum number of iterations for eigensolver.
|
protected |
Chosen eigensolver.
|
protected |
|
protected |
Chosen method for computing eigenvectors.
|
protected |
|
protected |
|
protected |
|
protected |
Here we save eigenvalues corresponding to the occupied orbitals.
Referenced by PurificationGeneral< MatrixType >::extract_computed_eigenpairs().
|
protected |
Here we save eigenvalues corresponding to the unoccupied orbitals.
Referenced by PurificationGeneral< MatrixType >::extract_computed_eigenpairs().
|
protected |
|
protected |
|
protected |
Here we save eigenvectors corresponding to the occupied orbitals.
Referenced by PurificationGeneral< MatrixType >::extract_computed_eigenpairs().
|
protected |
Here we save eigenvectors corresponding to the unoccupied orbitals.
Referenced by PurificationGeneral< MatrixType >::extract_computed_eigenpairs().
|
protected |
Error in eigenvalues (used just in old stopping criterion).
|
protected |
Error allowed in each iteration due to truncation.
|
protected |
Allowed error in invariant subspaces.
|
protected |
Matrix F.
Needed for computation of eigenvectors.
|
protected |
Used on the stopping criterion for estimation of eigenvalues from purification.
Referenced by Purification_sp2< MatrixType >::set_init_params(), and Purification_sp2acc< MatrixType >::set_init_params().
|
protected |
|
protected |
Iterations where homo eigenvector can be computed.
|
protected |
Iterations where homo eigenvector can be computed.
|
protected |
(1-homo) bounds for Xi in iteration i
|
protected |
Initial lumo bounds for F.
|
protected |
|
protected |
Initial lumo bounds for X.
PuriInfo PurificationGeneral< MatrixType >::info |
Fill in during purification with useful information.
Referenced by GetDensFromFock::get_dens_from_fock_sparse(), main(), Purification_sp2< MatrixType >::set_init_params(), Purification_sp2acc< MatrixType >::set_init_params(), test1(), test2(), test3(), and test4().
|
protected |
|
protected |
(Eigenvectors) Maximum error introduced in each iteration.
|
protected |
|
protected |
|
protected |
|
protected |
Lumo bounds for Xi in iteration i.
|
protected |
Initial homo bounds for F.
|
protected |
|
protected |
Initial lumo bounds for X.
|
protected |
Maximum number of iterations.
|
protected |
Number of occupied orbitals.
|
protected |
Norm used in the stopping criterion Can be mat::frobNorm, mat::mixedNorm, or mat::euclNorm.
|
protected |
Norm used for the truncation of matrices.
Can be mat::frobNorm, mat::mixedNorm, or mat::euclNorm.
|
protected |
|
protected |
|
protected |
|
protected |
Iterations where homo eigenvector is actually computed.
|
protected |
Iterations where lumo eigenvector is actually computed.
|
protected |
|
protected |
|
protected |
(Eigenvectors) Approximation of shifts in each iteration.
|
protected |
Outer bounds for the whole spectrum of F/Xi.
|
protected |
|
protected |
True for new stopping criterion.
Referenced by PurificationGeneral< MatrixType >::PurificationGeneral().
|
protected |
|
protected |
Save matrices Xi in each iteration (if used projection method for computing eigenvectors).
If ergo input file mat.write_to_file=1 than matrices are saved to the file to save memory.
|
protected |
Gap computed using inner homo and lumo bounds on each iteration.
|
protected |
Polynomials computed in the function estimated_number_of_iterations() VecPoly[i] = 1 if we use X=X^2 VecPoly[i] = 0 if we use X=2X-X^2 (or their accelerated versions)
MatrixType PurificationGeneral< MatrixType >::X |
Matrix X.
Referenced by PurificationGeneral< MatrixType >::clear(), GetDensFromFock::get_dens_from_fock_sparse(), PurificationGeneral< MatrixType >::get_nnz_X(), main(), test1(), and test4().
MatrixType PurificationGeneral< MatrixType >::Xsq |
Matrix X^2.
Referenced by PurificationGeneral< MatrixType >::clear(), and PurificationGeneral< MatrixType >::get_nnz_Xsq().