Re: [AMBER] random number generators visible from nab: choice necessary?

From: M. L. Dodson <>
Date: Tue, 8 Jun 2010 11:16:46 -0500

On Jun 7, 2010, at 5:10 PM, case wrote:


> That said, rand2.c needs a facelift: the comments are outdated, at the least,
> and the method of random number generation is not made clear. It would
> probably be good to port the algorithms in AmberTools/lib/random.f to
> ../sff/rand2.c

OK, I did some looking around with Teh Google. sff/rand2.c appears to use the MRG32k3a RNG from Pierre L'Ecuyer. (Some on the list may already know this, if so, sorry, I came to the party late.) This appears to be a quite highly thought of RNG. I have enclosed a reference implementation in C.

Given this, I suggest an edit to rand2.c to call attention to this point, otherwise to let it lie. If we dink around with it, we will either be changing the algorithm or the names. Neither of these is likely to be good for the principle of least astonishment or expected performance on the test suite.

The Box-Mueller method used in gauss() is completely standard, used everywhere, and seems to me to need no additional documentation.

I found a Marsaglia RNG in C with a friendly license, and it comes with test code to make sure it is giving the same sequence as the reference implementation. I am willing to pursue this as an addendum to the nab library (using different function names), but, given the availability of random.f and the ability of nab to use Fortran subroutines, I don't see this as critical. We should probably pursue this off list. (If we pursue it at all.)


PS, I was wrong about the possible name clash for gauss(). I forgot about the trailing underscore in compiled Fortran names.

>> PS, the SA routine has its own enclosed version of the Marsaglia
>> generator, but I would like to restrict the added code to the minimum
>> necessary.
> Given the comments above, you might want to consider using the Marsaglia
> generator, or proposing updates to rand2.c.
> ...regards...dave

M. L. Dodson
Business email: activesitedynamics-at-comcast-dot-net
Personal email: mldodson-at-comcast-dot-net
Phone: eight_three_two-five_63-386_one

AMBER mailing list

Received on Tue Jun 08 2010 - 09:30:03 PDT
Custom Search