ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
md_func.h
Go to the documentation of this file.
1#ifndef MD_FUNC_H
2#define MD_FUNC_H
3
5
6#ifdef __MPI
7#include <mpi.h> // MPI functions
8#endif
9
15namespace MD_func
16{
17
23double gaussrand();
24
37void init_vel(const UnitCell& unit_in,
38 const int& my_rank,
39 const bool& restart,
40 double& temperature,
41 double* allmass,
42 int& frozen_freedom,
45
52void read_vel(const UnitCell& unit_in, ModuleBase::Vector3<double>* vel);
53
66void rand_vel(const int& natom,
67 const double& temperature,
68 const double* allmass,
69 const int& frozen_freedom,
70 const ModuleBase::Vector3<int> frozen,
71 const ModuleBase::Vector3<int>* ionmbl,
72 const int& my_rank,
74
84void rescale_vel(const int& natom,
85 const double& temperature,
86 const double* allmass,
87 const int& frozen_freedom,
89
102 const int& istep,
103 UnitCell& unit_in,
104 double& potential,
106 const bool& cal_stress,
107 ModuleBase::matrix& virial);
116double kinetic_energy(const int& natom, const ModuleBase::Vector3<double>* vel, const double* allmass);
117
128void compute_stress(const UnitCell& unit_in,
130 const double* allmass,
131 const bool& cal_stress,
132 const ModuleBase::matrix& virial,
133 ModuleBase::matrix& stress);
134
142void print_stress(std::ofstream& ofs, const ModuleBase::matrix& virial, const ModuleBase::matrix& stress);
143
158void dump_info(const int& step,
159 const std::string& global_out_dir,
160 const UnitCell& unit_in,
161 const Parameter& param_in,
162 const ModuleBase::matrix& virial,
163 const ModuleBase::Vector3<double>* force,
164 const ModuleBase::Vector3<double>* vel);
165
174void get_mass_mbl(const UnitCell& unit_in,
175 double* allmass,
178
188double target_temp(const int& istep, const int& nstep, const double& tfirst, const double& tlast);
189
200double current_temp(double& kinetic,
201 const int& natom,
202 const int& frozen_freedom,
203 const double* allmass,
204 const ModuleBase::Vector3<double>* vel);
205
214void temp_vector(const int& natom,
216 const double* allmass,
217 ModuleBase::matrix& t_vector);
218
229void current_md_info(const int& my_rank, const std::string& file_dir, int& md_step, double& temperature);
230
231} // namespace MD_func
232
233#endif // MD_FUNC_H
3 elements vector
Definition vector3.h:22
Definition matrix.h:19
Definition esolver.h:11
Definition parameter.h:13
Definition unitcell.h:16
base functions in md
Definition for_testing_input_conv.h:244
double current_temp(double &kinetic, const int &natom, const int &frozen_freedom, const double *allmass, const ModuleBase::Vector3< double > *vel)
get the current temperature
Definition md_func.cpp:452
double gaussrand()
generate a Gaussian random number
Definition md_func.cpp:10
double target_temp(const int &istep, const int &nstep, const double &tfirst, const double &tlast)
get the target temperature of the current md step
Definition md_func.cpp:445
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
Definition md_func.cpp:415
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
Definition md_func.cpp:247
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
Definition md_func.cpp:54
double kinetic_energy(const int &natom, const ModuleBase::Vector3< double > *vel, const double *allmass)
calculate the ionic kinetic energy
Definition md_func.cpp:42
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
Definition md_func.cpp:323
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
Definition md_func.cpp:129
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
Definition md_func.cpp:107
void temp_vector(const int &natom, const ModuleBase::Vector3< double > *vel, const double *allmass, ModuleBase::matrix &t_vector)
get the temperature vectors
Definition md_func.cpp:470
void read_vel(const UnitCell &unit_in, ModuleBase::Vector3< double > *vel)
read in atomic velocities from STRU
Definition md_func.cpp:79
void print_stress(std::ofstream &ofs, const ModuleBase::matrix &virial, const ModuleBase::matrix &stress)
output the stress information
Definition md_func.cpp:289
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
Definition for_testing_input_conv.h:245
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
Definition md_func.cpp:186