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
ea9714c1
"vscode:/vscode.git/clone" did not exist on "aa7bd1cf520fb75d7e8fbbf52609bd0dcdc91ed2"
Commit
ea9714c1
authored
Dec 02, 2016
by
peastman
Browse files
CheckpointReporter does not create output file until first report
parent
bb2d463c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
wrappers/python/simtk/openmm/app/checkpointreporter.py
wrappers/python/simtk/openmm/app/checkpointreporter.py
+5
-2
No files found.
wrappers/python/simtk/openmm/app/checkpointreporter.py
View file @
ea9714c1
...
...
@@ -82,7 +82,8 @@ class CheckpointReporter(object):
self
.
_reportInterval
=
reportInterval
if
isinstance
(
file
,
str
):
self
.
_own_handle
=
True
self
.
_out
=
open
(
file
,
'w+b'
,
0
)
self
.
_filename
=
file
self
.
_out
=
None
else
:
self
.
_out
=
file
self
.
_own_handle
=
False
...
...
@@ -116,6 +117,8 @@ class CheckpointReporter(object):
state : State
The current state of the simulation
"""
if
self
.
_out
is
None
:
self
.
_out
=
open
(
self
.
_filename
,
'w+b'
,
0
)
self
.
_out
.
seek
(
0
)
chk
=
simulation
.
context
.
createCheckpoint
()
self
.
_out
.
write
(
chk
)
...
...
@@ -123,6 +126,6 @@ class CheckpointReporter(object):
self
.
_out
.
flush
()
def
__del__
(
self
):
if
self
.
_own_handle
:
if
self
.
_own_handle
and
self
.
_out
is
not
None
:
self
.
_out
.
close
()
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