ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
MD_func Namespace Reference

base functions in md More...

Functions

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 MDCell &mdcell, 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 (MDCell &mdcell, const bool &init_vel, const bool &restart, double &temperature, std::int64_t &frozen_freedom)
void force_virial (ModuleESolver::ESolver *p_esolver, const int &istep, const bool &positions_updated, MDCell &mdcell, DomainDecomposition &decomp, double &potential, 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 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
double current_temp (double &kinetic, const MDCell &mdcell, const std::int64_t &frozen_freedom)
std::int64_t global_dof (const MDCell &mdcell)
void current_md_info (const MDCell &mdcell, const std::string &file_dir, int &md_step, double &temperature)

Detailed Description

base functions in md

Namespace MD_func contains several functions used in md.

Function Documentation

◆ compute_stress()

void MD_func::compute_stress ( const MDCell & mdcell,
const bool & cal_stress,
const ModuleBase::matrix & virial,
ModuleBase::matrix & stress )

calculate the total stress tensor

Parameters
mdcellMD cell information
cal_stresswhether calculate stress
viriallattice virial tensor
stresstotal stress tensor
Here is the caller graph for this function:

◆ current_md_info()

void MD_func::current_md_info ( const MDCell & mdcell,
const std::string & file_dir,
int & md_step,
double & temperature )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ current_temp() [1/2]

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

Parameters
kinetickinetic energy
natomthe number of atoms
frozen_freedomthe fixed freedom
allmassatomic mass
velatomic velocities
Returns
the current temperature
Here is the call graph for this function:
Here is the caller graph for this function:

◆ current_temp() [2/2]

double MD_func::current_temp ( double & kinetic,
const MDCell & mdcell,
const std::int64_t & frozen_freedom )

◆ force_virial()

void MD_func::force_virial ( ModuleESolver::ESolver * p_esolver,
const int & istep,
const bool & positions_updated,
MDCell & mdcell,
DomainDecomposition & decomp,
double & potential,
const bool & cal_stress,
ModuleBase::matrix & virial )

calculate energy, forces and virial tensor

Parameters
p_esolverenrergy solver
istepcurrent md step
positions_updatedwhether ionic positions have drifted in this run; the initial force evaluation of a run (including a restarted run) passes false so the charge-extrapolation history is not advanced
mdcellMD cell information
potentialpotential energy
cal_stresswhether calculate stress
viriallattice virial tensor
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gaussrand()

double MD_func::gaussrand ( )

generate a Gaussian random number

Returns
a Gaussian random number
Here is the caller graph for this function:

◆ get_mass_mbl()

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

Parameters
unit_inunitcell information
allmassatomic mass
frozenthe fixed freedom along three directions
ionmbldetermine whether the atomic freedom is fixed
Here is the call graph for this function:
Here is the caller graph for this function:

◆ global_dof()

std::int64_t MD_func::global_dof ( const MDCell & mdcell)
Here is the caller graph for this function:

◆ init_vel()

void MD_func::init_vel ( MDCell & mdcell,
const bool & init_vel,
const bool & restart,
double & temperature,
std::int64_t & frozen_freedom )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kinetic_energy()

double MD_func::kinetic_energy ( const int & natom,
const ModuleBase::Vector3< double > * vel,
const double * allmass )

calculate the ionic kinetic energy

Parameters
natomthe number of atoms
velthe atomic velocities
allmassatomic mass
Returns
the ionic kinetic energy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_stress()

void MD_func::print_stress ( std::ofstream & ofs,
const ModuleBase::matrix & virial,
const ModuleBase::matrix & stress )

output the stress information

Parameters
ofsdetermine the output files
viriallattice virial tensor
stresstotal stress tensor
Here is the caller graph for this function:

◆ rand_vel()

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

Parameters
natomthe number of atoms
temperatureion temperature
allmassatomic mass
frozen_freedomthe fixed freedom
frozenthe fixed freedom along three directions
ionmbldetermine whether the atomic freedom is fixed
my_rankMPI rank of the processor
velthe genarated atomic velocities
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_vel()

void MD_func::read_vel ( const UnitCell & unit_in,
ModuleBase::Vector3< double > * vel )

read in atomic velocities from STRU

Parameters
unit_inunitcell information
velthe read-in atomic velocities
Here is the caller graph for this function:

◆ rescale_vel()

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

Parameters
natomthe number of atoms
temperatureion temperature
allmassatomic mass
frozen_freedomthe fixed freedom
velthe genarated atomic velocities
Here is the call graph for this function:
Here is the caller graph for this function:

◆ target_temp()

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

Parameters
istepthe current md step
nstepthe total md step
tfirstthe initial temperature
tlastthe final temperature
Returns
the target temperature
Here is the caller graph for this function: