"platforms/opencl/src/OpenCLArray.cpp" did not exist on "d9e73e43cb2685dd079fdfbbb535ebed8f7327c3"
Unverified Commit 8dfdd485 authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #2469 from peastman/steps

runForClockTime() updates currentStep correctly
parents 6024e7c0 e275bd08
...@@ -196,10 +196,11 @@ class Simulation(object): ...@@ -196,10 +196,11 @@ class Simulation(object):
while stepsToGo > 10: while stepsToGo > 10:
self.integrator.step(10) # Only take 10 steps at a time, to give Python more chances to respond to a control-c. self.integrator.step(10) # Only take 10 steps at a time, to give Python more chances to respond to a control-c.
stepsToGo -= 10 stepsToGo -= 10
self.currentStep += 10
if endTime is not None and datetime.now() >= endTime: if endTime is not None and datetime.now() >= endTime:
return return
self.integrator.step(stepsToGo) self.integrator.step(stepsToGo)
self.currentStep += nextSteps self.currentStep += stepsToGo
if anyReport: if anyReport:
# One or more reporters are ready to generate reports. Organize them into three # One or more reporters are ready to generate reports. Organize them into three
# groups: ones that want wrapped positions, ones that want unwrapped positions, # groups: ones that want wrapped positions, ones that want unwrapped positions,
......
...@@ -146,6 +146,12 @@ class TestSimulation(unittest.TestCase): ...@@ -146,6 +146,12 @@ class TestSimulation(unittest.TestCase):
self.assertTrue(endTime >= startTime+timedelta(seconds=5)) self.assertTrue(endTime >= startTime+timedelta(seconds=5))
self.assertTrue(endTime < startTime+timedelta(seconds=10)) self.assertTrue(endTime < startTime+timedelta(seconds=10))
# Check that the time and step count are consistent.
time = simulation.context.getState().getTime().value_in_unit(picoseconds)
expectedTime = simulation.currentStep*integrator.getStepSize().value_in_unit(picoseconds)
self.assertAlmostEqual(expectedTime, time)
# Load the checkpoint and state and make sure they are both correct. # Load the checkpoint and state and make sure they are both correct.
......
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