Running OptiM From the Command Line

OptiM can be run from the command line. This is useful when execution is initiated from a batch file or by an other program. Upon exit the program returns 0 for successful completion or 1 if an error has been encountered. Depending on the specified argument(s), the program will perform different actions which are described below.

To start the program in interactive (GUI) mode with a specific input (lattice description) file :

optim InputFileName
The program reads the file InputFileName and the GUI is ready for interactive operation. On the MS Windows platform, this mechanism makes it possible to launch OptiM by double clicking on a file of type (*.opt) from Windows Explorer by associating the .opt extension with optim.exe (use View | Option | File types in Windows Explorer).

Non-interactive modes

All the modes described below are meant for non-interactive program execution, i.e. the program is used to generate output files from input files. The command line arguments correspond to menu parameters in interactive program operation. The following switches can be used:

-f : save a table of Twiss  functions  (beta-functions, dispersions etc.) 
-s : save a table of Twiss functions to a file with MAD like structure
-c : save a table of coupled Twiss funtions 
-i : save a table of Twiss functions computed with accounting beam space charge
-t : save a table of beam centroid positions (trajectory)
-o : save a table of orbit positions
-r : read BdL from .snap file and create new OptiM file
-w : create a .snap file
-p : multi-particle tracking

To tabulate (uncoupled) Lattice Functions

optim -f InputOptimFileName OutputTwissFileName ‹filter› ‹MatchCase› ‹HideFirstLetter› ‹Comment› ‹step› ‹CloseLattice›
The default values for unspecified arguments are:
filter=*
MatchCase=Y
HideFirstLetter=Y
Comment=#
step=0
CloseLattice=Y  (the periodic solution will be used) 
‹Comment› is added on a separate line, pre-pended to the output file. For the CEBAF recirculator, the comment is used to keep track of the pass number.
To tabulate (uncoupled) Lattice Functions together with element parameters (MAD8 TWISS format)
optim -s InputOptimFileName OutputTwissFileName ‹filter› ‹MatchCase› ‹HideFirstLetter› ‹Comment› ‹step› ‹CloseLattice›
The default values for unspecified arguments are:
filter=*,  
MatchCase=Y, 
HideFirstLetter=Y, 
Comment=#
step=0,    
CloseLattice=Y (the periodic solution will be used).
Generate a list of coupled lattice functions:
optim -c InputOptimFileName OutputTwiss4DFileName ‹filter› ‹MatchCase› ‹HideFirstLetter› ‹step› ‹CloseLattice›
defaults:
filter=*
MatchCase=Y
HideFirstLetter=Y
step=0
CloseLattice=N
Generate a table of coupled beta-functions, taking into account linear space charge (de)focusing :
optim -i InputOptimFileName OutputTwiss4DFileName ‹filter› ‹MatchCase› ‹HideFirstLetter› ‹step› ‹CloseLattice›
defaults:
filter=*
MatchCase=Y
HideFirstLetter=Y
step=0
CloseLattice=N
Generate a Table of Output Beam Centroid Positions (trajectory) (see Type Trajectoryx) :
optim -t InputOptimFileName OutputTrajFileName  ‹filter›  ‹MatchCase›  ‹CloseLattice›  ‹OutputType›  ‹step›
Defaults:
filter=*
MatchCase=Y
HideFirstLetter=Y
CloseLattice=Y (N - No closure, Y - linear closure, E - nonlinear closure
OutputType=T (T - text, B - binary)
step=0
Generate a Table of Orbit Positions :
optim -o InputOptimFileName OutputTrajFileName  ‹filter›  ‹MatchCase›  ‹CloseLattice›  ‹OutputType›  ‹step›
Defaults:
filter=*
MatchCase=Y
HideFirstLetter=Y
CloseLattice=Y (N - No closure, Y - linear closure, E - nonlinear closure
OutputType=T (T - text, B - binary)
step=0
Read $\int B\; dL $ from a .snap File and Generate a New .opt File (see Read Field Integral)
optim -r InputOptimFileName OutputOptimFileName InputSnapFile  ‹filter›  ‹MatchCase›  ‹NamePrefix›  ‹Scale›  ‹StartTwissFile›
	Default values are:
filter=*
MatchCase=Y
NamePrefix=""
Scale=1
If StartTwissFile is used, the initial Twiss parameters will be taken from the END line of this file, otherwise values from initial OptiM file will be used. 
Create a .snap file (see Lattice)
optim -w InputOptimFileName OutputSnapFileName ‹filter›  ‹MatchCase›  ‹HideFirstLetter› 
Default values:
filter=*
MatchCase=Y
HideFirstLetter=Y
Multiparticle Tracking (see Track)
optim -p InputOptimFileName OutputTrackingFileName InputPartPosFileName  ‹filter›  ‹MatchCase›  ‹Nturn›  ‹ring›
Default are:
filter=*
MatchCase=Y
Nturn=1
ring=L (should be R or L)