Only one random number generator is used everywhere ("randy", which

seems to be the most uniform). Beware all kinds of unexpected side
effects.


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@5272 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
giannozz 2008-11-05 20:25:20 +00:00
parent 6856ddc581
commit 6f52984cd2
20 changed files with 89 additions and 301 deletions

View File

@ -1,5 +1,5 @@
!
! Copyright (C) 2002-2005 FPMD-CPV groups
! Copyright (C) 2002-2008 Quantum-Espresso group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
@ -363,7 +363,7 @@
USE mp_global, ONLY: me_image, nproc_image, root_image, intra_image_comm
USE reciprocal_vectors, ONLY: ig_l2g, ngw, ngwt, gzero
USE io_global, ONLY: stdout
USE random_numbers, ONLY: rranf
USE random_numbers, ONLY: randy
IMPLICIT NONE
@ -402,8 +402,8 @@
DO ib = noff, noff + n - 1
pwt( : ) = 0.0d0
DO ig = 3, ntest
rranf1 = 0.5d0 - rranf()
rranf2 = rranf()
rranf1 = 0.5d0 - randy()
rranf2 = randy()
pwt( ig ) = ampre * CMPLX(rranf1, rranf2)
END DO
DO ig = 1, ngw

View File

@ -34,7 +34,7 @@ SUBROUTINE compute_u_kq(ik, q)
USE bp, ONLY : lelfield
USE control_flags, ONLY : iverbosity
USE becmod, ONLY : becp
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
USE buffers
USE gipaw_module
IMPLICIT NONE
@ -100,8 +100,8 @@ SUBROUTINE compute_u_kq(ik, q)
! randomize a little bit
do i = 1, nbnd
do ig = 1, npw
rr = 0.1d0*(2.d0*rndm() - 1.d0)
arg = tpi * rndm()
rr = 0.1d0*(2.d0*randy() - 1.d0)
arg = tpi * randy()
evc(ig,i) = evc(ig,i)*CMPLX(1.d0+rr*cos(arg),rr*sin(arg))
enddo
enddo

View File

@ -513,6 +513,7 @@
USE cell_base, ONLY: r_to_s
USE io_global, ONLY: stdout
USE random_numbers, ONLY: randy
IMPLICIT NONE
REAL(DP) :: hinv(3,3)
@ -534,7 +535,7 @@
WRITE( stdout,615)
DO isa = isa_s, isa_e
oldp = tau(:,isa)
CALL RANDOM_NUMBER( rand_disp )
rand_disp = randy ()
rand_disp = amprp(is) * ( rand_disp - 0.5_DP )
rdisp = rand_disp
CALL r_to_s( rdisp(:), rand_disp(:), hinv )

View File

@ -272,7 +272,7 @@ MODULE metadyn_base
USE metadyn_vars, ONLY : ncolvar, fe_grad, fe_step, new_target, &
to_target, sw_nstep, gaussian_pos, &
g_amplitude
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
!
IMPLICIT NONE
!
@ -291,7 +291,7 @@ MODULE metadyn_base
!
gaussian_pos(i) = constr_target(i) - fe_step(i)*fe_grad(i)
!
step = ( 1.0_DP + 0.5_DP*rndm() )*fe_step(i)
step = ( 1.0_DP + 0.5_DP*randy() )*fe_step(i)
!
new_target(i) = constr_target(i) - step*fe_grad(i)
!

View File

