ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
vdwd2.h
Go to the documentation of this file.
1//==========================================================
2// AUTHOR : Peize Lin
3// DATE : 2014-04-25
4// UPDATE : 2019-04-26
5//==========================================================
6
7#ifndef VDWD2_H
8#define VDWD2_H
9
10#include "vdw.h"
11#include "vdwd2_parameters.h"
12
13namespace vdw
14{
15
16class Vdwd2 : public Vdw
17{
18
19 public:
20 Vdwd2(const UnitCell &unit_in) : Vdw(unit_in) {}
21
22 ~Vdwd2() = default;
23
25 const Vdwd2Parameters &parameter() const { return para_; }
26
27 private:
29
30 void evaluate_impl(const VdwRequest &request, VdwResult &result) override;
31
32 template <typename F>
33 void index_loops(F &&f)
34 {
35 int xidx = para_.period().x / 2;
36 int yidx = para_.period().y / 2;
37 int zidx = para_.period().z / 2;
38
39 for (int it1 = 0; it1 < ucell_.ntype; ++it1)
40 {
41 if (ucell_.atoms[it1].flag_empty_element)
42 {
43 continue;
44 }
45 for (int it2 = 0; it2 < ucell_.ntype; ++it2)
46 {
47 if (ucell_.atoms[it2].flag_empty_element)
48 {
49 continue;
50 }
51 const double C6_product =
52 sqrt(para_.C6().at(ucell_.atoms[it1].ncpp.psd) * para_.C6().at(ucell_.atoms[it2].ncpp.psd)) /
53 pow(ucell_.lat0, 6);
54 const double R0_sum =
55 (para_.R0().at(ucell_.atoms[it1].ncpp.psd) + para_.R0().at(ucell_.atoms[it2].ncpp.psd)) /
56 ucell_.lat0;
57 if (!R0_sum)
58 {
59 ModuleBase::WARNING_QUIT("Input", "R0_sum can not be 0");
60 }
61 for (int ia1 = 0; ia1 != ucell_.atoms[it1].na; ++ia1)
62 {
63 const ModuleBase::Vector3<double> tau1 = ucell_.atoms[it1].tau[ia1];
64 for (int ia2 = 0; ia2 != ucell_.atoms[it2].na; ++ia2)
65 {
67 for (ilat_loop.x = -xidx; ilat_loop.x <= xidx; ++ilat_loop.x)
68 {
69 for (ilat_loop.y = -yidx; ilat_loop.y <= yidx; ++ilat_loop.y)
70 {
71 for (ilat_loop.z = -zidx; ilat_loop.z <= zidx; ++ilat_loop.z)
72 {
73 if ((!(ilat_loop.x || ilat_loop.y || ilat_loop.z)) && (it1 == it2) && (ia1 == ia2))
74 {
75 continue;
76 }
78 ucell_.atoms[it2].tau[ia2] + ilat_loop * ucell_.latvec;
79 const double r_sqr = (tau1 - tau2).norm2();
80 const double r = sqrt(r_sqr);
81 f(r, R0_sum, C6_product, r_sqr, it1, ia1, tau1, tau2);
82 }
83 }
84 }
85 }
86 }
87 }
88 }
89 }
90};
91
92} // namespace vdw
93
94#endif // VDWD2_H
3 elements vector
Definition vector3.h:21
T x
Definition vector3.h:23
T y
Definition vector3.h:24
T z
Definition vector3.h:25
Provide the basic information about unitcell.
Definition unitcell.h:16
const UnitCell & ucell_
Definition vdw.h:55
Vdw(const UnitCell &unit_in)
Definition vdw.h:43
Definition vdwd2_parameters.h:20
~Vdwd2()=default
const Vdwd2Parameters & parameter() const
Definition vdwd2.h:25
Vdwd2Parameters para_
Definition vdwd2.h:28
Vdwd2(const UnitCell &unit_in)
Definition vdwd2.h:20
Vdwd2Parameters & parameter()
Definition vdwd2.h:24
void index_loops(F &&f)
Definition vdwd2.h:33
void evaluate_impl(const VdwRequest &request, VdwResult &result) override
Definition vdwd2.cpp:17
void WARNING_QUIT(const std::string &, const std::string &)
Combine the functions of WARNING and QUIT.
Definition test_delley.cpp:15
Definition esolver_fp.h:18
Definition vdw.h:22
Definition vdw.h:30