Skip to content

Commit

Permalink
Merge pull request #177 from JoaoRodrigues/reproducible_addatoms
Browse files Browse the repository at this point in the history
Added a seed parameter to addMissingAtoms to allow reproducible results
  • Loading branch information
peastman committed Oct 4, 2018
2 parents 699ba10 + ace2452 commit 4cea9a7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pdbfixer/pdbfixer.py
Expand Up @@ -855,9 +855,15 @@ def findMissingAtoms(self):
self.missingAtoms = missingAtoms
self.missingTerminals = missingTerminals

def addMissingAtoms(self):
def addMissingAtoms(self, seed=None):
"""Add all missing heavy atoms, as specified by the missingAtoms, missingTerminals, and missingResidues fields.
Parameters
----------
seed : int
Integer to set the random seed number of the integrator used in the minimization of the
coordinates of the newly-added atoms.
Notes
-----
You must already have called findMissingAtoms() to have identified atoms to be added.
Expand Down Expand Up @@ -924,6 +930,8 @@ def addMissingAtoms(self):
# Do an energy minimization.

integrator = mm.LangevinIntegrator(300*unit.kelvin, 10/unit.picosecond, 5*unit.femtosecond)
if seed is not None:
integrator.setRandomNumberSeed(seed)
context = mm.Context(system, integrator)
context.setPositions(newPositions)
mm.LocalEnergyMinimizer.minimize(context)
Expand Down

0 comments on commit 4cea9a7

Please sign in to comment.