ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ModuleESolver::ESolver_KS< T, Device > Class Template Reference

#include <esolver_ks.h>

Inheritance diagram for ModuleESolver::ESolver_KS< T, Device >:
Collaboration diagram for ModuleESolver::ESolver_KS< T, Device >:

Public Member Functions

 ESolver_KS ()
 Constructor.
 
virtual ~ESolver_KS ()
 Deconstructor.
 
virtual void before_all_runners (UnitCell &ucell, const Input_para &inp) override
 Initialize of the first-principels energy solver.
 
virtual void runner (UnitCell &ucell, const int istep) override
 run energy solver
 
virtual void after_all_runners (UnitCell &ucell) override
 perform post processing calculations
 
- Public Member Functions inherited from ModuleESolver::ESolver_FP
 ESolver_FP ()
 Constructor.
 
virtual ~ESolver_FP ()
 Deconstructor.
 
- Public Member Functions inherited from ModuleESolver::ESolver
 ESolver ()
 
virtual ~ESolver ()
 
virtual void others (UnitCell &ucell, const int istep)
 
virtual double cal_energy ()=0
 calculate total energy of a given system
 
virtual void cal_force (UnitCell &ucell, ModuleBase::matrix &force)=0
 calcualte forces for the atoms in the given cell
 
virtual void cal_stress (UnitCell &ucell, ModuleBase::matrix &stress)=0
 calcualte stress of given cell
 

Protected Member Functions

virtual void before_scf (UnitCell &ucell, const int istep) override
 Something to do before SCF iterations.
 
virtual void iter_init (UnitCell &ucell, const int istep, const int iter)
 Something to do before hamilt2rho function in each iter loop.
 
virtual void iter_finish (UnitCell &ucell, const int istep, int &iter, bool &conv_esolver) override
 Something to do after hamilt2rho function in each iter loop.
 
virtual void hamilt2rho_single (UnitCell &ucell, const int istep, const int iter, const double ethr)
 
void hamilt2rho (UnitCell &ucell, const int istep, const int iter, const double ethr)
 
virtual void after_scf (UnitCell &ucell, const int istep, const bool conv_esolver) override
 Something to do after SCF iterations when SCF is converged or comes to the max iter step.
 
virtual void update_pot (UnitCell &ucell, const int istep, const int iter, const bool conv_esolver)
 <Temporary> It should be replaced by a function in Hamilt Class
 

Protected Attributes

hamilt::Hamilt< T, Device > * p_hamilt = nullptr
 Hamiltonian.
 
ModulePW::PW_Basis_Kpw_wfc = nullptr
 PW for wave functions, only used in KSDFT, not in OFDFT.
 
Charge_Mixingp_chgmix = nullptr
 Charge mixing method.
 
pseudopot_cell_vnl ppcell
 nonlocal pseudopotentials
 
psi::Psi< T > * psi = nullptr
 Electronic wavefunctions.
 
std::string basisname
 
double esolver_KS_ne = 0.0
 esolver_ks_lcao.cpp
 
double diag_ethr
 number of electrons
 
double scf_thr
 the threshold for diagonalization
 
double scf_ene_thr
 scf density threshold
 
double drho
 scf energy threshold
 
double hsolver_error
 the difference between rho_in (before HSolver) and rho_out (After HSolver)
 
int maxniter
 the error of HSolver
 
int niter
 maximum iter steps for scf
 
bool oscillate_esolver = false
 iter steps actually used in scf
 
- Protected Attributes inherited from ModuleESolver::ESolver_FP
elecstate::ElecStatepelec = nullptr
 Electronic states.
 
K_Vectors kv
 K points in Brillouin zone.
 
Charge chr
 Electorn charge density.
 
ModulePW::PW_Basispw_rho
 
ModulePW::PW_Basispw_rhod
 
ModulePW::PW_Basis_Bigpw_big
 dense grid for USPP
 
Parallel_Grid Pgrid
 parallel for rho grid
 
Structure_Factor sf
 Structure factors that used with plane-wave basis set.
 
pseudopot_cell_vl locpp
 local pseudopotentials
 
Charge_Extra CE
 charge extrapolation method
 
surchem solvent
 solvent model
 
int pw_rho_flag = false
 flag for pw_rho, 0: not initialized, 1: initialized
 
double iter_time
 the start time of scf iteration
 

Additional Inherited Members

- Public Attributes inherited from ModuleESolver::ESolver
bool conv_esolver = true
 
std::string classname
 

Constructor & Destructor Documentation

◆ ESolver_KS()

template<typename T , typename Device >
ModuleESolver::ESolver_KS< T, Device >::ESolver_KS ( )

Constructor.

◆ ~ESolver_KS()

