next up previous contents
Next: Subroutine Track_with_rf_modulation Up: Small Example Programs Previous: Subroutine displaying Radiation in   Contents


Subroutine Showing a Beam-Beam Kick

!=================================================================
subroutine  Track_with_beam_beam
use madx_ptc_module
use pointer_lattice
use gauss_dis
implicit none
type(layout), pointer :: ALS
type(fibre), pointer ::p
integer i,mf,j,n
type(normal_spin) nf
type(normalform) normal
real(dp) s,fk,sx,sy,d(3),OMEGA(3),ang(3),a(3),ent(3,3),o(3),m(3,3)
integer loc,pos
type(integration_node), pointer :: t
logical(lp) f

als=>M_U%start

call FILL_SURVEY_DATA_IN_NODE_LAYOUT(ALS)



 ! TYPE BEAM_BEAM_NODE
 !    REAL(DP), POINTER :: S
 !    REAL(DP), POINTER :: SX,SY,FK
 !    REAL(DP), POINTER :: XM,YM   ! trivial transverse displacement: not needed
 !    REAL(DP), POINTER :: BBK(:)  ! kick on closed orbit
 !    REAL(DP), POINTER :: A(:)    ! patch angles
 !    REAL(DP), POINTER :: D(:)    ! patch translation
 !    INTEGER, POINTER :: A_X1,A_X2 ! patch inverse propagator (not needed)
 !    LOGICAL(LP), POINTER :: PATCH ! true= patch
 ! END TYPE BEAM_BEAM_NODE

 !    TYPE(BEAM_BEAM_NODE), POINTER :: BB


fk=.00000005d0
sx=.0004d0 
sy=.0004d0
loc=0
s=196.838521200000d0*two/12.d0+3.00d0
call s_locate_beam_beam(als,s,loc,t,f)

if(f) then
 t%bb%fk=fk
 t%bb%sx=sx
 t%bb%sy=sy

 write(6,*) t%a            ! node entrance position
 write(6,*) t%ent(1,1:3)   ! node entrance e_1 vector
 write(6,*) t%ent(2,1:3)   ! node entrance e_2 vector
 write(6,*) t%ent(3,1:3)   ! node entrance e_3 vector
 write(6,*) " s variable of node and following node "
 write(6,*) t%s(1),t%next%s(1)

endif

do_beam_beam=my_true

t%bb%d=0.00d0
t%bb%d(1)=8.7d-002 
t%bb%d(3)=0.342d0
t%bb%a=0.0d0
t%bb%a(2)=0.523598775598299d0
t%bb%PATCH=.true.

       CALL INVERSE_FIND_PATCH(t%a,t%ent, t%bb%d,t%bb%a,o,m)
       
       write(6,*) "   out "
       write(6,*) o
       write(6,*) m

       call FIND_PATCH(t%a,t%ent,o ,m,D,ANG)
       write(6,*) " d "
       write(6,*) d
       write(6,*) t%bb%d
       write(6,*) " ang "
       write(6,*) ang
       write(6,*) t%bb%a
       
          
call survey(als)
call FILL_SURVEY_DATA_IN_NODE_LAYOUT(ALS)

write(6,*) "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"
write(6,*) " Using the actual location of the beam-beam kick "
call locate_beam_beam(als,o,m,t,f)
       call FIND_PATCH(t%a,t%ent,o ,m,t%bb%d,t%bb%a)
       write(6,*) " displacements "
       write(6,*) t%bb%d
       write(6,*) " angles "
       write(6,*) t%bb%a
       t%bb%PATCH=.true.
      do_beam_beam=my_true
1000 continue

end subroutine  Track_with_beam_beam



Frank Schmidt 2010-10-15