!+ ! Subroutine track1_postprocess (start_orb, ele, param, end_orb) ! ! Dummy routine for post processing after the track1 routine is done. ! ! Also see: ! track1_preprocess ! track1_custom ! ! General rule: Your code may NOT modify any argument that is not listed as ! an output agument below. ! ! Modules Needed: ! use bmad ! ! Input: ! start_orb -- Coord_struct: Starting position. ! ele -- Ele_struct: Element. ! param -- lat_param_struct: Lattice parameters. ! end_orb -- Coord_struct: End position. ! ! Output: ! end_orb -- Coord_struct: End position. !- subroutine track1_postprocess (start_orb, ele, param, end_orb) use bmad !, except_dummy => track1_postprocess use parameters_bmad use quad_scrape_parameters implicit none type (coord_struct) :: start_orb,orb type (coord_struct) :: end_orb type (ele_struct) :: ele type (lat_param_struct) :: param type (em_field_struct) field logical err_flag logical local_ref_frame/.true./ real(rp) s_pos/0.001/ real(rp) voltage character(*), parameter :: r_name = 'track1_postprocess' ! print *,' track1_preprocess ' ! end_orb = start_orb ! if(associated(ele%grid_field) .and. index(ele%name,'QUAD') /= 0)then if(index(ele%name,'QUAD') /= 0)then if(abs(orb_diff) > 0)end_orb%vec(1)=end_orb%vec(1)+sign(orb_diff,end_orb%vec(1)) !for particles outside range of map, place them right at the edge. This offset was added in track1_preprocess ! if(abs(orb_diff) > 0)print '(a,a,a,1x,es12.4)','track1_postprocess: ele =',ele%name,' orb_diff = ', orb_diff !fringe field at end of quad if(quad_fringe_energy_change)then orb = start_orb call em_field_calc(ele, param, s_pos, orb, local_ref_frame, field, err_flag = err_flag) voltage = field%E(1)*orb%vec(1) + field%E(2)*orb%vec(3) end_orb%vec(6) = orb%vec(6) - voltage/ele%value(E_TOT$) endif endif ! end subroutine