Marsaglia RNG

Hi,

I would like to have more information about the random number generator used for DPD.

The source code (random_mars.cpp) mentions it is the "Marsaglia random number generator". However, there seems to be a whole family RNGs corresponding to that definition (ex: http://www.cse.yorku.ca/~oz/marsaglia-rng.html).

Which RNGs are used in this case? Is it's period known (or estimated)? How extensively has it been tested?

Thanks,

Hi,

I would like to have more information about the random number generator
used for DPD.

The source code (random_mars.cpp) mentions it is the "Marsaglia random
number generator". However, there seems to be a whole family RNGs
corresponding to that definition (ex:
http://www.cse.yorku.ca/~oz/marsaglia-rng.html).

if you look at the code, then you can figure that out. chances are
that it is adapted from what is implemented in commonly used sources
like numerical recipes.

Which RNGs are used in this case? Is it's period known (or estimated)?
How extensively has it been tested?

if you want a high quality pseudo random number generator, this is not
it. since the random number generator interface is modular, it would
be straightforward to interface a state-of-the-art modern pRNG like a
Mersenne twister variant.
please keep in mind, that normally in an MD run, the pRNG is used for
tasks where high quality random numbers are not really required
(initial velocities, randomized positions for initial geometries)
since any bad effects of the pRNG will be overcompensated by the
natural fluctuations due to the physics of the system.

axel.

It’s the RANMAR RNG discussed in the
attached paper by James, 1990 in CPC.
Period = 10^30 and 10^9 indenpendent
starting points. The latter is why it’s great to
use in parallel.

Steve

James90.pdf (1.31 MB)

Not that LAMMPS needs it (for the reason Axel mentioned), but on this
general topic, http://dl.acm.org/citation.cfm?id=2063405
(http://www.thesalmons.org/john/random123/papers/random123sc11.pdf)
might be of interest to people.

Jeff

Thank you, Axel and Steve,

I had already spent time looking at the code, but the concise coding style and many magic numbers (primes!) didn't allow my humble brain to properly understand the RNG. It's much clearer now.

The RNG used for velocities and position initialization is the Park-Miller RNG, a LCG, which is probably worse.

Indeed, the RNG's quality seems much less critical in dynamics than, say, in pure MC. Intensive use of the MC-like capacities of lammps should probably be made with care.

Thank you very much for the paper and insights, this will satisfy my curiosity.

Samuel Palato

Thank you, Axel and Steve,

I had already spent time looking at the code, but the concise coding
style and many magic numbers (primes!) didn't allow my humble brain to
properly understand the RNG. It's much clearer now.

The RNG used for velocities and position initialization is the
Park-Miller RNG, a LCG, which is probably worse.

Indeed, the RNG's quality seems much less critical in dynamics than,
say, in pure MC. Intensive use of the MC-like capacities of lammps
should probably be made with care.

FYI, i just implemented a Mersenne Twister RNG in my LAMMPS branch,
that could be used as a drop-in replacement for the masaglia RNG
(which is still used to seed the MT RNG).

axel.

Can you share it? I would like to compare it's performance with the current implementation.

Samuel Palato

https://sites.google.com/site/akohlmey/software/lammps-icms