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
6class Parameter;
7
8#ifdef __MPI
9#include <mpi.h> // MPI functions
10#endif
11
17namespace MD_func
18{
19
25double gaussrand();
26
39void init_vel(const UnitCell& unit_in,
40 const int& my_rank,
41 const bool& restart,
42 double& temperature,
43 double* allmass,
44 int& frozen_freedom,
47
54void read_vel(const UnitCell& unit_in, ModuleBase::Vector3<double>* vel);
55
68void rand_vel(const int& natom,
69 const double& temperature,
70 const double* allmass,
71 const int& frozen_freedom,
72 const ModuleBase::Vector3<int> frozen,
73 const ModuleBase::Vector3<int>* ionmbl,
74 const int& my_rank,
76
86void rescale_vel(const int& natom,
87 const double& temperature,
88 const double* allmass,
89 const int& frozen_freedom,
91
104 const int& istep,
105 UnitCell& unit_in,
106 double& potential,
108 const bool& cal_stress,
109 ModuleBase::matrix& virial);
118double kinetic_energy(const int& natom, const ModuleBase::Vector3<double>* vel, const double* allmass);
119
130void compute_stress(const UnitCell& unit_in,
132 const double* allmass,
133 const bool& cal_stress,
134 const ModuleBase::matrix& virial,
135 ModuleBase::matrix& stress);
136
144void print_stress(std::ofstream& ofs, const ModuleBase::matrix& virial, const ModuleBase::matrix& stress);
145
160void dump_info(const int& step,
161 const std::string& global_out_dir,
162 const UnitCell& unit_in,
163 const Parameter& param_in,
164 const ModuleBase::matrix& virial,
165 const ModuleBase::Vector3<double>* force,
166 const ModuleBase::Vector3<double>* vel);
167
176void get_mass_mbl(const UnitCell& unit_in,
177 double* allmass,
180
190double target_temp(const int& istep, const int& nstep, const double& tfirst, const double& tlast);
191
202double current_temp(double& kinetic,
203 const int& natom,
204 const int& frozen_freedom,
205 const double* allmass,
206 const ModuleBase::Vector3<double>* vel);
207
216void temp_vector(const int& natom,
218 const double* allmass,
219 ModuleBase::matrix& t_vector);
220
231void current_md_info(const int& my_rank, const std::string& file_dir, int& md_step, double& temperature);
232
233} // namespace MD_func
234
235#endif // MD_FUNC_H
3 elements vector
Definition vector3.h:24
Definition matrix.h:18
Definition esolver.h:12
Definition parameter.h:13
Definition unitcell.h:15
base functions in md
Definition for_testing_input_conv.h:228
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:453
double gaussrand()
generate a Gaussian random number
Definition md_func.cpp:11
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:446
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:416
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:248
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:55
double kinetic_energy(const int &natom, const ModuleBase::Vector3< double > *vel, const double *allmass)
calculate the ionic kinetic energy
Definition md_func.cpp:43
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:324
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:130
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:108
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:471
void read_vel(const UnitCell &unit_in, ModuleBase::Vector3< double > *vel)
read in atomic velocities from STRU
Definition md_func.cpp:80
void print_stress(std::ofstream &ofs, const ModuleBase::matrix &virial, const ModuleBase::matrix &stress)
output the stress information
Definition md_func.cpp:290
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:229
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:187