ergo
density_projection.h File Reference
#include "basisinfo.h"
#include "matrix_typedefs.h"

Go to the source code of this file.

Functions

int load_density_and_project_full (const char *densityFileName, int noOfDensityMatrices, const IntegralInfo *integralInfo, const BasisInfoStruct &basisInfo, ergo_real **densityMatrixList, int do_purification, const int *noOfElectronsList, ergo_real electronic_temperature)
 load_density_and_project_full loads one or two density matrices (depending on value of noOfDensityMatrices) from the file specified by densityFileName. More...
 
int load_density_and_project_sparse (const char *densityFileName, int noOfDensityMatrices, const IntegralInfo *integralInfo, const BasisInfoStruct &basisInfo, symmMatrix &S_symm, symmMatrix **densityMatrixList, const int *noOfElectronsList, mat::SizesAndBlocks matrix_size_block_info, std::vector< int > const &matrixPermutationVec, ergo_real sparse_threshold, triangMatrix &invCholFactor, ergo_real invCholFactor_euclnorm, ergo_real gap_expected_lower_bound, ergo_real purification_eigvalue_err_limit, ergo_real purification_subspace_err_limit, mat::normType const purification_truncation_norm, int purification_maxmul, int purification_create_m_files, int use_diagonalization, int use_diag_on_error, int purification_ignore_failure, int purification_use_rand_perturbation_for_alleigsint, ergo_real electronic_temperature)
 load_density_and_project_sparse loads one or two density matrices (depending on value of noOfDensityMatrices) from the file specified by densityFileName. More...
 

Function Documentation

◆ load_density_and_project_full()

int load_density_and_project_full ( const char *  densityFileName,
int  noOfDensityMatrices,
const IntegralInfo integralInfo,
const BasisInfoStruct basisInfo,
ergo_real **  densityMatrixList,
int  do_purification,
const int *  noOfElectronsList,
ergo_real  electronic_temperature 
)

load_density_and_project_full loads one or two density matrices (depending on value of noOfDensityMatrices) from the file specified by densityFileName.

Parameters
densityFileNameName of file to load density matrices from
noOfDensityMatricesNumber of density matrices to load
integralInfostatic helper object for integral evaluation.
basisInfothe basis set that the density is to be expanded into (if the original density was expressed with help of other basis set, an apriopriate projection will be performed).
densityMatrixListmust be already allocated and have proper dimension.
do_purificationdetermines whether an additional purification is to be run after the projection.
noOfElectronsListis an one or two element array specyfying the number of total electrons (one element) or alpha and beta electrons (two elements).
electronic_temperatureElectronic temperature

References compute_overlap_matrix(), ddf_load_density(), do_output(), ergo_new, LOG_AREA_MAIN, LOG_CAT_ERROR, LOG_CAT_INFO, and BasisInfoStruct::noOfBasisFuncs.

◆ load_density_and_project_sparse()

int load_density_and_project_sparse ( const char *  densityFileName,
int  noOfDensityMatrices,
const IntegralInfo integralInfo,
const BasisInfoStruct basisInfo,
symmMatrix S_symm,
symmMatrix **  densityMatrixList,
const int *  noOfElectronsList,
mat::SizesAndBlocks  matrix_size_block_info,
std::vector< int > const &  matrixPermutationVec,
ergo_real  sparse_threshold,
triangMatrix invCholFactor,
ergo_real  invCholFactor_euclnorm,
ergo_real  gap_expected_lower_bound,
ergo_real  purification_eigvalue_err_limit,
ergo_real  purification_subspace_err_limit,
mat::normType const  purification_truncation_norm,
int  purification_maxmul,
int  purification_create_m_files,
int  use_diagonalization,
int  use_diag_on_error,
int  purification_ignore_failure,
int  purification_use_rand_perturbation_for_alleigsint,
ergo_real  electronic_temperature 
)

load_density_and_project_sparse loads one or two density matrices (depending on value of noOfDensityMatrices) from the file specified by densityFileName.

The projection is done as follows: First, a matrix R is computed. R is the overlap matrix between the two basis sets. Then RT * P * R is computed, where P is the starting guess density matrix read from file. To get a final projected density one could then multiply by S_inv from both sides, but to prepare for purification the matrix S*D*S is needed, so we skip multiplication by S_inv since it will anyway be cancelled out.

Parameters
densityFileNameName of file to load density matrices from
noOfDensityMatricesNumber of density matrices to load
integralInfostatic helper object for integral evaluation.
basisInfothe basis set that the density is to be expanded into (if the original density was expressed with help of other basis set, an apriopriate projection will be performed).
S_symmOverlap matrix
densityMatrixListpointers to one or two empty matrices that will contain the result. Purification is always run after the projection.
noOfElectronsListis an one or two element array specyfying the number of total electrons (one element) or alpha and beta electrons (two elements).
matrix_size_block_infoInformation about HML matrix block sizes etc.
matrixPermutationVecPermutation vector used when calling matrix lib.
sparse_thresholdThreshold used when truncating matrices.
invCholFactorInverse Cholesky factor of S.
invCholFactor_euclnormEuclidean norm of inverse Cholesky factor.
gap_expected_lower_boundExpected lower bound for the band gap.
purification_eigvalue_err_limitRequested accuracy in eigenvalues of D_ort.
purification_subspace_err_limitRequested accuracy in the occupied subspace.
purification_truncation_normNorm to be used for truncation in purification.
purification_maxmulMaximum allowed number of matrix multiplications.
purification_create_m_filesFlag to create m-files with information about the purification process.
use_diagonalizationFlag to turn on diagonalization.
use_diag_on_errorFlag to fall back on diagonalization if purification fails.
purification_ignore_failureContinue even if purification fails to converge.
purification_use_rand_perturbation_for_alleigsintApply a random perturbation to (try to) improve the convergence speed of Lanczos calculation of extremal eigenvalues.
electronic_temperatureElectronic temperature.

References mat::MatrixSymmetric< Treal, Tmatrix >::assign_from_sparse(), mat::MatrixBase< Treal, Tmatrix >::clear(), compute_R_matrix_sparse(), ddf_load_density_sparse(), do_output(), mat::MatrixGeneral< Treal, Tmatrix >::eucl_thresh(), mat::MatrixSymmetric< Treal, Tmatrix >::eucl_thresh(), get_dens_from_fock_general(), getMatrixPermutation(), LOG_AREA_MAIN, LOG_AREA_SCF, LOG_CAT_ERROR, LOG_CAT_INFO, BasisInfoStruct::noOfBasisFuncs, output_current_memory_usage(), prepareMatrixSizesAndBlocks(), Util::TimeMeter::print(), mat::MatrixBase< Treal, Tmatrix >::resetSizesAndBlocks(), mat::transpose(), and mat::FileWritable::writeToFile().

Referenced by SCF_restricted::get_starting_guess_density(), and SCF_unrestricted::get_starting_guess_density().