# 4 Circle Diffractometer Setting Calculation

An essential part of operating a 4 circle diffractometer is the calculation of the setting angles for the diffractometer for a given reciprocal lattice point from the UB matrix and the wavelength. SICS does this through the hkl object. The hkl object can calculate the required settings both for normal 4 circle configuration and normal beam configuration. It is possible to specify if low chi or high chi values are preferred. The wavelength can be dealt with in two ways: it can be set manually. Or a variable controlling the wavelength can be specified. The hkl object will then be updated automatically with the newest value for the wavelength whenever the wavelength changes.

The hkl object understands the following commands:

hkl list
  Prints a listing of all relevant settings calculation parameters.
hkl current
  Prints the value of the last calculated reflection.
hkl lambda val
  Manually sets the wavelength to val. No automatic updates of the wavelength will be performed.
hkl lambdavar val
  Sets the name of the variable controlling the wavelength. The wavelength in the hkl object will be automatically updated whenever the wavelength is modified by driving variable val. This is a user command because the TRICS spectrometer has more then one monochromator.
hkl setub a11 a12 a13 a21 a22 a23 a31 a 32 a33
  SetUB sets the UB matrix to the nine values given.
hkl nb val
  Switches the mode for normal beam calculation. If val is 1 a normal beam calculation is performed, else normal four circle calculations are done.
hkl quadrant val
  Defines the chi quadrant to prefer. The parameter val can be 0 for low chi and 1 for high chi.
hkl calc h1 h2 h3 psi hamil
  Calculates and prints the setting angles for the reflection (h1,h2,h3). Optionally a psi value and a hamilton position can be specified.
hkl run h1 h2 h3 psi hamil
  Calculates the setting angles for the reflection (h1,h2,h3) and starts the motors to run to that position. This command will return immediately and will not wait for the diffractometer to arrive at the setting angles requested. Optionally a psi value and a hamilton position can be specified.
hkl drive h1 h2 h3 psi hamil
  Calculates the setting angles for the reflection (h1,h2,h3) and starts the motors to drive to that position. This command will wait for the diffractometer to arrive at the setting angles requested. Optionally a psi value and a hamilton position can be specified.