Skip to content

Commit

Permalink
This fixes the tilt in combination with centre option for quadrupole,
Browse files Browse the repository at this point in the history
elseparator and sextupoles.
  • Loading branch information
tobias committed Jul 21, 2021
1 parent bf36f35 commit a4010b4
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions src/twiss.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5924,7 +5924,18 @@ SUBROUTINE tmquad(fsec,ftrk,fcentre,plot_tilt,orbit,fmap,el,dl,ek,re,te)
endif

call qdbody(fsec,ftrk,tilt,sk1,orbit,dl,ek,re,te)
if (fcentre) return
if (fcentre) then
if (tilt .ne. zero) then
!--- rotate orbit at exit
tmp = orbit(1)
orbit(1) = ct * tmp - st * orbit(3)
orbit(3) = ct * orbit(3) + st * tmp
tmp = orbit(2)
orbit(2) = ct * tmp - st * orbit(4)
orbit(4) = ct * orbit(4) + st * tmp
endif
return
endif

!---- Half radiation effect at exit.
if (radiate .and. ftrk) then
Expand Down Expand Up @@ -6131,7 +6142,19 @@ SUBROUTINE tmsep(fsec,ftrk,fcentre,orbit,fmap,dl,ek,re,te)
ekick = efield * ten3m * charge / (pc * (one + deltap))

call spbody(fsec,ftrk,tilt,ekick,orbit,dl,ek,re,te)
if (fcentre) return
if (fcentre) then
if (tilt .ne. zero) then
!--- rotate orbit at exit
tmp = orbit(1)
orbit(1) = ct * tmp - st * orbit(3)
orbit(3) = ct * orbit(3) + st * tmp
tmp = orbit(2)
orbit(2) = ct * tmp - st * orbit(4)
orbit(4) = ct * orbit(4) + st * tmp
endif

return
endif

if (tilt .ne. zero) then
!--- rotate orbit at exit
Expand Down Expand Up @@ -6337,7 +6360,18 @@ SUBROUTINE tmsext(fsec,ftrk,fcentre,orbit,fmap,el,dl,ek,re,te)
endif

call sxbody(fsec,ftrk,tilt,sk2,orbit,dl,ek,re,te)
if (fcentre) return
if (fcentre) then
if (tilt .ne. zero) then
!--- rotate orbit at exit
tmp = orbit(1)
orbit(1) = ct * tmp - st * orbit(3)
orbit(3) = ct * orbit(3) + st * tmp
tmp = orbit(2)
orbit(2) = ct * tmp - st * orbit(4)
orbit(4) = ct * orbit(4) + st * tmp
endif
return
endif

!---- Half radiation effects at exit.
if (ftrk) then
Expand Down

0 comments on commit a4010b4

Please sign in to comment.