Commit 1f12f286 authored by peastman's avatar peastman
Browse files

Merge pull request #844 from swails/master

Update `Topology` creation from CHARMM parsers and fix Amber prmtop parsing when %COMMENT sections are present
parents b0ecf372 0a0e3ba3
......@@ -777,11 +777,12 @@ class CharmmPsfFile(object):
# Add each chain (separate 'system's) and residue
for atom in self.atom_list:
if atom.system != last_chain:
chain = topology.addChain()
chain = topology.addChain(atom.system)
last_chain = atom.system
if atom.residue.idx != last_residue:
last_residue = atom.residue.idx
residue = topology.addResidue(atom.residue.resname, chain)
residue = topology.addResidue(atom.residue.resname, chain,
str(atom.residue.idx))
if atom.type is not None:
# This is the most reliable way of determining the element
atomic_num = atom.type.atomic_number
......
......@@ -135,6 +135,8 @@ class PrmtopLoader(object):
format = format[index0+1:index1]
m = FORMAT_RE_PATTERN.search(format)
self._raw_format[self._flags[-1]] = (format, m.group(1), m.group(2), m.group(3), m.group(4))
elif line.startswith('%COMMENT'):
continue
elif self._flags \
and 'TITLE'==self._flags[-1] \
and not self._raw_data['TITLE']:
......
......@@ -1802,6 +1802,7 @@ WAT WAT
2.54487941E+01 1.27063907E+02 5.94825035E+02 0.00000000E+00 0.00000000E+00
0.00000000E+00
%FLAG LENNARD_JONES_CCOEF
%COMMENT This is the r^-4 term in the 12-6-4 LJ potential
%FORMAT(5E16.8)
0.00000000E+00 1.32908847E+02 0000000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment