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
7
8#include <cstdint>
9
10class Parameter;
12
13#ifdef __MPI
14#include <mpi.h> // MPI functions
15#endif
16
22namespace MD_func
23{
24
30double gaussrand();
31
32void init_vel(
33 MDCell &mdcell,
34 const bool &init_vel,
35 const bool &restart,
36 double &temperature,
37 std::int64_t &frozen_freedom);
38
45void read_vel(const UnitCell &unit_in, ModuleBase::Vector3<double> *vel);
46
59void rand_vel(
60 const int &natom,
61 const double &temperature,
62 const double *allmass,
63 const int &frozen_freedom,
64 const ModuleBase::Vector3<int> frozen,
65 const ModuleBase::Vector3<int> *ionmbl,
66 const int &my_rank,
67 ModuleBase::Vector3<double> *vel);
68
78void rescale_vel(
79 const int &natom,
80 const double &temperature,
81 const double *allmass,
82 const int &frozen_freedom,
83 ModuleBase::Vector3<double> *vel);
84
98void force_virial(
99 ModuleESolver::ESolver *p_esolver,
100 const int &istep,
101 const bool &positions_updated,
102 MDCell &mdcell,
103 DomainDecomposition &decomp,
104 double &potential,
105 const bool &cal_stress,
106 ModuleBase::matrix &virial);
115double kinetic_energy(const int &natom, const ModuleBase::Vector3<double> *vel, const double *allmass);
116
125void compute_stress(
126 const MDCell &mdcell,
127 const bool &cal_stress,
128 const ModuleBase::matrix &virial,
129 ModuleBase::matrix &stress);
130
138void print_stress(std::ofstream &ofs, const ModuleBase::matrix &virial, const ModuleBase::matrix &stress);
139
148void get_mass_mbl(
149 const UnitCell &unit_in,
150 double *allmass,
151 ModuleBase::Vector3<int> &frozen,
152 ModuleBase::Vector3<int> *ionmbl);
153
163double target_temp(
164 const int &istep,
165 const int &nstep,
166 const double &tfirst,
167 const double &tlast);
168
179double current_temp(
180 double &kinetic,
181 const int &natom,
182 const int &frozen_freedom,
183 const double *allmass,
184 const ModuleBase::Vector3<double> *vel);
185double current_temp(double &kinetic, const MDCell &mdcell, const std::int64_t &frozen_freedom);
186std::int64_t global_dof(const MDCell &mdcell);
187
188void current_md_info(
189 const MDCell &mdcell,
190 const std::string &file_dir,
191 int &md_step,
192 double &temperature);
193
194} // namespace MD_func
195
196#endif // MD_FUNC_H
Domain decomposition for distributed and single-domain neighbor input.
Definition dom_decomp.h:32
Definition parameter.h:16
base functions in md
Definition md_func.cpp:15
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:535
double gaussrand()
generate a Gaussian random number
Definition md_func.cpp:17
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:524
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:490
double kinetic_energy(const int &natom, const ModuleBase::Vector3< double > *vel, const double *allmass)
calculate the ionic kinetic energy
Definition md_func.cpp:49
void current_md_info(const MDCell &mdcell, const std::string &file_dir, int &md_step, double &temperature)
Definition md_func.cpp:609
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:148
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:124
void read_vel(const UnitCell &unit_in, ModuleBase::Vector3< double > *vel)
read in atomic velocities from STRU
Definition md_func.cpp:96
void print_stress(std::ofstream &ofs, const ModuleBase::matrix &virial, const ModuleBase::matrix &stress)
output the stress information
Definition md_func.cpp:441
void compute_stress(const MDCell &mdcell, const bool &cal_stress, const ModuleBase::matrix &virial, ModuleBase::matrix &stress)
calculate the total stress tensor
Definition md_func.cpp:62
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
Definition md_func.cpp:373
std::int64_t global_dof(const MDCell &mdcell)
Definition md_func.cpp:570
void init_vel(MDCell &mdcell, const bool &init_vel, const bool &restart, double &temperature, std::int64_t &frozen_freedom)
Definition md_func.cpp:206