# TRICS Data Analysis with XDS

A set of programs exist for TRICS data analysis which have been derived from the XDS package designed and written by Wolfgang Kabsch. Due to the different diffraction geometry at TRICS the program had to be subdivided. Data Analysis with this system requires four steps:

1. Location of strong diffraction spots with the program spots.
2. Indexing of diffraction spots and refining of a UB matrix with programs of your choice.
3. Integration of the diffraction spots with the program reflex.
4. Optionally, reflections collected in various runs can be merged with the program xscale.

The main limitation of this software is that only reflections at normal lattice positions can be analysed. Magnetic or superstructure reflections will not be integrated due to the fact that XDS uses predicted reflection positions for integration and has no facilities to predict either magnetic or superstructure reflections.

## LEGAL STUFF

The programs spots, reflexand xscale are no official versions of XDS. The responsability for these programs lies with PSI and not with Wolfang Kabsch. Binaries of the above mentioned programs may be distributed, but according to an agreement with Wolgang Kabsch the source code may not be redistributed. If you are interested in an official version of XDS, please contact Wolgang Kabsch directly.

## Spots and reflex Control File

The programs spots and reflex both require a control file to be specified as a command line parameter. The format of this control file resembles a Windows .ini file and is common for both programs. The syntax is: keyword = value.

## Running spots

The purpose of spots is to search for strong diffraction spots in the data and write them out in a format suitable for indexing. spots can be started by typing:

    spots controlfile

at the unix command prompt. All necessary parameters live in the control file. spots recognizes the following keywords in the control file:

numfiles
  The number of files to process.
fileXX
  Replace XX by the number of the file. For instance file00 is the first file to process. The value for this keyword is the filename to process.
numdetectors
  The number of detectors to process. TRICS can have up to three detector banks, if the electronics group finally makes them available by an act of grace.
det1dist, det2dist, det3dist
  The respective distances of the detectors from the sample positions.
det1x, det2x, det3x
  The number of pixels each detector supports in the x-direction.
det1y, det2y, det3y
  The number of pixels each detector supports in the y-direction.
det1pixx, det2pixx,det3pixx
  The size of a detector pixel in x-direction in mm for each detector.
det1pixy, det2pixy,det3pixy
  The size of a detector pixel in y-direction in mm for each detector.
wavelength
  The neutron wavelength.
bifile
  Switches on the writing of reflection positions converted to bissecting positions as from a normal four circle diffractometer. The value is the name of the file to which to write the list.
nbfile
  Switches on the writing of reflection positions converted to normal beam positions as from a normal beamdiffractometer. The value is the name of the file to which to write the list.
xyzfile
  Switches on the writing of reflection positions in XYZ format. The value is the name of the file to which to write the list.

bifile, nbfile or xyzfile are choices. Chhose the one which fits best with your preferred indexing program.

## Indexing and UB Matrix Refinement

For indexing a variety of programs are available:

- The ancient combination of index and rafin from ILL. For a description see the four circle single detector section.
- orient A modern indexing program extracted from Difrac. It has originally been written by R. A. Jacobsen, Ames Research laboratory. orient will not only index the reflections found and determine a UB matrix. It will also refine the UB matrix based on the reflections given to it and tries to determine the space group as well.

### Running orient

In order to start orient, type orient at the unix prompt. A selection dialog for the file type will show up. Select 2, then give the path to the file created with the spots option bifile. You will also be asked for the neutron wavelength. The following dialogs are self explaining. When orient finishes, the new UB matrix can be found in either the LPT1 or printer.out file.

## Running reflex

reflex is controlled through the same style control.ini file as used by spots. The options specified for spots have to be present in the control file for reflex as well. Additionally the following options are required:

ub1, ub2, ub3
  The three rows of the UB-matrix as determined by one of the indexing programs.
axis=0 0 -1
  These are the coordinates of the rotation axis in XDS's own coordinate system. Leave this at the values stated, everything else is shit if you are using TRICS.
beam=0 1 0
  These are the coordinates of the incoming neutron beam in XDS's own coordinate system. Leave this at the values stated, everything else is shit if you are using TRICS.
polarisation=.5 1 0 0
  Some values for handling X-ray polarisation. Leave at the values given.
spacegroup
  Set this to the space group selected. Expected is the number of the space group as given in the international tables.
divergence
  The beam divergence. See below for a comment.
mosaic
  The crystal mosaic. mosaic and divergence together determine the size of the box in reciprocal space which will be integrated for each reflection. reflex writes a representation of the integration box and of the reflection to its output file (PROFIT.LP). Inspect this carefully. If reflections are cut of in the reflection box or the reflection box is to large, modify these values in order to achieve a good fit. As more experience is gathered, the instrument scientist will be able to provide you with reasonable defaults for these values.

reflex is run by typing reflex control.ini at the unix prompt. control.ini is the name of the control file. PROFIT.LP is the main log file which shows what has been done. PROFIT.HKL is a binary file holding the reflections integrated.

