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
116aed39
Unverified
Commit
116aed39
authored
Aug 03, 2023
by
Raul
Committed by
GitHub
Aug 03, 2023
Browse files
Fix "off by one" error in xtc time reporting. (#4168)
parent
d8c67699
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
wrappers/python/openmm/app/xtcfile.py
wrappers/python/openmm/app/xtcfile.py
+1
-1
wrappers/python/tests/TestXtcFile.py
wrappers/python/tests/TestXtcFile.py
+6
-6
No files found.
wrappers/python/openmm/app/xtcfile.py
View file @
116aed39
...
...
@@ -141,7 +141,7 @@ class XTCFile(object):
)
else
:
boxVectors
=
np
.
zeros
((
3
,
3
)).
astype
(
np
.
float32
)
step
=
self
.
_modelCount
*
self
.
_interval
+
self
.
_firstStep
step
=
(
self
.
_modelCount
-
1
)
*
self
.
_interval
+
self
.
_firstStep
time
=
step
*
self
.
_dt
xtc_write_frame
(
self
.
_filename
.
encode
(
"utf-8"
),
...
...
wrappers/python/tests/TestXtcFile.py
View file @
116aed39
...
...
@@ -49,9 +49,9 @@ class TestXtcFile(unittest.TestCase):
box
=
np
.
array
(
box
).
transpose
(
1
,
2
,
0
)
self
.
assertTrue
(
np
.
allclose
(
box_read
,
box
,
atol
=
1e-3
))
self
.
assertTrue
(
np
.
allclose
(
time
,
np
.
arange
(
1
,
nframes
+
1
)
*
0.001
,
atol
=
1e-5
)
np
.
allclose
(
time
,
np
.
arange
(
0
,
nframes
)
*
0.001
,
atol
=
1e-5
)
)
self
.
assertTrue
(
np
.
allclose
(
step
,
np
.
arange
(
1
,
nframes
+
1
),
atol
=
1e-5
))
self
.
assertTrue
(
np
.
allclose
(
step
,
np
.
arange
(
0
,
nframes
),
atol
=
1e-5
))
def
test_xtc_cubic
(
self
):
"""Test the XTC file by writing a trajectory and reading it back. Using a cubic box"""
...
...
@@ -87,9 +87,9 @@ class TestXtcFile(unittest.TestCase):
box
=
np
.
array
(
box
).
transpose
(
1
,
2
,
0
)
self
.
assertTrue
(
np
.
allclose
(
box_read
,
box
,
atol
=
1e-3
))
self
.
assertTrue
(
np
.
allclose
(
time
,
np
.
arange
(
1
,
nframes
+
1
)
*
0.001
,
atol
=
1e-5
)
np
.
allclose
(
time
,
np
.
arange
(
0
,
nframes
)
*
0.001
,
atol
=
1e-5
)
)
self
.
assertTrue
(
np
.
allclose
(
step
,
np
.
arange
(
1
,
nframes
+
1
),
atol
=
1e-5
))
self
.
assertTrue
(
np
.
allclose
(
step
,
np
.
arange
(
0
,
nframes
),
atol
=
1e-5
))
def
test_xtc_box_from_topology
(
self
):
"""Test the XTC file by writing a trajectory and reading it back. Letting the box be set from the topology"""
...
...
@@ -131,9 +131,9 @@ class TestXtcFile(unittest.TestCase):
box
=
np
.
array
(
np
.
tile
(
boxVectors
,
(
nframes
,
1
,
1
))).
transpose
(
1
,
2
,
0
)
self
.
assertTrue
(
np
.
allclose
(
box_read
,
box
,
atol
=
1e-3
))
self
.
assertTrue
(
np
.
allclose
(
time
,
np
.
arange
(
1
,
nframes
+
1
)
*
0.001
,
atol
=
1e-5
)
np
.
allclose
(
time
,
np
.
arange
(
0
,
nframes
)
*
0.001
,
atol
=
1e-5
)
)
self
.
assertTrue
(
np
.
allclose
(
step
,
np
.
arange
(
1
,
nframes
+
1
),
atol
=
1e-5
))
self
.
assertTrue
(
np
.
allclose
(
step
,
np
.
arange
(
0
,
nframes
),
atol
=
1e-5
))
def
testLongTrajectory
(
self
):
"""Test writing a trajectory that has more than 2^31 steps."""
...
...
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