Commit 41e9a095 authored by leeping's avatar leeping
Browse files

Personal commit to make modeller easier to use

parent ca489698
...@@ -734,9 +734,8 @@ class Modeller(object): ...@@ -734,9 +734,8 @@ class Modeller(object):
else: else:
delta = Vec3(random.random(), random.random(), random.random())*nanometer delta = Vec3(random.random(), random.random(), random.random())*nanometer
delta *= 0.1*nanometer/norm(delta) delta *= 0.1*nanometer/norm(delta)
if len(expected) > 1: delta += 0.05*Vec3(random.random(), random.random(), random.random())*nanometer
delta += 0.05*Vec3(random.random(), random.random(), random.random())*nanometer delta *= 0.1*nanometer/norm(delta)
delta *= 0.1*nanometer/norm(delta)
newPositions.append(self.positions[parent.index]+delta) newPositions.append(self.positions[parent.index]+delta)
newTopology.addBond(newAtom, newH) newTopology.addBond(newAtom, newH)
else: else:
...@@ -758,7 +757,9 @@ class Modeller(object): ...@@ -758,7 +757,9 @@ class Modeller(object):
if atoms[i].element != elem.hydrogen: if atoms[i].element != elem.hydrogen:
# This is a heavy atom, so make it immobile. # This is a heavy atom, so make it immobile.
system.setParticleMass(i, 0) system.setParticleMass(i, 0)
context = Context(system, VerletIntegrator(0.0)) from simtk.openmm import Platform
plt = Platform.getPlatformByName('Reference')
context = Context(system, VerletIntegrator(0.0), plt)
context.setPositions(newPositions) context.setPositions(newPositions)
LocalEnergyMinimizer.minimize(context) LocalEnergyMinimizer.minimize(context)
self.topology = newTopology self.topology = newTopology
...@@ -922,4 +923,4 @@ class Modeller(object): ...@@ -922,4 +923,4 @@ class Modeller(object):
if bond[0] in newAtoms and bond[1] in newAtoms: if bond[0] in newAtoms and bond[1] in newAtoms:
newTopology.addBond(newAtoms[bond[0]], newAtoms[bond[1]]) newTopology.addBond(newAtoms[bond[0]], newAtoms[bond[1]])
self.topology = newTopology self.topology = newTopology
self.positions = newPositions self.positions = newPositions
\ No newline at end of file
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