"wrappers/python/vscode:/vscode.git/clone" did not exist on "af2e3c2fff52cdcf426811fcf257d79f660e1631"
Commit eb1c5858 authored by Peter Eastman's avatar Peter Eastman
Browse files

Bug fix

parent bc41b7a0
...@@ -1029,11 +1029,11 @@ class Modeller(object): ...@@ -1029,11 +1029,11 @@ class Modeller(object):
if atom1 in newExtraPoints: if atom1 in newExtraPoints:
a1 = newExtraPoints[atom1] a1 = newExtraPoints[atom1]
else: else:
a1 = matchingAtoms[atom1] a1 = newAtoms[matchingAtoms[atom1]]
if atom2 in newExtraPoints: if atom2 in newExtraPoints:
a2 = newExtraPoints[atom2] a2 = newExtraPoints[atom2]
else: else:
a2 = matchingAtoms[atom2] a2 = newAtoms[matchingAtoms[atom2]]
newTopology.addBond(a1, a2) newTopology.addBond(a1, a2)
for bond in self.topology.bonds(): for bond in self.topology.bonds():
......
...@@ -953,27 +953,29 @@ class TestModeller(unittest.TestCase): ...@@ -953,27 +953,29 @@ class TestModeller(unittest.TestCase):
</ForceField>""" </ForceField>"""
ff = ForceField(StringIO(xml)) ff = ForceField(StringIO(xml))
# Create a zinc atom. # Create two zinc atoms.
topology = Topology() topology = Topology()
chain = topology.addChain() chain = topology.addChain()
residue = topology.addResidue('ZN', chain) residue = topology.addResidue('ZN', chain)
topology.addAtom('ZN', element.zinc, residue) topology.addAtom('ZN', element.zinc, residue)
residue = topology.addResidue('ZN', chain)
topology.addAtom('ZN', element.zinc, residue)
# Add the extra particles. # Add the extra particles.
modeller = Modeller(topology, [Vec3(0.5, 1.0, 1.5)]*nanometers) modeller = Modeller(topology, [Vec3(0.5, 1.0, 1.5), Vec3(2.0, 2.0, 0.0)]*nanometers)
modeller.addExtraParticles(ff) modeller.addExtraParticles(ff)
top = modeller.topology top = modeller.topology
pos = modeller.positions pos = modeller.positions
# Check that the correct particles were added. # Check that the correct particles were added.
self.assertEqual(len(pos), 5) self.assertEqual(len(pos), 10)
for i, atom in enumerate(top.atoms()): for i, atom in enumerate(top.atoms()):
self.assertEqual(element.zinc if i == 0 else None, atom.element) self.assertEqual(element.zinc if i in (0,5) else None, atom.element)
# Check that their positions are reasonable. # Check that the positions in the first residue are reasonable.
center = Vec3(0.5, 1.0, 1.5)*nanometers center = Vec3(0.5, 1.0, 1.5)*nanometers
self.assertEqual(center, modeller.positions[0]) self.assertEqual(center, modeller.positions[0])
......
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