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 BARDualTopologyTest extends AlgorithmsTest {
46
47
48
49
50
51 public void testBAR() {
52
53 if (!ffxOpenMM) {
54 return;
55 }
56
57 String hispath = getResourcePath("testBar/dualTopology/HIS_solv.20.xyz");
58 String hidpath = getResourcePath("testBar/dualTopology/HID_solv.20.xyz");
59
60
61 String[] args = {"-t", "298", "--nw", "8", "--ac", "28", hispath, hidpath};
62 binding.setVariable("args", args);
63
64 BAR bar = new BAR(binding).run();
65 algorithmsScript = bar;
66
67 System.out.println("after run");
68
69 FreeEnergyDifferenceReporter reporter = bar.getReporter();
70
71 double expectedFepFor = -36.4647;
72 double actualFepFor = reporter.getForwardTotalFEDifference();
73 Assert.assertEquals(expectedFepFor, actualFepFor, 0.7);
74
75 double expectedFepBack = -36.0005;
76 double actualFepBack = reporter.getBackwardTotalFEDifference();
77 Assert.assertEquals(expectedFepBack, actualFepBack, 0.7);
78
79 double expectedhFor = -8.7772;
80 double actualhFor = reporter.getForwardTotalEnthalpyChange();
81 Assert.assertEquals(expectedhFor, actualhFor, 70);
82
83 double expectedhBack = 27.7404;
84 double actualhBack = reporter.getBackwardTotalEnthalpyChange();
85 Assert.assertEquals(expectedhBack, actualhBack, 60);
86
87 double expectedhBAR = 14.188;
88 double actualhBAR = reporter.getBarBSTotalEnthalpyChange();
89 Assert.assertEquals(expectedhBAR, actualhBAR, 7);
90
91 double expectedBARIteration = -35.7346;
92 double actualBARIteration = reporter.getBarIterTotalFEDiff();
93 Assert.assertEquals(expectedBARIteration, actualBARIteration, 1.0);
94
95 double expectedBARBootstrap = -35.9829;
96 double actualBARBootstrap = reporter.getBarBSTotalFEDiff();
97 Assert.assertEquals(expectedBARBootstrap, actualBARBootstrap, 1.0);
98 }
99
100 @Test
101 public void testBARHelp() {
102 String[] args = {"-h"};
103 binding.setVariable("args", args);
104
105
106 BAR bar = new BAR(binding).run();
107 algorithmsScript = bar;
108 }
109
110 }