28 character(10) :: normal_generator=
'random_d'
33 logical :: file_exists
34 character(14) :: empire_namelist=
'empire.nml'
38 inquire(file=empire_namelist,exist=file_exists)
40 open(unit_nml,file=empire_namelist,iostat=ios,action=
'read'&
41 &,status=
'old',form=
'formatted')
43 write(emp_e,*)
'Cannot open ',empire_namelist
44 write(emp_e,*)
'open_emp_o ERROR'
49 if(ios .ne. 0) normal_generator=
'random_d'
50 write(emp_o,*)
'random_number_controls: normal_generator read as: &
53 normal_generator =
'random_d'
62 integer,
parameter :: rk = kind(1.0d0)
63 integer,
intent(in) :: n
64 real(kind=rk),
intent(in) :: minv
65 real(kind=rk),
intent(in) :: maxv
66 real(kind=rk),
dimension(n),
intent(out) :: phi
68 call random_number(phi)
70 phi = minv + (maxv-minv)*phi
80 integer,
parameter :: rk = kind(1.0d0)
81 integer,
intent(in) :: n
82 real(kind=rk),
INTENT(IN) :: mean
83 real(kind=rk),
INTENT(IN) :: stdev
84 real(kind=rk),
dimension(n),
INTENT(OUT) :: phi
87 select case(normal_generator)
94 phi(i) = mean+stdev*
rnor()
97 write(emp_e,*)
'EMPIRE ERROR: wrong normal_generator selected in Nor&
99 write(emp_e,*)
'EMPIRE ERROR: normal_generator = ',normal_generator&
115 integer,
parameter :: rk = kind(1.0d0)
116 integer,
intent(in) :: n
117 integer,
intent(in) :: k
118 real(kind=rk),
INTENT(IN) :: mean
119 real(kind=rk),
INTENT(IN) :: stdev
120 real(kind=rk),
dimension(n,k),
INTENT(OUT) :: phi
123 select case(normal_generator)
133 phi(i,j) = mean+stdev*
rnor()
137 write(emp_e,*)
'EMPIRE ERROR: wrong normal_generator selected in Nor&
139 write(emp_e,*)
'EMPIRE ERROR: normal_generator = ',normal_generator&
163 real(kind=kind(1.0D0)),
intent(in) :: mean,stdev,ufac,epsi
164 integer,
intent(in) :: n
165 real(kind=kind(1.0D0)),
dimension(n),
intent(out) :: phi
166 logical,
intent(out) :: uniform
167 real(kind=kind(1.0D0)) :: draw
170 if(comm_version .eq. 1 .or. comm_version .eq. 2)
then
171 call random_number(draw)
172 elseif(comm_version .eq. 3)
then
173 if(pf_member_rank .eq. 0)
then
174 call random_number(draw)
176 call mpi_scatter(draw,1,mpi_double_precision,draw,1&
177 &,mpi_double_precision,0,pf_member_rank,mpi_err)
179 print*,
'EMPIRE VERSION ',comm_version,
' NOT SUPPORTED IN gen_rand'
180 print*,
'THIS IS AN ERROR. STOPPING'
184 if(draw .gt. epsi)
then
210 real(kind=kind(1.0D0)),
intent(in) :: mean,stdev,ufac,epsi
211 integer,
intent(in) :: n,k
212 real(kind=kind(1.0D0)),
dimension(n,k),
intent(out) :: phi
213 logical,
dimension(k),
intent(out) :: uniform
214 real(kind=kind(1.0D0)) :: draw
218 call random_number(draw)
220 if(draw .gt. epsi)
then
237 integer,
intent(in) :: pfid
240 integer,
allocatable,
dimension(:) :: seed
244 call random_seed(size=n)
246 call random_seed(get=seed)
249 if(.not. pf%gen_data)
then
254 call random_seed(put=seed)
subroutine normalrandomnumbers2d(mean, stdev, n, k, phi)
generate two dimensional Normal random numbers
Module containing EMPIRE coupling data.
Module that stores the information about the outputting from empire.
subroutine set_random_number_controls
subroutine mixturerandomnumbers1d(mean, stdev, ufac, epsi, n, phi, uniform)
generate one dimensional vector drawn from mixture density
subroutine normalrandomnumbers1d(mean, stdev, n, phi)
generate one dimension of Normal random numbers
subroutine, public zigset(jsrseed)
subroutine random_seed_mpi(pfid)
Subroutine to set the random seed across MPI threads.
real(dp) function, public rnor()
module pf_control holds all the information to control the the main program
real(kind=kind(1.0d+0)) function random_normal()
function to get random normal with zero mean and stdev 1
A module for random number generation from the following distributions:
subroutine mixturerandomnumbers2d(mean, stdev, ufac, epsi, n, k, phi, uniform)
generate two dimensional vector, each drawn from mixture density
subroutine uniformrandomnumbers1d(minv, maxv, n, phi)
generate one dimension of uniform random numbers