Commit 38d40527 authored by ChayaSt's avatar ChayaSt
Browse files

fixed parseElements

parent f7bfc6b7
......@@ -1679,13 +1679,11 @@ class NBFixGenerator(object):
def __init__(self, forcefield):
self.ff = forcefield
self.parmas = ForceField._AtomTypeParameters(forcefield, 'NonbondedForce', 'Atom', ('charge', 'sigma', 'epsilon'))
# I don't need charge but if I don't list it I get an error when calling parseDefinitions. ValueError:
# NonBondedForce: <UseAttributeFromResidue> specified an invalid attribute: charge
self.types1 = []
self.types2 = []
self.emin = []
self.rmin = []
self.nbfrc = [f for f in forcefield._forces if isinstance(f, NonbondedGenerator)]
def registerNBFix(self, parameters):
types = self.ff._findAtomTypes(parameters, 2)
......@@ -1708,30 +1706,30 @@ class NBFixGenerator(object):
for nbfix in element.findall('NBFix'):
generator.registerNBFix(nbfix.attrib)
generator.params.parseDefinitions(element)
def createForce(self, sys, data, nonbfrc, nonbondedMethod):
def createForce(self, sys, data, nonbondedMethod):
"""
Parameters
----------
sys
data
nonbfrc: NonbondedForce
NonBondedForce for the "standard" nonbonded interactions. This will be modified (specifically, L-J ixns
will be zeroed)
nonbondedMethod: NonbondedMethod (e.g., NoCutoff, PME, etc)
The nonbonded method to apply here. Ewald and PME will be interpreted as CutoffPeriodic for the
CustomNonbondedForce
"""
# NonBondedForce for 'standard' nonbonded interactions. This will be modified
nonbfrc = self.nbfrc[0]
# We need a CustomNonbondedForce to implement the NBFIX functionality.
# First derive the lookup tables
lj_indx_list = [0 for atom in data.atoms]
li_radii, lj_depths = [], []
num_lj_types= 0
lj_type_list = []
for i, atom in enumerate(data.atoms):
atype = data.atomTypes[atom]
values = self.params.paramsForType[atype]
values = nonbfrc.params.paramsForType[atype]
if lj_indx_list[i]: continue # already assigned
num_lj_types += 1
lj_indx_list[i] = num_lj_types
......@@ -1746,7 +1744,7 @@ class NBFixGenerator(object):
lj_indx_list[j] = num_lj_types
elif not atype in self.types1 or self.types2:
# Only non-NBFix atom types can be compressed
values = self.params.paramsForType[atype2]
values = nonbfrc.params.paramsForType[atype2]
ljtype2 = (values['sigma'], abs(values['epsilon']))
if ljtype == ljtype2:
lj_indx_list[j] = num_lj_types
......
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