Skip to content

Commit

Permalink
Merge branch 'master' into feature/charmm-enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
swails committed Feb 18, 2022
2 parents 6b17d16 + c848e17 commit 463fc17
Show file tree
Hide file tree
Showing 5 changed files with 754 additions and 11 deletions.
2 changes: 1 addition & 1 deletion parmed/amber/_amberparm.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def from_structure(cls, struct, copy=False):
return struct
if struct.unknown_functional:
raise TypeError('Cannot instantiate an AmberParm from unknown functional')
if (struct.urey_bradleys or struct.impropers or struct.cmaps or
if (struct.urey_bradleys or struct.impropers or
struct.trigonal_angles or struct.pi_torsions or
struct.out_of_plane_bends or struct.stretch_bends or
struct.torsion_torsions or struct.multipole_frames):
Expand Down
13 changes: 11 additions & 2 deletions parmed/gromacs/gromacstop.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ def read(self, fname, defines=None, parametrize=True):
dihedral_types = dict()
exc_types = dict()
elif current_section == 'atoms':
molecule.add_atom(*self._parse_atoms(line, params))
atom, resname, resnum, icode = self._parse_atoms(line, params)
molecule.add_atom(atom, resname, resnum, inscode=icode)
elif current_section == 'bonds':
bond, bond_type = self._parse_bonds(line, bond_types, molecule.atoms)
molecule.bonds.append(bond)
Expand Down Expand Up @@ -582,7 +583,15 @@ def _parse_atoms(self, line, params):
else:
atom = Atom(atomic_number=atomic_number, name=words[4],
type=words[1], charge=charge, mass=mass)
return atom, words[3], int(words[2])

# 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:
icode = words[2][-1]
resnum = int(words[2][:-1])
return atom, words[3], resnum, icode

def _parse_bonds(self, line, bond_types, atoms):
""" Parses a bond line. Returns a Bond, BondType/None """
Expand Down

0 comments on commit 463fc17

Please sign in to comment.