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 ffx.algorithms.misc.AlgorithmsTest;
41 import ffx.numerics.estimator.FreeEnergyDifferenceReporter;
42 import org.junit.Assert;
43 import org.junit.Test;
44
45 public class BARSingleTopologyTest extends AlgorithmsTest {
46
47
48
49
50
51 public void testBAR() {
52
53 if (!ffxOpenMM) {
54 return;
55 }
56
57
58 String filepath = getResourcePath("testBar/singleTopology/dimethylphosphate.10.xyz");
59 String[] args = {"-t", "298", "--nw", "8", "--ac", "1-13", filepath};
60 binding.setVariable("args", args);
61
62 BAR bar = new BAR(binding).run();
63 algorithmsScript = bar;
64
65 FreeEnergyDifferenceReporter reporter = bar.getReporter();
66
67 double expectedFepFor = -54.3012;
68 double actualFepFor = reporter.getForwardTotalFEDifference();
69 Assert.assertEquals(expectedFepFor, actualFepFor, 0.2);
70
71 double expectedFepBack = -52.9186;
72 double actualFepBack = reporter.getBackwardTotalFEDifference();
73 Assert.assertEquals(expectedFepBack, actualFepBack, 0.2);
74
75 double expectedhFor = -32.0327;
76 double actualhFor = reporter.getForwardTotalEnthalpyChange();
77 Assert.assertEquals(expectedhFor, actualhFor, 7);
78
79 double expectedhBack = 52.9186;
80 double actualhBack = reporter.getBackwardTotalEnthalpyChange();
81 Assert.assertEquals(expectedhBack, actualhBack, 0.1);
82
83 double expectedhBAR = 14.6302;
84 double actualhBAR = reporter.getBarBSTotalEnthalpyChange();
85 Assert.assertEquals(expectedhBAR, actualhBAR, 1);
86
87 double expectedBARIteration = -53.3234;
88 double actualBARIteration = reporter.getBarIterTotalFEDiff();
89 Assert.assertEquals(expectedBARIteration, actualBARIteration, 0.1);
90
91 double expectedBARBootstrap = -53.3224;
92 double actualBARBootstrap = reporter.getBarBSTotalFEDiff();
93 Assert.assertEquals(expectedBARBootstrap, actualBARBootstrap, 0.2);
94 }
95
96 @Test
97 public void testBARHelp() {
98 String[] args = {"-h"};
99 binding.setVariable("args", args);
100
101
102 BAR bar = new BAR(binding).run();
103 algorithmsScript = bar;
104 }
105
106 }