Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
e275bd08
Commit
e275bd08
authored
Nov 12, 2019
by
peastman
Browse files
runForClockTime() updates currentStep correctly
parent
6024e7c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
wrappers/python/simtk/openmm/app/simulation.py
wrappers/python/simtk/openmm/app/simulation.py
+2
-1
wrappers/python/tests/TestSimulation.py
wrappers/python/tests/TestSimulation.py
+6
-0
No files found.
wrappers/python/simtk/openmm/app/simulation.py
View file @
e275bd08
...
...
@@ -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,
...
...
wrappers/python/tests/TestSimulation.py
View file @
e275bd08
...
...
@@ -147,6 +147,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.
velocities
=
simulation
.
context
.
getState
(
getVelocities
=
True
).
getVelocities
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment