Skip to content

Commit 336ff1d

Browse files
committed
Add gromacs-2016 in the TPR test suite
Gromacs-2016 bumps the version of the TPR files. This commit adds the files needed to test the support of that new TPR version, and include the files in the test suite. 2lyz_gmx_2016.tpr was build from 2lyz_gmx_5.1.tpr using echo 0 | gmx convert-tpr -s 2lyz_gmx_5.1.tpr -o 2lyz_gmx_206.tpr dummy_2016.tpr was build using gmx grompp on the source files in data/tprs/all_bonded.
1 parent b375b4b commit 336ff1d

File tree

4 files changed

+40
-27
lines changed

4 files changed

+40
-27
lines changed
521 KB
Binary file not shown.
4.17 KB
Binary file not shown.

testsuite/MDAnalysisTests/datafiles.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
"PDB_xlserial",
5959
"TPR400", "TPR402", "TPR403", "TPR404", "TPR405", "TPR406", "TPR407",
6060
"TPR450", "TPR451", "TPR452", "TPR453", "TPR454", "TPR455", "TPR455Double",
61-
"TPR460", "TPR461", "TPR502", "TPR504", "TPR505", "TPR510",
62-
"TPR510_bonded",
61+
"TPR460", "TPR461", "TPR502", "TPR504", "TPR505", "TPR510", "TPR2016",
62+
"TPR510_bonded", "TPR2016_bonded",
6363
"PDB_sub_sol", "PDB_sub_dry", # TRRReader sub selection
6464
"TRR_sub_sol",
6565
"XTC_sub_sol",
@@ -214,12 +214,14 @@
214214
TPR504 = resource_filename(__name__, 'data/tprs/2lyz_gmx_5.0.4.tpr')
215215
TPR505 = resource_filename(__name__, 'data/tprs/2lyz_gmx_5.0.5.tpr')
216216
TPR510 = resource_filename(__name__, 'data/tprs/2lyz_gmx_5.1.tpr')
217+
TPR2016 = resource_filename(__name__, 'data/tprs/2lyz_gmx_2016.tpr')
217218
# double precision
218219
TPR455Double = resource_filename(__name__, 'data/tprs/drew_gmx_4.5.5.double.tpr')
219220
TPR460 = resource_filename(__name__, 'data/tprs/ab42_gmx_4.6.tpr')
220221
TPR461 = resource_filename(__name__, 'data/tprs/ab42_gmx_4.6.1.tpr')
221222
# all bonded interactions
222223
TPR510_bonded = resource_filename(__name__, 'data/tprs/all_bonded/dummy_5.1.tpr')
224+
TPR2016_bonded = resource_filename(__name__, 'data/tprs/all_bonded/dummy_2016.tpr')
223225

224226
XYZ_psf = resource_filename(__name__, 'data/2r9r-1b.psf')
225227
XYZ_bz2 = resource_filename(__name__, 'data/2r9r-1b.xyz.bz2')

testsuite/MDAnalysisTests/test_tprparser.py

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
1414
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
1515
#
16-
from MDAnalysis.tests.datafiles import TPR, \
17-
TPR400, TPR402, TPR403, TPR404, TPR405, TPR406, TPR407, \
18-
TPR450, TPR451, TPR452, TPR453, TPR454, TPR455, TPR455Double, \
19-
TPR460, TPR461, TPR502, TPR504, TPR505, TPR510, TPR510_bonded
16+
from MDAnalysis.tests.datafiles import (
17+
TPR,
18+
TPR400, TPR402, TPR403, TPR404, TPR405, TPR406, TPR407,
19+
TPR450, TPR451, TPR452, TPR453, TPR454, TPR455, TPR455Double,
20+
TPR460, TPR461, TPR502, TPR504, TPR505, TPR510, TPR2016,
21+
TPR510_bonded, TPR2016_bonded,
22+
)
2023

2124
from numpy.testing import TestCase, dec, assert_
2225
from test_topology import _TestTopology
@@ -240,7 +243,15 @@ class TestTPR510(_TestTopology, TPR510):
240243
"""Testing TPR version 103"""
241244

242245

243-
def _test_is_in_topology(name, elements, topology_section, topology_path):
246+
class TPR2016(TPRBase):
247+
topology = TPR2016
248+
249+
250+
class TestTPR2016(_TestTopology, TPR2016):
251+
"""Testing TPR version 110"""
252+
253+
254+
def _test_is_in_topology(name, elements, topology_path, topology_section):
244255
"""
245256
Test if an interaction appears as expected in the topology
246257
"""
@@ -252,51 +263,51 @@ def _test_is_in_topology(name, elements, topology_section, topology_path):
252263

