ergo
densfromf_sparse.cc File Reference

Routine get_dens_from_fock_sparse() for getting density matrix from a given Fock matrix using purification. More...

#include "densfromf_sparse.h"
#include "output.h"
#include <memory.h>
#include <stdio.h>
#include <math.h>
#include <fstream>
#include <sstream>
#include "utilities.h"
#include "matrix_utilities.h"
#include "TC2.h"
#include "PuriInfo.h"
#include "Purification.h"
#include "Purification_scaled.h"
#include "units.h"
#include "machine_epsilon.h"
#include "simple_purification.h"
#include "puri_mmul_tests.h"
#include "AllocatorManager.h"

Macros

#define RUN_NEW_PURIFICATION   0
 

Typedefs

typedef mat::DebugLevelLow debugPolicy
 
typedef mat::PuriInfo< ergo_real, generalVector, debugPolicypuriInfoType
 
typedef mat::Purification< ergo_real, symmMatrix, debugPolicypurificationType
 
typedef mat::Interval< ergo_realintervalType
 

Functions

intervalType getAllEigsInterval (int n, symmMatrix &F, mat::SizesAndBlocks const &matrixSizesAndBlocks, int use_rand_perturbation)
 
int get_dens_from_fock_sparse (int n, int noOfOccupiedOrbs, symmMatrix &resultDens, ergo_real factor, symmMatrix const &Finput, intervalType &homoInterval_Finput, intervalType &lumoInterval_Finput, triangMatrix const &invCholFactor, ergo_real invCholFactor_euclnorm, ergo_real gap_expected_lower_bound, mat::SizesAndBlocks const &matrixSizesAndBlocks, symmMatrix &F_ort_prev, intervalType &homoInterval_F_ort_prev, intervalType &lumoInterval_F_ort_prev, ergo_real eigvalueErrorLimit, ergo_real subspaceErrorLimit, mat::normType const truncationNormPurification, int maxMul, int create_m_files, int ignore_purification_failure, int use_rand_perturbation_for_alleigsint, std::string stats_prefix, std::map< std::string, double > &puri_stats, int do_sparsity_investigation, int sparsity_plots_resolution_m, int do_comparison_to_simple_purification, int do_puri_mmul_tests, generalVector *eigVecLUMO, generalVector *eigVecHOMO)
 

Variables

static int globalCounter = 0
 

Detailed Description

Routine get_dens_from_fock_sparse() for getting density matrix from a given Fock matrix using purification.

Author
: Elias Rudberg responsible.

Macro Definition Documentation

◆ RUN_NEW_PURIFICATION

#define RUN_NEW_PURIFICATION   0

Typedef Documentation

◆ debugPolicy

◆ intervalType

◆ purificationType

◆ puriInfoType

Function Documentation

◆ get_dens_from_fock_sparse()

int get_dens_from_fock_sparse ( int  n,
int  noOfOccupiedOrbs,
symmMatrix resultDens,
ergo_real  factor,
symmMatrix const &  Finput,
intervalType homoInterval_Finput,
intervalType lumoInterval_Finput,
triangMatrix const &  invCholFactor,
ergo_real  invCholFactor_euclnorm,
ergo_real  gap_expected_lower_bound,
mat::SizesAndBlocks const &  matrixSizesAndBlocks,
symmMatrix F_ort_prev,
intervalType homoInterval_F_ort_prev,
intervalType lumoInterval_F_ort_prev,
ergo_real  eigvalueErrorLimit,
ergo_real  subspaceErrorLimit,
mat::normType const  truncationNormPurification,
int  maxMul,
int  create_m_files,
int  ignore_purification_failure,
int  use_rand_perturbation_for_alleigsint,
std::string  stats_prefix,
std::map< std::string, double > &  puri_stats,
int  do_sparsity_investigation,
int  sparsity_plots_resolution_m,
int  do_comparison_to_simple_purification,
int  do_puri_mmul_tests,
generalVector eigVecLUMO,
generalVector eigVecHOMO 
)
Parameters
nSystem size.
noOfOccupiedOrbsNumber of occupied orbitals.
resultDens(out) Resulting density matrix (D_S) in 'non-orthogonal basis'. ( D_S = Z*D_ort*ZT )
factorFactor to scale the resulting density matrix. (for restricted vs unrestricted calc)
Finput(in) Fock/Kohn-Sham matrix (F_S) in 'non-orthogonal basis'. (written to file)
homoInterval_Finput(out) Output: Contains the homo eigenvalue of Finput.
lumoInterval_Finput(out) Output: Contains the lumo eigenvalue of Finput.
invCholFactor(in) Inverse Cholesky factor of S. (written to file)
invCholFactor_euclnormEuclidean norm of inverse Cholesky factor.
gap_expected_lower_boundExpected lower bound for the gap to be used in early iterations.
matrixSizesAndBlocksInformation about HML matrix block sizes etc.
F_ort_prev(in/out) Input: Previous F matrix in orthogonal basis. (written to file) Output: New F matrix in orthogonal basis ( ZT*Finput*Z ). (written to file)
homoInterval_F_ort_prev(in/out) Input: Contains the homo eigenvalue of F_ort_prev. Output: Contains the homo eigenvalue of F_ort_prev.
lumoInterval_F_ort_prev(in/out) Input: Contains the lumo eigenvalue of F_ort_prev. Output: Contains the lumo eigenvalue of F_ort_prev.
eigvalueErrorLimit(in) Requested accuracy in eigenvalues of D_ort.
subspaceErrorLimit(in) Requested accuracy in the occupied subspace of D_ort.
truncationNormPurificationNorm to be used for truncation in, before, and after purification.
maxMulMaximum allowed number of matrix multiplications.
create_m_filesFlag to create m-files with information about the purification process.
ignore_purification_failureContinue even if purification fails to converge.
use_rand_perturbation_for_alleigsintApply a random perturbation to (try to) improve the convergence speed of Lanczos calculation of extremal eigenvalues.
stats_prefixPrefix to be added to statistics files.
puri_statsMap to store stats for purification.
do_sparsity_investigationFlag to turn on sparsity investigation.
sparsity_plots_resolution_mResolution in element magnitude histograms.
do_comparison_to_simple_purificationFlag to turn on comparison to simple purification.
do_puri_mmul_testsFlag to turn on purification matrix-matrix multiplication tests.
eigVecLUMOLUMO eigenvector
eigVecHOMOHOMO eigenvector