## Running xscale

xscale has not been modified since it has been received from W. Kabsch. Therefore the original documentation, reproduced below is still valid.

    C***********************************************************************
    C********************** DESCRIPTION OF FILES ***************************
    C***********************************************************************
    C                                                                      *
    C                     XSCALE.INP     (formatted sequential)            *
    C                     ==========                                       *
    C                                                                      *
    C This file contains the input parameters you have to provide to run   *
    C the XSCALE program.(free format)                                     *
    C                                                                      *
    C line #            DESCRIPTION OF INPUT PARAMETERS                    *
    C                                                                      *
    C   1      Resolution shell limits (Angstrom). Only the high resolution*
    C          limit of each shell is given. Up to NRES (20) resolution    *
    C          shells will be accepted. The shell limits must be specified *
    C          in decreasing order. The resolution shells are used to      *
    C          report statistical properties of the data sets as a function*
    C          of resolution.                                              *
    C   2      Space group number and unit cell parameters                 *
    C          (Angstrom and degrees)                                      *
    C   3...   Each line describes a reflection file used for scaling      *
    C          and contains the following items:                           *
    C          >Optional control character - or * of the following meaning *
    C            -: ignore this data set (this line will be skipped)       *
    C            *: put all data sets to the same scale as this one;       *
    C               default is the first data set.                         *
    C          >File name of data set used for scaling.                    *
    C            The name must not be longer than 50 characters and        *
    C            intervening blanks are not allowed.                       *
    C          >File type must be one of the three following keywords      *
    C            DIRECT: the file is of type XDS.HKL as generated by XDS.  *
    C            UNIQUE: the file is of type UNIQUE.HKL as produced by XDS.*
    C            OLDHKL: the ASCII file consists of free format records    *
    C                    H,K,L,INTENSITY,SIGMA                             *
    C                    The standard deviation SIGMA may be omitted and   *
    C                    is estimated then as SIGMA=0.1*INTENSITY          *
    C                    Reflection data files of type UNIQUE or OLDHKL    *
    C                    may be unsorted and the reflection indices need   *
    C                    not be the asymmetric indices. This simplifies    *
    C                    the scaling of data sets generated by other       *
    C                    programs than XDS.                                *
    C          >Resolution window for accepting reflections from this file *
    C            low  resolution limit (Angstrom)                          *
    C            high resolution limit (Angstrom)                          *
    C          >Frame separation (mandatory for data sets of type DIRECT)  *
    C            specifying the maximum number of frames between FRIEDEL-  *
    C            pairs to be included in the estimated anomalous intensity *
    C            difference.                                               *
    C          >Number of batches (optional for data sets of type DIRECT)  *
    C            This number gives the number of subdivisions of the       *
    C            rotation range covering the data set. Typically, it is    *
    C            the total rotation range divided by 2.5...5 degrees, but  *
    C            should not exceed a value of 36. This leads to at most    *
    C            9*36=324 scaling factors for a single data set. The total *
    C            number of scaling factors from all data sets together     *
    C            must not exceed the value given by "MAXFAC" (1000).       *
    C          >SAVE=file-name (optional); default file-name is XSCALE.HKL *
    C            The type of the SAVE-file produced is UNIQUE. Symmetry    *
    C            related reflections from input data sets sharing the same *
    C            SAVE-file are used after scaling to estimate a mean       *
    C            intensity, an anomalous intensity difference, and their   *
    C            standard deviations. Scaling factors for each data set    *
    C            are determined from all symmetry related reflections      *
    C            regardless whether they go to different SAVE-files.       *
    C                                                                      *
    C***********************************************************************
    C                                                                      *
    C                     XSCALE.LP      (formatted sequential)            *
    C                     =========                                        *
    C                                                                      *
    C This file contains the printed messages and results from running the *
    C XSCALE-program.                                                      *
    C                                                                      *
    C***********************************************************************
    C                                                                      *
    C Description of XSCALE input file format of type DIRECT as produced   *
    C by XDS.                                                              *
    C                                                                      *
    C                       XDS.HKL  (unformatted direct access)           *
    C                       =======                                        *
    C                                                                      *
    C The corrected reflection intensities are saved on this unformatted   *
    C direct access file of record length 68 bytes for each reflection.    *
    C The file is sorted with respect to the unique reflection indices.    *
    C This means:                                                          *
    C  For each reflection with the original indices H,K,L all symmetry    *
    C  equivalent indices are generated including Friedel related ones.    *
    C  Among all these indices we choose the unique reflection indices     *
    C  HA,KA,LA in the following order: HA is the largest H-index, among   *
    C  those with the same HA-value select those with the largest K-index  *
    C  which is KA, and finally the largest L-index which is called LA.    *
    C  The unique indices HA,KA,LA thus found are packed into a 32-bit     *
    C  word  KEY=(LA+511)+(KA+511)*1024+(HA+511)*1048576  .                *
    C  The reflections are then sorted in growing values of KEY.           *
    C                                                                      *
    C                     Record structure                                 *
    C                                                                      *
    C  16bit-WORD #                     CONTENTS                           *
    C       1         HA    (The last record is indicated by HA=10000)     *
    C       2         KA     HA,KA,LA are the unique reflection indices.   *
    C       3         LA     Any two reflections have the same unique      *
    C                        indices if and only if they are related by    *
    C                        symmetry. (HA,KA,LA are integer*2)            *
    C       4          H     Original reflection indices H,K,L.            *
    C       5          K     H,K,L are integer*2.                          *
    C       6          L                                                   *
    C       7          S     Identifying number of symmetry operator used  *
    C                        to go from original to unique indices.        *
    C                        (integer*2). A negative sign indicates that   *
    C                        a mirror operation has been applied. This     *
    C                        information may be useful if a special        *
    C                        treatment for anomalous differences is        *
    C                        required which goes beyond the method of      *
    C                        the XDS-program.                              *
    C       8        IPEAK   Percentage of observed reflection intensity.  *
    C                        A value less than 100 indicates either a      *
    C                        reflection overlap or bad spots in the profile*
    C       9        ICORR   Percentage of correlation (integer*2) between *
    C                        observed and expected reflection profile.     *
    C     10,11      FFADD   LP-corrected intensity of this reflection     *
    C                        obtained by straight summation of counts      *
    C                        within spot region ( background subtracted).  *
    C                        The intensity is also corrected for radiation *
    C                        damage and absorption.      (real*4)          *
    C     12,13      SDADD   Standard deviation of FFADD.(real*4)          *
    C     14,15      RLP     Reciprocal LP-correction factor (real*4)      *
    C       16      ABSCAY   Combined absorption and decay correction      *
    C                        factor*1000 (integer*2).                      *
    C                        In case you want to remove this calculated    *
    C                        correction, divide intensities and standard   *
    C                        deviations by ABSCAY/1000.0  .                *
    C       17       IALFA   IALFA and IBETA (both integer*2) are polar-   *
    C       18       IBETA   coordinates of the spindle axis in units of a *
    C                        hundreth of a degree. The lab coordinates of  *
    C                        the spindle axis are:                         *
    C                        Ux=sin(BETA)*cos(ALPHA)                       *
    C                        Uy=sin(BETA)*sin(ALPHA)                       *
    C                        Uz=cos(BETA)                                  *
    C                        where ALPHA=IALFA/5729.578,                   *
    C                              BETA =IBETA/5729.578.                   *
    C       19       IFRM    Frame number at diffraction of this reflection*
    C                        (integer*2)                                   *
    C       20       PHI     Calculated spindle position for this          *
    C                        reflection at diffraction in units of a       *
    C                        hundreth of a degree. (integer*2)             *
    C       21        IX,    Calculated detector x- and y-coordinates for  *
    C       22        IY     this reflection at diffraction in units of a  *
    C                        tenth of a pixel times 512.0/NX and 512.0/NY, *
    C                        respectively. NX, NY are the numbers of pixels*
    C                        along the detector X- and Y-axis.             *
    C                        IX,IY are integer*2.                          *
    C     23-28       S0     Laboratory coordinates of direct beam wave-   *
    C                        vector ( rec. Angstroem). S0 points from the  *
    C                        x-ray source towards the crystal.             *
    C     29-34       S1     Laboratory coordinates of scattered beam wave-*
    C                        vector. Length is 1.0/lambda (rec. Angstroem) *
    C                        S0 and S1 are real*4 arrays of length 3. S1   *
    C                        points from the crystal towards the detector. *
    C                        At diffraction, laboratory coordinates of the *
    C                        reflection H,K,L are: S1(.)-S0(.)             *
    C                                                                      *
    C***********************************************************************
    C                                                                      *
    C Description of XSCALE input file format of type UNIQUE as produced   *
    C by XDS.                                                              *
    C                                                                      *
    C                       UNIQUE.HKL (formatted sequential)              *
    C                       ==========                                     *
    C                                                                      *
    C              DESCRIPTION OF SHORT OUTPUT FILE                        *
    C                                                                      *
    C Symmetry related reflections are averaged and written with           *
    C FORMAT(3I5,4E12.4). Each record consists of                          *
    C                                                                      *
    C   HA,KA,LA,INTENSITY,STANDARD DEVIATION OF INTENSITY,                *
    C   ANOMALOUS INTENSITY DIFFERENCE,STANDARD DEVIATION OF DIFFERENCE    *
    C                                                                      *
    C where HA,KA,LA are the unique reflection indices. The file is sorted *
    C with respect to these unique reflection indices. The last record     *
    C is indicated by HA=10000.                                            *
    C Unobserved ANOMALOUS INTENSITY DIFFERENCE and its STANDARD DEVIATION *
    C are both set to zero.                                                *
    C                                                                      *
    C***********************************************************************

xscale can be started by typing xscale at the unix prompt. Please note that xscale expects an input file named XSCALE.INP in the current directory.