program multibunch use bmad implicit none type (lat_struct) lat type (coord_struct), allocatable :: orbit(:) integer unit, number, ix, nargs integer lun real(rp) chrom_x1, chrom_y1, delta_e character*140 lat_file character*120 line !this stuff is to ready an input file from the command line nargs = cesr_iargc() if(nargs == 1)then call cesr_getarg(1,lat_file) print *, 'Using ', trim(lat_file) else lat_file = 'bmad.' print '(a,$)',' Lattice file name ? (default= synch.lat) ' read(5,'(a)') line call string_trim(line, line, ix) lat_file = line if(ix == 0) lat_file = '/home/jdp279/Documents/Chromcalc/darkphoton/files/synch.lat' print *, ' lat_file = ', lat_file endif call bmad_parser (lat_file, lat) !parse lattice file call reallocate_coord (orbit, lat%n_ele_track) !allocate memory for orbit call lat_make_mat6(lat, -1) !compute transfer matrics for all of the elements in the lattice call twiss_at_start(lat) ! compute twiss parameters at the starting point call twiss_propagate_all(lat) ! propagate twiss parameters to all elements in the lattice call closed_orbit_calc(lat,orbit,6) !compute the closed orbit call writeinfo(lat) delta_e = 1.0e-6 call chrom_calc(lat,delta_e,chrom_x1,chrom_y1) open(unit=lun, file='chromaticities.dat') write(lun,'(4es12.4)')chrom_x1, chrom_y1 close(unit=lun) end