Commit 875c973f authored by kyleabeauchamp's avatar kyleabeauchamp
Browse files

Added test.

parent c212839e
......@@ -275,5 +275,25 @@ class TestAmberPrmtopFile(unittest.TestCase):
diff = norm(f1-f2)
self.assertTrue(diff < 0.1 or diff/norm(f1) < 1e-4)
def test_with_dcd_reporter(self):
"""Check that an amber simulation like the docs example works with a DCD reporter."""
temperature = 50*kelvin
prmtop = prmtop4 # Mg + water
inpcrd = inpcrd4 # Mg + water
system = prmtop.createSystem(nonbondedMethod=PME, nonbondedCutoff=1*nanometer, constraints=HBonds)
system.addForce(MonteCarloBarostat(1.0 * atmospheres, temperature, 1))
integrator = LangevinIntegrator(temperature, 1.0 / picosecond, 0.0001 * picoseconds)
simulation = Simulation(prmtop.topology, system, integrator)
simulation.context.setPositions(inpcrd.positions)
simulation.context.setPeriodicBoxVectors(*inpcrd.boxVectors)
simulation.reporters.append(DCDReporter('output.dcd', 1)) # This is an explicit test for the bugs in issue #850
simulation.step(5)
if __name__ == '__main__':
unittest.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