program test use bmad use mode3_mod use nr implicit none type (lat_struct) lat type (ele_struct) ele type (coord_struct), allocatable :: orbit(:) type (coord_struct) co_positron, co_electron integer unit, number, m, i, ix, nargs character*19 file_name character*3 num character*140 lat_file character*120 line, last_line integer error real(rp) tune(3), G(6,6), V(6,6) nargs = cesr_iargc() if(nargs == 1)then call cesr_getarg(1,lat_file) print *, 'Using ', trim(lat_file) else lat_file = 'bmad.' type '(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.' type *, ' lat_file = ', lat_file endif call bmad_parser (lat_file, lat) call twiss_at_start(lat,error) call twiss_propagate_all(lat) write(11,'(a16,5a12)')'element','s','v15','v16','v25','v26' do i = 1, lat%n_ele_track write(11, '(a16,5es12.4)'),lat%ele(i)%name,lat%ele(i)%s, lat%ele(i)%mode3%V(1,5),lat%ele(i)%mode3%V(2,5), & lat%ele(i)%mode3%V(1,6),lat%ele(i)%mode3%V(2,6) end do end