Oldconstraints

Constraints may be changed on the fly. To change the constraints, an auxiliary program makeconstrain must be available in the reflectometry directory. The makeconstrain program assumes the Bourne shell is available in /bin/sh.

The change the constraints simply edit the code in the constraints window. This will make the Update button available. Pressing Update compiles the new constraints. If there is an error, a window will appear containing the text of the error on the top and the constraints program on the bottom. The line numbers in the error message should correspond to the line numbers in the constraints window. Pressing Show program displays the constraints program even if there were no errors.

Pressing Apply applies the constraints to the current layer profile. They are applied automatically during fits.

The syntax for the constraints is based on the C programming language, with a few modifications. Parameters are specified as they are listed on the fit screen. For example, the following sets Qc^2 for layer 3 to that of layer 4:

QC3 = QC4

You may also use parentheses:

QC(3) = QC(j)

Parameters are not case sensitive.

You can use your own variable definitions, but declarations must precede any other statements just as in C. Variables other than fit parameters are case sensitive. Control structures such as if, while and for must conform to good C language syntax.

Statements need not be terminated with semicolon. The program will try to make intelligent guesses as to when a semicolon should be appended to the end of the line. Savvy C programmers may consult MAKECONSTRAIN source code for the precise conditions. Note that lines beginning for- or while-loops should end either with curly brace or backslash to prevent the addition of the semicolon. Otherwise, your loop statements will not be part of the loop. The same holds true for multiline if/else statements.

Constraints may be suspended with the gj2/mlayer command ULC. They are restored with the command LC, or by modifying the constraints and clicking Update.

Any of the parameters are available for use in constraints, and may even be fit with the fitting commands. An exception exists for MLAYER. The layer after the last layer in the top and middle regions is not available. These layers store copies of the parameters for the first layer in the middle and bottom regions, respectively. In addition, the NL variable of GJ2 (for number of layers) and the NTL, NML, NBL and NMR variables of MLAYER (for number of top, middle, bottom layers and number of middle layer repeats) are available for use in constraints.

Local variables may be declared before any statements have been executed, and declarations follow the C conventions. Variables beginning with _ are reserved.

Two temporary files are created every time the program starts. The first one, named /tmp/aaaaXXXXX (XXXXX is randomly generated) stores the current script. the other, named /tmp/baaaXXXXX (same XXXXX) stores the compiled constraints. When the program is terminated normally, or with ^C at any prompt, these files will be deleted. If there is a serious problem and the program terminates with the message "(core dumped)", these files will not be deleted. Be a responsible user and DELETE THESE FILES IF THE PROGRAM DUMPS CORE.

2003-01-17


Browse Index