@ -1,5 +1,5 @@
!
! Copyright (C) 2001-2005 Quantum-ESPRESSO group
! Copyright (C) 2001-2008 Quantum-ESPRESSO group
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
@ -13,8 +13,6 @@ MODULE random_numbers
!
IMPLICIT NONE
!
INTEGER, SAVE :: irand
!
INTERFACE gauss_dist
!
MODULE PROCEDURE gauss_dist_scal, gauss_dist_vect
@ -24,188 +22,54 @@ MODULE random_numbers
CONTAINS
!
!------------------------------------------------------------------------
FUNCTION rranf()
FUNCTION randy ( irand )
!------------------------------------------------------------------------
!
IMPLICIT NONE
!
REAL(DP) :: rranf
!
INTEGER :: m, konst
DATA m/100001/, konst/125/
SAVE m, konst
!
m = m * konst
m = m - 2796203 * ( m / 2796203 )
!
rranf = DBLE( m ) / 2796203.0_DP
!
RETURN
!
END FUNCTION rranf
!
!------------------------------------------------------------------------
FUNCTION randy()
!------------------------------------------------------------------------
!
! ... use machine-specific random-number generator when available
! x=rand(n) : reseed with initial seed idum=n
! if randy is not explicitly initialized, it will be
! initialized with seed idum=0 the first time it is called
! x=rand( ) : generate uniform real(DP) numbers x in [0,1]
!
REAL(DP) :: randy
#ifdef __AIX
#define __USE_SYSTEM_RAND
randy = rand()
#endif
INTEGER, optional :: irand
!
! ... use fortran random-number generator in all other cases
!
#ifndef __USE_SYSTEM_RAND
INTEGER , PARAMETER :: m = 714025, &
ia = 1366, &
ic = 150889, &
ntab = 97
REAL(DP), PARAMETER :: rm = 1.0_DP / m
INTEGER :: ir(ntab), iff, idum, j, iy
DATA iff /0/, idum/0/
SAVE iff, idum, iy, ir
INTEGER :: j
INTEGER, SAVE :: ir(ntab), iy, idum=0
LOGICAL, SAVE :: first=.true.
!
!
IF ( idum < 0 .OR. iff == 0 ) THEN
IF ( present(irand) ) THEN
idum = irand
first=.true.
END IF
IF ( first ) THEN
!
iff = 1
first = .false.
idum = MOD( ic - idum, m )
!
DO j=1,ntab
idum=mod(ia*idum+ic,m)
ir(j)=idum
END DO
idum=mod(ia*idum+ic,m)
iy=idum
DO j=1,ntab
idum=mod(ia*idum+ic,m)
ir(j)=idum
END DO
idum=mod(ia*idum+ic,m)
iy=idum
END IF
j=1+(ntab*iy)/m
IF(j.gt.ntab.or.j.lt.1) call errore('randy','j out of range',j)
IF( j > ntab .OR. j < 1 ) call errore('randy','j out of range',j)
iy=ir(j)
randy=iy*rm
idum=mod(ia*idum+ic,m)
ir(j)=idum
#endif
!
RETURN
!
END FUNCTION randy
!
!------------------------------------------------------------------------
function rndm()
!------------------------------------------------------------------------
!
! ... random number generator equivalent to ran1 of Num.Rec.
!
IMPLICIT NONE
!
REAL(DP) :: rndm
REAL(DP) :: shuffle(32)
INTEGER :: i
LOGICAL :: first
DATA first / .TRUE. /
SAVE first, shuffle, i
!
! ... starting seed, must be not be 0
!
IF ( first ) irand = -1
!
IF ( first .OR. irand < 0 ) THEN
!
irand = - irand
!
DO i = 32 + 8, 1, - 1
!
shuffle( MIN( i, 32 ) ) = rndx( irand )
!
END DO
!
i = 32 * shuffle(1) + 1
!
first = .FALSE.
!
end if
!
rndm = shuffle(i)
!
shuffle(i) = rndx( irand )
!
i = 32 * rndm + 1
!
RETURN
!
END FUNCTION rndm
!
!------------------------------------------------------------------------
FUNCTION rndx( irand )
!------------------------------------------------------------------------
!
! ... random number generator equivalent to ran0 of Num.Rec.
!
IMPLICIT NONE
!
INTEGER, INTENT(INOUT) :: irand
REAL(DP) :: rndx
!
INTEGER :: im, ia, iq, ir, is, it
REAL(DP) :: obm
LOGICAL :: first
DATA first / .TRUE. /
SAVE im, ia, iq, ir, obm, first
!
IF ( first ) THEN
!
! ... this is 2**31-1 avoiding overflow
!
im = 2 * ( 2**30 - 1 ) + 1
obm = 1.0_DP / im
ia = 7*7*7*7*7
iq = im / ia
ir = im - ia * iq
!
first = .FALSE.
!
END IF
!
is = irand / iq
it = irand - is * iq
!
irand = ia * it - is * ir
!
IF ( irand < 0 ) irand = irand + im
!
rndx = irand * obm
!
RETURN
!
END FUNCTION rndx
!
!------------------------------------------------------------------------
SUBROUTINE set_rndm_seed( iseed )
!------------------------------------------------------------------------
!
! ... this subroutine initialize the random number with the given seed
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: iseed
! INTEGER :: irand
!
REAL(DP) :: dummy
!
IF ( iseed < 0 ) &
CALL errore( 'set_rndm_seed', 'seed should be a positive integer', 1 )
!
! ... make sure rndm() has been called already once !
!
dummy = rndm()
irand = - iseed
!
RETURN
!
END SUBROUTINE set_rndm_seed
!
!-----------------------------------------------------------------------
FUNCTION gauss_dist_scal( mu, sigma )
!-----------------------------------------------------------------------
@ -224,8 +88,8 @@ MODULE random_numbers
!
gaussian_loop: DO
!
x1 = 2.0_DP * rndm() - 1.0_DP
x2 = 2.0_DP * rndm() - 1.0_DP
x1 = 2.0_DP * randy() - 1.0_DP
x2 = 2.0_DP * randy() - 1.0_DP
!
w = x1 * x1 + x2 * x2
!
@ -263,8 +127,8 @@ MODULE random_numbers
!
gaussian_loop: DO
!
x1 = 2.0_DP * rndm() - 1.0_DP
x2 = 2.0_DP * rndm() - 1.0_DP
x1 = 2.0_DP * randy() - 1.0_DP
x2 = 2.0_DP * randy() - 1.0_DP
!
w = x1 * x1 + x2 * x2
!

