]> git.uio.no Git - u/mrichter/AliRoot.git/blame - GEANT321/gparal/gpdefrng.F
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / GEANT321 / gparal / gpdefrng.F
CommitLineData
fe4da5cc 1*CMZ : 26/02/96 11.38.47 by S.Ravndal
2*-- Author :
3C------------------------------------------------------------------------
4c gpdefrng( ibase )
5c
6c Modified: November 6, 1995 J.A. to provide more flexibility by
7c including argument
8c
9c Function: Provide seeds for the pseudo-random number
10c generator different on each node
11c If ibase <= 0 default sequences are used.
12c
13c Should be called to provide a default seeding.
14c Only currently available for RANECU/GRNDM.
15c
16c ibase= the RNG sequence for first node.
17c If ibase=0 a system default is used.
18c
19C called by: <USER>, uginit, (if CERNLIB_PARA switch is used)
20C------------------------------------------------------------------------
21#if defined(CERNLIB_PARA)
22 subroutine gpdefrng( ibase )
23 implicit none
24 integer ibase
25
26C--------------------------------------------------------------
27C Must be called in uginit only after other routines that do the
28C default RNG seeding for sequential machines
29C have been called (ie after ginit) ... see example uginit
30C--------------------------------------------------------------
31#include "geant321/mpifinc.inc"
32#include "geant321/multiprox.inc"
33#include "geant321/multseeds.inc"
34#include "geant321/gcflag.inc"
35#include "geant321/gcunit.inc"
36 integer ibasedef, lunerr
37 data ibasedef / 1 /
38 integer msgerror, rngerror
39 data msgerror, rngerror / 0, 0 /
40c----------------------------------------------------------------------------
41c Random number generator seeding:
42c
43c Set the seeds on each node for the start of a different sequence.
44c----------------------------------------------------------------------------
45c Done for RANECU
46c----------------------------------------------------------------------------
47
48 if ( ibase .lt. 0 ) then
49 ibase = 0
50 write( chmail, '(a,a,i4,a)' )
51 $ ' Warning: gpdefrng: ibase < 0 is invalid. Value =',
52 $ ibase , ' Reset to zero '
53 call gmail(1,1)
54 endif
55 if ( ibase .eq. 0 ) then
56 ibase = ibasedef
57 endif
58
59C We check to see if the resulting sequence is valid for RANECU
60
61 iseqnc = ibase + nprank
62 if( (iseqnc .gt.0 ) .and. (iseqnc .le. 215 )) then
63 call GRNDMQ( iseeda, iseedb, iseqnc, 'Q' )
64 write (*,*) ' Node ', nprank, ' init-ed seq ', iseqnc,
65 & ' and got seeds ', iseeda, iseedb
66 call GRNDMQ( iseeda, iseedb, iseqnc, 'S' )
67 else
68 write (lunerr, *) ' Node ', nprank, ': in GRNDMQ exceeds ',
69 & ' number of rng sequences with precalculated seeds.'
70 rngerror = 1
71
72c --- Other Possibility: ---
73c write (lunerr, *) ' Node ', nprank, ': wrapping around ... '
74c iseqnc = mod( iseqnc, 215 ) + 1
75c call GRNDMQ( iseeda, iseedb, iseqnc, 'Q' )
76 endif
77#if defined(CERNLIB_PARA_RANMAR)
78c----------------------------------------------------------------------------
79c In the case that RANMAR is used
80c
81c----------------------------------------------------------------------------
82 ibase = nrndm(1)
83 iseeda = ibase * 100 + nprank
84 iseqnc = 1
85c
86c As changed by Stic/Delphi only the first parameter is used.
87c
88 call GRNDMQ( iseeda, iseedb, iseqnc, 'S' )
89c
90#endif
91 return
92 end
62be6b28 93#else
94 SUBROUTINE GPDEFRNG_DUMMY
95 END
fe4da5cc 96#endif
97