Re: CCL:random no.generation(doubt)
hello,
A random number generator with very little remaining structure in the
result of consecutive calls may look like this:
function ggubs()
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c ggubs
c
c
c purpose - basic uniform (0,1) pseudo-random number
c generator
c arguments dseed - input/output double precision variable
c assigned an integer value in the
c exclusive range (1.d0, 2147483647.d0).
c dseed is replaced by a new value to be
c used in a subsequent call.
c
c
real*8 dseed,c1,c2,ggubs,c3
include 'mpif.h'
parameter (c1=2147483647.d+00,c2=2.d+00**(-31),ic3=16807)
common/random/dseed
dseed=dmod(ic3*dseed,c1)
ggubs=c2*dseed
i=i+1
5 format(d30.20)
return
end
where dmod(x,y) does the following:
DMOD
DMOD calculates a longreal number modulus a second longreal number.
Declaration
FUNCTION DMOD(VAR x,y:LONGREAL):LONGREAL; EXTERNAL;
Attributes
Parameters: Both arguments are longreal numbers.
Result: A longreal number.
HP FORTRAN 77/XL: Intrinsic function: Z=DMOD(X,Y).
Error: If either of the arguments is a NaN (or the
first argument is infinity or the second
argument is zero), there are two possible
actions. If the INVALID trap is enabled, the
message "DMOD(X,Y): ANY OF X AND Y=NaN OR
X=INFINITY OR Y=0.0" occurs. Otherwise, the
INVALID flag is set. In either case, a quiet
NaN is returned.
This was tested in the context of phase space sampling for molecular
dynamics simulations by some folks in Göteborg like 10 years ago
(I havn't got the exact reference at arms length, sorry) and it has
been used ever since.
for what it's worth ;-)
/Harald
On Mon, 30 Sep 2002, sweta nigam wrote:
> hello
> can u help me to find out what r random no.generators ,plz site some
examples used in commercial software like tripos or accelrys in their molecular
dyanamics suite...
>
> Thanks n Regards
> Sweta
> TCS
>
Dr. Harald Svedung cellphone: +49-175 736 2576
Institut für Physikalische Chemie or: +46-709-223 206
Universität Karlsruhe
Fritz-Haber-Weg 4
D-761 28 Karlsruhe
Tyskland
Tel: +49-721 608 2715
Fax:+49-721 608 6524