-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathimprop.cpp
More file actions
114 lines (90 loc) · 3.16 KB
/
Copy pathimprop.cpp
File metadata and controls
114 lines (90 loc) · 3.16 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
#include "ff/evalence.h"
#include "test.h"
#include "testrt.h"
using namespace tinker;
TEST_CASE("Improp-Trpcage-Charmm19", "[ff][eimprop][trpcage]")
{
const char* k1 = "test_trpcage.key";
const char* k2 = "impropterm only\n";
const char* x1 = "test_trpcage.xyz";
TestFile fke(TINKER9_DIRSTR "/test/file/trpcage/trp_charmm.key", k1, k2);
TestFile fxy(TINKER9_DIRSTR "/test/file/trpcage/trp_charmm.xyz", x1);
TestFile fpr(TINKER9_DIRSTR "/test/file/commit_4f11c0d4/charmm19.prm");
TestReference r(TINKER9_DIRSTR "/test/ref/improp.1.txt");
auto ref_e = r.getEnergy();
auto ref_v = r.getVirial();
auto ref_count = r.getCount();
auto ref_g = r.getGradient();
const double eps_e = testGetEps(0.0001, 0.0001);
const double eps_g = testGetEps(0.0003, 0.0001);
const double eps_v = testGetEps(0.001, 0.001);
const char* argv[] = {"dummy", x1};
int argc = 2;
testBeginWithArgs(argc, argv);
rc_flag = calc::xyz | calc::vmask;
initialize();
energy(calc::v3);
COMPARE_REALS(esum, ref_e, eps_e);
COMPARE_INTS(niprop, ref_count);
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::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("Improp-BDNA3-Charmm36", "[ff][eimprop][bdna3]")
{
const char* k1 = "test_bdna3.key";
const char* k2 = "impropterm only\n";
const char* x1 = "test_bdna3.xyz";
TestFile fke(TINKER9_DIRSTR "/test/file/bdna3/bdna3.key", k1, k2);
TestFile fxy(TINKER9_DIRSTR "/test/file/bdna3/bdna3.xyz", x1);
TestFile fpr(TINKER9_DIRSTR "/test/file/commit_4f11c0d4/charmm36m.prm");
TestReference r(TINKER9_DIRSTR "/test/ref/improp.2.txt");
auto ref_e = r.getEnergy();
auto ref_v = r.getVirial();
auto ref_count = r.getCount();
auto ref_g = r.getGradient();
const double eps_e = testGetEps(0.0001, 0.0001);
const double eps_g = testGetEps(0.001, 0.0001);
const double eps_v = testGetEps(0.001, 0.001);
const char* argv[] = {"dummy", x1};
int argc = 2;
testBeginWithArgs(argc, argv);
rc_flag = calc::xyz | calc::vmask;
initialize();
energy(calc::v3);
COMPARE_REALS(esum, ref_e, eps_e);
COMPARE_INTS(niprop, ref_count);
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::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();
}