View File

@ -183,7 +183,7 @@ CONTAINS
! - generate an array of random vectors (uniform deviate on unitary sphere)
!
USE constants, ONLY: tpi
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY: randy
implicit none
!
@ -201,9 +201,9 @@ CONTAINS
real(DP) :: costheta, sintheta, phi
do ir = 1, llx
costheta = 2.0_DP * rndm() - 1.0_DP
costheta = 2.0_DP * randy() - 1.0_DP
sintheta = SQRT ( 1.0_DP - costheta*costheta)
phi = tpi * rndm()
phi = tpi * randy()
r (1,ir) = sintheta * cos(phi)
r (2,ir) = sintheta * sin(phi)
r (3,ir) = costheta

View File

@ -547,7 +547,7 @@
! randomize wave functions coefficients
! ----------------------------------------------
USE random_numbers, ONLY : rranf
USE random_numbers, ONLY : randy
IMPLICIT NONE
! ... declare subroutine arguments
COMPLEX(DP) :: wf(:,:)
@ -560,8 +560,8 @@
! ----------------------------------------------
DO i = 1, SIZE(wf, 2)
DO j = 1, SIZE( wf, 1)
rranf1 = 0.5_DP - rranf()
rranf2 = 0.5_DP - rranf()
rranf1 = 0.5_DP - randy()
rranf2 = 0.5_DP - randy()
wf(j,i) = wf(j,i) + ampre * CMPLX(rranf1, rranf2)
END DO
END DO
@ -574,7 +574,7 @@
! randomize wave functions coefficients
! ----------------------------------------------
USE random_numbers, ONLY : rranf
USE random_numbers, ONLY : randy
IMPLICIT NONE
! ... declare subroutine arguments
COMPLEX(DP) :: wf(:)
@ -585,8 +585,8 @@
! ... end of declarations
! ----------------------------------------------
DO j = 1, SIZE( wf )
rranf1 = 0.5_DP - rranf()
rranf2 = 0.5_DP - rranf()
rranf1 = 0.5_DP - randy()
rranf2 = 0.5_DP - randy()
wf(j) = wf(j) + ampre * CMPLX(rranf1, rranf2)
END DO
RETURN

View File

