From ace245225fad3be64d37d02976d66cd68ee2485b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Rodrigues?= Date: Wed, 3 Oct 2018 15:34:49 -0700 Subject: [PATCH] Added a seed parameter to addMissingAtoms to allow reproducible results --- pdbfixer/pdbfixer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pdbfixer/pdbfixer.py b/pdbfixer/pdbfixer.py index d1ac03e..7a09374 100644 --- a/pdbfixer/pdbfixer.py +++ b/pdbfixer/pdbfixer.py @@ -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. @@ -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)