Commit 4cea9a7f by peastman Committed by GitHub

Merge pull request #177 from JoaoRodrigues/reproducible_addatoms

Added a seed parameter to addMissingAtoms to allow reproducible results
parents 699ba103 ace24522
......@@ -855,9 +855,15 @@ class PDBFixer(object):
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.
......@@ -924,6 +930,8 @@ class PDBFixer(object):
# 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)
......
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