|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
charge extrapolation method More...
#include <chg_extra.h>
Public Member Functions | |
| Charge_Extra () | |
| Charge_Extra (const Charge_Extra &)=delete | |
| Charge_Extra & | operator= (const Charge_Extra &)=delete |
| void | Init_CE (const int &nspin, const int &natom, const int &nrxx, const std::string chg_extrap) |
| Initialization of viriables used in charge extrapolation methods. | |
| void | extrapolate_charge (Parallel_Grid *Pgrid, UnitCell &ucell, Charge *chr, const ModulePW::PW_Basis &rhopw, Structure_Factor *sf, std::ofstream &ofs_running, std::ofstream &ofs_warning, const AtomicRhoCfg &atomic_rho_cfg, const bool has_float_data) |
| charge extrapolation method | |
| void | update_all_dis (const UnitCell &ucell) |
| update displacements | |
| void | update_delta_rho (const UnitCell &ucell, const Charge *chr, const ModulePW::PW_Basis &rhopw, const Structure_Factor *sf, const AtomicRhoCfg &atomic_rho_cfg) |
| update the difference of charge density | |
| int | get_istep () const |
| the current step | |
| void | set_istep (const int istep_in) |
| int | get_pot_order () const |
| the specified charge extrapolation method | |
| void | set_pot_order (const int pot_order_in) |
| int | get_rho_extr () const |
| the extrapolation order actually used this step, which extrapolate_charge() derives from pot_order and istep | |
| int | get_nspin () const |
| the number of spins | |
| std::vector< ModuleBase::Vector3< double > > & | get_dis_old1 () |
| displacement histories: dis_old2 = pos_old1 - pos_old2, dis_old1 = pos_now - pos_old1, dis_now = pos_next - pos_now | |
| std::vector< ModuleBase::Vector3< double > > & | get_dis_old2 () |
| std::vector< ModuleBase::Vector3< double > > & | get_dis_now () |
| std::vector< std::vector< double > > & | get_delta_rho1 () |
| the last three steps' difference of rho and atomic_rho | |
| std::vector< std::vector< double > > & | get_delta_rho2 () |
| std::vector< std::vector< double > > & | get_delta_rho3 () |
| double | get_alpha () const |
| parameter used in the second order extrapolation | |
| double | get_beta () const |
| coefficient for the third delta_rho contribution | |
| void | find_alpha_and_beta_for_testing (const int &natom, std::ofstream &ofs_running, std::ofstream &ofs_warning) |
| run find_alpha_and_beta() against the displacement histories currently held, so its solution can be checked on its own rather than only through a full extrapolate_charge() step | |
Private Member Functions | |
| void | find_alpha_and_beta (const int &natom, std::ofstream &ofs_running, std::ofstream &ofs_warning) |
| determine alpha and beta | |
Private Attributes | |
| int | istep = 0 |
| the current step | |
| int | pot_order |
| the specified charge extrapolation method | |
| int | rho_extr |
| the actually used method | |
| int | nspin |
| the number of spins | |
| std::vector< ModuleBase::Vector3< double > > | dis_old1 |
| dis_old2 = pos_old1 - pos_old2 | |
| std::vector< ModuleBase::Vector3< double > > | dis_old2 |
| dis_old1 = pos_now - pos_old1 | |
| std::vector< ModuleBase::Vector3< double > > | dis_now |
| dis_now = pos_next - pos_now | |
| std::vector< std::vector< double > > | delta_rho1 |
| the last step difference of rho and atomic_rho | |
| std::vector< std::vector< double > > | delta_rho2 |
| the second last step difference of rho and atomic_rho | |
| std::vector< std::vector< double > > | delta_rho3 |
| the third last step difference of rho and atomic_rho | |
| double | alpha |
| parameter used in the second order extrapolation | |
| double | beta |
| coefficient for the third delta_rho contribution | |
charge extrapolation method
This class implements several charge extrapolation methods: pot_order=0 : copy the old potential (nothing is done); pot_order=1 : subtract old atomic charge density and sum the new if dynamics is done the routine extrapolates also the difference between the scf charge and the atomic one; pot_order=2 : first order extrapolation: [ \rho(t+dt) = 2\ \rho(t)-\rho(t-dt); ] pot_order=3 : second order extrapolation: [ \rho(t+dt) = \rho(t) + \alpha_0\ (\rho(t) - \rho(t-dt))
The (\alpha_0) and (\beta_0) parameters are calculated in find_alpha_and_beta() so that (|\tau'-\tau(t+dt)|) is minimum. (\tau') and (\tau(t+dt)) are respectively the atomic positions at time t+dt and the extrapolated one: [ \tau(t+dt) = \tau(t) + \alpha_0\ ( \tau(t) - \tau(t-dt) )
| module_charge::Charge_Extra::Charge_Extra | ( | ) |
|
delete |
| void module_charge::Charge_Extra::extrapolate_charge | ( | Parallel_Grid * | Pgrid, |
| UnitCell & | ucell, | ||
| Charge * | chr, | ||
| const ModulePW::PW_Basis & | rhopw, | ||
| Structure_Factor * | sf, | ||
| std::ofstream & | ofs_running, | ||
| std::ofstream & | ofs_warning, | ||
| const AtomicRhoCfg & | atomic_rho_cfg, | ||
| const bool | has_float_data ) |
charge extrapolation method
| Pgrid | parallel grids |
| ucell | the cell information |
| chr | the charge density |
| rhopw | plane-wave basis bound to chr |
| sf | the structure factor |
| ofs_running | the output stream |
| ofs_warning | the output stream |
| atomic_rho_cfg | configuration for atomic_rho (nelec, magnetism, verbosity) |
| has_float_data | whether the Hamiltonian carries float data; forwarded to Structure_Factor::setup() when the structure factor is refreshed |
|
private |
determine alpha and beta
| natom | the number of atoms |
| ofs_running | the output stream |
| ofs_warning | the output stream |
|
inline |
run find_alpha_and_beta() against the displacement histories currently held, so its solution can be checked on its own rather than only through a full extrapolate_charge() step
|
inline |
parameter used in the second order extrapolation
|
inline |
coefficient for the third delta_rho contribution
|
inline |
the last three steps' difference of rho and atomic_rho
|
inline |
|
inline |
|
inline |
|
inline |
displacement histories: dis_old2 = pos_old1 - pos_old2, dis_old1 = pos_now - pos_old1, dis_now = pos_next - pos_now
|
inline |
|
inline |
the current step
|
inline |
the number of spins
|
inline |
the specified charge extrapolation method
|
inline |
the extrapolation order actually used this step, which extrapolate_charge() derives from pot_order and istep
| void module_charge::Charge_Extra::Init_CE | ( | const int & | nspin, |
| const int & | natom, | ||
| const int & | nrxx, | ||
| const std::string | chg_extrap ) |
Initialization of viriables used in charge extrapolation methods.
When Esolver is initialized, ucell.natom is not determined As a result, data structures in Charge_Extra cannot be allocated This is a temporary solution by delaying the allocation But after ucell and Esolver are fully decoupled Init_CE will be removed and everything put back in the constructor
| nspin | the number of spins |
| natom | the number of atoms |
| nrxx | the number of grids |
| chg_extrap | the charge extrapolation method |
|
delete |
|
inline |
|
inline |
| void module_charge::Charge_Extra::update_all_dis | ( | const UnitCell & | ucell | ) |
update displacements
In the second order extrapolation, the displacements of previous three steps are needed to determine alpha and beta, which are parameters used in this method.
| ucell | the cell information |
| void module_charge::Charge_Extra::update_delta_rho | ( | const UnitCell & | ucell, |
| const Charge * | chr, | ||
| const ModulePW::PW_Basis & | rhopw, | ||
| const Structure_Factor * | sf, | ||
| const AtomicRhoCfg & | atomic_rho_cfg ) |
update the difference of charge density
| ucell | the cell information |
| chr | the charge density |
| rhopw | plane-wave basis bound to chr |
| sf | the structure factor |
| atomic_rho_cfg | configuration for atomic_rho (nelec, magnetism, verbosity) |
|
private |
parameter used in the second order extrapolation
|
private |
coefficient for the third delta_rho contribution
|
private |
the last step difference of rho and atomic_rho
|
private |
the second last step difference of rho and atomic_rho
|
private |
the third last step difference of rho and atomic_rho
|
private |
dis_now = pos_next - pos_now
|
private |
dis_old2 = pos_old1 - pos_old2
|
private |
dis_old1 = pos_now - pos_old1
|
private |
the current step
|
private |
the number of spins
|
private |
the specified charge extrapolation method
|
private |
the actually used method