ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
charge extrapolation method More...
#include <charge_extra.h>
Public Member Functions | |
Charge_Extra () | |
~Charge_Extra () | |
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, Structure_Factor *sf, std::ofstream &ofs_running, std::ofstream &ofs_warning) |
charge extrapolation method | |
void | update_all_dis (const UnitCell &ucell) |
update displacements | |
void | update_delta_rho (const UnitCell &ucell, const Charge *chr, const Structure_Factor *sf) |
update the difference of charge density | |
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 | |
ModuleBase::Vector3< double > * | dis_old1 = nullptr |
dis_old2 = pos_old1 - pos_old2 | |
ModuleBase::Vector3< double > * | dis_old2 = nullptr |
dis_old1 = pos_now - pos_old1 | |
ModuleBase::Vector3< double > * | dis_now = nullptr |
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 |
parameter used in the second order extrapolation | |
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) )
Charge_Extra::Charge_Extra | ( | ) |
Charge_Extra::~Charge_Extra | ( | ) |
void Charge_Extra::extrapolate_charge | ( | Parallel_Grid * | Pgrid, |
UnitCell & | ucell, | ||
Charge * | chr, | ||
Structure_Factor * | sf, | ||
std::ofstream & | ofs_running, | ||
std::ofstream & | ofs_warning | ||
) |
charge extrapolation method
Pgrid | parallel grids |
ucell | the cell information |
chr | the charge density |
sf | the structure factor |
ofs_running | the output stream |
ofs_warning | the output stream |
|
private |
determine alpha and beta
natom | the number of atoms |
ofs_running | the output stream |
ofs_warning | the output stream |
void 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 |
void 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 Charge_Extra::update_delta_rho | ( | const UnitCell & | ucell, |
const Charge * | chr, | ||
const Structure_Factor * | sf | ||
) |
update the difference of charge density
ucell | the cell information |
chr | the charge density |
sf | the structure factor |
|
private |
parameter used in the second order extrapolation
|
private |
parameter used in the second order extrapolation
|
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