Unverified Commit 76d5b600 authored by John Chodera's avatar John Chodera Committed by GitHub
Browse files

Generate more informative error message if residue template not found (#3558)

* Fix #3557 : Generate more informative error message if residue template not found.

* Fix test failures
parent 99a9fdc9
......@@ -1086,12 +1086,12 @@ class ForceField(object):
# Find the template matching each residue, compiling a list of residues for which no templates are available.
bondedToAtom = self._buildBondedToAtomList(topology)
templates = list() # list of templates matching the corresponding residues
for res in topology.residues():
for residue in topology.residues():
# Attempt to match one of the existing templates.
[template, matches] = self._getResidueTemplateMatches(res, bondedToAtom, ignoreExternalBonds=ignoreExternalBonds)
[template, matches] = self._getResidueTemplateMatches(residue, bondedToAtom, ignoreExternalBonds=ignoreExternalBonds)
# Raise an exception if we have found no templates that match.
if matches is None:
raise ValueError('No template found for residue %d (%s). %s' % (res.index+1, res.name, _findMatchErrors(self, res)))
raise ValueError('No template found for chainid <%s> resid <%s> resname <%s> (residue index within topology %d).\n%s' % (residue.chain.id, residue.id, residue.name, residue.index, _findMatchErrors(self, residue)))
else:
templates.append(template)
......
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