Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This fixes the tilt in combination with centre option for quadrupole #1026

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 37 additions & 3 deletions src/twiss.f90
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