253264
def test_all_bonds():
254265
"""Test that all bond types are parsed as expected"""
255-
topology = TPR510_bonded
266+
topologies = (TPR510_bonded, TPR2016_bonded)
256267
bonds = {'BONDS':[(0, 1)], 'G96BONDS':[(1, 2)], 'MORSE':[(2, 3)],
257268
'CUBICBONDS':[(3, 4)], 'CONNBONDS':[(4, 5)], 'HARMONIC':[(5, 6)],
258269
'FENEBONDS':[(6, 7)], 'RESTRAINTPOT':[(7, 8)],
259270
'TABBONDS':[(8, 9)], 'TABBONDSNC':[(9, 10)],
260271
'CONSTR':[(10, 11)], 'CONSTRNC':[(11, 12)],}
261272
bond_type_in_topology = functools.partial(_test_is_in_topology,
262-
topology_section='bonds',
263-
topology_path=topology)
264-
for bond_type, elements in bonds.items():
265-
yield (bond_type_in_topology, bond_type, elements)
273+
topology_section='bonds')
274+
for topology in topologies:
275+
for bond_type, elements in bonds.items():
276+
yield (bond_type_in_topology, bond_type, elements, topology)
266277

267278

268279
def test_all_angles():
269-
topology = TPR510_bonded
280+
topologies = (TPR510_bonded, TPR2016_bonded)
270281
angles = {'ANGLES':[(0, 1, 2)], 'G96ANGLES':[(1, 2, 3)],
271282
'CROSS_BOND_BOND':[(2, 3, 4)], 'CROSS_BOND_ANGLE':[(3, 4, 5)],
272283
'UREY_BRADLEY':[(4, 5, 6)], 'QANGLES':[(5, 6, 7)],
273284
'RESTRANGLES':[(6, 7, 8)], 'TABANGLES':[(7, 8, 9)],}
274285
angle_type_in_topology = functools.partial(_test_is_in_topology,
275-
topology_section='angles',
276-
topology_path=topology)
277-
for angle_type, elements in angles.items():
278-
yield (angle_type_in_topology, angle_type, elements)
286+
topology_section='angles')
287+
for topology in topologies:
288+
for angle_type, elements in angles.items():
289+
yield (angle_type_in_topology, angle_type, elements, topology)
279290

280291

281292
def test_all_dihedrals():
282-
topology = TPR510_bonded
293+
topologies = (TPR510_bonded, TPR2016_bonded)
283294
dihs = {'PDIHS':[(0, 1, 2, 3), (1, 2, 3, 4), (7, 8, 9, 10)],
284295
'RBDIHS':[(4, 5, 6, 7)], 'RESTRDIHS':[(8, 9, 10, 11)],
285296
'CBTDIHS':[(9, 10, 11, 12)], 'FOURDIHS':[(6, 7, 8, 9)],
286297
'TABDIHS':[(10, 11, 12, 13)],}
287298
dih_type_in_topology = functools.partial(_test_is_in_topology,
288-
topology_section='dihedrals',
289-
topology_path=topology)
290-
for dih_type, elements in dihs.items():
291-
yield (dih_type_in_topology, dih_type, elements)
299+
topology_section='dihedrals')
300+
for topology in topologies:
301+
for dih_type, elements in dihs.items():
302+
yield (dih_type_in_topology, dih_type, elements, topology)
292303

293304

294305
def test_all_impropers():
295-
topology = TPR510_bonded
306+
topologies = (TPR510_bonded, TPR2016_bonded)
296307
imprs = {'IDIHS':[(2, 3, 4, 5), (3, 4, 5, 6)], 'PIDIHS':[(5, 6, 7, 8)]}
297308
impr_type_in_topology = functools.partial(_test_is_in_topology,
298-
topology_section='impropers',
299-
topology_path=topology)
300-
for impr_type, elements in imprs.items():
301-
yield (impr_type_in_topology, impr_type, elements)
309+
topology_section='impropers')
310+
for topology in topologies:
311+
for impr_type, elements in imprs.items():
312+
yield (impr_type_in_topology, impr_type, elements, topology)
302313

0 commit comments

Comments
 (0)