MADNESS 0.10.1
madness::Solver< T, NDIM > Class Template Reference

The main class of the periodic DFT solver. More...

#include <solver.h>

Collaboration diagram for madness::Solver< T, NDIM >:

Classes

struct  GuessDensity

Public Member Functions

 Solver (World &world, const rfunctionT &vnucrhon, const vecfuncT &phis, const std::vector< T > &eigs, const ElectronicStructureParams &params, MolecularEntity mentity)
 Solver (World &world, const std::string &filename)
 Solver (World &world, rfunctionT vnucrhon, vecfuncT phis, std::vector< T > eigs, std::vector< KPoint > kpoints, std::vector< double > occs, ElectronicStructureParams params, MolecularEntity mentity)
 Solver (World &world, rfunctionT vnucrhon, vecfuncT phisa, vecfuncT phisb, std::vector< T > eigsa, std::vector< T > eigsb, ElectronicStructureParams params, MolecularEntity mentity)
virtual ~Solver ()
void apply_hf_exchange (vecfuncT &phisa, vecfuncT &phisb, vecfuncT &funcsa, vecfuncT &funcsb)
void apply_hf_exchange3 (vecfuncT &phisa, vecfuncT &phisb, vecfuncT &funcsa, vecfuncT &funcsb, double &xc)
void apply_hf_exchange4 (vecfuncT &phisa, vecfuncT &phisb, vecfuncT &funcsa, vecfuncT &funcsb, double &xc)
void apply_potential (vecfuncT &pfuncsa, vecfuncT &pfuncsb, const vecfuncT &phisa, const vecfuncT &phisb, const rfunctionT &rhoa, const rfunctionT &rhob, const rfunctionT &rho)
 Applies the LDA effective potential to each orbital. Currently only lda and spin-polarized is not implemented.
tensorT build_fock_matrix (vecfuncT &psi, vecfuncT &vpsi, KPoint kpoint)
double calculate_kinetic_energy ()
vecfuncT compute_residual (const vecfuncT &awfs, const vecfuncT &bwfs)
rfunctionT compute_rho (const vecfuncT &phis, std::vector< KPoint > kpoints, std::vector< double > occs)
rfunctionT compute_rho_slow (const vecfuncT &phis, std::vector< KPoint > kpoints, std::vector< double > occs)
 Compute the electronic density for either a molecular or periodic system.
ctensorT csqrt (const ctensorT &s, double tol=1e-8)
 Computes matrix square root (not used any more?).
void do_rhs (vecfuncT &wf, vecfuncT &vwf, std::vector< KPoint > kpoints, std::vector< T > &alpha, std::vector< double > &eigs)
void do_rhs_simple (vecfuncT &wf, vecfuncT &vwf, std::vector< KPoint > kpoints, std::vector< T > &alpha, std::vector< double > &eigs)
void END_TIMER (World &world, const char *msg)
KPoint find_kpt_from_orb (unsigned int idx)
void fix_occupations (const std::vector< T > &eps, std::vector< double > &occs)
std::vector< KPoint > genkmesh (unsigned int ngridk0, unsigned ngridk1, unsigned int ngridk2, double koffset0, double koffset1, double koffset2, double R)
void gram_schmidt (vecfuncT &f, KPoint kpoint)
void init (const std::string &filename)
void initial_guess ()
 Initializes alpha and beta mos, occupation numbers, eigenvalues.
void load_orbitals ()
std::vector< poperatorT > make_bsh_operators (const std::vector< T > &eigs)
tensor_complex make_kinetic_matrix (World &world, const vector_complex_function_3d &v, const KPoint &k)
rfunctionT make_lda_potential (World &world, const rfunctionT &arho, const rfunctionT &brho, const rfunctionT &adelrhosq, const rfunctionT &bdelrhosq)
void make_nuclear_charge_density_impl ()
void make_nuclear_potential ()
void make_nuclear_potential_impl ()
ctensorT matrix_exponential (const ctensorT &A)
void orthonormalize (vecfuncT &wf, KPoint kpoint)
void print_fock_matrix_eigs (const vecfuncT &wf, const vecfuncT &vwf, KPoint kpoint)
void print_potential_matrix_eigs (const vecfuncT &wf, const vecfuncT &vwf)
template<typename Q>
void print_tensor2d (ostream &os, Tensor< Q > t)
vecfuncT project_ao_basis (World &world, KPoint kpt)
tensorT Q3 (const tensorT &s)
 Given overlap matrix, return rotation with 3rd order error to orthonormalize the vectors.
