Skip to content

Commit

Permalink
Merge pull request #47 from gaskelld/master
Browse files Browse the repository at this point in the history
Array size fix for newer gfortran compilers.
  • Loading branch information
gaskelld authored Jul 29, 2022
2 parents f88aae2 + d2ca473 commit 66e822e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions trg_track.f
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

SUBROUTINE trgTrack (u,E,dl,l,spect)
IMPLICIT NONE
REAL*8 u(6),E,dl,l
REAL*8 u(9),E,dl,l
INTEGER spect
* -- track a single particle with given start parameters
*
Expand Down Expand Up @@ -91,7 +91,7 @@ SUBROUTINE trgTrack (u,E,dl,l,spect)

SUBROUTINE trgXTrack (u,E,dl,l,Bdl,Xfun,id,spect)
IMPLICIT NONE
REAL*8 u(6),E,dl,l,Bdl
REAL*8 u(9),E,dl,l,Bdl
INTEGER id,spect
INTEGER Xfun
EXTERNAL Xfun
Expand Down Expand Up @@ -142,6 +142,9 @@ SUBROUTINE trgXTrack (u,E,dl,l,Bdl,Xfun,id,spect)
DO i=1,6
u(i) = uu (i)
ENDDO
DO i=7,9
u (i) = 0.
ENDDO

! calculate Bdl ( B_x^2+B_y^2+B_z^2 )
Bdl = SQRT(uu(7)**2+uu(8)**2+uu(9)**2)
Expand All @@ -151,7 +154,7 @@ SUBROUTINE trgXTrack (u,E,dl,l,Bdl,Xfun,id,spect)

SUBROUTINE trgTrackToPlane (u,E,dl,a,b,c,d,ok,spect)
IMPLICIT NONE
REAL*8 u(6),E,dl,a,b,c,d
REAL*8 u(9),E,dl,a,b,c,d
INTEGER spect
LOGICAL ok
* -- track a single particle with given start parameters
Expand All @@ -174,7 +177,7 @@ SUBROUTINE trgTrackToPlane (u,E,dl,a,b,c,d,ok,spect)
REAL*8 factor
COMMON /trgConversionFactor/factor

REAL*8 ts,n,an,bn,cn,dn,maxdist,dist0,dist1,u0(6),u1(6)
REAL*8 ts,n,an,bn,cn,dn,maxdist,dist0,dist1,u0(9),u1(9)

INTEGER i,steps,max_steps

Expand Down Expand Up @@ -486,7 +489,7 @@ SUBROUTINE trgDeriv(u,dudt,spect)
SUBROUTINE trgRK4(u0,u1,h,spect)
IMPLICIT NONE
REAL*8 u0(6),u1(6),h
REAL*8 u0(9),u1(9),h
* -- Fourth-order Runge-Kutta from Numerical Recipes book
* for tracking through the target field
*
Expand All @@ -499,7 +502,7 @@ SUBROUTINE trgRK4(u0,u1,h,spect)
* spect I: -1 for e spectrometer, +1 for p spectrometer
INTEGER i,spect
REAL*8 ut(6),dudt(9),dut(9),dum(9),hh,h6
REAL*8 ut(9),dudt(9),dut(9),dum(9),hh,h6
hh=h*0.5
h6=h/6.
Expand Down Expand Up @@ -616,7 +619,7 @@ subroutine track_from_tgt(x,y,z,dx,dy,mom,mass,spect,ok)
parameter (cc = 29.9792458)
real*8 vel ! velocity of particle [cm/ns]
real*8 eng ! energy of particle
real*8 vT(6)
real*8 vT(9)

C write(*,*) 'from target',spect
C write(*,*) mom,mass
Expand Down Expand Up @@ -748,7 +751,7 @@ subroutine track_to_tgt(delta,y,dx,dy,frx,fry,mom,mass,ctheta,
integer spect,arm
logical ok

real*8 vT(6),vTx(6)
real*8 vT(9),vTx(9)
real*8 xx,delx
real*8 xxd
integer*2 i,n
Expand Down Expand Up @@ -877,7 +880,7 @@ subroutine print_coord1(txt,y,delta,dxdz,dydz,x,z)
include 'simulate.inc'
character*(*) txt
real*8 y,delta,dxdz,dydz,x,z
real*8 vT(6)
real*8 vT(9)

vt(1) = -x
vt(2) = y
Expand All @@ -900,7 +903,7 @@ subroutine print_coord2(txt,x,y,z,dxdz,dydz)
include 'simulate.inc'
character*(*) txt
real*8 y,dxdz,dydz,x,z
real*8 vT(6)
real*8 vT(9)

vt(1) = x
vt(2) = y
Expand Down

0 comments on commit 66e822e

Please sign in to comment.