"vscode:/vscode.git/clone" did not exist on "a9ef79c6563afb2da118812a5a4fdaf862e9b341"
Commit e275bd08 authored by peastman's avatar peastman
Browse files

runForClockTime() updates currentStep correctly

parent 6024e7c0
......@@ -196,10 +196,11 @@ class Simulation(object):
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.
stepsToGo -= 10
self.currentStep += 10
if endTime is not None and datetime.now() >= endTime:
return
self.integrator.step(stepsToGo)
self.currentStep += nextSteps
self.currentStep += stepsToGo
if anyReport:
# One or more reporters are ready to generate reports. Organize them into three
# groups: ones that want wrapped positions, ones that want unwrapped positions,
......
......@@ -146,6 +146,12 @@ class TestSimulation(unittest.TestCase):
self.assertTrue(endTime >= startTime+timedelta(seconds=5))
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.
......
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