template<typename T , typename Device >
ModuleESolver::ESolver_KS< T, Device >::~ESolver_KS ( )
virtual

Deconstructor.

Member Function Documentation

◆ after_all_runners()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::after_all_runners ( UnitCell ucell)
overridevirtual

perform post processing calculations

Reimplemented from ModuleESolver::ESolver_FP.

Reimplemented in ModuleESolver::ESolver_DM2rho< TK, TR >, ModuleESolver::ESolver_GetS, ModuleESolver::ESolver_KS_LCAO< TK, TR >, ModuleESolver::ESolver_KS_LCAO< std::complex< double >, TR >, ModuleESolver::ESolver_KS_LIP< T >, ModuleESolver::ESolver_KS_PW< T, Device >, ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >, and ModuleESolver::ESolver_SDFT_PW< T, Device >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ after_scf()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::after_scf ( UnitCell ucell,
const int  istep,
const bool  conv_esolver 
)
overrideprotectedvirtual

Something to do after SCF iterations when SCF is converged or comes to the max iter step.

Reimplemented from ModuleESolver::ESolver_FP.

Reimplemented in ModuleESolver::ESolver_KS_LCAO< TK, TR >, ModuleESolver::ESolver_KS_LCAO< std::complex< double >, TR >, ModuleESolver::ESolver_KS_LCAO_TDDFT< TR, Device >, ModuleESolver::ESolver_KS_PW< T, Device >, ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >, and ModuleESolver::ESolver_SDFT_PW< T, Device >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ before_all_runners()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::before_all_runners ( UnitCell ucell,
const Input_para inp 
)
overridevirtual

Initialize of the first-principels energy solver.

1) initialize "before_all_runniers" in ESolver_FP


charge mixing

3) it has been established that

4) setup the charge mixing parameters

5) ESolver depends on the Symmetry module

6) Setup the k points according to symmetry.

7) print information

8) setup plane wave for electronic wave functions

9) initialize the real-space uniform grid for FFT and parallel distribution of plane waves

10) calculate the structure factor

1) read pseudopotentials

2) initialie the plane wave basis for rho

3) initialize the double grid (for uspp) if necessary

4) print some information

5) initialize the charge extrapolation method if necessary

Reimplemented from ModuleESolver::ESolver_FP.

Reimplemented in ModuleESolver::ESolver_DM2rho< TK, TR >, ModuleESolver::ESolver_GetS, ModuleESolver::ESolver_KS_LCAO< TK, TR >, ModuleESolver::ESolver_KS_LCAO< std::complex< double >, TR >, ModuleESolver::ESolver_KS_LCAO_TDDFT< TR, Device >, ModuleESolver::ESolver_KS_LIP< T >, ModuleESolver::ESolver_KS_PW< T, Device >, ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >, and ModuleESolver::ESolver_SDFT_PW< T, Device >.

Here is the caller graph for this function:

◆ before_scf()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::before_scf ( UnitCell ucell,
const int  istep 
)
overrideprotectedvirtual

Something to do before SCF iterations.

Reimplemented from ModuleESolver::ESolver_FP.

Reimplemented in ModuleESolver::ESolver_KS_LCAO< TK, TR >, ModuleESolver::ESolver_KS_LCAO< std::complex< double >, TR >, ModuleESolver::ESolver_KS_LIP< T >, ModuleESolver::ESolver_KS_PW< T, Device >, ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >, and ModuleESolver::ESolver_SDFT_PW< T, Device >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hamilt2rho()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::hamilt2rho ( UnitCell ucell,
const int  istep,
const int  iter,
const double  ethr 
)
protected
Here is the call graph for this function:

◆ hamilt2rho_single()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::hamilt2rho_single ( UnitCell ucell,
const int  istep,
const int  iter,
const double  ethr 
)
protectedvirtual

the 5th function of ESolver_KS: hamilt2rho_single mohan add 2024-05-11

Reimplemented in ModuleESolver::ESolver_KS_LCAO< TK, TR >, ModuleESolver::ESolver_KS_LCAO< std::complex< double >, TR >, ModuleESolver::ESolver_KS_LCAO_TDDFT< TR, Device >, ModuleESolver::ESolver_KS_LIP< T >, ModuleESolver::ESolver_KS_PW< T, Device >, ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >, and ModuleESolver::ESolver_SDFT_PW< T, Device >.

Here is the call graph for this function:

◆ iter_finish()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::iter_finish ( UnitCell ucell,
const int  istep,
int &  iter,
bool &  conv_esolver 
)
overrideprotectedvirtual

Something to do after hamilt2rho function in each iter loop.

Reimplemented from ModuleESolver::ESolver_FP.

Reimplemented in ModuleESolver::ESolver_KS_LCAO< TK, TR >, ModuleESolver::ESolver_KS_LCAO< std::complex< double >, TR >, ModuleESolver::ESolver_KS_LCAO_TDDFT< TR, Device >, ModuleESolver::ESolver_KS_LIP< T >, ModuleESolver::ESolver_KS_PW< T, Device >, ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >, and ModuleESolver::ESolver_SDFT_PW< T, Device >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iter_init()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::iter_init ( UnitCell ucell,
const int  istep,
const int  iter 
)
protectedvirtual

Something to do before hamilt2rho function in each iter loop.

Reimplemented in ModuleESolver::ESolver_KS_LCAO< TK, TR >, ModuleESolver::ESolver_KS_LCAO< std::complex< double >, TR >, ModuleESolver::ESolver_KS_LIP< T >, ModuleESolver::ESolver_KS_PW< T, Device >, and ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runner()

template<typename T , typename Device >
void ModuleESolver::ESolver_KS< T, Device >::runner ( UnitCell cell,
const int  istep 
)
overridevirtual

run energy solver

Implements ModuleESolver::ESolver.

Reimplemented in ModuleESolver::ESolver_KS_LCAO_TDDFT< TR, Device >, ModuleESolver::ESolver_DM2rho< TK, TR >, and ModuleESolver::ESolver_GetS.

Here is the call graph for this function:

◆ update_pot()

template<typename T , typename Device = base_device::DEVICE_CPU>
virtual void ModuleESolver::ESolver_KS< T, Device >::update_pot ( UnitCell ucell,
const int  istep,
const int  iter,
const bool  conv_esolver 
)
inlineprotectedvirtual

Member Data Documentation

◆ basisname

template<typename T , typename Device = base_device::DEVICE_CPU>
std::string ModuleESolver::ESolver_KS< T, Device >::basisname
protected

◆ diag_ethr

template<typename T , typename Device = base_device::DEVICE_CPU>
double ModuleESolver::ESolver_KS< T, Device >::diag_ethr
protected

number of electrons

◆ drho

template<typename T , typename Device = base_device::DEVICE_CPU>
double ModuleESolver::ESolver_KS< T, Device >::drho
protected

scf energy threshold

◆ esolver_KS_ne

template<typename T , typename Device = base_device::DEVICE_CPU>
double ModuleESolver::ESolver_KS< T, Device >::esolver_KS_ne = 0.0
protected

◆ hsolver_error

template<typename T , typename Device = base_device::DEVICE_CPU>
double ModuleESolver::ESolver_KS< T, Device >::hsolver_error
protected

the difference between rho_in (before HSolver) and rho_out (After HSolver)

◆ maxniter

template<typename T , typename Device = base_device::DEVICE_CPU>
int ModuleESolver::ESolver_KS< T, Device >::maxniter
protected

the error of HSolver

◆ niter

template<typename T , typename Device = base_device::DEVICE_CPU>
int ModuleESolver::ESolver_KS< T, Device >::niter
protected

maximum iter steps for scf

◆ oscillate_esolver

template<typename T , typename Device = base_device::DEVICE_CPU>
bool ModuleESolver::ESolver_KS< T, Device >::oscillate_esolver = false
protected

iter steps actually used in scf

◆ p_chgmix

template<typename T , typename Device = base_device::DEVICE_CPU>
Charge_Mixing* ModuleESolver::ESolver_KS< T, Device >::p_chgmix = nullptr
protected

Charge mixing method.

◆ p_hamilt

template<typename T , typename Device = base_device::DEVICE_CPU>
hamilt::Hamilt<T, Device>* ModuleESolver::ESolver_KS< T, Device >::p_hamilt = nullptr
protected

Hamiltonian.

◆ ppcell

template<typename T , typename Device = base_device::DEVICE_CPU>
pseudopot_cell_vnl ModuleESolver::ESolver_KS< T, Device >::ppcell
protected

nonlocal pseudopotentials

◆ psi

template<typename T , typename Device = base_device::DEVICE_CPU>
psi::Psi<T>* ModuleESolver::ESolver_KS< T, Device >::psi = nullptr
protected

Electronic wavefunctions.

◆ pw_wfc

template<typename T , typename Device = base_device::DEVICE_CPU>
ModulePW::PW_Basis_K* ModuleESolver::ESolver_KS< T, Device >::pw_wfc = nullptr
protected

PW for wave functions, only used in KSDFT, not in OFDFT.

◆ scf_ene_thr

template<typename T , typename Device = base_device::DEVICE_CPU>
double ModuleESolver::ESolver_KS< T, Device >::scf_ene_thr
protected

scf density threshold

◆ scf_thr

template<typename T , typename Device = base_device::DEVICE_CPU>
double ModuleESolver::ESolver_KS< T, Device >::scf_thr
protected

the threshold for diagonalization


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