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 package ffx.algorithms.groovy;
39
40 import static org.junit.Assert.assertEquals;
41
42 import ffx.algorithms.misc.AlgorithmsTest;
43 import org.junit.Test;
44
45
46
47
48
49
50
51 public class ManyBodyTest extends AlgorithmsTest {
52
53
54
55
56
57 @Test
58 public void testManyBodyBoxOptimization() {
59
60 String[] args = {
61 "-a", "5",
62 "-L", "2",
63 "--bL", "10",
64 "--bB", "2",
65 "--tC", "2",
66 "--pr", "2",
67 getResourcePath("5awl.pdb")
68 };
69 binding.setVariable("args", args);
70 binding.setVariable("baseDir", registerTemporaryDirectory().toFile());
71
72
73 ManyBody manyBody = new ManyBody(binding).run();
74 algorithmsScript = manyBody;
75
76 double expectedTotalPotential = -221.0842558097416;
77 double actualTotalPotential = manyBody.getPotential().getTotalEnergy();
78 assertEquals(expectedTotalPotential, actualTotalPotential, 1E-7);
79
80 double expectedApproximateEnergy = -216.93107790352414;
81 double actualApproximateEnergy = manyBody.getManyBodyOptions().getApproximate();
82 assertEquals(expectedApproximateEnergy, actualApproximateEnergy, 1E-7);
83 }
84
85
86
87
88
89
90 @Test
91 public void testManyBodyBoxRestart() {
92
93 String[] args = {
94 "-a", "5",
95 "--bL", "10",
96 "--tC", "1.5",
97 "-T", "--thC",
98 "1.5", "--eR",
99 getResourcePath("5awl.box.restart"),
100 getResourcePath("5awl.pdb")
101 };
102 binding.setVariable("args", args);
103 binding.setVariable("baseDir", registerTemporaryDirectory().toFile());
104
105
106 ManyBody manyBody = new ManyBody(binding).run();
107 algorithmsScript = manyBody;
108
109 double expectedTotalPotential = -221.0842558097416;
110 double actualTotalPotential =
111 manyBody.getPotential().getTotalEnergy();
112 assertEquals(expectedTotalPotential, actualTotalPotential, 1E-7);
113
114 double expectedApproximateEnergy = -220.31899441275732;
115 double actualApproximateEnergy = manyBody.getManyBodyOptions().getApproximate();
116 assertEquals(expectedApproximateEnergy, actualApproximateEnergy, 1E-7);
117 }
118
119 @Test
120 public void testManyBodyGlobal() {
121
122 String[] args = {
123 "-a", "2", "-L", "2", "--tC", "2",
124 getResourcePath("5awl.pdb")
125 };
126 binding.setVariable("args", args);
127 binding.setVariable("baseDir", registerTemporaryDirectory().toFile());
128
129
130 ManyBody manyBody = new ManyBody(binding).run();
131 algorithmsScript = manyBody;
132
133
134 manyBody.run();
135 double expectedTotalPotential = -221.0842558097416;
136 double actualTotalPotential = manyBody.getPotential().getTotalEnergy();
137 assertEquals(expectedTotalPotential, actualTotalPotential, 1E-5);
138
139 double expectedApproximateEnergy = -212.4798252638091;
140 double actualApproximateEnergy = manyBody.getManyBodyOptions().getApproximate();
141 assertEquals(expectedApproximateEnergy, actualApproximateEnergy, 1E-5);
142
143
144 manyBody.getManyBodyOptions().getRestartFile().delete();
145 }
146
147 @Test
148 public void testManyBodyHelp() {
149
150 String[] args = {"-h"};
151 binding.setVariable("args", args);
152
153
154 ManyBody manyBody = new ManyBody(binding).run();
155 algorithmsScript = manyBody;
156 }
157
158
159
160
161
162
163 @Test
164 public void testManyBodyMonteCarlo() {
165
166
167 System.setProperty("polarization", "direct");
168 System.setProperty("manybody-testing", "true");
169 System.setProperty("manybody-testing-mc", "true");
170
171
172 String[] args = {
173 "-a", "2",
174 "-L", "2",
175 "--tC", "2",
176 "--pr", "2",
177 "--mC", "100",
178 getResourcePath("5awl.pdb")
179 };
180 binding.setVariable("args", args);
181 binding.setVariable("baseDir", registerTemporaryDirectory().toFile());
182
183
184 ManyBody manyBody = new ManyBody(binding);
185 algorithmsScript = manyBody;
186 manyBody.run();
187
188 double expectedTotalPotential = -204.72742343060315;
189 double actualTotalPotential = manyBody.getPotential().getTotalEnergy();
190 assertEquals(expectedTotalPotential, actualTotalPotential, 1E-5);
191
192 double expectedApproximateEnergy = -195.16120410395288;
193 double actualApproximateEnergy = manyBody.getManyBodyOptions().getApproximate();
194 assertEquals(expectedApproximateEnergy, actualApproximateEnergy, 1E-5);
195
196
197 manyBody.getManyBodyOptions().getRestartFile().delete();
198 }
199
200
201
202
203
204 @Test
205 public void testManyBodyRestart() {
206
207 String[] args = {"-a", "2", "-L", "2", "--tC", "1.5", "-T", "--thC", "1.5", "--eR",
208 getResourcePath("5awl.test.restart"),
209 getResourcePath("5awl.pdb")
210 };
211 binding.setVariable("args", args);
212 binding.setVariable("baseDir", registerTemporaryDirectory().toFile());
213
214
215 ManyBody manyBody = new ManyBody(binding).run();
216 algorithmsScript = manyBody;
217
218 double expectedTotalPotential = -220.14890239220347;
219 double actualTotalPotential = manyBody.getPotential().getTotalEnergy();
220 assertEquals(expectedTotalPotential, actualTotalPotential, 1E-5);
221
222 double expectedApproximateEnergy = -290.57260490705966;
223 double actualApproximateEnergy = manyBody.getManyBodyOptions().getApproximate();
224 assertEquals(expectedApproximateEnergy, actualApproximateEnergy, 1E-5);
225 }
226
227 @Test
228 public void testManyBodyTitration() {
229
230 String[] args = {"--pH","7.0","--eR",
231 getResourcePath("DEHK.rot.restart"),
232 getResourcePath("DEHK.rot.pdb")
233 };
234 binding.setVariable("args", args);
235 binding.setVariable("baseDir", registerTemporaryDirectory().toFile());
236
237
238 ManyBody manyBody = new ManyBody(binding).run();
239 algorithmsScript = manyBody;
240
241 double expectedTotalPotential = -93.18377835710643;
242 double actualTotalPotential = manyBody.getPotential().getTotalEnergy();
243 assertEquals(expectedTotalPotential, actualTotalPotential, 1E-5);
244
245 double expectedApproximateEnergy = -179.5339377645139;
246 double actualApproximateEnergy = manyBody.getManyBodyOptions().getApproximate();
247
248 assertEquals(expectedApproximateEnergy, actualApproximateEnergy, 1E-0);
249 }
250
251 }