Skip to content

Commit

Permalink
Reading a Gromacs topology fails with insertion code or negative numb…
Browse files Browse the repository at this point in the history
…er (#1225)

* reading gromacs topologies with insertion codes fixed

* using conditional instead of try-except clause
  • Loading branch information
Valdes-Tresanco-MS committed Feb 15, 2022
1 parent f5b914a commit 252c5ba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions parmed/gromacs/gromacstop.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,9 @@ def _parse_atoms(self, line, params):
else:
atom = Atom(atomic_number=atomic_number, name=words[4],
type=words[1], charge=charge, mass=mass)
# check for insertion code
if words[2].isnumeric():

# check for insertion code and negative res number
if words[2].isnumeric() or (words[2].startswith('-') and words[2][1:].isnumeric()):
icode = ''
resnum = int(words[2])
else:
Expand Down

0 comments on commit 252c5ba

Please sign in to comment.