Unverified Commit 3b3def0e authored by Richard Gowers's avatar Richard Gowers Committed by GitHub
Browse files

addSolvent now only replaces newly added water molecules with ions (#4104)

* addSolvent now only replaces newly added water molecules with ions

previously pre-existing (i.e. potentially crystallographic waters) were candidates for replacement with an ion.

concentration calculations (i.e. total water molecules) still include these pre-existing water molecules

* only include added water in concentration calc
parent f30d716a
......@@ -619,7 +619,7 @@ class Modeller(object):
addedWaters = filteredWaters
# Add the water molecules.
waterPos = {}
for index, pos in addedWaters:
newResidue = newTopology.addResidue(residue.name, newChain)
residue = pdbResidues[index]
......@@ -629,6 +629,8 @@ class Modeller(object):
for atom in residue.atoms():
molAtoms.append(newTopology.addAtom(atom.name, atom.element, newResidue))
newPositions.append((pos+pdbPositions[atom.index]-oPos)*nanometer)
if atom.element == elem.oxygen:
waterPos[newResidue] = newPositions[-1]
for atom1 in molAtoms:
if atom1.element == elem.oxygen:
for atom2 in molAtoms:
......@@ -638,16 +640,6 @@ class Modeller(object):
self.topology = newTopology
self.positions = newPositions
# Convert water list to dictionary (residue:position)
waterPos = {}
_oxygen = elem.oxygen
for chain in newTopology.chains():
for residue in chain.residues():
if residue.name == 'HOH':
for atom in residue.atoms():
if atom.element == _oxygen:
waterPos[residue] = newPositions[atom.index]
# Total number of waters in the box
numTotalWaters = len(waterPos)
......
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