Large dynamic range small-angle diffractometer

MAD command files

This document gives information about the structure of MAD command files and describes how to set up nested MAD command files.

For other details, refer to the complete D22 Manual.

See also the D22 documentation.

Basic information

The program MAD accepts to run series of commands in the form of command files.

Command files are started by the command

START file.ext number_of_repetitions

where file.ext is the name of the command file which is repeated number_of_repetitions times (default :1). MAD command files can have any name and extension, e.g. FIRST.RUN. The default extension is .CMD or .cmd. You are advised not to user other extensions for the sake of easier administration of the user zone on the acquisition computer. The default extension can be omitted. START next_1 means the same as START next_1.cmd.

Note that the length of the whole command-file name (including .ext) must not exceed 16 characters.

Such command files can also be executed as parts of higher-level command files. This opens interesting options allowing one to modify a series of experimentswhile it is being executed.

The following command file was created with an editor (nedit). Some lines start with an exclamation mark. These seve as comment lines for additional information, for temporarily "hiding" certain commands, or to make the structure of the command file appear clearer.

This command file fills, when executed with the START command, certain parameters to be used for data characterisation and interpretation (DATE, PROPOSAL, USERNAME, LOGBOOK, TITLE).

Note: The DATE command in front of the PAR commands will make MAD print the date and time at execution, whereas PAR DATE fixes a parameter to be stored with the data.

It then sets the WAVelength and the DETECTOR and COLLIMATION distances, offsets the detector by 400 mm laterally to the right, and removes the ATTENUATOR. A BEAMstop is selected and positioned horizontally (Bx) and vertically (By). No CRYOGENICS command is to issued.

After this, the sample CHANGER is moved to four different positions, the corresponding sample title entered as SUBTITLE, and a measurement started by the command RUN. The preset is selected as T(ime); in could also have been M(onitor).

The motor commands can be written into one line, but the collimation command must not be the first in a line. Remember that the collimation command must not be interrupted .

When preparing a series of measurents, it is preferrable to separate the instrument setting commands from those executing the positioning and counting of samples. This can be achieved by creating higher-level command files like the following.

Since command files are only read whenever the START command is executed, it is the (last version of) the file present at execution which is used by MAD.

One can, therefore, supply a command file like NEXT.CMD


which loops "infinitely" executing whatever is found in NEXT_1 etc. In practice, the number of levels is limited to a depth of 99, i.e. MAD will stop after opening NEXT.CMD 99 times!

This property of MAD allows one to change the course of an experiment, e.g. from home, without accessing the program MAD. For example, NEXT_1 could contain


and so on.

If you decide to not continue at some position of the file, it is sufficient to edit the NEXT_n file currently being executed in order to completely change the measuring sequence. Note that the file MY_SAMPLES that is being executed will be finished by MAD. Therefore, it is preferrable to enter three times "START MY_SAMPLES" rather than "START MY_SAMPLES 3".

If you invisage to stop execution of a series at any point, you may insert a command like "START NOTHING" in MY_SAMPLES

where NOTHING.CMD can be an initially empty file. If you decide to not go on with the current experiment, you may modify it to say START NEXT or START NEXT_8 etc. in order to modify the course of the experiment.

Don't forget to change NOTHING.CMD back to empty once the jump has happened!

Web document produced by Roland May, ILL Grenoble Last updated 12-Mar-2001.