&run_setup lattice="elegant_out.lte", use_beamline="BEAMLINE", p_central_mev=15.0, default_order = 3 final="%s.fin", parameters="%s.parms", &end &run_control &end &optimization_setup mode = "minimize", method = "simplex", target = 1e-14, tolerance = 1e-16, n_passes = 3, n_evaluations = 1500, n_restarts = 10, verbose = 0, output_sparsing_factor = 10 log_file = /dev/tty &end !USE the skew quadrupoles to decouple the emittance. Optimize by changing TILT and K values &optimization_variable item=TILT, name=qA1, step_size=0.001, upper_limit=0.78 lower_limit=-0.78 &end &optimization_variable item=TILT, name=qA2, step_size=0.001, upper_limit=0.78 lower_limit=-0.78 &end &optimization_variable item=TILT, name=qA3, step_size=0.001, upper_limit=0.78 lower_limit=-0.78 &end &optimization_variable item=K1, name=qA1, step_size=.01, upper_limit=100. lower_limit=-100. &end &optimization_variable item=K1, name=qA2, step_size=.01, upper_limit=100. lower_limit=-100. &end &optimization_variable item=K1, name=qA3, step_size=.01, upper_limit=100. lower_limit=-100. &end &optimization_term weight=1, term="ex 5.84e-6 - sqr", &end &optimization_term weight=1, term="ey 5.84e-6 - sqr", &end &bunched_beam n_particles_per_bunch=500, emit_x=5.84e-6, emit_y=5.84e-6, beta_x=0.00307233, alpha_x=-0.106397, beta_y=0.00307233, alpha_y=-0.0902401, eta_x=0 ,etap_x=0, sigma_dp=0.033,sigma_s=0.000222, distribution_type[0] = 3*"gaussian", distribution_cutoff[0] = 3*3, enforce_rms_values[0]= 3*1, one_random_bunch = 1 ! Essential during optimization &end &optimize &end &run_setup lattice="elegant_out.lte", use_beamline="BEAMLINE", p_central_mev=15.0, default_order = 3, centroid="%s.cen", sigma="%s.sig", tracking_updates=1 &end &load_parameters filename = %s.parms, change_defined_values = 1 &end &run_control &end &bunched_beam n_particles_per_bunch=500, emit_x=5.84e-6, emit_y=5.84e-6, beta_x=0.00307233, alpha_x=-0.106397, beta_y=0.00307233, alpha_y=-0.0902401, eta_x=0 ,etap_x=0, sigma_dp=0.033,sigma_s=0.000222, distribution_type[0] = 3*"gaussian", distribution_cutoff[0] = 3*3, enforce_rms_values[0]=1,1,1 &end &track &end &stop &end