7.55 replace_elements
- type: action command.
- function: Replace old element with a newly defined element, or just remove it from beamline.
This is a convenient way to modify lattice in an elegant run. See also transmute_elements.
- sequence: must follow run_setup.
- notes: The modified lattice can be saved through save_lattice command. Be sure to use
“output_seq = 1” option in that command.
- warning: The element’s occurrence is re-calculated after each usage of this command. If you
need to repeat this command for SAME named element several times, you have to re-calculate
it occurrence every time. For example, you want to remove Q1 at occurrence position (1,3,5),
and use ‘replace_elements” twice. If in the first command you use “occurence[0]=1,3”, then
in the second command you have to use “occurence[0]=3”, since after remove of (1,3) Q1s,
the 5th Q1 now becoming 3rd Q1.
- Command syntax, including use of equations and subcommands, is discussed in 7.2.
&replace_elements
STRING name = NULL;
STRING type = NULL;
STRING exclude = NULL;
long skip = 1;
long disable = 0;
STRING element_def = NULL;
long total_occurrences = 0;
long occurrence[100]={0};
&end
- name — Possibly wild-card containing string specifying the name of the elements to be
removed or replaced.
- type — Possibly wild-card containing string specifying the type of the elements to be removed
or replaced.
- exclude — Possibly wild-card containing string specifying the name of elements to be
excluded from this command.
- skip — The element is removed or replaced at every nth specified location.
- disable — If nonzero, the command is ignored.
- element_def — If NULL, the specified elements are removed from the beamline. If not NULL,
the specified elements are replaced with the new element defined here. The definition of the
element should be just as it would be entered in the lattice file.
- total_occurrences, occurrence — These parameters are used to replace or delete specified
occurrences of the element name. total_occurrences specifies how many elements to replace
or delete up to a maximum of 100, while the entries in the array occurrence specify the
occurrences to replace or delete. If total_occurrences is non-zero, then skip must be set to
zero and the name must be the exact name (no wild-card matching).