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.potential.groovy;
39
40 import static org.apache.commons.math3.util.FastMath.floor;
41 import static org.apache.commons.math3.util.FastMath.random;
42 import static org.junit.Assert.assertEquals;
43
44 import ffx.potential.groovy.test.Gradient;
45 import ffx.potential.utils.PotentialTest;
46 import org.junit.Test;
47
48
49 public class VolumeTest extends PotentialTest {
50
51 private final double tolerance = 0.001;
52
53
54
55
56 @Test
57 public void testConnollyMolecularButane() {
58
59 String filepath = getResourcePath("butane.xyz");
60 String[] args = {"-c", "-p", "1.4", "-m", filepath};
61 binding.setVariable("args", args);
62
63 Volume volume = new Volume(binding).run();
64 potentialScript = volume;
65 assertEquals(79.85081214917432, volume.totalVolume, tolerance);
66 assertEquals(98.14422780202705, volume.totalSurfaceArea, tolerance);
67 }
68
69
70 @Test
71 public void testConnollyMolecularCrambin() {
72
73 String filepath = getResourcePath("crambin.xyz");
74 String[] args = {"-c", "-m", "-p", "1.4", filepath};
75 binding.setVariable("args", args);
76
77
78 Volume volume = new Volume(binding).run();
79 potentialScript = volume;
80 assertEquals(5222.628196815338, volume.totalVolume, tolerance);
81 assertEquals(2326.375086471378, volume.totalSurfaceArea, tolerance);
82 }
83
84
85
86
87 @Test
88 public void testConnollyMolecularEthylbenzene() {
89
90 String filepath = getResourcePath("ethylbenzene.xyz");
91 String[] args = {"-c", "-p", "1.4", "-m", filepath};
92 binding.setVariable("args", args);
93
94
95 Volume volume = new Volume(binding).run();
96 potentialScript = volume;
97 assertEquals(126.96932864947797, volume.totalVolume, tolerance);
98 assertEquals(137.7753894764906, volume.totalSurfaceArea, tolerance);
99 }
100
101
102
103
104 @Test
105 public void testConnollyMolecularHydrogenButane() {
106
107 String filepath = getResourcePath("butane.xyz");
108 String[] args = {"-c", "-p", "1.4", "-m", "-y", filepath};
109 binding.setVariable("args", args);
110
111
112 Volume volume = new Volume(binding).run();
113 potentialScript = volume;
114 assertEquals(119.0512090546068, volume.totalVolume, tolerance);
115 assertEquals(132.598010667639, volume.totalSurfaceArea, tolerance);
116 }
117
118
119 @Test
120 public void testConnollyMolecularHydrogenCrambin() {
121
122 String filepath = getResourcePath("crambin.xyz");
123 String[] args = {"-c", "-m", "-p", "1.4", "-y", filepath};
124 binding.setVariable("args", args);
125
126
127 Volume volume = new Volume(binding).run();
128 potentialScript = volume;
129 assertEquals(5890.028072142157, volume.totalVolume, tolerance);
130 assertEquals(2456.835858765312, volume.totalSurfaceArea, tolerance);
131 }
132
133
134 @Test
135 public void testConnollyMolecularHydrogenEthylbenzene() {
136
137 String filepath = getResourcePath("ethylbenzene.xyz");
138 String[] args = {"-c", "-p", "1.4", "-m", "-y", filepath};
139 binding.setVariable("args", args);
140
141
142 Volume volume = new Volume(binding).run();
143 potentialScript = volume;
144 assertEquals(165.83018235892447, volume.totalVolume, tolerance);
145 assertEquals(171.91980284282084, volume.totalSurfaceArea, tolerance);
146 }
147
148
149 @Test
150 public void testConnollySEVButane() {
151
152 String filepath = getResourcePath("butane.xyz");
153 String[] args = {"-c", "-p", "1.4", filepath};
154 binding.setVariable("args", args);
155
156
157 Volume volume = new Volume(binding).run();
158 potentialScript = volume;
159 assertEquals(302.0524178356785, volume.totalVolume, tolerance);
160 assertEquals(227.49657650050898, volume.totalSurfaceArea, tolerance);
161 }
162
163
164 @Test
165 public void testConnollySEVCrambin() {
166
167 String filepath = getResourcePath("crambin.xyz");
168 String[] args = {"-c", "-p", "1.4", filepath};
169 binding.setVariable("args", args);
170
171
172 Volume volume = new Volume(binding).run();
173 potentialScript = volume;
174 assertEquals(8956.620463626994, volume.totalVolume, tolerance);
175 assertEquals(3015.7687533888334, volume.totalSurfaceArea, tolerance);
176 }
177
178
179 @Test
180 public void testConnollySEVEthylbenzene() {
181
182 String filepath = getResourcePath("ethylbenzene.xyz");
183 String[] args = {"-c", "-p", "1.4", filepath};
184 binding.setVariable("args", args);
185
186
187 Volume volume = new Volume(binding).run();
188 potentialScript = volume;
189 assertEquals(418.96380636214514, volume.totalVolume, tolerance);
190 assertEquals(287.56961427851286, volume.totalSurfaceArea, tolerance);
191 }
192
193
194 @Test
195 public void testConnollySEVHydrogenButane() {
196
197 String filepath = getResourcePath("butane.xyz");
198 String[] args = {"-c", "-p", "1.4", "-y", filepath};
199 binding.setVariable("args", args);
200
201
202 Volume volume = new Volume(binding).run();
203 potentialScript = volume;
204 assertEquals(402.708673112844, volume.totalVolume, tolerance);
205 assertEquals(280.836964340470, volume.totalSurfaceArea, tolerance);
206 }
207
208
209 @Test
210 public void testConnollySEVHydrogenCrambin() {
211
212 String filepath = getResourcePath("crambin.xyz");
213 String[] args = {"-c", "-p", "1.4", "-y", filepath};
214 binding.setVariable("args", args);
215
216
217 Volume volume = new Volume(binding).run();
218 potentialScript = volume;
219 assertEquals(9804.262055253388, volume.totalVolume, tolerance);
220 assertEquals(3142.106787870207, volume.totalSurfaceArea, tolerance);
221 }
222
223
224 @Test
225 public void testConnollySEVHydrogenEthylbenzene() {
226
227 String filepath = getResourcePath("ethylbenzene.xyz");
228 String[] args = {"-c", "-p", "1.4", "-y", filepath};
229 binding.setVariable("args", args);
230
231
232 Volume volume = new Volume(binding).run();
233 potentialScript = volume;
234 assertEquals(518.612603965319, volume.totalVolume, tolerance);
235 assertEquals(340.264998320387, volume.totalSurfaceArea, tolerance);
236 }
237
238
239 @Test
240 public void testConnollySEVHydrogenEthylbenzeneDerivatives() {
241
242 String filepath = getResourcePath("ethylbenzene.xyz");
243 String[] args = {"--tol", "5.0e-2", filepath};
244 binding.setVariable("args", args);
245
246
247 Gradient gradient = new Gradient(binding).run();
248 potentialScript = gradient;
249 assertEquals("Ethylbenzene gradient failures: ", 0, gradient.nFailures);
250 }
251
252
253 @Test
254 public void testConnollyVDWCrambin() {
255
256 String filepath = getResourcePath("crambin.xyz");
257 String[] args = {"-c", "-p", "0.0", filepath};
258 binding.setVariable("args", args);
259
260
261 Volume volume = new Volume(binding).run();
262 potentialScript = volume;
263 assertEquals(4418.303482563956, volume.totalVolume, tolerance);
264 assertEquals(4168.547763834282, volume.totalSurfaceArea, tolerance);
265 }
266
267
268 @Test
269 public void testGaussVolButane() {
270
271 String filepath = getResourcePath("butane.xyz");
272 String[] args = {"-o", "0.4", filepath};
273 binding.setVariable("args", args);
274
275
276 Volume volume = new Volume(binding).run();
277 potentialScript = volume;
278 assertEquals(125.5120767378517, volume.totalVolume, tolerance);
279 assertEquals(134.50524040566165, volume.totalSurfaceArea, tolerance);
280 }
281
282
283 @Test
284 public void testGaussVolCrambin() {
285
286 String filepath = getResourcePath("crambin.xyz");
287 String[] args = {"-o", "0.0", filepath};
288 binding.setVariable("args", args);
289
290
291 Volume volume = new Volume(binding).run();
292 potentialScript = volume;
293 assertEquals(4371.667466648112, volume.totalVolume, tolerance);
294 assertEquals(3971.0619085859435, volume.totalSurfaceArea, tolerance);
295 }
296
297
298 @Test
299 public void testGaussVolCrambinDerivatives() {
300
301 System.setProperty("gkterm", "true");
302 System.setProperty("cavmodel", "gauss-disp");
303
304 int atomID = (int) floor(random() * 642) + 1;
305 String filepath = getResourcePath("crambin.xyz");
306 String[] args = {"--ga", Integer.toString(atomID), filepath};
307 binding.setVariable("args", args);
308
309
310 Gradient gradient = new Gradient(binding).run();
311 potentialScript = gradient;
312 assertEquals("Crambin gradient failures: ", 0, gradient.nFailures);
313 }
314
315
316 @Test
317 public void testGaussVolEthylbenzene() {
318
319 String filepath = getResourcePath("ethylbenzene.xyz");
320 String[] args = {"-o", "0.4", filepath};
321 binding.setVariable("args", args);
322
323
324 Volume volume = new Volume(binding).run();
325 potentialScript = volume;
326 assertEquals(194.44960348422916, volume.totalVolume, tolerance);
327 assertEquals(193.55314214639066, volume.totalSurfaceArea, tolerance);
328 }
329
330
331 @Test
332 public void testGaussVolHydrogenEthylbenzeneDerivatives() {
333
334 System.setProperty("gkterm", "true");
335 System.setProperty("cavmodel", "gauss-disp");
336
337 String filepath = getResourcePath("ethylbenzene.xyz");
338 String[] args = {filepath};
339 binding.setVariable("args", args);
340
341
342 Gradient gradient = new Gradient(binding).run();
343 potentialScript = gradient;
344 assertEquals("Ethylbenzene gradient failures: ", 0, gradient.nFailures);
345 }
346 }