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
a6b0cd84
Commit
a6b0cd84
authored
Apr 16, 2025
by
Evan Pretti
Browse files
Improve DCD header validation check
parent
cc158237
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
wrappers/python/openmm/app/dcdfile.py
wrappers/python/openmm/app/dcdfile.py
+3
-4
No files found.
wrappers/python/openmm/app/dcdfile.py
View file @
a6b0cd84
...
@@ -85,10 +85,9 @@ class DCDFile(object):
...
@@ -85,10 +85,9 @@ class DCDFile(object):
boxFlag
=
1
boxFlag
=
1
if
append
:
if
append
:
file
.
seek
(
0
,
os
.
SEEK_SET
)
file
.
seek
(
0
,
os
.
SEEK_SET
)
headerBytes
=
struct
.
unpack
(
'<i'
,
file
.
read
(
4
))[
0
]
headerMagic
=
file
.
read
(
8
)
headerMagic
=
file
.
read
(
4
)
if
headerMagic
[
4
:
8
]
!=
b
'CORD'
or
struct
.
unpack
(
'<i'
,
headerMagic
[:
4
])[
0
]
!=
84
:
if
headerBytes
!=
84
or
headerMagic
!=
b
'CORD'
:
raise
ValueError
(
'Cannot append to file with invalid DCD header'
)
raise
ValueError
(
'Cannot append to DCD file with invalid header'
)
self
.
_modelCount
=
struct
.
unpack
(
'<i'
,
file
.
read
(
4
))[
0
]
self
.
_modelCount
=
struct
.
unpack
(
'<i'
,
file
.
read
(
4
))[
0
]
file
.
seek
(
92
,
os
.
SEEK_SET
)
file
.
seek
(
92
,
os
.
SEEK_SET
)
commentsBytes
=
struct
.
unpack
(
'<i'
,
file
.
read
(
4
))[
0
]
commentsBytes
=
struct
.
unpack
(
'<i'
,
file
.
read
(
4
))[
0
]
...
...
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