ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
lj_forcefield.h
Go to the documentation of this file.
1#ifndef SOURCE_MD_MODULE_LJ_LJ_FORCEFIELD_H
2#define SOURCE_MD_MODULE_LJ_LJ_FORCEFIELD_H
3
7
8#include <iosfwd>
9#include <string>
10#include <vector>
11
12namespace ModuleMD
13{
14
15class LJ : public ForceField
16{
17 public:
18 LJ(const std::string &output_dir, std::ofstream &running_log);
19
20 void initialize(BaseCell &cell, const Input_para &inp) override;
21 void compute(
22 BaseCell &cell,
23 double &energy,
24 ModuleBase::matrix &force,
25 ModuleBase::matrix &stress) override;
26
27 //====================================================================
28 // Test seam.
29 //
30 // initialize() derives the LJ tables in three steps. The unit tests
31 // drive each step on its own and check the table it produced, so the steps
32 // and the tables are reachable here rather than by reinterpreting the access
33 // specifiers.
34 //
35 // Production code must keep going through initialize(); nothing
36 // outside the tests should call the *_for_testing() wrappers.
37 //====================================================================
38
40 double get_search_radius() const { return search_radius; }
42 const ModuleBase::matrix &get_lj_rcut() const { return lj_rcut; }
44 const ModuleBase::matrix &get_lj_c6() const { return lj_c6; }
46 const ModuleBase::matrix &get_lj_c12() const { return lj_c12; }
48 const ModuleBase::matrix &get_en_shift() const { return en_shift; }
49 void rcut_search_radius_for_testing(const int &ntype, const std::vector<double> &rcut)
50 {
51 rcut_search_radius(ntype, rcut);
52 }
54 const int &ntype,
55 const int &rule,
56 const std::vector<double> &epsilon,
57 const std::vector<double> &sigma)
58 {
59 set_c6_c12(ntype, rule, epsilon, sigma);
60 }
61 void cal_en_shift_for_testing(const int &ntype, const bool &is_shift) { cal_en_shift(ntype, is_shift); }
62
63 private:
64 std::string output_dir_;
65 std::ofstream &running_log_;
66 double LJ_energy(const double &d, const int &i, const int &j) const;
67
68 ModuleBase::Vector3<double> LJ_force(const ModuleBase::Vector3<double> &dr, const int &i, const int &j) const;
69
70 void rcut_search_radius(const int &ntype, const std::vector<double> &rcut);
71
72 void set_c6_c12(
73 const int &ntype,
74 const int &rule,
75 const std::vector<double> &epsilon,
76 const std::vector<double> &sigma);
77
78 void cal_en_shift(const int &ntype, const bool &is_shift);
79
80 double search_radius = -1.0;
85};
86} // namespace ModuleMD
87#endif
Definition basecell.h:9
3 elements vector
Definition vector3.h:21
Definition matrix.h:15
Definition forcefield.h:16
void cal_en_shift(const int &ntype, const bool &is_shift)
Definition lj_forcefield.cpp:335
void set_c6_c12(const int &ntype, const int &rule, const std::vector< double > &epsilon, const std::vector< double > &sigma)
Definition lj_forcefield.cpp:258
const ModuleBase::matrix & get_lj_rcut() const
per-type-pair cutoff radii
Definition lj_forcefield.h:42
std::ofstream & running_log_
Definition lj_forcefield.h:65
ModuleBase::matrix en_shift
Definition lj_forcefield.h:84
const ModuleBase::matrix & get_lj_c12() const
per-type-pair c12 coefficients
Definition lj_forcefield.h:46
double search_radius
Definition lj_forcefield.h:80
void initialize(BaseCell &cell, const Input_para &inp) override
Definition lj_forcefield.cpp:25
void cal_en_shift_for_testing(const int &ntype, const bool &is_shift)
Definition lj_forcefield.h:61
void set_c6_c12_for_testing(const int &ntype, const int &rule, const std::vector< double > &epsilon, const std::vector< double > &sigma)
Definition lj_forcefield.h:53
std::string output_dir_
Definition lj_forcefield.h:64
ModuleBase::matrix lj_c12
Definition lj_forcefield.h:82
LJ(const std::string &output_dir, std::ofstream &running_log)
Definition lj_forcefield.cpp:21
ModuleBase::matrix lj_c6
Definition lj_forcefield.h:83
ModuleBase::matrix lj_rcut
Definition lj_forcefield.h:81
void rcut_search_radius_for_testing(const int &ntype, const std::vector< double > &rcut)
Definition lj_forcefield.h:49
double LJ_energy(const double &d, const int &i, const int &j) const
Definition lj_forcefield.cpp:202
const ModuleBase::matrix & get_lj_c6() const
per-type-pair c6 coefficients
Definition lj_forcefield.h:44
void compute(BaseCell &cell, double &energy, ModuleBase::matrix &force, ModuleBase::matrix &stress) override
Definition lj_forcefield.cpp:65
const ModuleBase::matrix & get_en_shift() const
per-type-pair energy shift at the cutoff
Definition lj_forcefield.h:48
ModuleBase::Vector3< double > LJ_force(const ModuleBase::Vector3< double > &dr, const int &i, const int &j) const
Definition lj_forcefield.cpp:211
double get_search_radius() const
neighbour search radius derived from the largest cutoff
Definition lj_forcefield.h:40
void rcut_search_radius(const int &ntype, const std::vector< double > &rcut)
Definition lj_forcefield.cpp:223
Definition esolver_forcefields.h:9
Definition input_parameter.h:13