References mat::MatrixBase< Treal, Tmatrix >::clear(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::converged(), do_output(), mat::MatrixSymmetric< Treal, Tmatrix >::eucl_diff(), mat::MatrixSymmetric< Treal, Tmatrix >::eucl_thresh(), mat::euclNorm, mat::MatrixSymmetric< Treal, Tmatrix >::frob_diff(), pur::Purification_scaled< Tmatrix >::get_homo_lumo_intervals(), get_machine_epsilon(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getAccumulatedTimeSquare(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getAccumulatedTimeThresh(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getAccumulatedTimeTotal(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getAccumulatedTimeXmX2Norm(), getAllEigsInterval(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getHOMOandLUMOeigVecs(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getHomoF(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getLumoF(), mat::getNormTypeString(), mat::Params::getNProcs(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getNSteps(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getPolys(), mat::AllocatorManager< Treal >::getStatistics(), mat::FileWritable::getStatsCountCopyAndAssign(), mat::FileWritable::getStatsCountRead(), mat::FileWritable::getStatsCountWrite(), mat::FileWritable::getStatsTimeCopyAndAssign(), mat::FileWritable::getStatsTimeRead(), mat::FileWritable::getStatsTimeWrite(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::getThreshValues(), globalCounter, mat::Interval< Treal >::increase(), mat::AllocatorManager< Treal >::instance(), mat::Interval< Treal >::intersect(), mat::VectorGeneral< Treal, Tvector >::is_empty(), LOG_AREA_DENSFROMF, LOG_CAT_ERROR, LOG_CAT_INFO, LOG_CAT_TIMINGS, LOG_CAT_WARNING, mat::Interval< Treal >::low(), pur::Purification_scaled< Tmatrix >::mInfo(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::mInfo(), mat::MatrixSymmetric< Treal, Tmatrix >::mixed_diff(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::mMemUsage(), pur::Purification_scaled< Tmatrix >::mTime(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::mTimings(), mat::MatrixSymmetric< Treal, Tmatrix >::nnz(), output_current_memory_usage(), output_magnitude_histogram(), Util::TimeMeter::print(), mat::Purification< Treal, Tmatrix, TdebugPolicy >::purify(), pur::Purification_scaled< Tmatrix >::purify(), mat::FileWritable::readFromFile(), mat::FileWritable::resetStats(), run_comparison_to_simple_purification(), run_puri_mmul_tests(), mat::PuriInfo< Treal, Tvector, TdebugPolicy >::subspaceError(), mat::MatrixSymmetric< Treal, Tmatrix >::thresh(), mat::Gblas::time, mat::Gblas::timekeeping, mat::MatrixBase< Treal, Tmatrix >::trace(), mat::trace(), mat::MatrixSymmetric< Treal, Tmatrix >::transfer(), mat::transpose(), UNIT_one_eV, mat::Interval< Treal >::upp(), mat::FileWritable::writeAndReadAll(), and mat::FileWritable::writeToFile().

Referenced by get_dens_from_fock_general().

◆ getAllEigsInterval()

Variable Documentation

◆ globalCounter

int globalCounter = 0
static