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

From: case <>
Date: Mon, 7 Jun 2010 18:10:47 -0400

On Mon, Jun 07, 2010, M. L. Dodson wrote:
> I have been investigating the random number generators available in nab
> (for a project interfacing nab to a simulated annealing routine written
> in Fortran) and find that the function gauss() is implemented in rand2.c
> as
> REAL_T gauss( REAL_T *mean, REAL_T *sd ) {
> etc.
> }
> but it is also defined in random.f as
> !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> !+ Default generator wrapper for gauss_gen
> subroutine gauss(am,sd,v)
> implicit none
> #include "random.h"
> _REAL_, intent (in) :: am, sd
> _REAL_, intent (out) :: v
> type (rand_gen_state) :: def_gen
> common /raset1/ def_gen
> call gauss_gen(def_gen, am, sd, v)
> end subroutine gauss

I'm pretty sure nab/sff never sees random.f. So, the gauss() routine in
rand2.c is what would get called.

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

> 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.


AMBER mailing list
Received on Mon Jun 07 2010 - 15:30:03 PDT
Custom Search