ergo
density_projection.cc File Reference

Functionality for preparing a starting guess density matrix given a previous density matrix. More...

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include "density_description_file.h"
#include "density_projection.h"
#include "densfromf_full.h"
#include "integrals_general.h"
#include "operator_matrix.h"
#include "matrix_algebra.h"
#include "memorymanag.h"
#include "output.h"
#include "utilities.h"
#include "matrix_utilities.h"
#include "integral_matrix_wrappers.h"

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 (GetDensFromFock &DensFromFock, 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)
 load_density_and_project_sparse loads one or two density matrices (depending on value of noOfDensityMatrices) from the file specified by densityFileName. More...
 

Detailed Description

Functionality for preparing a starting guess density matrix given a previous density matrix.

The old density is read from file, and a projection between the basis sets is performed.

Author
: Elias Rudberg responsible

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_UNDEFINED, LOG_CAT_ERROR, LOG_CAT_INFO, and BasisInfoStruct::noOfBasisFuncs.

◆ load_density_and_project_sparse()

int load_density_and_project_sparse ( GetDensFromFock DensFromFock,
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 
)

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
DensFromFockInstance of GetDensFromFock class contatining all data for computing the density matrix.
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.

References GetDensFromFock::clean_eigs_intervals(), compute_R_matrix_sparse(), ddf_load_density_sparse(), do_output(), GetDensFromFock::get_dens_from_fock(), GetDensFromFock::get_eigvalueErrorLimit(), GetDensFromFock::get_puri_eig_acc_factor_for_guess(), GetDensFromFock::get_use_diag_on_error(), getMatrixPermutation(), LOG_AREA_UNDEFINED, LOG_CAT_ERROR, LOG_CAT_INFO, BasisInfoStruct::noOfBasisFuncs, output_current_memory_usage(), prepareMatrixSizesAndBlocks(), Util::TimeMeter::print(), GetDensFromFock::set_eigvalueErrorLimit(), GetDensFromFock::set_generate_figures(), GetDensFromFock::set_no_occupied_orbs(), GetDensFromFock::set_SCF_step(), GetDensFromFock::set_use_diag_on_error(), mat::transpose(), GetDensFromFock::unset_generate_figures(), and GetDensFromFock::unset_use_diag_on_error().

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