@ -2,7 +2,7 @@ c* ///////////////////////////////////////////////////////////////////////////
c* @file mikpckd.f
c* @author Michael Holst
c* @brief A collection of useful low-level routines (timing, etc).
c* @version $Id: mikpckd.f,v 1.2 2008-06-19 14:47:18 varini Exp $
c* @version $Id: mikpckd.f,v 1.3 2008-11-05 20:25:18 giannozz Exp $
c* @attention
c* @verbatim
c*
@ -440,41 +440,6 @@ cmdir 3 3
11 continue
10 continue
c*
c* *** return and end ***
return
end
subroutine xrand(nx,ny,nz,x)
c* *********************************************************************
c* purpose:
c*
c* fill grid function with random values.
c*
c* author: michael holst
c* *********************************************************************
implicit none
integer nx,ny,nz,i,j,k,iflag
double precision x(nx,ny,nz)
double precision xdum
c*
cmdir 0 0
c*
c* *** do it ***
iflag = 1
call random_number(xdum)
cmdir 3 1
do 10 k = 2, nz-1
cmdir 3 2
do 11 j = 2, ny-1
cmdir 3 3
do 12 i = 2, nx-1
call random_number(x(i,j,k))
12 continue
11 continue
10 continue
c*
c* *** return and end ***
return
end
@ -544,52 +509,6 @@ cmdir 1 1
x(i) = 0.0d0
20 continue
c*
c* *** return and end ***
return
end
subroutine axrand(nx,ny,nz,x)
c* *********************************************************************
c* purpose:
c*
c* fill grid function with random values, including boundary values.
c*
c* author: michael holst
c* *********************************************************************
implicit none
integer nx,ny,nz,iflag
double precision x(*)
double precision xdum
integer n,i,ii,nproc,ipara,ivect
parameter (nproc=1)
c*
cmdir 0 0
c*
c* *** find parallel loops (ipara), remainder (ivect) ***
n = nx * ny * nz
ipara = n / nproc
ivect = mod(n,nproc)
iflag = 1
call random_number(xdum)
c*
c* *** do parallel loops ***
cmdir 2 1
do 10 ii = 1, nproc
cmdir 2 2
do 11 i = 1+(ipara*(ii-1)), ipara*ii
call random_number(x(i))
11 continue
10 continue
c*
c* *** do vector loops ***
cmdir 1 1
do 20 i = ipara*nproc+1, n
call random_number(x(i))
20 continue
c*
c* *** return and end ***
return
end

View File

@ -583,6 +583,7 @@ pcgreen.o : ../PW/pwcom.o
pcgreen.o : phcom.o
ph_restart.o : ../Modules/io_files.o
ph_restart.o : ../Modules/io_global.o
ph_restart.o : ../Modules/ions_base.o
ph_restart.o : ../Modules/kind.o
ph_restart.o : ../Modules/mp.o
ph_restart.o : ../Modules/mp_global.o
@ -982,9 +983,12 @@ transform_int_so.o : phcom.o
trntnsc.o : ../Modules/kind.o
trntnsr_3.o : ../Modules/kind.o
write_dyn_on_file.o : ../Modules/kind.o
write_epsilon_and_zeu.o : ../Modules/cell_base.o
write_epsilon_and_zeu.o : ../Modules/constants.o
write_epsilon_and_zeu.o : ../Modules/io_global.o
write_epsilon_and_zeu.o : ../Modules/ions_base.o
write_epsilon_and_zeu.o : ../Modules/kind.o
write_epsilon_and_zeu.o : phcom.o
write_matrix.o : ../Modules/io_global.o
write_matrix.o : ../Modules/kind.o
write_ramtns.o : ../Modules/cell_base.o

View File

