monochromator

monochromator control macros

DESCRIPTION

spec supports energy-selecting monochromators in three configurations. The first configuration uses a single motor to control the monochromator tilt. The second configuration uses three motors to control the tilt of two crystals and the travel distance between them. The third configuration takes into account a fourth motor to control the offset between the two crystals. (In the three-motor configuration the offset is a fixed parameter.)

All of the monochromator support is contained in the macro source file macros/energy.mac, which is automatically installed with the standard macro library. When the macros are read, commands from the energy.mac file check whether particular motor mnemonics are present in the config file. Motors with mnemonics monu, mond, montrav and monoff select the four-motor configuration. The mnemonics stand for the upstream, downstream, travel and offset monochromator motors. If there are only motors with mnemonics monu, mond and montrav, the three-motor configuration is selected. Having just a motor with a mnemonic of either monu or mono selects the one-motor configuration.

USER-INVOKED MACROS

setmono [d-spacing] [offset]
Used to enter the monochromator d-spacing. If using a three-motor monochromator, you can also enter the offset between the two crystals. With no arguments, the macro will prompt you to enter values. If you enter a 0 for the d-spacing in interactive mode, you will then be prompted to enter the type of crystal and its Miller indices. The macro will then calculate the d-spacing for you. The macro knows about Silicon and Germanium crystals. For other materials, you need to enter the crystal lattice parameter. The distributed setmono only allows you to change the parameters if you have write permission for the file g_mo_d.mac in spec's auxiliary file directory. The current values of the parameters g_mo_d and g_mo_s (if used) are stored in that file. If you can't write the g_mo_d.mac file, the file is read as a command file. If you can write to the file, the file will be updated with the new parameters.
getE
Displays the current energy calculated from the monochromator motor position(s).
moveE energy_in_KeV
Moves the monochromator motor(s) to correspond to the energy value given as an argument. The macro writes the new energy to the data file using the comment macro.
setE energy_in_KeV
Changes the user offset of the monochromator motor(s) so that the current motor position(s) correspond to the energy value given as an argument. No motors are moved. The set macro, which comments a change of a motor's user offset to the data file, is used within setE. (Additional motors that may be involved by way of the calcM_local macro will not be set by this macro.)
Escan start end intervals time [ fixQ ]
Does an energy scan, starting at the energy given by start and ends at the energy given by end. The step size is (start-end)/intervals. The number of data points collected will be intervals+1. Count time is given by time, which if positive, specifies seconds and if negative, specifies monitor counts. If the optional fifth argument is given as the literal characters fixQ, the values of H, K and L at the start of the scan are maintained at each point.

INTERNAL MACROS AND GLOBAL VARIABLES

mono_type
Global variable set to one, three or four representing the number of motors in the monochromator.
g_mo_d
Global variable containing the monochromator d-spacing in Angstroms.
g_mo_s
Global variable containing the offset for the three-motor monochromator in millimeters.
xtal_ind
Global array containing the Miller indices of the crystal (if d-spacing is specified by Miller indices and crystal type).
xtal_lat
Global variable containing the monochromator crystal lattice parameter in Angstroms (if d-spacing is specified by Miller indices and crystal type).
xtal_type
Global variable describing the material of the crystal (if d-spacing is specified by Miller indices and crystal type). It is set to "S" for Si, "G" for Ge and "o" for any other material.
calcM energy_in_KeV
Calculates standard monochromator motor positions from the argument. Calls the macro calcM_local, if defined, to calculate additional motor positions.
calcM_local energy_in_KeV
Optionally defined by local users to calculate motor positions for monochromator motors not taken care of in calcM.
calcE
Calculates LAMBDA from motor positions.
_chk_mlim
Checks limits on monochromator motors, used by Escan.
pa_mono
Displays monochromator parameters as part of the pa macro.
sav_mono
Saves monochromator parameters as part of the save macro.
miller
Used by setmono to calculate d-spacing from Miller indices.
_assign_mono
Figures out which kind of monochromator is being used from motor mnemonics specified in the config file. This macro is called after the reconfig statement in the config macro.

NOTES

To control access to the monochromator parameters, the spec administrator can set the write permission and ownership of the g_mo_d.mac file appropriately.

To have the monochromator parameters automatically read in by each user running spec, put the line

qdofile(sprintf("%s/g_mo_d.mac",SPECD))

in the site.mac file in the auxiliary file directory. (The site.mac file is automatically read as a command file each time a user starts spec.)

The business of storing the monochromator parameters in a file will need to be changed if there is more than one version of spec using monochromators running at the same time on the same computer.