Commit 6b6f92a0 authored by João Rodrigues's avatar João Rodrigues
Browse files

Removed duplicated code. Fixed comment on rounding integers.

parent 8c8dbed1
...@@ -312,7 +312,7 @@ class Modeller(object): ...@@ -312,7 +312,7 @@ class Modeller(object):
for i in range(nonbonded.getNumParticles()): for i in range(nonbonded.getNumParticles()):
nb_i = nonbonded.getParticleParameters(i) nb_i = nonbonded.getParticleParameters(i)
totalCharge += nb_i[0].value_in_unit(elementary_charge) totalCharge += nb_i[0].value_in_unit(elementary_charge)
# Round up to integer # Round to nearest integer
totalCharge = int(floor(0.5 + totalCharge)) totalCharge = int(floor(0.5 + totalCharge))
# Figure out how many ions to add based on requested params/concentration # Figure out how many ions to add based on requested params/concentration
...@@ -476,17 +476,6 @@ class Modeller(object): ...@@ -476,17 +476,6 @@ class Modeller(object):
raise ValueError('Neither the box size, box vectors, nor padding was specified, and the Topology does not define unit cell dimensions') raise ValueError('Neither the box size, box vectors, nor padding was specified, and the Topology does not define unit cell dimensions')
invBox = Vec3(1.0/box[0], 1.0/box[1], 1.0/box[2]) invBox = Vec3(1.0/box[0], 1.0/box[1], 1.0/box[2])
# Identify the ion types.
posIonElements = {'Cs+':elem.cesium, 'K+':elem.potassium, 'Li+':elem.lithium, 'Na+':elem.sodium, 'Rb+':elem.rubidium}
negIonElements = {'Cl-':elem.chlorine, 'Br-':elem.bromine, 'F-':elem.fluorine, 'I-':elem.iodine}
if positiveIon not in posIonElements:
raise ValueError('Illegal value for positive ion: %s' % positiveIon)
if negativeIon not in negIonElements:
raise ValueError('Illegal value for negative ion: %s' % negativeIon)
positiveElement = posIonElements[positiveIon]
negativeElement = negIonElements[negativeIon]
# Have the ForceField build a System for the solute from which we can determine van der Waals radii. # Have the ForceField build a System for the solute from which we can determine van der Waals radii.
system = forcefield.createSystem(self.topology) system = forcefield.createSystem(self.topology)
...@@ -1310,17 +1299,6 @@ class Modeller(object): ...@@ -1310,17 +1299,6 @@ class Modeller(object):
nx = int(ceil((proteinSize[0]+2*minimumPadding)/patchSize[0])) nx = int(ceil((proteinSize[0]+2*minimumPadding)/patchSize[0]))
ny = int(ceil((proteinSize[1]+2*minimumPadding)/patchSize[1])) ny = int(ceil((proteinSize[1]+2*minimumPadding)/patchSize[1]))
# Identify the ion types.
posIonElements = {'Cs+':elem.cesium, 'K+':elem.potassium, 'Li+':elem.lithium, 'Na+':elem.sodium, 'Rb+':elem.rubidium}
negIonElements = {'Cl-':elem.chlorine, 'Br-':elem.bromine, 'F-':elem.fluorine, 'I-':elem.iodine}
if positiveIon not in posIonElements:
raise ValueError('Illegal value for positive ion: %s' % positiveIon)
if negativeIon not in negIonElements:
raise ValueError('Illegal value for negative ion: %s' % negativeIon)
positiveElement = posIonElements[positiveIon]
negativeElement = negIonElements[negativeIon]
# Record the bonds for each residue. # Record the bonds for each residue.
resBonds = defaultdict(list) resBonds = defaultdict(list)
......
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