"vscode:/vscode.git/clone" did not exist on "1db349e5272aeedfbf37ca2ad250b0a468b73255"
Commit 36cdbc8d authored by peastman's avatar peastman
Browse files

Fixed exception in addExtraParticles()

parent 8d276c26
......@@ -924,7 +924,7 @@ class Modeller(object):
# extra points.
template = None
residueNoEP = Residue(residue.name, residue.index, residue.chain)
residueNoEP = Residue(residue.name, residue.index, residue.chain, residue.id)
residueNoEP._atoms = [atom for atom in residue.atoms() if atom.element is not None]
if signature in forcefield._templateSignatures:
for t in forcefield._templateSignatures[signature]:
......
......@@ -886,6 +886,27 @@ class TestModeller(unittest.TestCase):
validate_equivalence(self, topology_LYN, topology_after)
def test_addExtraParticles(self):
"""Test addExtraParticles()."""
# Create a box of water.
ff1 = ForceField('tip3p.xml')
modeller = Modeller(Topology(), []*nanometers)
modeller.addSolvent(ff1, 'tip3p', boxSize=Vec3(2,2,2)*nanometers)
# Now convert the water to TIP4P.
ff2 = ForceField('tip4pew.xml')
modeller.addExtraParticles(ff2)
for residue in modeller.topology.residues():
atoms = list(residue.atoms())
self.assertEqual(4, len(atoms))
ep = [atom for atom in atoms if atom.element is None]
self.assertEqual(1, len(ep))
def assertVecAlmostEqual(self, p1, p2, tol=1e-7):
scale = max(1.0, norm(p1),)
for i in range(3):
......
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