Skip to content

Commit

Permalink
Additional changes for new gfortran treatment of double precision var…
Browse files Browse the repository at this point in the history
…iables and

functions.
Garth Huber
Nov 24, 2015
  • Loading branch information
huberg committed Nov 26, 2015
1 parent 5b1bb80 commit 6c5267a
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 109 deletions.
64 changes: 32 additions & 32 deletions brem.f
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ real*8 function brem(ein,eout,egamma,radiate_proton,bsoft,bhard,dbsoft)
! direct initial electron
aprod= 1.d0
aprod= 1.e0
bei= aprod*(-1./(2.*pi))*log(ak/de)
dbei= aprod*(1./(2.*pi*de))
! direct final electron
aprod= 1.d0
aprod= 1.e0
bef= aprod*(-1./(2.*pi))*log(akp/de)
dbef= aprod*(1./(2.*pi*de))
! e-e interference
aprod= -1.d0
aprod= -1.e0
adot= ak*akp*(1.-cos(eang))
alpha= 2.*ame**2-2.*adot
ar1= 0.5+sqrt(adot**2-ame**4)/alpha
Expand All @@ -89,19 +89,19 @@ real*8 function brem(ein,eout,egamma,radiate_proton,bsoft,bhard,dbsoft)
! initial p direct
aprod= 1.d0
aprod= 1.e0
bpi= aprod*(-1./(2.*pi))*log(am/de)
dbpi= aprod*(1./(2.*pi*de))
! final p direct
aprod= 1.d0
aprod= 1.e0
bpf= aprod*(-1./(2.*pi))*log(ape/de)
dbpf= aprod*(1/(2.*pi*de))
! p-p interference
aprod= -1.d0
aprod= -1.e0
adot= am*ape
alpha= 2.*am**2-2.*adot
ar1= 0.5+sqrt(adot**2-am**4)/alpha
Expand All @@ -113,7 +113,7 @@ real*8 function brem(ein,eout,egamma,radiate_proton,bsoft,bhard,dbsoft)
! ei-pi interference
aprod= -1.d0
aprod= -1.e0
adot= ak*am
alpha= am**2+ame**2-2.*adot
ar1= (am**2-adot+sqrt(adot**2-(ame*am)**2))/alpha
Expand All @@ -125,7 +125,7 @@ real*8 function brem(ein,eout,egamma,radiate_proton,bsoft,bhard,dbsoft)
! ef-pf interference
aprod= -1.d0
aprod= -1.e0
adot= akp*ape-akp*ap*cos(eang+pang)
alpha= am**2+ame**2-2.*adot
ar1= (am**2-adot+sqrt(adot**2-(ame*am)**2))/alpha
Expand All @@ -137,7 +137,7 @@ real*8 function brem(ein,eout,egamma,radiate_proton,bsoft,bhard,dbsoft)
! ei-pf interference
aprod= 1.d0
aprod= 1.e0
adot= ak*ape-ak*ap*cos(pang)
alpha= am**2+ame**2-2.*adot
ar1= (am**2-adot+sqrt(adot**2-(ame*am)**2))/alpha
Expand All @@ -149,7 +149,7 @@ real*8 function brem(ein,eout,egamma,radiate_proton,bsoft,bhard,dbsoft)
! ef-pi interference
aprod= 1.d0
aprod= 1.e0
adot= akp*am
alpha= am**2+ame**2-2.*adot
ar1= (am**2-adot+sqrt(adot**2-(ame*am)**2))/alpha
Expand Down Expand Up @@ -189,7 +189,7 @@ real*8 function brem(ein,eout,egamma,radiate_proton,bsoft,bhard,dbsoft)
write(6,*)' bzz= ',bzz
write(6,*)' bhard= ',bhard
write(6,*)' total= ',bsoft+bhard
write(6,*)' exp= ',1.-dexp(-1.*(bsoft))*(1.-bhard)
write(6,*)' exp= ',1.-exp(-1.*(bsoft))*(1.-bhard)
write(6,*)' '
write(6,*)' ultra-relativistic limit'
call srad(ak,akp,eang,q2,ame,am,ap,de,produce_output)
Expand All @@ -204,7 +204,7 @@ real*8 function brem(ein,eout,egamma,radiate_proton,bsoft,bhard,dbsoft)
! ......... the derivative has dimension 1/[energy] --> convert back to MeV
dbsoft = dbsoft/1000.
if (exponentiate) then
brem = -dbsoft/dexp(bsoft)
brem = -dbsoft/exp(bsoft)
else
brem = 1.-dbsoft
endif
Expand Down Expand Up @@ -293,7 +293,7 @@ real*8 function spence(ax)
real*8 ax,bx
bx= dabs(ax)
bx= abs(ax)
! ... N.B. Have replaced the former calculation (commented out) with an
! ... approximate expression -- saves a WHALE of CPU!
Expand Down Expand Up @@ -409,10 +409,10 @@ real*8 function bremos(egamma, ! photon energy
p_i%e = mp

! ... check energy-momentum conservation
! e_check= dabs(k_f%e+p_f%e-k_i%e-p_i%e)
! x_check= dabs(k_f%x+p_f%x-k_i%x-p_i%x)
! y_check= dabs(k_f%y+p_f%y-k_i%y-p_i%y)
! z_check= dabs(k_f%z+p_f%z-k_i%z-p_i%z)
! e_check= abs(k_f%e+p_f%e-k_i%e-p_i%e)
! x_check= abs(k_f%x+p_f%x-k_i%x-p_i%x)
! y_check= abs(k_f%y+p_f%y-k_i%y-p_i%y)
! z_check= abs(k_f%z+p_f%z-k_i%z-p_i%z)
!
! if((e_check.gt.0.0001).or.(x_check.gt.0.0001).or.
! + (y_check.gt.0.0001).or.(z_check.gt.0.0001)) then
Expand All @@ -433,17 +433,17 @@ real*8 function bremos(egamma, ! photon energy
! ... electron terms

! ........ direct initial electron
aprod= 1.d0
aprod= 1.e0
bei= aprod*(-1./twopi)*log(k_i%e/de)
dbei= aprod*(-1./twopi)*(-1./de)

! ........ direct final electron
aprod= 1.d0
aprod= 1.e0
bef= aprod*(-1./twopi)*log(k_f%e/de)
dbef= aprod*(-1./twopi)*(-1./de)

! ........ e-e interference
aprod= -1.d0
aprod= -1.e0
adot= k_i%e*k_f%e-k_i%x*k_f%x-k_i%y*k_f%y-k_i%z*k_f%z
alpha= 2.*ame**2-2.*adot
ar1= 0.5+sqrt(4.*adot**2-4.*ame**4)/(2.*alpha)
Expand All @@ -457,17 +457,17 @@ real*8 function bremos(egamma, ! photon energy
if (radiate_proton) then

! ........ initial p direct
aprod= 1.d0
aprod= 1.e0
bpi= aprod*(-1./twopi)*log(p_i%e/de)
dbpi= aprod*(-1./twopi)*(-1./de)

! ........ final p direct
aprod= 1.d0
aprod= 1.e0
bpf= aprod*(-1./twopi)*log(p_f%e/de)
dbpf= aprod*(-1./twopi)*(-1./de)

! ........ p-p interference
aprod= -1.d0
aprod= -1.e0
adot= p_i%e*p_f%e-p_i%x*p_f%x-p_i%y*p_f%y-p_i%z*p_f%z
alpha= ami**2+amf**2-2.*adot
ar1= (2.*amf**2-2.*adot+sqrt(4.*adot**2-4.*(ami*amf)**2))/(2.*alpha)
Expand All @@ -477,7 +477,7 @@ real*8 function bremos(egamma, ! photon energy
if (produce_output) write(6,*) ar1,ar2

! ........ ei-pi interference
aprod= -1.d0
aprod= -1.e0
adot= k_i%e*p_i%e-k_i%x*p_i%x-k_i%y*p_i%y-k_i%z*p_i%z
alpha= ami**2+ame**2-2.*adot
ar1= (2.*ami**2-2.*adot+sqrt(4.*adot**2-4.*(ame*ami)**2))/(2.*alpha)
Expand All @@ -487,7 +487,7 @@ real*8 function bremos(egamma, ! photon energy
if (produce_output) write(6,*) ar1,ar2

! ........ ef-pf interference
aprod= -1.d0
aprod= -1.e0
adot= k_f%e*p_f%e-k_f%x*p_f%x-k_f%y*p_f%y-k_f%z*p_f%z
alpha= amf**2+ame**2-2.*adot
ar1= (2.*amf**2-2.*adot+sqrt(4.*adot**2-4.*(ame*amf)**2))/(2.*alpha)
Expand All @@ -497,7 +497,7 @@ real*8 function bremos(egamma, ! photon energy
if (produce_output) write(6,*) ar1,ar2

! ........ ei-pf interference
aprod= 1.d0
aprod= 1.e0
adot= k_i%e*p_f%e-k_i%x*p_f%x-k_i%y*p_f%y-k_i%z*p_f%z
alpha= amf**2+ame**2-2.*adot
ar1=(2.*amf**2-2.*adot+sqrt(4.*adot**2-4.*(ame*amf)**2))/(2.*alpha)
Expand All @@ -507,7 +507,7 @@ real*8 function bremos(egamma, ! photon energy
if (produce_output) write(6,*) ar1,ar2

! ........ ef-pi interference
aprod= 1.d0
aprod= 1.e0
adot= k_f%e*p_i%e-k_f%x*p_i%x-k_f%y*p_i%y-k_f%z*p_i%z
alpha= ami**2+ame**2-2.*adot
ar1=(2.*ami**2-2.*adot+sqrt(4.*adot**2-4.*(ame*ami)**2))/(2.*alpha)
Expand Down Expand Up @@ -548,11 +548,11 @@ real*8 function bremos(egamma, ! photon energy
write(6,*)' bzz= ',bzz
write(6,*)' bhard= ',bhard
write(6,*)' total= ',1-bsoft-bhard
write(6,*)' exp= ',dexp(-1.*(bsoft))*(1.-bhard)
write(6,*)' exp= ',exp(-1.*(bsoft))*(1.-bhard)
write(6,*)' 1-bhard= ',1-bhard
write(6,*)' exps= ',dexp(-1.*(bsoft))
write(6,*)' expse= ',dexp(-1.*b)
write(6,*)' expsp= ',dexp(-1.*(bz+bzz))
write(6,*)' exps= ',exp(-1.*(bsoft))
write(6,*)' expse= ',exp(-1.*b)
write(6,*)' expsp= ',exp(-1.*(bz+bzz))
write(6,*)' '
write(6,*)' Schwinger Result'
bsch= 2.*e2/pi*((log(k_i%e/de)-13./12.)*(log(q2/ame**2)-1.)+17./36.)
Expand All @@ -564,7 +564,7 @@ real*8 function bremos(egamma, ! photon energy
! ......... the derivative has dimension 1/[energy] --> convert back to MeV
dbsoft = dbsoft/1000. !convert back to MeV
if (exponentiate) then
bremos = -dbsoft/dexp(bsoft)
bremos = -dbsoft/exp(bsoft)
else
bremos = 1.-dbsoft
endif
Expand Down
8 changes: 4 additions & 4 deletions dbase.f
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ subroutine dbase_read(H)

if (doing_pion .or. doing_kaon .or. doing_delta .or.
> (cuts%Em%min.eq.cuts%Em%max) ) then
cuts%Em%min = -1.d6
cuts%Em%max = 1.d6
cuts%Em%min = -1.e6
cuts%Em%max = 1.e6
endif

if (abs(deForest_flag).gt.1) stop 'Idiot! check setting of deForest_flag'
Expand Down Expand Up @@ -559,9 +559,9 @@ subroutine dbase_read(H)
tmpfile='benharsf_12.dat'
endif
! Choos proton or neutron spectral function based on targ.Mtar_struck
if (abs(targ%Mtar_struck-Mp).le.1.d-6) then
if (abs(targ%Mtar_struck-Mp).le.1.e-6) then
call sf_lookup_init(tmpfile,.true.) !proton S.F.
else if (abs(targ%Mtar_struck-Mn).le.1.d-6) then
else if (abs(targ%Mtar_struck-Mn).le.1.e-6) then
call sf_lookup_init(tmpfile,.false.) !neutron S.F.
else
write(6,*) 'targ%Mtar_struck = ',targ%Mtar_struck
Expand Down
12 changes: 6 additions & 6 deletions enerloss_new.f
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ subroutine enerloss_new(len,dens,zeff,aeff,epart,mpart,typeflag,Eloss)
beta = sqrt(1.-1./gamma**2)

if(zeff.eq.1) then !Ionization potential in MeV
I = 21.8d-06
I = 21.8e-06
else
I = (16.*zeff**0.9)*1.0d-06
I = (16.*zeff**0.9)*1.0e-06
endif

hnup = 28.816d-06*sqrt(dens*zeff/aeff) !plasma frequency
hnup = 28.816e-06*sqrt(dens*zeff/aeff) !plasma frequency
log10bg = log(beta*gamma)/log(10.)
CO=log(hnup)-log(I)+0.5

Expand All @@ -45,9 +45,9 @@ subroutine enerloss_new(len,dens,zeff,aeff,epart,mpart,typeflag,Eloss)
if (thick.le.0.) then
Eloss = 0.
else
Eloss_mp = 0.1536d-03 * zeff/aeff * thick * ( 19.26 +
Eloss_mp = 0.1536e-03 * zeff/aeff * thick * ( 19.26 +
& log(thick/dens) )
Eloss_mp_new = 0.1536d-03 * zeff/aeff *thick/beta**2* (
Eloss_mp_new = 0.1536e-03 * zeff/aeff *thick/beta**2* (
& log(me/I**2) + 1.063 + 2.*log(gamma*beta) +
& log(0.1536*zeff/aeff*thick/beta**2)-beta**2-denscorr)
c write(6,*) 'ELOSS',Eloss_mp,Eloss_mp_new
Expand All @@ -56,7 +56,7 @@ subroutine enerloss_new(len,dens,zeff,aeff,epart,mpart,typeflag,Eloss)
Eloss_mp = Eloss_mp_new*1000.
chsi = 0.307075/2.*zeff/aeff*thick/beta**2
if(typeflag.eq.1)then
x=abs(gauss1(10.0d0))
x=abs(gauss1(10.0e0))
elseif(typeflag.eq.2)then
x=3
elseif(typeflag.eq.3)then
Expand Down
14 changes: 7 additions & 7 deletions init.f
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ subroutine target_init(using_Eloss,using_Coulomb,the_cent,thp_cent,
logical using_Eloss, using_Coulomb

real*8 zero
parameter (zero=0.0d0) !double precision zero for subroutines calls.
parameter (zero=0.0e0) !double precision zero for subroutines calls.

! The radiation length of the target

Expand Down Expand Up @@ -225,7 +225,7 @@ subroutine limits_init(H)
> targ%Coulomb%max + dE_edge_test
pp%min = (1.+SPedge%p%delta%min/100.)*spec%p%P - dE_edge_test
pp%max = (1.+SPedge%p%delta%max/100.)*spec%p%P + dE_edge_test
pp%min = max(0.001d0,pp%min) !avoid p=0 (which can lead to div by zero)(
pp%min = max(0.001e0,pp%min) !avoid p=0 (which can lead to div by zero)(
edge%p%E%min = sqrt(pp%min**2 + Mh2)
edge%p%E%max = sqrt(pp%max**2 + Mh2)
Expand Down Expand Up @@ -296,7 +296,7 @@ subroutine limits_init(H)
slop%total%Em%used = slop_Ebeam + slop_Ee + slop_Ep + dE_edge_test
edge%Em%min = cuts%Em%min - slop%total%Em%used
edge%Em%max = cuts%Em%max + slop%total%Em%used
edge%Em%min = max(0.d0,edge%Em%min)
edge%Em%min = max(0.e0,edge%Em%min)
endif
! Edges on Em, Pm, etc... VERTEXedge.* values are vertex limits. edge.* values
Expand Down Expand Up @@ -460,7 +460,7 @@ subroutine limits_init(H)
gen%sumEgen%min = gen%sumEgen%min - dE_edge_test
gen%sumEgen%max = gen%sumEgen%max + dE_edge_test
gen%sumEgen%min = max(0.d0,gen%sumEgen%min)
gen%sumEgen%min = max(0.e0,gen%sumEgen%min)
! ... E arm GENERATION limits from sumEgen.
! ... Not used for doing_hyd_elast, but define for the hardwired histograms.
Expand Down Expand Up @@ -524,9 +524,9 @@ subroutine limits_init(H)
H%gen%p%yptar%bin = (gen%p%yptar%max-gen%p%yptar%min)/float(nHbins)
H%gen%p%xptar%bin = (gen%p%xptar%max-gen%p%xptar%min)/float(nHbins)
H%gen%Em%min = VERTEXedge%Em%min
H%gen%Em%bin = (max(100.d0,VERTEXedge%Em%max) - VERTEXedge%Em%min)/float(nHbins)
H%gen%Em%bin = (max(100.e0,VERTEXedge%Em%max) - VERTEXedge%Em%min)/float(nHbins)
H%gen%Pm%min = VERTEXedge%Pm%min
H%gen%Pm%bin = (max(100.d0,VERTEXedge%Pm%max) - VERTEXedge%Pm%min)/float(nHbins)
H%gen%Pm%bin = (max(100.e0,VERTEXedge%Pm%max) - VERTEXedge%Pm%min)/float(nHbins)
H%geni%e%delta%min = H%gen%e%delta%min
H%geni%e%yptar%min = H%gen%e%yptar%min
Expand Down Expand Up @@ -663,7 +663,7 @@ subroutine radc_init_ev (main,vertex)
! modifications to vertex.* variables in later calls.

real*8 zero
parameter (zero=0.0d0) !double precision zero for subroutine calls.
parameter (zero=0.0e0) !double precision zero for subroutine calls.

! Compute some quantities that will be needed for rad corr on this event

Expand Down
6 changes: 3 additions & 3 deletions jacobians.f
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ subroutine transform_to_cm(vertex,main,

* f's and fer indicate fermi momenta, s, star or cm CM system
tcos = vertex%up%x*vertex%uq%x+vertex%up%y*vertex%uq%y+vertex%up%z*vertex%uq%z
if(tcos-1..gt.0..and.tcos-1..lt.1.d-8)tcos=1.0
if(tcos-1..gt.0..and.tcos-1..lt.1.e-8)tcos=1.0
tsin=sqrt(1.-tcos**2)

tfcos = pferx*vertex%uq%x+pfery*vertex%uq%y+pferz*vertex%uq%z
if(tfcos-1..gt.0..and.tfcos-1..lt.1.d-8)tfcos=1.0
if(tfcos-1..gt.0..and.tfcos-1..lt.1.e-8)tfcos=1.0
tfsin=sqrt(1.-tfcos**2)

cospq = cos(main%phi_pq)
Expand Down Expand Up @@ -118,7 +118,7 @@ subroutine transform_to_cm(vertex,main,

* DJG: Boost virtual photon to CM.

zero =0.d0
zero =0.e0
call loren(gstar,bstarx,bstary,bstarz,vertex%nu,
> zero,zero,vertex%q,nustar,qstarx,qstary,qstarz,qstar)

Expand Down
3 changes: 0 additions & 3 deletions last.kumac

This file was deleted.

4 changes: 2 additions & 2 deletions mt19937.f
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ double precision function grnd()
y=ieor(y,ishft(y,-18))

if(y.lt.0) then
grnd=(dble(y)+2.0d0**32)/(2.0d0**32-1.0d0)
grnd=(dble(y)+2.0e0**32)/(2.0e0**32-1.0e0)
else
grnd=dble(y)/(2.0d0**32-1.0d0)
grnd=dble(y)/(2.0e0**32-1.0e0)
endif

return
Expand Down
Loading

0 comments on commit 6c5267a

Please sign in to comment.