ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
base functions in md More...
Functions | |
void | current_md_info (const int &my_rank, const std::string &file_dir, int &md_step, double &temperature) |
determine thr current md step and temperature | |
double | gaussrand () |
generate a Gaussian random number | |
double | kinetic_energy (const int &natom, const ModuleBase::Vector3< double > *vel, const double *allmass) |
calculate the ionic kinetic energy | |
void | compute_stress (const UnitCell &unit_in, const ModuleBase::Vector3< double > *vel, const double *allmass, const bool &cal_stress, const ModuleBase::matrix &virial, ModuleBase::matrix &stress) |
calculate the total stress tensor | |
void | read_vel (const UnitCell &unit_in, ModuleBase::Vector3< double > *vel) |
read in atomic velocities from STRU | |
void | rescale_vel (const int &natom, const double &temperature, const double *allmass, const int &frozen_freedom, ModuleBase::Vector3< double > *vel) |
rescale the velocity to the target temperature | |
void | rand_vel (const int &natom, const double &temperature, const double *allmass, const int &frozen_freedom, const ModuleBase::Vector3< int > frozen, const ModuleBase::Vector3< int > *ionmbl, const int &my_rank, ModuleBase::Vector3< double > *vel) |
generate atomic velocities that satisfy the Boltzmann distribution | |
void | init_vel (const UnitCell &unit_in, const int &my_rank, const bool &restart, double &temperature, double *allmass, int &frozen_freedom, ModuleBase::Vector3< int > *ionmbl, ModuleBase::Vector3< double > *vel) |
initialize the atomic velocities | |
void | force_virial (ModuleESolver::ESolver *p_esolver, const int &istep, UnitCell &unit_in, double &potential, ModuleBase::Vector3< double > *force, const bool &cal_stress, ModuleBase::matrix &virial) |
calculate energy, forces and virial tensor | |
void | print_stress (std::ofstream &ofs, const ModuleBase::matrix &virial, const ModuleBase::matrix &stress) |
output the stress information | |
void | dump_info (const int &step, const std::string &global_out_dir, const UnitCell &unit_in, const Parameter ¶m_in, const ModuleBase::matrix &virial, const ModuleBase::Vector3< double > *force, const ModuleBase::Vector3< double > *vel) |
dump the md information | |
void | get_mass_mbl (const UnitCell &unit_in, double *allmass, ModuleBase::Vector3< int > &frozen, ModuleBase::Vector3< int > *ionmbl) |
obtain the atomic mass and whether the freedom is fixed | |
double | target_temp (const int &istep, const int &nstep, const double &tfirst, const double &tlast) |
get the target temperature of the current md step | |
double | current_temp (double &kinetic, const int &natom, const int &frozen_freedom, const double *allmass, const ModuleBase::Vector3< double > *vel) |
get the current temperature | |
void | temp_vector (const int &natom, const ModuleBase::Vector3< double > *vel, const double *allmass, ModuleBase::matrix &t_vector) |
get the temperature vectors | |
base functions in md
Namespace MD_func contains several functions used in md.
void MD_func::compute_stress | ( | const UnitCell & | unit_in, |
const ModuleBase::Vector3< double > * | vel, | ||
const double * | allmass, | ||
const bool & | cal_stress, | ||
const ModuleBase::matrix & | virial, | ||
ModuleBase::matrix & | stress | ||
) |
calculate the total stress tensor
unit_in | unitcell information |
vel | the atomic velocities |
allmass | atomic mass |
cal_stress | whether calculate stress |
virial | lattice virial tensor |
stress | total stress tensor |
void MD_func::current_md_info | ( | const int & | my_rank, |
const std::string & | file_dir, | ||
int & | md_step, | ||
double & | temperature | ||
) |
determine thr current md step and temperature
determine thr current md step and temperature according to Restart_md.dat if md_restart is true
my_rank | MPI rank of the processor |
file_dir | the directory of read-in files |
md_step | current md step |
temperature | current temperature |
double MD_func::current_temp | ( | double & | kinetic, |
const int & | natom, | ||
const int & | frozen_freedom, | ||
const double * | allmass, | ||
const ModuleBase::Vector3< double > * | vel | ||
) |
get the current temperature
kinetic | kinetic energy |
natom | the number of atoms |
frozen_freedom | the fixed freedom |
allmass | atomic mass |
vel | atomic velocities |
void MD_func::dump_info | ( | const int & | step, |
const std::string & | global_out_dir, | ||
const UnitCell & | unit_in, | ||
const Parameter & | param_in, | ||
const ModuleBase::matrix & | virial, | ||
const ModuleBase::Vector3< double > * | force, | ||
const ModuleBase::Vector3< double > * | vel | ||
) |
dump the md information
including md step, lattice constant, lattice vectors, lattice virial tensor, ion index, ion positions, ion velocities, ion forces
step | current md step |
global_out_dir | directory of output files |
unit_in | unitcell information |
param_in | input parameters used in md |
virial | lattice virial tensor |
force | atomic forces |
vel | atomic velocities |
< Angstrom
< Angstrom/fs
< kBar
< eV/Angstrom
void MD_func::force_virial | ( | ModuleESolver::ESolver * | p_esolver, |
const int & | istep, | ||
UnitCell & | unit_in, | ||
double & | potential, | ||
ModuleBase::Vector3< double > * | force, | ||
const bool & | cal_stress, | ||
ModuleBase::matrix & | virial | ||
) |
calculate energy, forces and virial tensor
p_esolver | enrergy solver |
istep | current md step |
unit_in | unitcell information |
potential | potential energy |
force | atomic forces |
cal_stress | whether calculate stress |
virial | lattice virial tensor |
convert Rydberg to Hartree
double MD_func::gaussrand | ( | ) |
generate a Gaussian random number
void MD_func::get_mass_mbl | ( | const UnitCell & | unit_in, |
double * | allmass, | ||
ModuleBase::Vector3< int > & | frozen, | ||
ModuleBase::Vector3< int > * | ionmbl | ||
) |
obtain the atomic mass and whether the freedom is fixed
unit_in | unitcell information |
allmass | atomic mass |
frozen | the fixed freedom along three directions |
ionmbl | determine whether the atomic freedom is fixed |
void MD_func::init_vel | ( | const UnitCell & | unit_in, |
const int & | my_rank, | ||
const bool & | restart, | ||
double & | temperature, | ||
double * | allmass, | ||
int & | frozen_freedom, | ||
ModuleBase::Vector3< int > * | ionmbl, | ||
ModuleBase::Vector3< double > * | vel | ||
) |
initialize the atomic velocities
unit_in | unitcell information |
my_rank | MPI rank of the processor |
restart | whether restart the md |
temperature | ion temperature |
allmass | atomic mass |
frozen_freedom | the fixed freedom |
ionmbl | determine whether the atomic freedom is fixed |
vel | the genarated atomic velocities |
double MD_func::kinetic_energy | ( | const int & | natom, |
const ModuleBase::Vector3< double > * | vel, | ||
const double * | allmass | ||
) |
calculate the ionic kinetic energy
natom | the number of atoms |
vel | the atomic velocities |
allmass | atomic mass |
void MD_func::print_stress | ( | std::ofstream & | ofs, |
const ModuleBase::matrix & | virial, | ||
const ModuleBase::matrix & | stress | ||
) |
output the stress information
ofs | determine the output files |
virial | lattice virial tensor |
stress | total stress tensor |
void MD_func::rand_vel | ( | const int & | natom, |
const double & | temperature, | ||
const double * | allmass, | ||
const int & | frozen_freedom, | ||
const ModuleBase::Vector3< int > | frozen, | ||
const ModuleBase::Vector3< int > * | ionmbl, | ||
const int & | my_rank, | ||
ModuleBase::Vector3< double > * | vel | ||
) |
generate atomic velocities that satisfy the Boltzmann distribution
natom | the number of atoms |
temperature | ion temperature |
allmass | atomic mass |
frozen_freedom | the fixed freedom |
frozen | the fixed freedom along three directions |
ionmbl | determine whether the atomic freedom is fixed |
my_rank | MPI rank of the processor |
vel | the genarated atomic velocities |
void MD_func::read_vel | ( | const UnitCell & | unit_in, |
ModuleBase::Vector3< double > * | vel | ||
) |
read in atomic velocities from STRU
unit_in | unitcell information |
vel | the read-in atomic velocities |
void MD_func::rescale_vel | ( | const int & | natom, |
const double & | temperature, | ||
const double * | allmass, | ||
const int & | frozen_freedom, | ||
ModuleBase::Vector3< double > * | vel | ||
) |
rescale the velocity to the target temperature
natom | the number of atoms |
temperature | ion temperature |
allmass | atomic mass |
frozen_freedom | the fixed freedom |
vel | the genarated atomic velocities |
double MD_func::target_temp | ( | const int & | istep, |
const int & | nstep, | ||
const double & | tfirst, | ||
const double & | tlast | ||
) |
get the target temperature of the current md step
istep | the current md step |
nstep | the total md step |
tfirst | the initial temperature |
tlast | the final temperature |
void MD_func::temp_vector | ( | const int & | natom, |
const ModuleBase::Vector3< double > * | vel, | ||
const double * | allmass, | ||
ModuleBase::matrix & | t_vector | ||
) |
get the temperature vectors
natom | the number of atoms |
vel | atomic velocities |
allmass | atomic mass |
t_vector | the temperature vectors |