1 *CMZ : 26/02/96 11.38.47 by S.Ravndal
3 C------------------------------------------------------------------------
6 c Modified: November 6, 1995 J.A. to provide more flexibility by
9 c Function: Provide seeds for the pseudo-random number
10 c generator different on each node
11 c If ibase <= 0 default sequences are used.
13 c Should be called to provide a default seeding.
14 c Only currently available for RANECU/GRNDM.
16 c ibase= the RNG sequence for first node.
17 c If ibase=0 a system default is used.
19 C called by: <USER>, uginit, (if CERNLIB_PARA switch is used)
20 C------------------------------------------------------------------------
21 #if defined(CERNLIB_PARA)
22 subroutine gpdefrng( ibase )
26 C--------------------------------------------------------------
27 C Must be called in uginit only after other routines that do the
28 C default RNG seeding for sequential machines
29 C have been called (ie after ginit) ... see example uginit
30 C--------------------------------------------------------------
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
38 integer msgerror, rngerror
39 data msgerror, rngerror / 0, 0 /
40 c----------------------------------------------------------------------------
41 c Random number generator seeding:
43 c Set the seeds on each node for the start of a different sequence.
44 c----------------------------------------------------------------------------
46 c----------------------------------------------------------------------------
48 if ( ibase .lt. 0 ) then
50 write( chmail, '(a,a,i4,a)' )
51 $ ' Warning: gpdefrng: ibase < 0 is invalid. Value =',
52 $ ibase , ' Reset to zero '
55 if ( ibase .eq. 0 ) then
59 C We check to see if the resulting sequence is valid for RANECU
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' )
68 write (lunerr, *) ' Node ', nprank, ': in GRNDMQ exceeds ',
69 & ' number of rng sequences with precalculated seeds.'
72 c --- Other Possibility: ---
73 c write (lunerr, *) ' Node ', nprank, ': wrapping around ... '
74 c iseqnc = mod( iseqnc, 215 ) + 1
75 c call GRNDMQ( iseeda, iseedb, iseqnc, 'Q' )
77 #if defined(CERNLIB_PARA_RANMAR)
78 c----------------------------------------------------------------------------
79 c In the case that RANMAR is used
81 c----------------------------------------------------------------------------
83 iseeda = ibase * 100 + nprank
86 c As changed by Stic/Delphi only the first parameter is used.
88 call GRNDMQ( iseeda, iseedb, iseqnc, 'S' )