@ -17,7 +17,7 @@ subroutine random_matrix (irt, irgq, nsymq, minus_q, irotmq, nat, &
!
!
USE kinds, only : DP
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
implicit none
!
! The dummy variables
@ -48,13 +48,13 @@ subroutine random_matrix (irt, irgq, nsymq, minus_q, irotmq, nat, &
wdyn (:, :, :, :) = (0d0, 0d0)
do na = 1, nat
do ipol = 1, 3
wdyn (ipol, ipol, na, na) = CMPLX (2 * rndm () - 1, 0.d0)
wdyn (ipol, ipol, na, na) = CMPLX (2 * randy () - 1, 0.d0)
do jpol = ipol + 1, 3
if (lgamma) then
wdyn (ipol, jpol, na, na) = CMPLX (2 * rndm () - 1, 0.d0)
wdyn (ipol, jpol, na, na) = CMPLX (2 * randy () - 1, 0.d0)
else
wdyn (ipol, jpol, na, na) = &
CMPLX (2 * rndm () - 1, 2 * rndm () - 1)
CMPLX (2 * randy () - 1, 2 * randy () - 1)
endif
wdyn (jpol, ipol, na, na) = CONJG(wdyn (ipol, jpol, na, na) )
enddo
@ -70,10 +70,10 @@ subroutine random_matrix (irt, irgq, nsymq, minus_q, irotmq, nat, &
if ( (nb == ira) .or. (nb == iramq) ) then
do jpol = 1, 3
if (lgamma) then
wdyn (ipol, jpol, na, nb) = CMPLX (2*rndm () - 1, 0.d0)
wdyn (ipol, jpol, na, nb) = CMPLX (2*randy () - 1, 0.d0)
else
wdyn (ipol, jpol, na, nb) = &
CMPLX (2*rndm () - 1, 2*rndm () - 1)
CMPLX (2*randy () - 1, 2*randy () - 1)
endif
wdyn(jpol, ipol, nb, na) = CONJG(wdyn(ipol, jpol, na, nb))
enddo

View File

@ -34,7 +34,7 @@ subroutine set_irr (nat, at, bg, xq, s, invs, nsym, rtau, irt, &
USE io_global, ONLY : stdout
USE kinds, only : DP
USE constants, ONLY: tpi
USE random_numbers, ONLY : set_rndm_seed
USE random_numbers, ONLY : randy
#ifdef __PARA
use mp, only: mp_bcast
#endif
@ -113,7 +113,7 @@ subroutine set_irr (nat, at, bg, xq, s, invs, nsym, rtau, irt, &
!
! then we generate a random hermitean matrix
!
call set_rndm_seed(1)
arg = randy(0)
call random_matrix (irt,irgq,nsymq,minus_q,irotmq,nat,wdyn,lgamma)
!call write_matrix('random matrix',wdyn,nat)
!

View File

@ -16,7 +16,7 @@ SUBROUTINE d_matrix_nc (dy012, dy112, dy212, dy312)
USE kinds, only: DP
USE cell_base, ONLY : at, bg, ibrav, symm_type
USE symme, ONLY: nsym, s
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
!
IMPLICIT NONE
!
@ -86,9 +86,9 @@ SUBROUTINE d_matrix_nc (dy012, dy112, dy212, dy312)
! randomly distributed points on a sphere
!
DO m = 1, maxm
rl (1, m) = rndm () - 0.5d0
rl (2, m) = rndm () - 0.5d0
rl (3, m) = rndm () - 0.5d0
rl (1, m) = randy () - 0.5d0
rl (2, m) = randy () - 0.5d0
rl (3, m) = randy () - 0.5d0
rrl (m) = rl (1,m)**2 + rl (2,m)**2 + rl (3,m)**2
END DO
CALL ylmr2 ( maxlm, 2*maxl+1, rl, rrl, ylm )

View File

@ -18,7 +18,7 @@ SUBROUTINE d_matrix_so (dyj12, dyj32, dyj52, dyj72)
USE cell_base, ONLY : at, bg, ibrav, symm_type
USE symme, ONLY: nsym, s
USE spin_orb, ONLY : rot_ylm
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
!
IMPLICIT NONE
!
@ -148,9 +148,9 @@ SUBROUTINE d_matrix_so (dyj12, dyj32, dyj52, dyj72)
! randomly distributed points on a sphere
!
DO m = 1, maxm
rl (1, m) = rndm () - 0.5d0
rl (2, m) = rndm () - 0.5d0
rl (3, m) = rndm () - 0.5d0
rl (1, m) = randy () - 0.5d0
rl (2, m) = randy () - 0.5d0
rl (3, m) = randy () - 0.5d0
rrl (m) = rl (1,m)**2 + rl (2,m)**2 + rl (3,m)**2
END DO
CALL ylmr2 ( maxlm, 2*maxl+1, rl, rrl, ylm )

View File

@ -1687,7 +1687,7 @@ end subroutine wan2sic
subroutine ylm_expansion
USE io_global, ONLY : stdout
use kinds, ONLY : DP
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
use wannier
implicit none
! local variables
@ -1703,7 +1703,7 @@ subroutine ylm_expansion
! generate a set of nr=lmax2 random vectors
do ir=1,lmax2
do i=1,3
r(i,ir) = rndm() -0.5d0
r(i,ir) = randy() -0.5d0
end do
end do
rr(:) = r(1,:)*r(1,:) + r(2,:)*r(2,:) + r(3,:)*r(3,:)

View File

@ -13,7 +13,7 @@ subroutine d_matrix (dy1, dy2, dy3)
USE kinds, only: DP
USE cell_base, ONLY : at, bg
USE symme, ONLY: nsym, s
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
implicit none
real(DP) :: dy1 (3, 3, 48), dy2 (5, 5, 48), dy3 (7, 7, 48)
!
@ -32,9 +32,9 @@ subroutine d_matrix (dy1, dy2, dy3)
! randomly distributed points on a sphere
!
do m = 1, maxm
rl (1, m) = rndm () - 0.5d0
rl (2, m) = rndm () - 0.5d0
rl (3, m) = rndm () - 0.5d0
rl (1, m) = randy () - 0.5d0
rl (2, m) = randy () - 0.5d0
rl (3, m) = randy () - 0.5d0
rrl (m) = rl (1,m)**2 + rl (2,m)**2 + rl (3,m)**2
enddo
call ylmr2 ( maxlm, 2*maxl+1, rl, rrl, ylm )

View File

@ -474,7 +474,7 @@ MODULE dynamics_module
SUBROUTINE apply_thermostat()
!--------------------------------------------------------------------
!
USE random_numbers, ONLY : rndm, gauss_dist
USE random_numbers, ONLY : randy, gauss_dist
!
IMPLICIT NONE
!
@ -554,7 +554,7 @@ MODULE dynamics_module
!
DO na = 1, nat
!
IF ( rndm() < 1.D0 / DBLE( nraise ) ) THEN
IF ( randy() < 1.D0 / DBLE( nraise ) ) THEN
!
sigma = SQRT( kt / mass(na) )
!

View File

@ -136,7 +136,7 @@ SUBROUTINE PAW_atomic_becsum()
USE lsda_mod, ONLY : nspin, starting_magnetization
USE paw_variables, ONLY : okpaw
USE paw_onecenter, ONLY : PAW_symmetrize
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
USE basis, ONLY : starting_wfc
IMPLICIT NONE
@ -184,7 +184,7 @@ SUBROUTINE PAW_atomic_becsum()
DO ispin = 1, nspin
becsum(ijh,na,ispin) = 0._dp
if (noise > 0._dp) &
becsum(ijh,na,ispin) = becsum(ijh,na,ispin) + noise *2._dp*(.5_dp-rndm())
becsum(ijh,na,ispin) = becsum(ijh,na,ispin) + noise *2._dp*(.5_dp-randy())
END DO
!
ijh = ijh + 1

View File

@ -153,7 +153,7 @@ SUBROUTINE init_wfc ( ik )
USE uspp, ONLY : nkb, okvan
USE noncollin_module, ONLY : npol
USE wavefunctions_module, ONLY : evc
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
!
IMPLICIT NONE
!
@ -207,8 +207,8 @@ SUBROUTINE init_wfc ( ik )
!
DO ig = 1, npw
!
rr = rndm()
arg = tpi * rndm()
rr = randy()
arg = tpi * randy()
!
wfcatom(ig,ipol,ibnd) = wfcatom(ig,ipol,ibnd) * &
( 1.0_DP + 0.05_DP * CMPLX( rr*COS(arg), rr*SIN(arg) ) )
@ -232,8 +232,8 @@ SUBROUTINE init_wfc ( ik )
!
DO ig = 1, npw
!
rr = rndm()
arg = tpi * rndm()
rr = randy()
arg = tpi * randy()
!
wfcatom(ig,ipol,ibnd) = &
CMPLX( rr*COS( arg ), rr*SIN( arg ) ) / &

View File

@ -14,7 +14,7 @@ subroutine find_coefficients &
! recherche des coefficients du polynome
!
use kinds, only : DP
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
implicit none
integer, intent(in) :: ndm, lam, ik
real(DP), intent(in):: vpot(ndm), psi(ndm), r(ndm), dx, energy
@ -56,7 +56,7 @@ subroutine find_coefficients &
oldvalue = funz(amat,ipvt,y,rc,ik,aenorm,c2o,c,c2, &
lam,r,dx,ndm)**2
10 continue
c2 = c2o + (0.5_dp - rndm())*dc2
c2 = c2o + (0.5_dp - randy())*dc2
newvalue = funz(amat,ipvt,y,rc,ik,aenorm,c2,c,c2,lam, &
r,dx,ndm)**2
if (newvalue < precision) return

View File

@ -277,7 +277,7 @@
! Very Stupid Minimization
!
USE kinds, only: DP
USE random_numbers, ONLY : rndm
USE random_numbers, ONLY : randy
IMPLICIT NONE
INTEGER maxpar, nseek, npar, nmin, n,j,i
PARAMETER (maxpar=4)
@ -292,7 +292,7 @@
DO j = 1,nmin
DO i = 1,nseek
DO n = 1,npar
10 parnew(n) = par(n) + (0.5d0 - rndm())*deltapar(n)
10 parnew(n) = par(n) + (0.5d0 - randy())*deltapar(n)
IF(parnew(n).GT.parmax(n) .OR. parnew(n).LT.parmin(n)) &
go to 10
ENDDO