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
e688b86e
Unverified
Commit
e688b86e
authored
Jan 07, 2026
by
Peter Eastman
Committed by
GitHub
Jan 07, 2026
Browse files
Fix error reading CONECT records in PDB with multiple models (#5179)
parent
82703dff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
wrappers/python/openmm/app/internal/pdbstructure.py
wrappers/python/openmm/app/internal/pdbstructure.py
+5
-2
No files found.
wrappers/python/openmm/app/internal/pdbstructure.py
View file @
e688b86e
...
@@ -4,7 +4,7 @@ pdbstructure.py: Used for managing PDB formatted files.
...
@@ -4,7 +4,7 @@ pdbstructure.py: Used for managing PDB formatted files.
This is part of the OpenMM molecular simulation toolkit.
This is part of the OpenMM molecular simulation toolkit.
See https://openmm.org/development.
See https://openmm.org/development.
Portions copyright (c) 2012-202
1
Stanford University and the Authors.
Portions copyright (c) 2012-202
6
Stanford University and the Authors.
Authors: Christopher M. Bruns
Authors: Christopher M. Bruns
Contributors: Peter Eastman
Contributors: Peter Eastman
...
@@ -153,11 +153,14 @@ class PdbStructure(object):
...
@@ -153,11 +153,14 @@ class PdbStructure(object):
def
_load
(
self
,
input_stream
):
def
_load
(
self
,
input_stream
):
self
.
_reset_atom_numbers
()
self
.
_reset_atom_numbers
()
self
.
_reset_residue_numbers
()
self
.
_reset_residue_numbers
()
skip_remaining_models
=
False
# Read one line at a time
# Read one line at a time
for
pdb_line
in
input_stream
:
for
pdb_line
in
input_stream
:
if
not
isinstance
(
pdb_line
,
str
):
if
not
isinstance
(
pdb_line
,
str
):
pdb_line
=
pdb_line
.
decode
(
'utf-8'
)
pdb_line
=
pdb_line
.
decode
(
'utf-8'
)
command
=
pdb_line
[:
6
]
command
=
pdb_line
[:
6
]
if
skip_remaining_models
and
command
!=
"CONECT"
:
continue
# Look for atoms
# Look for atoms
if
command
==
"ATOM "
or
command
==
"HETATM"
:
if
command
==
"ATOM "
or
command
==
"HETATM"
:
self
.
_add_atom
(
Atom
(
pdb_line
,
self
,
self
.
extraParticleIdentifier
))
self
.
_add_atom
(
Atom
(
pdb_line
,
self
,
self
.
extraParticleIdentifier
))
...
@@ -179,7 +182,7 @@ class PdbStructure(object):
...
@@ -179,7 +182,7 @@ class PdbStructure(object):
elif
command
==
"ENDMDL"
:
elif
command
==
"ENDMDL"
:
self
.
_current_model
.
_finalize
()
self
.
_current_model
.
_finalize
()
if
not
self
.
load_all_models
:
if
not
self
.
load_all_models
:
break
skip_remaining_models
=
True
elif
pdb_line
[:
3
]
==
"END"
:
elif
pdb_line
[:
3
]
==
"END"
:
self
.
_current_model
.
_finalize
()
self
.
_current_model
.
_finalize
()
if
not
self
.
load_all_models
:
if
not
self
.
load_all_models
:
...
...
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