assign, echo = file_name;where "file_name" is the name of an output file, or "terminal". This allows switching the echo stream to a file or back, but only for the commands value, show, and print. Allows easy composition of future MAD-X input files. A real life example (always the same) is to be found under footprint example.
call, file = file_name;where "file_name" is the name of an input file. This file will be read until a "return;" statement, or until end_of_file; it may contain any number of calls itself, and so on to any depth.
coguess,tolerance=double,x=double, px=double,y=double,py=double,t=double,pt=double;sets the required convergence precision in the closed orbit search ("tolerance", see as well Twiss command tolerance.
The other parameters define a first guess for all future closed orbit searches in case they are different from zero.
create,table=table,column=var1,var2,_name,...;creates a table with the specified variables as columns. This table can then be filled, and finally one can write it in TFS format. The attribute "_name" adds the element name to the table at the specified column, this replaces the undocumented "withname" attribute that was not always working properly.
See the user table I example;
or an example of joining 2 tables of different length in one table including the element name: user table II
delete,sequence=s_name,table=t_name;deletes a sequence with name "s_name" or a table with name "t_name" from memory. The sequence deletion is done without influence on other sequences that may have elements that were in the deleted sequence.
dumpsequ, sequence = s_name, level = integer;Actually a debug statement, but it may come handy at certain occasions. Here "s_name" is the name of an expanded (i.e. USEd) sequence. The amount of detail is controlled by "level":
level = 0: print only the cumulative node length = sequence length > 0: print all node (element) names except drifts > 2: print all nodes with their attached parameters > 3: print all nodes, and their elements with all parameters
exec, label;Each statement may be preceded by a label; it is then stored and can be executed again with "exec, label;" any number of times; the executed statement may be another "exec", etc.; however, the major usage of this statement is the execution of a macro.
exit;ends the program execution.
fill,table=table;adds a new line with the current values of all column variables into the user table created beforehand. This table one can then write in TFS format. See as well the user table example.
help,statement_name;prints all parameters, and their defaults of the statement given; this includes basic element types.
option, flag { = true | false }; option, flag | -flag;sets an option as given in "flag"; the part in curly brackets is optional: if only the name of the option is given, then the option will be set true (see second line); a "-" sign preceding the name sets it to "false".
Example:
option,echo=true; option,echo;are identical, ditto
option,echo=false; option,-echo;The available options are:
name default meaning if true ==== ======= =============== bborbit false the closed orbit is modified by beam-beam kicks sympl false all element matrices are symplectified in Twiss echo true echoes the input on the standard output file trace false prints the system time after each command verify false issues a warning if an undefined variable is used warn true issues warnings info true issues informations tell false prints the current value of all options reset false resets all options to their defaults rbarc true converts the RBEND straight length into the arc length thin_foc true if false suppresses the 1(rho**2) focusing of thin dipoles no_fatal_stop false Prevents madx from stopping in case of a fatal error. Use at your own risk.The option "rbarc" is implemented for backwards compatibility with MAD-8 up to version 8.23.06 included; in this version, the RBEND length was just taken as the arc length of an SBEND with inclined pole faces, contrary to the MAD-8 manual.
print,text="...";prints the text to the current output file (see ASSIGN above). The text can be edited with the help of a macro statement. For more details, see there.
quit;ends the program execution.
readtable,file=filename;reads a TFS file containing a MAD-X table back into memory. This table can then be manipulated as any other table, i.e. its values can be accessed, it can be plotted, written out again etc.
readmytable,file=filename,table=internalname;reads a TFS file containing a MAD-X table back into memory. This table can then be manipulated as any other table, i.e. its values can be accessed, it can be plotted, written out again etc. An internal name for the table can be freely assigned while for the command READTABLE it is taken from the information section of the table itself. This feature allows to store multiple tables of the same type in memory without overwriting existing ones.
resbeam,sequence=s_name;resets the default values of the beam belonging to sequence s_name, or of the default beam if no sequence is given.
return;ends reading from a "called" file; if encountered in the standard input file, it ends the program execution.
save,beam,sequence=sequ1,sequ2,...,file=filename,beam,bare;saves the sequence(s) specified with all variables and elements needed for their expansion, onto the file "filename". If quotes are used for the "filename" capital and low characters are kept as specified, if they are omitted the "filename" will have lower characters only. The optional flag can have the value "mad8" (without the quotes), in which case the sequence(s) is/are saved in MAD-8 input format.
The flag "beam" is optional; when given, all beams belonging to the sequences specified are saved at the top of the save file.
The parameter "sequence" is optional; when omitted, all sequences are saved.
However, it is not advisable to use "save" without the "sequence" option unless you know what you are doing. This practice will avoid spurious saved entries. Any number of "select,flag=save" commands may precede the SAVE command. In that case, the names of elements, variables, and sequences must match the pattern(s) if given, and in addition the elements must be of the class(es) specified. See here for a SAVE with SELECT example.
It is important to note that the precision of the output of the save command depends on the output precision. Details about default precisions and how to adjust those precisions can be found at the SET Format instruction page.
The Attribute 'bare' allows to save just the sequence without the element definitions nor beam information. This allows to re-read in a sequence with might otherwise create a stop of the program. This is particularly useful to turn a line into a sequence to seqedit it. Example:
tl3:line=(ldl6,qtl301,mqn,qtl301,ldl7,qtl302,mqn,qtl302,ldl8,ison); DLTL3 : LINE=(delay, tl3); use, period=dltl3; save,sequence=dltl3,file=t1,bare; // new parameter "bare": only sequ. saved call,file=t1; // sequence is read in and is now a "real" sequence // if the two preceding lines are suppressed, seqedit will print a warning // and else do nothing use, period=dltl3; twiss, save, betx=bxa, alfx=alfxa, bety=bya, alfy=alfya; plot, vaxis=betx, bety, haxis=s, colour:=100; SEQEDIT, SEQUENCE=dltl3; remove,element=cx.bhe0330; remove,element=cd.bhe0330; ENDEDIT; use, period=dltl3; twiss, save, betx=bxa, alfx=alfxa, bety=bya, alfy=alfya;
savebeta, label=label,place=place,sequence=s_name;marks a place "place" in an expanded sequence "s_name"; at the next TWISS command execution, a beta0 block will be saved at that place with the label "label". This is done only once; in order to get a new beta0 block there, one has to re-issue the command. The contents of the beta0 block can then be used in other commands, e.g. TWISS and MATCH.
Example (after sequence expansion):
savebeta,label=sb1,place=mb[5],sequence=fivecell; twiss; show,sb1;will save and show the beta0 block parameters at the end (!) of the fifth element mb in the sequence.
select, flag=flag,range=range,class=class,pattern=pattern, slice=integer,column=s1,s2,s3,..,sn,sequence=s_name, full,clear;selects one or several elements for special treatment in a subsequent command. All selections for a given command remain valid until "clear" is specified; the selection criteria on the same command are logically ANDed, on different SELECT statements logically ORed.
Example:
select,flag=error,class=quadrupole,range=mb[1]/mb[5]; select,flag=error,pattern="^mqw.*";selects all quadrupoles in the range mb[1] to mb[5], and all elements (in the whole sequence) the name of which starts with "mqw" for treatment by the error module.
"flag" can be one of the following::
"slice" is only used by makethin and prescribes the number of slices into which the selected elements have to be cut (default = 1).
"column" is only valid for tables and decides the selection of columns to be written into the TFS file. The "name" argument is special in that it refers to the actual name of the selected element. For an example, see SELECT.
show,command;prints the "command" (typically "beam", "beam%sequ", or an element name), with the actual value of all its parameters.
stop;ends the program execution.
system,"...";transfers the string in quotes to the system for execution.
Example:
system,"ln -s /afs/cern.ch/user/u/user/public/some/directory short";
tabstring(arg1,arg2,arg3)The"string function" tabstring(arg1,arg2,arg3) with exactly three arguments; arg1 is a table name (string), arg2 is a column name (string), arg3 is a row number (integer), count starts at 0. The function can be used in any context where a string appears; in case there is no match, it returns _void_.
title,"...";inserts the string in quotes as title in various tables and plots.
use,period=s_name,range=range;expands the sequence with name "s_name", or a part of it as specified in the range.
value,exp1,exp2,...;prints the actual values of the expressions given.
Example:
a=clight/1000.; value,a,pmass,exp(sqrt(2));results in
a = 299792.458 ; pmass = 0.938271998 ; exp(sqrt(2)) = 4.113250379 ;
write,table=table,file=file_name;writes the table "table" onto the file "file_name"; only the rows and columns of a preceding select,flag=table,...; are written. If no select has been issued for this table, the file will only contain the header. If the FILE argument is omitted, the table is written to standard output.
hansg, June 17, 2002