subroutine turn_2000(lat, co) use bmad use ramp_parameters implicit none type (lat_struct) lat type (coord_struct) co type (coord_struct), allocatable:: co_2000(:),co_many(:) integer lunx integer j integer track_state call reallocate_coord(co_2000,lat%n_ele_track) call reallocate_coord(co_many,lat%n_ele_track) lunx = lunget() open(unit=lunx,file = trim(directory)//'/orbit_2000.dat') co_2000(0) = co co_2000(0)%vec(1:2)=0 write(lunx,'(a12,1x,6a12)')'s', 'x','px','y','py','z','pz' call track_many(lat,co_2000,0,0,direction=1,ix_branch=0, track_state=track_state) !track full turn at electrostatic septum do j=1,lat%n_ele_track write(lunx,'(es12.4,1x,6es12.4)')lat%ele(j)%s,co_2000(j)%vec end do close(unit=lunx) ! compute trajectory of extracted particle co_many(0) = co co_many(0)%vec(:) = 0.0 co_many(0)%vec(1) = 0.031 ! displacement at septum lunx = lunget() open(unit=lunx, file = trim(directory)//'/extraction_line_trajectory.dat') call track_many(lat,co_many,0,0,direction=1,ix_branch=1,track_state = track_state) !track from extraction septum to end of extraction line write(lunx,'(a16,7a12)')'ele name', 's', 'x','px','y','py','z','pz' do j=1,lat%branch(1)%n_ele_track write(lunx,'(a16,7es12.4)')lat%branch(1)%ele(j)%name, lat%branch(1)%ele(j)%s, co_many(j)%vec end do close(lunx) return end