"plugins/drude/openmmapi/vscode:/vscode.git/clone" did not exist on "a5e42f57289b654368ba91183cb8f4a3649a5f68"
Unverified Commit cee3b812 authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #1932 from peastman/contiguous

Require atoms and residues to be contiguous
parents 33e2c3cd d4c9eb1d
...@@ -154,6 +154,8 @@ class Topology(object): ...@@ -154,6 +154,8 @@ class Topology(object):
Residue Residue
the newly created Residue the newly created Residue
""" """
if len(chain._residues) > 0 and self._numResidues != chain._residues[-1].index+1:
raise ValueError('All residues within a chain must be contiguous')
if id is None: if id is None:
id = str(self._numResidues+1) id = str(self._numResidues+1)
residue = Residue(name, self._numResidues, chain, id) residue = Residue(name, self._numResidues, chain, id)
...@@ -181,6 +183,8 @@ class Topology(object): ...@@ -181,6 +183,8 @@ class Topology(object):
Atom Atom
the newly created Atom the newly created Atom
""" """
if len(residue._atoms) > 0 and self._numAtoms != residue._atoms[-1].index+1:
raise ValueError('All atoms within a residue must be contiguous')
if id is None: if id is None:
id = str(self._numAtoms+1) id = str(self._numAtoms+1)
atom = Atom(name, element, self._numAtoms, residue, id) atom = Atom(name, element, self._numAtoms, residue, id)
......
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