void reproject ()
void save_orbitals ()
void set_occs2 (const std::vector< KPoint > &kpoints, const std::vector< double > &eigsa, const std::vector< double > &eigsb, std::vector< double > &occsa, std::vector< double > &occsb)
void solve ()
void START_TIMER (World &world)
void step_restriction (vecfuncT &owfs, vecfuncT &nwfs, int aorb)
template<typename Q>
void test_periodicity (const Function< Q, 3 > &f)
void update_orbitals (vecfuncT &awfs, vecfuncT &bwfs, std::vector< KPoint > kpoints)

Public Attributes

double sss
double ttt

Private Types

typedef Tensor< std::complex< double > > ctensorT
typedef FunctionFactory< valueT, NDIM > factoryT
typedef Function< valueT, NDIM > functionT
typedef Vector< double, NDIM > kvecT
typedef SeparatedConvolution< T, 3 > operatorT
typedef std::pair< vecfuncT, vecfuncT > pairvecfuncT
typedef std::shared_ptr< operatorT> poperatorT
typedef FunctionFactory< T, NDIM > rfactoryT
typedef Function< T, NDIM > rfunctionT
typedef Tensor< double > rtensorT
typedef std::vector< pairvecfuncT > subspaceT
typedef Tensor< valueT > tensorT
typedef std::complex< T > valueT
typedef std::vector< functionT > vecfuncT
typedef std::vector< subspaceT > vecsubspaceT
typedef std::vector< tensorT > vectensorT

Private Attributes

AtomicBasisSet _aobasis
cvecfuncT _aobasisf
SeparatedConvolution< T, NDIM > * _cop
std::ofstream _eigF
std::vector< T > _eigsa
std::vector< T > _eigsb
int _it
std::ofstream _kmeshF
std::vector< KPoint > _kpoints
std::ofstream _matF
double _maxthresh
MolecularEntity _mentity
int _nao
std::vector< double > _occsa
std::vector< double > _occsb
std::ofstream _outputF
ElectronicStructureParams _params
vecfuncT _phisa
vecfuncT _phisb
double _residual
rfunctionT _rho
rfunctionT _rhoa
rfunctionT _rhob
Subspace< T, NDIM > * _subspace
rfunctionT _vnuc
rfunctionT _vnucrhon
World & _world

Detailed Description

template<typename T, int NDIM>
class madness::Solver< T, NDIM >

The main class of the periodic DFT solver.

\‍[z = frac{x}{1 - y^2}
\‍]

Member Typedef Documentation

◆ ctensorT

template<typename T, int NDIM>
typedef Tensor<std::complex<double> > madness::Solver< T, NDIM >::ctensorT
private

◆ factoryT

template<typename T, int NDIM>
typedef FunctionFactory<valueT,NDIM> madness::Solver< T, NDIM >::factoryT
private

◆ functionT

template<typename T, int NDIM>
typedef Function<valueT,NDIM> madness::Solver< T, NDIM >::functionT
private

◆ kvecT

template<typename T, int NDIM>
typedef Vector<double,NDIM> madness::Solver< T, NDIM >::kvecT
private

◆ operatorT

template<typename T, int NDIM>
typedef SeparatedConvolution<T,3> madness::Solver< T, NDIM >::operatorT
private

◆ pairvecfuncT

template<typename T, int NDIM>
typedef std::pair<vecfuncT,vecfuncT> madness::Solver< T, NDIM >::pairvecfuncT
private

◆ poperatorT

template<typename T, int NDIM>
typedef std::shared_ptr<operatorT> madness::Solver< T, NDIM >::poperatorT
private

◆ rfactoryT

template<typename T, int NDIM>
typedef FunctionFactory<T,NDIM> madness::Solver< T, NDIM >::rfactoryT
private

◆ rfunctionT

template<typename T, int NDIM>
typedef Function<T,NDIM> madness::Solver< T, NDIM >::rfunctionT
private

◆ rtensorT

template<typename T, int NDIM>
typedef Tensor<double> madness::Solver< T, NDIM >::rtensorT
private

◆ subspaceT

template<typename T, int NDIM>
typedef std::vector<pairvecfuncT> madness::Solver< T, NDIM >::subspaceT
private

◆ tensorT

template<typename T, int NDIM>
typedef Tensor<valueT> madness::Solver< T, NDIM >::tensorT
private

◆ valueT

template<typename T, int NDIM>
typedef std::complex<T> madness::Solver< T, NDIM >::valueT
private

◆ vecfuncT

template<typename T, int NDIM>
typedef std::vector<functionT> madness::Solver< T, NDIM >::vecfuncT
private

◆ vecsubspaceT

template<typename T, int NDIM>
typedef std::vector<subspaceT> madness::Solver< T, NDIM >::vecsubspaceT
private

◆ vectensorT

template<typename T, int NDIM>
typedef std::vector<tensorT> madness::Solver< T, NDIM >::vectensorT
private

Constructor & Destructor Documentation

◆ Solver() [1/4]

template<typename T, int NDIM>
madness::Solver< T, NDIM >::Solver ( World & world,
const std::string & filename )
inline

◆ Solver() [2/4]

◆ Solver() [3/4]

template<typename T, int NDIM>
madness::Solver< T, NDIM >::Solver ( World & world,
const rfunctionT & vnucrhon,
const vecfuncT & phis,
const std::vector< T > & eigs,
const ElectronicStructureParams & params,
MolecularEntity mentity )
inline

◆ Solver() [4/4]

template<typename T, int NDIM>
madness::Solver< T, NDIM >::Solver ( World & world,
rfunctionT vnucrhon,
vecfuncT phis,
std::vector< T > eigs,
std::vector< KPoint > kpoints,
std::vector< double > occs,
ElectronicStructureParams params,
MolecularEntity mentity )
inline

◆ ~Solver()

template<typename T, int NDIM>
virtual madness::Solver< T, NDIM >::~Solver ( )
inlinevirtual

References _eigF, _matF, _outputF, and _subspace.

Member Function Documentation

◆ apply_hf_exchange()

◆ apply_hf_exchange3()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::apply_hf_exchange3 ( vecfuncT & phisa,
vecfuncT & phisb,
vecfuncT & funcsa,
vecfuncT & funcsb,
double & xc )
inline

◆ apply_hf_exchange4()

◆ build_fock_matrix()

template<typename T, int NDIM>
tensorT madness::Solver< T, NDIM >::build_fock_matrix ( vecfuncT & psi,
vecfuncT & vpsi,
KPoint kpoint )
inline

◆ calculate_kinetic_energy()

template<typename T, int NDIM>
double madness::Solver< T, NDIM >::calculate_kinetic_energy ( )
inline

◆ compute_residual()

template<typename T, int NDIM>
vecfuncT madness::Solver< T, NDIM >::compute_residual ( const vecfuncT & awfs,
const vecfuncT & bwfs )
inline

◆ compute_rho()

◆ csqrt()

template<typename T, int NDIM>
ctensorT madness::Solver< T, NDIM >::csqrt ( const ctensorT & s,
double tol = 1e-8 )
inline

Computes matrix square root (not used any more?).

References c, e(), m, MADNESS_ASSERT, MADNESS_EXCEPTION, madness::print(), and madness::syev().

Referenced by orthonormalize().

◆ do_rhs()

◆ do_rhs_simple()

◆ END_TIMER()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::END_TIMER ( World & world,
const char * msg )
inline

◆ find_kpt_from_orb()

template<typename T, int NDIM>
KPoint madness::Solver< T, NDIM >::find_kpt_from_orb ( unsigned int idx)
inline

References _kpoints, k1, and MADNESS_EXCEPTION.

Referenced by apply_hf_exchange4().

◆ fix_occupations()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::fix_occupations ( const std::vector< T > & eps,
std::vector< double > & occs )
inline

◆ genkmesh()

template<typename T, int NDIM>
std::vector< KPoint > madness::Solver< T, NDIM >::genkmesh ( unsigned int ngridk0,
unsigned ngridk1,
unsigned int ngridk2,
double koffset0,
double koffset1,
double koffset2,
double R )
inline

◆ gram_schmidt()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::gram_schmidt ( vecfuncT & f,
KPoint kpoint )
inline

◆ init()

◆ initial_guess()

◆ load_orbitals()

◆ make_bsh_operators()

template<typename T, int NDIM>
std::vector< poperatorT > madness::Solver< T, NDIM >::make_bsh_operators ( const std::vector< T > & eigs)
inline

◆ make_kinetic_matrix()

template<typename T, int NDIM>
tensor_complex madness::Solver< T, NDIM >::make_kinetic_matrix ( World & world,
const vector_complex_function_3d & v,
const KPoint & k )
inline

◆ make_lda_potential()

template<typename T, int NDIM>
rfunctionT madness::Solver< T, NDIM >::make_lda_potential ( World & world,
const rfunctionT & arho,
const rfunctionT & brho,
const rfunctionT & adelrhosq,
const rfunctionT & bdelrhosq )
inline

◆ make_nuclear_charge_density_impl()

◆ make_nuclear_potential()

◆ make_nuclear_potential_impl()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::make_nuclear_potential_impl ( )
inline

◆ matrix_exponential()

◆ orthonormalize()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::orthonormalize ( vecfuncT & wf,
KPoint kpoint )
inline

◆ print_fock_matrix_eigs()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::print_fock_matrix_eigs ( const vecfuncT & wf,
const vecfuncT & vwf,
KPoint kpoint )
inline

◆ print_potential_matrix_eigs()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::print_potential_matrix_eigs ( const vecfuncT & wf,
const vecfuncT & vwf )
inline

◆ print_tensor2d()

