ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
vdw.h
Go to the documentation of this file.
1#ifndef VDW_H
2#define VDW_H
3
6
7#include <fstream>
8#include <memory>
9#include <utility>
10#include <vector>
11
12namespace vdw
13{
14
15template <typename T, typename... Args>
16std::unique_ptr<T> make_unique_compat(Args &&...args)
17{
18 return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
19}
20
22{
23 VdwRequest(const bool force_in, const bool stress_in) : force(force_in), stress(stress_in) {}
24
25 bool force;
26 bool stress;
27};
28
30{
31 VdwResult() : energy(0.0), has_force(false), has_stress(false) { stress.Zero(); }
32
33 double energy;
34 std::vector<ModuleBase::Vector3<double>> force;
38};
39
40class Vdw
41{
42 public:
43 Vdw(const UnitCell &unit_in) : ucell_(unit_in) {}
44
45 virtual ~Vdw() = default;
46
48 {
49 VdwResult result;
50 evaluate_impl(request, result);
51 return result;
52 }
53
54 protected:
56
57 virtual void evaluate_impl(const VdwRequest &request, VdwResult &result) = 0;
58};
59
68std::unique_ptr<Vdw> make_vdw(const UnitCell &ucell, const Input_para &input, std::ofstream *plog = nullptr);
69
70} // namespace vdw
71
72#endif // VDW_H
3x3 matrix and related mathamatical operations
Definition matrix3.h:15
Provide the basic information about unitcell.
Definition unitcell.h:16
virtual void evaluate_impl(const VdwRequest &request, VdwResult &result)=0
const UnitCell & ucell_
Definition vdw.h:55
virtual ~Vdw()=default
VdwResult evaluate(const VdwRequest &request)
Definition vdw.h:47
Vdw(const UnitCell &unit_in)
Definition vdw.h:43
#define T
Definition exp.cpp:237
Definition esolver_fp.h:18
std::unique_ptr< Vdw > make_vdw(const UnitCell &ucell, const Input_para &input, std::ofstream *plog)
make vdw correction object
Definition vdw.cpp:48
std::unique_ptr< T > make_unique_compat(Args &&...args)
Definition vdw.h:16
Definition input_parameter.h:13
Definition vdw.h:22
VdwRequest(const bool force_in, const bool stress_in)
Definition vdw.h:23
bool force
Definition vdw.h:25
bool stress
Definition vdw.h:26
Definition vdw.h:30
bool has_force
Definition vdw.h:36
bool has_stress
Definition vdw.h:37
std::vector< ModuleBase::Vector3< double > > force
Definition vdw.h:34
double energy
Definition vdw.h:33
VdwResult()
Definition vdw.h:31
ModuleBase::Matrix3 stress
Definition vdw.h:35
Input_para input
Definition test_io_sys_var.cpp:58