Skip to content

Commit b1bf53d

Browse files
committed
added test for R1/R2
1 parent e5ed541 commit b1bf53d

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

tests/test_twomolecules.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ def test_R1(twomol_universe):
172172
"""Assert that the calculated value of R1 is correct."""
173173
u, group_H2O = twomol_universe
174174

175-
d_atoms = 8.0
176-
expected_gij = np.float32(np.round(1/d_atoms**6, 7))
177-
178175
nmrd_pbc = NMRD(
179176
u=u,
180177
atom_group=group_H2O,
@@ -191,14 +188,16 @@ def test_R1(twomol_universe):
191188
dt = (nmrd_pbc.t[1]-nmrd_pbc.t[0]) * cst.pico
192189

193190
# expected J
194-
J0_0 = np.mean(nmrd_pbc.gij) * dt * 2 * len(nmrd_pbc.t) # J in freq 0
191+
d_atoms = 8.0
192+
expected_gij = np.float32(np.round(1/d_atoms**6, 7))
193+
J0_0 = expected_gij * dt * 2 * len(nmrd_pbc.t) # J in freq 0
195194

196195
# expected R1
197196
R1_0 = prefactor * (J0_0 + 4 * J0_0) / 6
198197

199-
assert np.float32(np.round(nmrd_pbc.R1[0], 10)) == np.float32(np.round(R1_0, 10))
198+
assert np.float32(np.round(nmrd_pbc.R1[0], 9)) == np.float32(np.round(R1_0, 9))
200199

201200
# expected R2
202201
R2_0 = prefactor * (3/2 * J0_0 + (5/2) * J0_0 + J0_0) / 6
203202

204-
assert np.float32(np.round(nmrd_pbc.R2[0], 10)) == np.float32(np.round(R2_0, 10))
203+
assert np.float32(np.round(nmrd_pbc.R2[0], 9)) == np.float32(np.round(R2_0, 9))

0 commit comments

Comments
 (0)