template<typename T, int NDIM>
template<typename Q>
void madness::Solver< T, NDIM >::print_tensor2d ( ostream & os,
Tensor< Q > t )
inline

◆ project_ao_basis()

◆ Q3()

template<typename T, int NDIM>
tensorT madness::Solver< T, NDIM >::Q3 ( const tensorT & s)
inline

Given overlap matrix, return rotation with 3rd order error to orthonormalize the vectors.

References madness::inner(), and Q().

◆ reproject()

◆ save_orbitals()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::save_orbitals ( )
inline

References _kpoints, _params, _phisa, _phisb, and _world.

Referenced by solve().

◆ set_occs2()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::set_occs2 ( const std::vector< KPoint > & kpoints,
const std::vector< double > & eigsa,
const std::vector< double > & eigsb,
std::vector< double > & occsa,
std::vector< double > & occsb )
inline

◆ solve()

◆ START_TIMER()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::START_TIMER ( World & world)
inline

◆ step_restriction()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::step_restriction ( vecfuncT & owfs,
vecfuncT & nwfs,
int aorb )
inline

◆ test_periodicity()

template<typename T, int NDIM>
template<typename Q>
void madness::Solver< T, NDIM >::test_periodicity ( const Function< Q, 3 > & f)
inline

◆ update_orbitals()

template<typename T, int NDIM>
void madness::Solver< T, NDIM >::update_orbitals ( vecfuncT & awfs,
vecfuncT & bwfs,
std::vector< KPoint > kpoints )
inline

Member Data Documentation

◆ _aobasis

template<typename T, int NDIM>
AtomicBasisSet madness::Solver< T, NDIM >::_aobasis
private

◆ _aobasisf

template<typename T, int NDIM>
cvecfuncT madness::Solver< T, NDIM >::_aobasisf
private

◆ _cop

◆ _eigF

template<typename T, int NDIM>
std::ofstream madness::Solver< T, NDIM >::_eigF
private

Referenced by ~Solver(), do_rhs(), do_rhs_simple(), and init().

◆ _eigsa

template<typename T, int NDIM>
std::vector<T> madness::Solver< T, NDIM >::_eigsa
private

◆ _eigsb

template<typename T, int NDIM>
std::vector<T> madness::Solver< T, NDIM >::_eigsb
private

◆ _it

template<typename T, int NDIM>
int madness::Solver< T, NDIM >::_it
private

◆ _kmeshF

template<typename T, int NDIM>
std::ofstream madness::Solver< T, NDIM >::_kmeshF
private

Referenced by init().

◆ _kpoints

template<typename T, int NDIM>
std::vector<KPoint> madness::Solver< T, NDIM >::_kpoints
private

◆ _matF

template<typename T, int NDIM>
std::ofstream madness::Solver< T, NDIM >::_matF
private

Referenced by ~Solver(), and init().

◆ _maxthresh

template<typename T, int NDIM>
double madness::Solver< T, NDIM >::_maxthresh
private

◆ _mentity

◆ _nao

template<typename T, int NDIM>
int madness::Solver< T, NDIM >::_nao
private

Referenced by initial_guess().

◆ _occsa

template<typename T, int NDIM>
std::vector<double> madness::Solver< T, NDIM >::_occsa
private

◆ _occsb

template<typename T, int NDIM>
std::vector<double> madness::Solver< T, NDIM >::_occsb
private

◆ _outputF

template<typename T, int NDIM>
std::ofstream madness::Solver< T, NDIM >::_outputF
private

◆ _params

◆ _phisa

◆ _phisb

◆ _residual

template<typename T, int NDIM>
double madness::Solver< T, NDIM >::_residual
private

◆ _rho

template<typename T, int NDIM>
rfunctionT madness::Solver< T, NDIM >::_rho
private

Referenced by solve().

◆ _rhoa

template<typename T, int NDIM>
rfunctionT madness::Solver< T, NDIM >::_rhoa
private

Referenced by initial_guess(), and solve().

◆ _rhob

template<typename T, int NDIM>
rfunctionT madness::Solver< T, NDIM >::_rhob
private

Referenced by initial_guess(), and solve().

◆ _subspace

template<typename T, int NDIM>
Subspace<T,NDIM>* madness::Solver< T, NDIM >::_subspace
private

◆ _vnuc

◆ _vnucrhon

template<typename T, int NDIM>
rfunctionT madness::Solver< T, NDIM >::_vnucrhon
private

◆ _world

◆ sss

template<typename T, int NDIM>
double madness::Solver< T, NDIM >::sss

Referenced by END_TIMER(), and START_TIMER().

◆ ttt

template<typename T, int NDIM>
double madness::Solver< T, NDIM >::ttt

Referenced by END_TIMER(), and START_TIMER().


The documentation for this class was generated from the following file: