ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
module_charge::Charge_Extra Class Reference

charge extrapolation method More...

#include <chg_extra.h>

Collaboration diagram for module_charge::Charge_Extra:

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

Detailed Description

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))

  • \beta_0\ (\rho(t-dt)- \rho(t-2 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) )

  • \beta_0\ ( \tau(t-dt) - \tau(t-2 dt) ). ]

Constructor & Destructor Documentation

◆ Charge_Extra() [1/2]

module_charge::Charge_Extra::Charge_Extra ( )
Here is the caller graph for this function:

◆ Charge_Extra() [2/2]

module_charge::Charge_Extra::Charge_Extra ( const Charge_Extra & )
delete
Here is the call graph for this function:

Member Function Documentation

◆ extrapolate_charge()

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

Parameters
Pgridparallel grids
ucellthe cell information
chrthe charge density
rhopwplane-wave basis bound to chr
sfthe structure factor
ofs_runningthe output stream
ofs_warningthe output stream
atomic_rho_cfgconfiguration for atomic_rho (nelec, magnetism, verbosity)
has_float_datawhether the Hamiltonian carries float data; forwarded to Structure_Factor::setup() when the structure factor is refreshed
Here is the call graph for this function:

◆ find_alpha_and_beta()

void module_charge::Charge_Extra::find_alpha_and_beta ( const int & natom,
std::ofstream & ofs_running,
std::ofstream & ofs_warning )
private

determine alpha and beta

Parameters
natomthe number of atoms
ofs_runningthe output stream
ofs_warningthe output stream
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_alpha_and_beta_for_testing()

void module_charge::Charge_Extra::find_alpha_and_beta_for_testing ( const int & natom,
std::ofstream & ofs_running,
std::ofstream & ofs_warning )
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

Here is the call graph for this function:

◆ get_alpha()

double module_charge::Charge_Extra::get_alpha ( ) const
inline

parameter used in the second order extrapolation

◆ get_beta()

double module_charge::Charge_Extra::get_beta ( ) const
inline

coefficient for the third delta_rho contribution

◆ get_delta_rho1()

std::vector< std::vector< double > > & module_charge::Charge_Extra::get_delta_rho1 ( )
inline

the last three steps' difference of rho and atomic_rho

◆ get_delta_rho2()

std::vector< std::vector< double > > & module_charge::Charge_Extra::get_delta_rho2 ( )
inline

◆ get_delta_rho3()

std::vector< std::vector< double > > & module_charge::Charge_Extra::get_delta_rho3 ( )
inline

◆ get_dis_now()

std::vector< ModuleBase::Vector3< double > > & module_charge::Charge_Extra::get_dis_now ( )
inline

◆ get_dis_old1()

std::vector< ModuleBase::Vector3< double > > & module_charge::Charge_Extra::get_dis_old1 ( )
inline

displacement histories: dis_old2 = pos_old1 - pos_old2, dis_old1 = pos_now - pos_old1, dis_now = pos_next - pos_now

◆ get_dis_old2()

std::vector< ModuleBase::Vector3< double > > & module_charge::Charge_Extra::get_dis_old2 ( )
inline

◆ get_istep()

int module_charge::Charge_Extra::get_istep ( ) const
inline

the current step

◆ get_nspin()

int module_charge::Charge_Extra::get_nspin ( ) const
inline

the number of spins

◆ get_pot_order()

int module_charge::Charge_Extra::get_pot_order ( ) const
inline

the specified charge extrapolation method

◆ get_rho_extr()

int module_charge::Charge_Extra::get_rho_extr ( ) const
inline

the extrapolation order actually used this step, which extrapolate_charge() derives from pot_order and istep

◆ Init_CE()

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

Parameters
nspinthe number of spins
natomthe number of atoms
nrxxthe number of grids
chg_extrapthe charge extrapolation method
Here is the call graph for this function:

◆ operator=()

Charge_Extra & module_charge::Charge_Extra::operator= ( const Charge_Extra & )
delete
Here is the call graph for this function:

◆ set_istep()

void module_charge::Charge_Extra::set_istep ( const int istep_in)
inline

◆ set_pot_order()

void module_charge::Charge_Extra::set_pot_order ( const int pot_order_in)
inline

◆ update_all_dis()

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.

Parameters
ucellthe cell information

◆ update_delta_rho()

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

Parameters
ucellthe cell information
chrthe charge density
rhopwplane-wave basis bound to chr
sfthe structure factor
atomic_rho_cfgconfiguration for atomic_rho (nelec, magnetism, verbosity)
Here is the call graph for this function:

Member Data Documentation

◆ alpha

double module_charge::Charge_Extra::alpha
private

parameter used in the second order extrapolation

◆ beta

double module_charge::Charge_Extra::beta
private

coefficient for the third delta_rho contribution

◆ delta_rho1

std::vector<std::vector<double> > module_charge::Charge_Extra::delta_rho1
private

the last step difference of rho and atomic_rho

◆ delta_rho2

std::vector<std::vector<double> > module_charge::Charge_Extra::delta_rho2
private

the second last step difference of rho and atomic_rho

◆ delta_rho3

std::vector<std::vector<double> > module_charge::Charge_Extra::delta_rho3
private

the third last step difference of rho and atomic_rho

◆ dis_now

std::vector<ModuleBase::Vector3<double> > module_charge::Charge_Extra::dis_now
private

dis_now = pos_next - pos_now

◆ dis_old1

std::vector<ModuleBase::Vector3<double> > module_charge::Charge_Extra::dis_old1
private

dis_old2 = pos_old1 - pos_old2

◆ dis_old2

std::vector<ModuleBase::Vector3<double> > module_charge::Charge_Extra::dis_old2
private

dis_old1 = pos_now - pos_old1

◆ istep

int module_charge::Charge_Extra::istep = 0
private

the current step

◆ nspin

int module_charge::Charge_Extra::nspin
private

the number of spins

◆ pot_order

int module_charge::Charge_Extra::pot_order
private

the specified charge extrapolation method

◆ rho_extr

int module_charge::Charge_Extra::rho_extr
private

the actually used method


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