-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathdisp.cpp
More file actions
116 lines (92 loc) · 3.17 KB
/
Copy pathdisp.cpp
File metadata and controls
116 lines (92 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "ff/hippo/edisp.h"
#include "test.h"
#include "testrt.h"
using namespace tinker;
TEST_CASE("EDISP-1-NONDEWALD", "[ff][hippo][edisp][nondewald]")
{
TestFile fx1(TINKER9_DIRSTR "/test/file/c5h12acnh2/c5h12acnh2.xyz");
TestFile fk1(TINKER9_DIRSTR "/test/file/disp/ndewald.key");
TestFile fp1(TINKER9_DIRSTR "/test/file/disp/hippo19.prm");
const char* xn = "c5h12acnh2.xyz";
const char* kn = "ndewald.key";
const char* argv[] = {"dummy", xn, "-k", kn};
int argc = 4;
const double eps_e = testGetEps(0.0001, 0.0001);
const double eps_g = testGetEps(0.0001, 0.0001);
const double eps_v = testGetEps(0.001, 0.001);
TestReference r(TINKER9_DIRSTR "/test/ref/disp.1.txt");
auto ref_c = r.getCount();
auto ref_e = r.getEnergy();
auto ref_v = r.getVirial();
auto ref_g = r.getGradient();
rc_flag = calc::xyz | calc::vmask;
testBeginWithArgs(argc, argv);
initialize();
energy(calc::v0);
COMPARE_REALS(esum, ref_e, eps_e);
energy(calc::v1);
COMPARE_REALS(esum, ref_e, eps_e);
COMPARE_GRADIENT(ref_g, eps_g);
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
COMPARE_REALS(vir[i * 3 + j], ref_v[i][j], eps_v);
energy(calc::v3);
COMPARE_REALS(esum, ref_e, eps_e);
COMPARE_INTS(countReduce(ndisp), ref_c);
energy(calc::v4);
COMPARE_REALS(esum, ref_e, eps_e);
COMPARE_GRADIENT(ref_g, eps_g);
energy(calc::v5);
COMPARE_GRADIENT(ref_g, eps_g);
energy(calc::v6);
COMPARE_GRADIENT(ref_g, eps_g);
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
COMPARE_REALS(vir[i * 3 + j], ref_v[i][j], eps_v);
finish();
testEnd();
}
TEST_CASE("EDISP-2-DEWALD", "[ff][hippo][edisp][dewald]")
{
TestFile fx1(TINKER9_DIRSTR "/test/file/c5h12acnh2/c5h12acnh2.xyz");
TestFile fk1(TINKER9_DIRSTR "/test/file/disp/dewald.key");
TestFile fp1(TINKER9_DIRSTR "/test/file/disp/hippo19.prm");
const char* xn = "c5h12acnh2.xyz";
const char* kn = "dewald.key";
const char* argv[] = {"dummy", xn, "-k", kn};
int argc = 4;
const double eps_e = testGetEps(0.0030, 0.0001);
const double eps_g = testGetEps(0.0006, 0.0001);
const double eps_v = testGetEps(0.0065, 0.001);
TestReference r(TINKER9_DIRSTR "/test/ref/disp.2.txt");
auto ref_c = r.getCount();
auto ref_e = r.getEnergy();
auto ref_v = r.getVirial();
auto ref_g = r.getGradient();
rc_flag = calc::xyz | calc::vmask;
testBeginWithArgs(argc, argv);
initialize();
energy(calc::v0);
COMPARE_REALS(esum, ref_e, eps_e);
energy(calc::v1);
COMPARE_REALS(esum, ref_e, eps_e);
COMPARE_GRADIENT(ref_g, eps_g);
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
COMPARE_REALS(vir[i * 3 + j], ref_v[i][j], eps_v);
energy(calc::v3);
COMPARE_REALS(esum, ref_e, eps_e);
COMPARE_INTS(countReduce(ndisp), ref_c);
energy(calc::v4);
COMPARE_REALS(esum, ref_e, eps_e);
COMPARE_GRADIENT(ref_g, eps_g);
energy(calc::v5);
COMPARE_GRADIENT(ref_g, eps_g);
energy(calc::v6);
COMPARE_GRADIENT(ref_g, eps_g);
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
COMPARE_REALS(vir[i * 3 + j], ref_v[i][j], eps_v);
finish();
testEnd();
}