Unverified Commit c8a73c91 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Made ordering of impropers more deterministic (#2992)

* Made ordering of impropers more deterministic

* Fixed typo
parent 9008050c
......@@ -608,6 +608,7 @@ class ForceField(object):
self.bondedToAtom[bond.atom2].add(bond.atom1)
self.atomBonds[bond.atom1].append(i)
self.atomBonds[bond.atom2].append(i)
self.bondedToAtom = [sorted(b) for b in self.bondedToAtom]
def addConstraint(self, system, atom1, atom2, distance):
"""Add a constraint to the system, avoiding duplicate constraints."""
......@@ -989,8 +990,8 @@ class ForceField(object):
Returns
-------
bondedToAtom : list of set of int
bondedToAtom[index] is the set of atom indices bonded to atom `index`
bondedToAtom : list of list of int
bondedToAtom[index] is the list of atom indices bonded to atom `index`
"""
bondedToAtom = []
......@@ -999,6 +1000,7 @@ class ForceField(object):
for (atom1, atom2) in topology.bonds():
bondedToAtom[atom1.index].add(atom2.index)
bondedToAtom[atom2.index].add(atom1.index)
bondedToAtom = [sorted(b) for b in bondedToAtom]
return bondedToAtom
def getUnmatchedResidues(self, topology):
......
......@@ -935,7 +935,7 @@ class TestForceField(unittest.TestCase):
system1_indexes = [imp1[0], imp1[1], imp1[2], imp1[3]]
system2_indexes = [imp2[0], imp2[1], imp2[2], imp2[3]]
self.assertEqual(system1_indexes, [51, 56, 54, 55])
self.assertEqual(system1_indexes, [51, 55, 54, 56])
self.assertEqual(system2_indexes, [51, 55, 54, 56])
def test_ImpropersOrdering_smirnoff(self):
......
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