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
2124from numpy .testing import TestCase , dec , assert_
2225from 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
253264def 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
268279def 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
281292def 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
294305def 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