Skip to content

Commit

Permalink
Transfer chain IDs to OpenMM topology. (ParmEd#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpthompson17 authored Jun 9, 2023
1 parent 6e7332a commit bf0790f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parmed/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1672,22 +1672,22 @@ def topology(self):
self.unchange()

self._topology = top = app.Topology()
chain = top.addChain()
try:
last_chain = self.residues[0].chain
last_residue = None
last_omm_residue = None
except IndexError:
# Empty topology
return self._topology
chain = top.addChain(id=last_chain)
# Add the atoms
for i, atom in enumerate(self.atoms):
# See if we need to add a new residue
if atom.residue is not last_residue:
# See if we need a new chain
if last_chain != atom.residue.chain:
last_chain = atom.residue.chain
chain = top.addChain()
chain = top.addChain(id=last_chain)
last_residue = atom.residue
last_omm_residue = top.addResidue(atom.residue.name, chain)
try:
Expand Down

0 comments on commit bf0790f

Please sign in to comment.