module muon_mod use precision_def use bmad_struct type muon_struct real(rp) Jx, Jy,x,y,t,px,py,pz,gas,phix,phiy, flat, sigx, sigpx, sigy, sigpy type (coord_struct) coord real(rp) last_vec(6), last_time, at_vec(6),betaCrossE(3), betaCrossE_time, betaDotB(3), path, pathx, ave_vec(6), B_field(3), BetaCrossB(3) real(rp) path_1 ! turns + partial - first logical lost, decay integer n integer turn end type type electron_struct type (coord_struct) coord integer ix_start !index of element at which the electron is generated integer ix_lost !index of element at which the electron is lost integer index_mu !index of the correspnding muon in muons(:) logical exist,lost end type type g2twiss_struct real(rp) betax, betay, alphax, alphay, etax, etapx, etay, etapy, phix, phiy, gammax, gammay ! real(rp) twiss(8) end type type g2moment_struct real(rp) sigma(6,6), ave(6), third(6) real(rp) max_sigma(6,6), min_sigma(6,6), max_ave(6), min_ave(6) end type type initial_offsets_struct real(rp) x_mean, y_mean, tmean, pxmean, pymean, pzmean end type type kicker_params_struct real(rp) kicker_field(4), kick_width(4), dtRise(4), dtFall(4) end type type quad_plate_struct real(rp) inner,bottom,outer,top end type quad_plate_struct type quad_params_struct real(rp) long_quad_field_index(4) real(rp) short_quad_field_index(4) type(quad_plate_struct) short_quad_plate_index(4) type(quad_plate_struct) long_quad_plate_index(4) end type quad_params_struct type rf_quad_struct real(rp) freq_h,freq_v,amp_h,amp_v,phi_h,phi_v, t_max, start_h, start_v integer periods_h, periods_v end type type averages_struct real(rp) x2_average, y2_average, px2_average, py2_average, xpx_average, ypy_average, pz2_average, xpz_average, pxpz_average, ypz_average, pypz_average, deltapz end type type sumBetaCrossE_struct real(rp) vec(3), dt, vec_pitch(3), path, pathx, B_field(3), BetaCrossB(3) integer npts end type type kick_and_pulse_struct real(rp) kick_time, kick, pulse_time, pulse_height end type type deriv_struct real(rp) coef(4), coef_err(4), chisq integer norder end type type running_moment_struct real(rp) product(1:6,1:6), sum(1:6), third(6) integer n end type running_moment_struct end module