- type: setup command.
- function: set up for correction of the tunes.
- sequence: should follow twiss_output.
- Command syntax, including use of equations and subcommands, is discussed in 7.2.

&correct_tunes

STRING quadrupoles = NULL;

STRING lower_limits = NULL;

STRING upper_limits = NULL;

STRING exclude = NULL;

double tune_x = 0;

double tune_y = 0;

long n_iterations = 5;

double correction_fraction = 0.9;

double tolerance = 0;

long step_up_interval = 0;

double max_correction_fraction = 0.9;

double delta_correction_fraction = 0.1;

long update_orbit = 0;

STRING strength_log = NULL;

long change_defined_values = 0;

long use_perturbed_matrix = 0;

double dK1_weight = 1;

STRING response_matrix_output = NULL;

STRING correction_matrix_output = NULL;

long fse_units = 0;

&end

- quadrupoles — List of names of quadrupoles to be used. Several names may be given and the names may include wildcards. If so, then quadrupoles in each group are changed by the same amount for each iteration. This would typically be used when the quadrupoles are nominally identical (though perhaps differing in strength because of introduced errors). If that’s not the case, the iteration may fail to converge
- lower_limits, upper_limits — Lists of lower and upper limits for each family. The input style is
unusual for elegant, given that lists of numbers are to be provided in a string. For
example
&correct_tunes

quadrupoles = "Q1 Q2 Q3",

lower_limits = "0 -1.5 0",

upper_limits = "1.75 0 1.25"

...

&end - exclude — List of names of elements to exclude. This may be used to exclude some quadrupoles that are matched by wildcards in the quadrupoles list.
- dK1_weight — Weighting factor that is used to minimize the mean-square changes in K
_{1}values in the event that there are more than two families. - tune_x, tune_y — Desired x and y tune values. If not given, the desired values are assumed to be the unperturbed tunes.
- n_iterations — The number of iterations of the correction to perform.
- correction_fraction — The fraction of the correction to apply at each iteration.
- tolerance — When both tunes are within this value of the desired tunes, the iteration is stopped.
- step_up_interval — Interval between increases in the correction fraction.
- max_correction_fraction — Maximum correction fraction to allow.
- delta_correction_fraction — Change in correction fraction after each step_up_interval steps.
- update_orbit — If non-zero, the orbit calculation is updated after each n
^{th}adjustment of the quadupoles. - strength_log — The (incomplete) name of a SDDS file to which the quadrupole strengths will be written as correction proceeds. Recommended value: “%s.qst”. May be used with load_parameters.
- change_defined_values — Changes the defined values of the quadrupole strengths. This means that when the lattice is saved (using save_lattice), the quadrupoles will have the corrected values. This would be used for correcting the tunes of a design lattice, for example, but not for correcting tunes of a perturbed lattice.
- use_perturbed_matrix — If nonzero, requests use of the perturbed correction matrix in performing correction. For difficult lattices with large errors, this may be necessary to obtain correction. In general, it is not necessary and only slows the simulation.
- response_matrix_output, correction_matrix_output — The (incomplete) names of SDDS files to which the response and correction matrices will be written.
- fse_units — If non-zero, then the data in the response_matrix_output and
correction_matrix_output files is in units of fractional strength error rather than
K
_{1}L.

coupled_twiss_output