From chemistry-request@server.ccl.net Wed Oct  2 03:38:23 2002
Received: from mailgate.rz.uni-karlsruhe.de (exim@[129.13.64.97])
	by server.ccl.net (8.11.6/8.11.0) with ESMTP id g927cNc03069
	for <chemistry@ccl.net>; Wed, 2 Oct 2002 03:38:23 -0400
Received: from rz70.rz.uni-karlsruhe.de (rz70.rz.uni-karlsruhe.de [129.13.97.243])
	by mailgate.rz.uni-karlsruhe.de with esmtp (Exim 3.36 #1)
	id 17we56-0000VR-00; Wed, 02 Oct 2002 09:38:04 +0200
Date: Wed, 2 Oct 2002 09:38:04 +0200 (CES)
From: Harald Svedung <cd95@rz.uni-karlsruhe.de>
To: sweta nigam <sweta_n@atc.tcs.co.in>
cc: chemistry@ccl.net, <sankha@atc.tcs.co.in>
Subject: Re: CCL:random no.generation(doubt)
In-Reply-To: <003701c2687a$e8382e50$a62813ac@ATCSWETANIGAM>
Message-ID: <Pine.HPX.4.44.0210020919250.23745-100000@rz70.rz.uni-karlsruhe.de>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by server.ccl.net id g927cNc03070


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




