Commit 47d07e44 authored by peastman's avatar peastman
Browse files

Fixed some bugs in addExtraParticles() that affect the CHARMM polarizable force field

parent 24cb7109
...@@ -39,6 +39,7 @@ from simtk.openmm.app.topology import Residue ...@@ -39,6 +39,7 @@ from simtk.openmm.app.topology import Residue
from simtk.openmm.vec3 import Vec3 from simtk.openmm.vec3 import Vec3
from simtk.openmm import System, Context, NonbondedForce, CustomNonbondedForce, HarmonicBondForce, HarmonicAngleForce, VerletIntegrator, LocalEnergyMinimizer from simtk.openmm import System, Context, NonbondedForce, CustomNonbondedForce, HarmonicBondForce, HarmonicAngleForce, VerletIntegrator, LocalEnergyMinimizer
from simtk.unit import nanometer, molar, elementary_charge, amu, gram, liter, degree, sqrt, acos, is_quantity, dot, norm from simtk.unit import nanometer, molar, elementary_charge, amu, gram, liter, degree, sqrt, acos, is_quantity, dot, norm
import simtk.unit as unit
import element as elem import element as elem
import os import os
import random import random
...@@ -843,7 +844,9 @@ class Modeller(object): ...@@ -843,7 +844,9 @@ class Modeller(object):
if atom.element is not None: if atom.element is not None:
newIndex[i] = index newIndex[i] = index
index += 1 index += 1
newTemplate.atoms.append(ForceField._TemplateAtomData(atom.name, atom.type, atom.element)) newAtom = ForceField._TemplateAtomData(atom.name, atom.type, atom.element)
newAtom.externalBonds = atom.externalBonds
newTemplate.atoms.append(newAtom)
for b1, b2 in template.bonds: for b1, b2 in template.bonds:
if b1 in newIndex and b2 in newIndex: if b1 in newIndex and b2 in newIndex:
newTemplate.bonds.append((newIndex[b1], newIndex[b2])) newTemplate.bonds.append((newIndex[b1], newIndex[b2]))
...@@ -968,7 +971,7 @@ class Modeller(object): ...@@ -968,7 +971,7 @@ class Modeller(object):
# and hope that energy minimization will fix it. # and hope that energy minimization will fix it.
knownPositions = [x for x in templateAtomPositions if x is not None] knownPositions = [x for x in templateAtomPositions if x is not None]
position = sum(knownPositions)/len(knownPositions) position = unit.sum(knownPositions)/len(knownPositions)
newPositions.append(position*nanometer) newPositions.append(position*nanometer)
for bond in self.topology.bonds(): for bond in self.topology.bonds():
if bond[0] in newAtoms and bond[1] in newAtoms: if bond[0] in newAtoms and bond[1] in newAtoms:
......
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