program test use bmad use runge_kutta_mod implicit none type (lat_struct) lat type (coord_struct), allocatable :: co(:) type (track_struct) track integer lun integer nargs, iargc, ios integer ix integer track_state integer i character*120 line, lat_file, lat_file_name character*120 string logical err_flag real(rp) y nargs = command_argument_count() if (nargs == 1) then call get_command_argument(1, lat_file) else if(lat_file_name /= '')then lat_file = lat_file_name else lat_file = 'bmad.' print '(a,$)',' Lattice file name? (Default = bmad.) ' read(5,'(a)') line call string_trim(line, line, ix) lat_file = line if (ix==0) lat_file = 'bmad.' endif print *, ' lat_file = ', lat_file call bmad_parser(lat_file, lat) call reallocate_coord (co, lat%n_ele_max) y=-0.02 co(0)%vec=0 do while( y < 0.02) y=y+0.001 co(0)%vec(3) = y call track_all(lat, co, track_state=track_state, err_flag=err_flag) print '(a,1x,i10,1x,i10,1x,10es12.4)',coord_state_name(co(lat%n_ele_max)%state),track_state,err_flag,& (lat%ele(i)%S,co(i)%vec(3), i=0,lat%n_ele_max) end do end