Commit c2191b61 authored by Jason Swails's avatar Jason Swails
Browse files

Add a section at the end of the manual about stochastic forces, integrators, and

random numbers.  Add 2 citations about Langevin synchronization.  Convert the
references.bib file to UNIX line endings.
parent be8bd376
This diff is collapsed.
...@@ -1379,3 +1379,65 @@ specific types of rules. They are: ...@@ -1379,3 +1379,65 @@ specific types of rules. They are:
.. math:: .. math::
\mathbf{r}=\mathbf{o}+p_1\mathbf{\hat{x}}+p_2\mathbf{\hat{y}}+p_3\mathbf{\hat{z}} \mathbf{r}=\mathbf{o}+p_1\mathbf{\hat{x}}+p_2\mathbf{\hat{y}}+p_3\mathbf{\hat{z}}
.. ..
Random Numbers with Stochastic Integrators and Forces
*****************************************************
OpenMM includes many stochastic integrators and forces that make extensive use
of random numbers. It is impossible to generate truly random numbers on a
computer like you would with a dice roll or coin flip in real life---instead
programs rely on pseudo-random number generators (PRNGs) that take some sort of
initial "seed" value and steps through a sequence of seemingly random numbers.
The exact implementation of the PRNGs is not important (in fact, each platform
may have its own PRNG whose performance is optimized for that hardware). What
*is* important, however, is that the PRNG must generate a uniform distribution
of random numbers between 0 and 1. Random numbers drawn from this distribution
can be manipulated to yield random integers in a desired range or even a random
number from a different type of probability distribution function (e.g., a
normal distribution).
What this means is that the random numbers used by integrators and forces within
OpenMM cannot have any discernible pattern to them. Patterns can be induced in
PRNGs in two principle ways:
1. The PRNG uses a bad algorithm with a short period.
2. Two PRNGs are started using the same seed
All PRNG algorithms in common use are periodic---that is their sequence of
random numbers repeats after a given *period*, defined by the number of "unique"
random numbers in the repeating pattern. As long as this period is longer than
the total number of random numbers your application requires (preferably by
orders of magnitude), the first problem described above is avoided. All PRNGs
employed by OpenMM have periods far longer than any current simulation can cycle
through.
Point two is far more common in biomolecular simulation, and can result in very
strange artifacts that may be difficult to detect. For example, with Langevin
dynamics, two simulations that use the same sequence of random numbers appear to
synchronize in their global movements.\ :cite:`Uberuaga2004`\
:cite:`Sindhikara2009` It is therefore very important that the stochastic forces
and integrators in OpenMM generate unique sequences of pseudo-random numbers not
only within a single simulation, but between two different simulations of the
same system as well (including any restarts of previous simulations).
Every stochastic force and integrator that does (or could) make use of random
numbers has two instance methods attached to it: ``getRandomNumberSeed()`` and
``setRandomNumberSeed(int seed)``. If you set a unique random seed for two
different simulations (or different forces/integrators if applicable), OpenMM
guarantees that the generated sequences of random numbers will be different (by
contrast, no guarantee is made that the same seed will result in identical
random number sequences).
Since breaking simulations up into pieces and/or running multiple replicates of
a system to obtain more complete statistics is common practice, a new strategy
has been employed for OpenMM versions 6.3 and later with the aim of trying to
ensure that each simulation will be started with a unique random seed. A random
seed value of 0 (the default) will cause a unique random seed to be generated
when a new ``Context`` is instantiated.
Prior to the introduction of this feature, deserializing a serialized
``System`` XML file would result in each stochastic force or integrator being
assigned the same random seed as the original instance that was serialized. If
you use a ``System`` XML file generated by a version of OpenMM older than 6.3
to start a new simulation, you should manually set the random number seed of
each stochastic force or integrator to 0 (or another unique value).
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