openmm / pdbfixer

PDBFixer fixes problems in PDB files
Other
461 stars 115 forks source link

Added a seed parameter to addMissingAtoms to allow reproducible results #177

Closed JoaoRodrigues closed 5 years ago

JoaoRodrigues commented 5 years ago

Addresses issue #176. Setting the random seed when calling addMissingAtoms yields reproducible atom positions, while no seed results in the current behaviour (no reproducibility).

peastman commented 5 years ago

Looks good. Be aware though that even if you set the seed, that doesn't guarantee you'll get identical results every time. It depends on the platform you're using. For example, on the CPU platform the CustomNonbondedForce sums interactions in a non-deterministic order. That causes the initial forces to be slightly different, which can cause the minimization to end up somewhere different.

JoaoRodrigues commented 5 years ago

Thanks Peter. Indeed, but at least on the same platform running the same script gives the same result.

I'd consider actually adding a similar setting for addHydrogens in openmm because of a similar issue. Maybe there a global setSeed method would be better, for simplicity.

peastman commented 5 years ago

but at least on the same platform running the same script gives the same result.

Not necessarily. With some platforms it will. For others it won't.