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.numerics.multipole;
39
40 import static org.junit.Assert.assertEquals;
41
42 import java.util.Arrays;
43 import java.util.Collection;
44
45 import ffx.utilities.FFXTest;
46 import org.junit.Test;
47 import org.junit.runner.RunWith;
48 import org.junit.runners.Parameterized;
49 import org.junit.runners.Parameterized.Parameters;
50
51
52
53
54
55
56
57 @RunWith(Parameterized.class)
58 public class MultipoleTensorTest extends FFXTest {
59
60 private final int order;
61 private final int tensorCount;
62 private final String info;
63
64
65 protected static final double[] xyz = {2.97338529, 0.0, 0.03546452, 0.0};
66
67 protected final static double[] Qi = {-0.51966,
68 0.06979198988239577, 0.0, 0.0289581620819011,
69 0.024871041044109393, -0.1170771231287098, 0.09220608208460039,
70 0.0, -0.03374891685535346, 0.0};
71
72 protected final static double[] Qk = {-0.51966,
73 0.05872406108747119, 0.0, 0.047549780780788455,
74 0.048623413357888695, -0.1170771231287098, 0.06845370977082109,
75 0.0, -0.04662811558421081, 0.0};
76
77
78 protected final static double permanentEnergy = 0.08861401274679;
79 protected final static double[] permTorqueI = {0.0, 0.00039200904382, 0.0};
80 protected final static double[] permTorqueK = {0.0, -0.00400122461628, 0.0};
81
82 protected final static double permanentEnergyEwald = 0.001275693067120;
83 protected final static double[] permTorqueIEwald = {0.0, -0.000304652548761, 0.0};
84 protected final static double[] permTorqueKEwald = {0.0, -0.000745949268609, 0.0};
85
86
87 protected final static double scaleMutual = 1.0;
88 protected final static double[] Ui = {0.04886563833303603, 0.0, -0.0018979726219775425};
89 protected final static double[] Uk = {-0.040839567654139396, 0.0, -5.982126263609587E-4};
90 protected final static double polarizationEnergyCoulomb = -0.002576831234958;
91 protected final static double[] polarGradICoulomb = {-0.003233364149133, 0.0, 0.000081374809911};
92 protected final static double[] polarTorqueICoulomb = {0.0, 0.000015759704950, 0.0};
93 protected final static double[] polarTorqueKCoulomb = {0.0, 0.000340863064066, 0.0};
94
95 protected final static double polarizationEnergyThole = 0.000000036672468;
96 protected final static double[] polarGradIThole = {0.000001005045968, 0.0, 0.000000090221488};
97 protected final static double[] polarTorqueIThole = {0.0, 0.000000072500602, 0.0};
98 protected final static double[] polarTorqueKThole = {0.0, 0.000000151677615, 0.0};
99
100
101 protected final static double[] UiEwald = {0.017212550663556914, 0.0, 0.0026849371538929636};
102 protected final static double[] UkEwald = {0.0020051189004858657, 0.0, 0.005476556978973183};
103 protected final static double polarizationEnergyEwald = -0.000078870483232;
104 protected final static double[] polarGradIEwald = {-0.000345793382509, 0.0, 0.000025382496373};
105 protected final static double[] polarTorqueIEwald = {0.0, -0.000003385814434, 0.0};
106 protected final static double[] polarTorqueKEwald = {0.0, 0.000080790360336, 0.0};
107
108 public MultipoleTensorTest(String info, int order) {
109 this.info = info;
110 this.order = order;
111 this.tensorCount = MultipoleTensor.tensorCount(order);
112 }
113
114 @Parameters
115 public static Collection<Object[]> data() {
116 return Arrays.asList(
117 new Object[][] {
118 {
119 "Order 6", 6
120 },
121 {
122 "Order 5", 5
123 },
124 {
125 "Order 4", 4
126 }
127 });
128 }
129
130
131
132
133
134
135 @Test
136 public void tensorCountTest() {
137 int result = MultipoleTensor.tensorCount(order);
138 assertEquals(info, tensorCount, result);
139 }
140
141
142 @Test
143 public void tensorIndexTest() {
144 int dx = 1;
145 int dy = 0;
146 int dz = 0;
147 int expResult = 1;
148 int result = MultipoleTensor.ti(dx, dy, dz, order);
149 assertEquals(info, expResult, result);
150 }
151
152 }