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

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 &param_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
 

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

Parameters
unit_inunitcell information
velthe atomic velocities
allmassatomic mass
cal_stresswhether calculate stress
viriallattice virial tensor
stresstotal stress tensor
Here is the call graph for this function:
Here is the caller graph for this function:

◆ current_md_info()

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

Parameters
my_rankMPI rank of the processor
file_dirthe directory of read-in files
md_stepcurrent md step
temperaturecurrent temperature
Here is the call graph for this function:
Here is the caller graph for this function:

◆ current_temp()

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:

◆ dump_info()

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

Parameters
stepcurrent md step
global_out_dirdirectory of output files
unit_inunitcell information
param_ininput parameters used in md
viriallattice virial tensor
forceatomic forces
velatomic velocities

< Angstrom

< Angstrom/fs

< kBar

< eV/Angstrom

Here is the call graph for this function:
Here is the caller graph for this function:

◆ force_virial()

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

Parameters
p_esolverenrergy solver
istepcurrent md step
unit_inunitcell information
potentialpotential energy
forceatomic forces
cal_stresswhether calculate stress
viriallattice virial tensor

convert Rydberg to Hartree

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:

◆ init_vel()

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

Parameters
unit_inunitcell information
my_rankMPI rank of the processor
restartwhether restart the md
temperatureion temperature
allmassatomic mass
frozen_freedomthe fixed freedom
ionmbldetermine whether the atomic freedom is fixed
velthe genarated atomic velocities
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:

◆ temp_vector()

void MD_func::temp_vector ( const int &  natom,
const ModuleBase::Vector3< double > *  vel,
const double *  allmass,
ModuleBase::matrix t_vector 
)

get the temperature vectors

Parameters
natomthe number of atoms
velatomic velocities
allmassatomic mass
t_vectorthe temperature vectors
Here is the call graph for this function:
Here is the caller graph for this function: