"examples/cpp-examples/HelloEthane.cpp" did not exist on "0accdd2cde396fc451c95569b603e09a036c920e"
Commit 91920ef4 authored by Zheng Gong's avatar Zheng Gong
Browse files

add test case for constraints and rigidWater in CharmmPsfFile

parent 0c646ace
...@@ -366,41 +366,34 @@ class TestCharmmFiles(unittest.TestCase): ...@@ -366,41 +366,34 @@ class TestCharmmFiles(unittest.TestCase):
psf = CharmmPsfFile('systems/water_methanol.psf') psf = CharmmPsfFile('systems/water_methanol.psf')
params = CharmmParameterSet('systems/water_methanol.prm') params = CharmmParameterSet('systems/water_methanol.prm')
# the system is made of one water molecule and one methanol molecule # the system is made of one water molecule and one methanol molecule
bH_water = [[0, 1], [1, 2]] hBonds_water = [[0, 1], [1, 2]]
aH_water = [[0, 2]] hAngles_water = [[0, 2]]
bH_methanol = [[3, 4], [3, 5], [3, 6], [7, 8]] hBonds_methanol = [[3, 4], [3, 5], [3, 6], [7, 8]]
bCO_methanol = [[3, 7]] allBonds_methanol = hBonds_methanol + [[3, 7]]
aH_methanol = [[4, 5], [4, 6], [5, 6], [3, 8]] hAngles_methanol = [[4, 5], [4, 6], [5, 6], [3, 8]]
system = psf.createSystem(params, constraints=None, rigidWater=False) system = psf.createSystem(params, constraints=None, rigidWater=False)
assert system.getNumConstraints() == 0 self.assertEqual(system.getNumConstraints(), 0)
system = psf.createSystem(params, constraints=None, rigidWater=True) system = psf.createSystem(params, constraints=None, rigidWater=True)
assert system.getNumConstraints() == 3 self.assertCountEqual([system.getConstraintParameters(i)[:2] for i in range(system.getNumConstraints())],
for i in range(3): hBonds_water + hAngles_water)
assert system.getConstraintParameters(i)[:2] in bH_water + aH_water
system = psf.createSystem(params, constraints=HBonds, rigidWater=False) system = psf.createSystem(params, constraints=HBonds, rigidWater=False)
assert system.getNumConstraints() == 6 self.assertCountEqual([system.getConstraintParameters(i)[:2] for i in range(system.getNumConstraints())],
for i in range(6): hBonds_water + hBonds_methanol)
assert system.getConstraintParameters(i)[:2] in bH_water + bH_methanol
system = psf.createSystem(params, constraints=HBonds, rigidWater=True) system = psf.createSystem(params, constraints=HBonds, rigidWater=True)
assert system.getNumConstraints() == 7 self.assertCountEqual([system.getConstraintParameters(i)[:2] for i in range(system.getNumConstraints())],
for i in range(7): hBonds_water + hAngles_water + hBonds_methanol)
assert system.getConstraintParameters(i)[:2] in bH_water + aH_water + bH_methanol
system = psf.createSystem(params, constraints=AllBonds, rigidWater=False) system = psf.createSystem(params, constraints=AllBonds, rigidWater=False)
assert system.getNumConstraints() == 7 self.assertCountEqual([system.getConstraintParameters(i)[:2] for i in range(system.getNumConstraints())],
for i in range(7): hBonds_water + allBonds_methanol)
assert system.getConstraintParameters(i)[:2] in bH_water + bH_methanol + bCO_methanol
system = psf.createSystem(params, constraints=AllBonds, rigidWater=True) system = psf.createSystem(params, constraints=AllBonds, rigidWater=True)
assert system.getNumConstraints() == 8 self.assertCountEqual([system.getConstraintParameters(i)[:2] for i in range(system.getNumConstraints())],
for i in range(8): hBonds_water + hAngles_water + allBonds_methanol)
assert system.getConstraintParameters(i)[:2] in bH_water + aH_water + bH_methanol + bCO_methanol
system = psf.createSystem(params, constraints=HAngles, rigidWater=False) system = psf.createSystem(params, constraints=HAngles, rigidWater=False)
assert system.getNumConstraints() == 12 self.assertCountEqual([system.getConstraintParameters(i)[:2] for i in range(system.getNumConstraints())],
for i in range(12): hBonds_water + hAngles_water + allBonds_methanol + hAngles_methanol)
assert system.getConstraintParameters(i)[:2] in bH_water + aH_water + bH_methanol + bCO_methanol + aH_methanol
system = psf.createSystem(params, constraints=HAngles, rigidWater=True) system = psf.createSystem(params, constraints=HAngles, rigidWater=True)
assert system.getNumConstraints() == 12 self.assertCountEqual([system.getConstraintParameters(i)[:2] for i in range(system.getNumConstraints())],
for i in range(12): hBonds_water + hAngles_water + allBonds_methanol + hAngles_methanol)
assert system.getConstraintParameters(i)[:2] in bH_water + aH_water + bH_methanol + bCO_methanol + aH_methanol
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment