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
b788fdd6
Commit
b788fdd6
authored
Jul 22, 2013
by
peastman
Browse files
Merge pull request #66 from rmcgibbo/buffering
StateDataReporter buffering
parents
99df6758
bc9f1c6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
wrappers/python/simtk/openmm/app/statedatareporter.py
wrappers/python/simtk/openmm/app/statedatareporter.py
+3
-1
No files found.
wrappers/python/simtk/openmm/app/statedatareporter.py
View file @
b788fdd6
...
@@ -67,7 +67,7 @@ class StateDataReporter(object):
...
@@ -67,7 +67,7 @@ class StateDataReporter(object):
self
.
_reportInterval
=
reportInterval
self
.
_reportInterval
=
reportInterval
self
.
_openedFile
=
isinstance
(
file
,
str
)
self
.
_openedFile
=
isinstance
(
file
,
str
)
if
self
.
_openedFile
:
if
self
.
_openedFile
:
self
.
_out
=
open
(
file
,
'w'
)
self
.
_out
=
open
(
file
,
'w'
,
0
)
else
:
else
:
self
.
_out
=
file
self
.
_out
=
file
self
.
_step
=
step
self
.
_step
=
step
...
@@ -109,6 +109,7 @@ class StateDataReporter(object):
...
@@ -109,6 +109,7 @@ class StateDataReporter(object):
self
.
_initializeConstants
(
simulation
)
self
.
_initializeConstants
(
simulation
)
headers
=
self
.
_constructHeaders
()
headers
=
self
.
_constructHeaders
()
print
>>
self
.
_out
,
'#"%s"'
%
(
'"'
+
self
.
_separator
+
'"'
).
join
(
headers
)
print
>>
self
.
_out
,
'#"%s"'
%
(
'"'
+
self
.
_separator
+
'"'
).
join
(
headers
)
self
.
_out
.
flush
()
self
.
_hasInitialized
=
True
self
.
_hasInitialized
=
True
# Check for errors.
# Check for errors.
...
@@ -119,6 +120,7 @@ class StateDataReporter(object):
...
@@ -119,6 +120,7 @@ class StateDataReporter(object):
# Write the values.
# Write the values.
print
>>
self
.
_out
,
self
.
_separator
.
join
(
str
(
v
)
for
v
in
values
)
print
>>
self
.
_out
,
self
.
_separator
.
join
(
str
(
v
)
for
v
in
values
)
self
.
_out
.
flush
()
def
_constructReportValues
(
self
,
simulation
,
state
):
def
_constructReportValues
(
self
,
simulation
,
state
):
"""Query the simulation for the current state of our observables of interest.
"""Query the simulation for the current state of our observables of interest.
...
...
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