pdbfixer
pdbfixer copied to clipboard
Non-reproducible behaviour of `addMissingAtoms`
Running addMissingAtoms()
gives different results because the LocalEnergyMinimizer
does not allow setting a random seed from pdbfixer
. The end result is that re-built sidechains are pointing in different directions at every different try, which is not good for reproducibilty. Setting random.seed
and np.random.seed
does not help. The following code snippet ran on any structure missing heavy atoms will reproduce the problem.
for i in range(5):
random.seed(917)
import pdbfixer as pf
from simtk.openmm.app import PDBFile
mol = pf.PDBFixer('../example/4xt1_AB.pdb')
mol.findMissingResidues()
mol.findMissingAtoms()
mol.addMissingAtoms()
with open('output_{}.pdb'.format(i), 'w') as handle:
PDBFile.writeFile(mol.topology, mol.positions, handle)
My suggestion would be add an optional seed parameter to addMissingAtoms
that then sets the integrator seed. I'll follow with a pull request.