People
Software
XDS
 
XDS (X-ray Data Streamer)

XDS is program used for automatic processing of rotation diffraction data from crystals of initially unknown symmetry and cell constants.

To use XDS on the DEC-ALPHAs you need to add the following lines to your .login file:

alias xds    /joule2/programs/xds/xds
alias xscale /joule2/programs/xds/xscale

XDS needs one file called XDS.DATA that contains all the information to run the program. A typical XDS file to process RAXIS images looks like this:

IDXREF
RAXIS   QX=0.1017 QY=0.105
a1gil1???.osc    RAXIS DIRECT
NONE
1.5418 0 0 1 0.444 0.0 1.0 0.0
20 20  0.0  4.00   0 1 0
-100.0  952.0 954.0 1 0 0 0 -1 0  0.001
0  21.0  21.00 27.00  95.0  103.0 119.5
0 0  0.5  0.9  10


C***********************************************************************
C                                                                      *
C                                                                      *
C                 XX     XX     DDDDDD       SSSSSS                    *
C                  XX   XX      DD   DD     SS                         *
C                   XX XX       DD    DD    SS                         *
C                    XXX        DD    DD     SSSSSS                    *
C                   XX XX       DD    DD          SS                   *
C                  XX   XX      DD   DD           SS                   *
C                 XX     XX     DDDDDD       SSSSSS                    *
C                                                                      *
C                                                                      *
C***********************************************************************
C                                                                      *
C      X-RAY DATA STREAMER FOR THE XENTRONICS AREA DETECTOR,           *
C      THE MAR-RESEARCH AND R-AXISII IMAGING PLATE SYSTEMS             *
C                     VERSION  August-1994                             *
C                                                                      *
C      WOLFGANG KABSCH                                                 *
C      MAX-PLANCK-INSTITUTE FOR MEDICAL RESEARCH                       *
C      DEPARTMENT OF BIOPHYSICS                                        *
C      JAHNSTRASSE 29                                                  *
C      69028 HEIDELBERG                                                *
C      GERMANY                                                         *
C                                                                      *
C              e-mail: kabsch@mpimf-heidelberg.mpg.de                  *
C                                                                      *
C***********************************************************************
C                                                                      *
C      XDS is based on the theory described in the references:         *
C                                                                      *
C 1)"Automatic processing of rotation diffraction data from crystals   *
C    of initially unknown symmetry and cell constants"                 *
C    Kabsch,W. (1993),J.Appl.Cryst.26,795-800.                         *
C 2)"EVALUATION OF SINGLE CRYSTAL X-RAY DIFFRACTION DATA FROM A        *
C    POSITION SENSITIVE DETECTOR"                                      *
C    Kabsch,W. (1988),J.Appl.Cryst.21,916-924.                         *
C 3)"AUTOMATIC INDEXING OF ROTATION DIFFRACTION PATTERNS"              *
C    Kabsch,W. (1988),J.Appl.Cryst.21,67-71.                           *
C                                                                      *
C    Instrument control and the production of data frames for the      *
C    Nicolet/Siemens detector are based on software described in:      *
C                                                                      *
C 4)"A SYSTEM FOR COLLECTION AND ON-LINE INTEGRATION OF X-RAY          *
C    DIFFRACTION DATA FROM A MULTIWIRE AREA DETECTOR"                  *
C    Blum,M., Metcalf,P., Harrison,S.C. and Wiley,D.C. (1987),         *
C    J.Appl.Cryst.20,235-242.                                          *
C                                                                      *
C***********************************************************************
C****************** HISTORY OF PROGRAM CHANGES *************************
C***********************************************************************
C                                                                      *
C     ORIGINAL VERSION FOR THE NICOLET/SIEMENS DETECTOR       12-1988  *
C                                                                      *
C     GLOBAL PARAMETER REFINEMENT ("GLOREF"-STEP) ADDED        6-1990  *
C                                                                      *
C     CHANGE OF "GETFRM" (CONTRIBUTED BY GERSON COHEN, NIH)    5-1991  *
C     FOR PROCESSING OF DATA COLLECTED AT THE ARGONNE NATIONAL         *
C     LAB. FASTER VERSION OF THE "CORRECT" SUBROUTINE.                 *
C                                                                      *
C     MAJOR MODIFICATION OF XDS FOR THE PROCESSING OF DATA    10-1991  *
C     FROM CRYSTALS OF UNKNOWN SPACE GROUP SYMMETRY AND CELL           *
C     CONSTANTS.                                                       *
C                                                                      *
C     BUG CORRECTIONS AND MINOR CHANGES                        2-1992  *
C                                                                      *
C     ADAPTATION TO THE MAR RESEARCH IMAGING PLATE             8-1992  *
C                                                                      *
C     PRE-REFINEMENT ADDED TO "IDXREF"                        11-1992  *
C                                                                      *
C     HANDLING OF HARVARD 16-BIT FRAME FORMAT ADDED.           8-1993  *
C     XDS NOW ACCEPTS UNIX COMPRESSED DATA FRAME FILES.                *
C     COMPRESS-COMMAND. THE MANUAL INCLUDES A REPORT OF A              *
C     CASE OF OBTAINING THE WRONG ENANTIOMORPH BY DATA                 *
C     PROCESSING WITH XDS (CONTRIBUTED BY JANET SMITH, PURDUE)         *
C     UTILITY FUNCTION "DIRB" ADDED. IT PROVIDES A TOOL FOR            *
C     ESTABLISHING THE MAPPING BETWEEN PIXEL-SPACE AND THE LAB         *
C     COORDINATE SYSTEM.                                               *
C                                                                      *
C     ALL RESTRICTIONS FOR THE MAXIMUM NUMBER OF REFLECTIONS   1-1994  *
C     CLOSE TO THE EWALD SPHERE HAVE BEEN ELIMINATED.                  *
C     THE MINIMUM NUMBER OF CONSECUTIVE DATA FRAMES REQUIRED           *
C     BY "XDS" HAS BEEN REDUCED TO 1.                                  *
C                                                                      *
C     ADAPTATION TO THE R-AXIS IMAGING PLATE DETECTOR          8-1994  *
C                                                                      *
C***********************************************************************
C****************** INSTALLATION OF THE PROGRAM ************************
C***********************************************************************
C                                                                      *
C THE PROGRAM IS WRITTEN IN FORTRAN 77 WITH FEW NON-STANDARD           *
C EXTENSIONS OF THE LANGUAGE DEFINITION. THESE ARE:                    *
C                                                                      *
C              NON-STANDARD DATA TYPES                                 *
C                                                                      *
C It is assumed in XDS that:                                           *
C     A CHARACTER*1 VARIABLE IS REPRESENTED BY  8 BITS=1 BYTES.        *
C     A INTEGER*2   VARIABLE IS REPRESENTED BY 16 BITS=2 BYTES.        *
C     A INTEGER*4   VARIABLE IS REPRESENTED BY 32 BITS=4 BYTES.        *
C     A INTEGER     VARIABLE IS REPRESENTED BY 32 BITS=4 BYTES.        *
C     A REAL        VARIABLE IS REPRESENTED BY 32 BITS=4 BYTES.        *
C     A REAL*4      VARIABLE IS REPRESENTED BY 32 BITS=4 BYTES.        *
C     A REAL*8      VARIABLE IS REPRESENTED BY 64 BITS=8 BYTES.        *
C                                                                      *
C                                                                      *
C        NON-STANDARD FUNCTIONS AND SUBROUTINES                        *
C                                                                      *
C XDS uses the non-standard functions "IAND", "IOR" and the subroutine *
C "DATE". With few exceptions these are available on most computers    *
C and no modifications are required. Known exceptions are PCS/CADMUS   *
C and IBM risk 6000 computers.                                         *
C PCS/CADMUS:    Uncomment the code provided at the end of this file   *
C                (xds.f) for "IAND", "IOR". (Use your editor to search *
C                for "CADMUS".)                                        *
C IBM RISC 6000: Uncomment the code for subroutine "DATE" provided     *
C                at the end of this file (xds.f). (Use your editor     *
C                to search for "DATE".)                                *
C                                                                      *
C                      SYSTEM CALLS                                    *
C                                                                      *
C All system calls are issued in subroutine OPFRAM located near the    *
C end of this file (xds.f). Appropriate calls are described for the    *
C UNIX and VAX-VMS operating systems. Use your editor to search for    *
C "SYSTEM(" to check and possibly modify the system calls according    *
C to the comments near these places.                                   *
C THE PROGRAM CODE IS CONTAINED ON TWO FILES:                          *
C                                                                      *
C - THE FILE "xdslib.f" contains a large number of hopefully device    *
C independent subroutines needed by the main program. It is unlikely   *
C that you have to modify anything on this file.                       *
C                                                                      *
C - THE FILE "xds.f" (the one you read now) contains the manual, main  *
C program and a small number of probably machine dependent routines.   *
C All constants used by XDS are named by symbols and assigned values   *
C at a unique place in the main program. Some of these constants       *
C control the size of arrays used by the subroutines. These arrays     *
C are allocated here in the main program (file xds.f) to simplify a    *
C change of their sizes without the necessity to recompile all the     *
C subroutines (file xdslib.f). To make a new version of XDS tailored   *
C to a specific task (like processing data taken from crystals with    *
C a very large unit cell) thus amounts to changing a few constants     *
C and recompiling the main program only.                               *
C COMMON and EQUIVALENCE directives are used to reduce the size of the *
C virtual address space for the whole program since not all of the     *
C arrays are needed at the same time in each program step. XDS is      *
C organized into 7 steps - XYCORR, COLSPOT, IDXREF, COLPROF,           *
C PROFIT, CORRECT, GLOREF - which are invoked consecutively by the     *
C main program. There is no exchange of information between these      *
C steps through shared memory. Information is exchanged by files       *
C which allows to repeat selected steps in case of a system crash      *
C or with changed input parameters in XDS.DATA without rerunning the   *
C whole program.                                                       *
C In the following you find a description of what you have to do for   *
C installing XDS at your specific environment. In addition, some       *
C examples of global parameter settings are given.                     *
C                                                                      *
C   GLOBAL PARAMETER SETTINGS                                          *
C                                                                      *
C USE YOUR EDITOR TO SEARCH FOR "FRMTYP=" TO CHECK AND POSSIBLY MODIFY *
C ITS VALUE WHICH SETS THE DEFAULT FOR TYPE AND ACCESS OF DATA FRAMES. *
C Values 1,...,4 for FRMTYP are applicable to the NICOLET/SIEMENS      *
C multiwire area detector, while 5 or 6 should be used for the MAR-    *
C research imaging plate system, 7 or 8 for the R-AXIS.                *
C FRMTYP=1 IF DATA FRAMES (ORIGINAL HARVARD FORMAT) ARE OPENED WITH    *
C          ACCESS='DIRECT', AS IS THE CASE FOR  CONVEX, PCS, IRIS,     *
C          IBM-RISK 6000, DEC 3000/400 (OSF/1).                        *
C       =2 IF DATA FRAMES (ORIGINAL HARVARD FORMAT) ARE OPENED WITH    *
C          ACCESS='SEQUENTIAL', AS IS THE CASE FOR A VAX (VMS).        *
C       =3 IF DATA FRAMES (ARGONNE FORMAT) ARE OPENED WITH ACCESS=     *
C          'DIRECT'.(CONVEX,PCS,IRIS,IBM-RISK6000, DEC 3000/400)       *
C       =4 IF DATA FRAMES (ARGONNE FORMAT) ARE OPENED WITH ACCESS=     *
C          'SEQUENTIAL', AS FOR A VAX (VMS).                           *
C       =5 IF DATA FRAMES (MAR RESEARCH FORMAT) ARE OPENED WITH        *
C          ACCESS='DIRECT'. (CONVEX,PCS,IRIS,IBM-RISK6000,DEC 3000/400)*
C       =6 IF DATA FRAMES (MAR RESEARCH FORMAT) ARE OPENED WITH        *
C          ACCESS='SEQUENTIAL'. (VAX VMS)                              *
C       =7 IF DATA FRAMES (R-AXIS II 1900 X 1900) ARE OPENED WITH      *
C          ACCESS='DIRECT'. (CONVEX,PCS,IRIS,IBM-RISK6000,DEC 3000/400)*
C       =8 IF DATA FRAMES (R-AXIS II 1900 X 1900) ARE OPENED WITH      *
C          ACCESS='SEQUENTIAL'. (VAX VMS)                              *
C IN "XDS.DATA" YOU MAY ALWAYS OVERRIDE THIS DEFAULT SETTING BY        *
C USING OPTIONAL KEY-WORDS  "HARVARD", "ARGONNE", "MAR", "DIRECT",     *
C "SEQUENTIAL" FOLLOWING THE FILE NAMES OF THE FRAME CONTAINING SPATIAL*
C CORRECTION DATA AND THE NAME TEMPLATE OF FRAME FILES.                *
C                                                                      *
C USE YOUR EDITOR TO SEARCH FOR "A=5." TO CHECK AND POSSIBLY MODIFY    *
C ITS VALUE. "A" IS THE SHORTEST DISTANCE (mm) BETWEEN HOLES IN THE    *
C CALIBRATION BRASS PLATE FOR THE NICOLET/SIEMENS DETECTOR.            *
C                                                                      *
C Other parameter values which are important for the type of detector  *
C you have, are QX,QY,NX,NY. A description of the meaning              *
C of all parameters used by XDS is included in this manual (xds.f).    *
C Some typical sets of parameter values are given below for the        *
C SIEMENS and the MAR-research detectors.                              *
C                                                                      *
C PARAMETER   SIEMENS    R-AXIS II                         MAR         *
C----------------------------------------------------------------------*
C     A         5.08     not used                        not used      *
C   DELPHI      2.5        5.0                              5.0        *
C   FRMTYP     1...4        7                             5 or 6       *
C   MAXRFL    160000      300000                         300000        *
C   NGRID        4          4                                4         *
C   NGRIDG       4          4                                4         *
C     NX        512        1900                            1200        *
C     NY        512        1900                            1200        *
C     QX        0.19      0.1017                           0.15        *
C     QY        0.19      0.105                            0.15        *
C   OVLOAD     65000      250000                         130000
C   TBLSIZ     32749      299993                         299993        *
C----------------------------------------------------------------------*
C  Program    16Mbyte    24Mbyte                         24Mbyte       *
C   size                                                               *
C                                                                      *
C                                                                      *
C   COMPILATION                                                        *
C                                                                      *
C AFTER THE MODIFICATIONS AND CHECKS OF xds.f HAVE BEEN CARRIED OUT,   *
C COMPILE AND LINK  xds.f, xdslib.f  TO GET AN EXECUTABLE PROGRAM.     *
C IF AVAILABLE, IT IS A GOOD IDEA TO USE A COMPILER FLAG THAT          *
C GENERATES REAL NUMBERS IN IEEE-STANDARD REPRESENTATION. THIS         *
C RESULTS IN MUCH LESS TROUBLES IF YOU TRY TO USE XDS-GENERATED        *
C BINARY FILES ON OTHER MACHINES.                                      *
C                                                                      *
C***********************************************************************
C************* COORDINATE SYSTEMS AND SAMPLE INPUT DATA ****************
C***********************************************************************
C                                                                      *
C Among the input data the user has to provide (see description of     *
C file XDS.DATA for details) are geometrical parameters describing     *
C the setup of the diffraction experiment with respect to a fixed      *
C laboratory coordinate system. Any convenient right-handed            *
C orthonormal system may be chosen with the origin at the inter-       *
C section between rotation axis, direct beam and crystal.              *
C                                                                      *
C Using the laboratory coordinate system as described in reference 3), *
C the y-axis points vertically down and is defined to be collinear     *
C (parallel or antiparallel) with the rotation axis. The z-axis lies   *
C within the plane spanned by the rotation axis and the detector       *
C normal at swing angle 0, with +z pointing from the crystal towards   *
C the detector. The x-axis is defined to yield an orthonormal right    *
C handed laboratory coordinate system {x,y,z}.                         *
C A typical experimental setup is shown below:                         *
C                                                                      *
C  viewed from ABOVE:                                                  *
C                                                                      *
C                                                       \              *
C                                                        \             *
C                              |                          \            *
C                              |                           \           *
C                              |                            \ detector *
C                              |                             \         *
C                              |                              \        *
C  ------beam->-->-->----------O------------------- +z         \       *
C                              |                                \      *
C                              |                                       *
C                              |                                       *
C                              |                                       *
C                              |                                       *
C                             +x                                       *
C                                                                      *
C                                                                      *
C  viewed from the SIDE:                                               *
C                                                                      *
C                         omega axis                                   *
C                        2-theta axis                                  *
C                        rotation axis                                 *
C                              |                                       *
C                              |                            |          *
C                              |                            |          *
C                              |                            |          *
C                              |                            |          *
C  ------beam->-->-->----------O------------------- +z      | detector *
C                              |                            |          *
C                              |                            |          *
C                              |                            |          *
C                              |                            |          *
C                              |                                       *
C                             +y                                       *
C                                                                      *
C Direct beam:                                                         *
C The positive beam direction points along +z from the source towards  *
C the crystal. If the beam is aligned normal to the rotation axis and  *
C the detector normal at swing angle 0, the coordinates of the incident*
C beam wavevector (see input parameter S0 in XDS.DATA) are  0  0  1.   *
C                                                                      *
C Rotation axis:                                                       *
C XDS requires that the frame increment (oscillation range, see input  *
C parameter DPHI in XDS.DATA) be positive. Thus the coordinates of the *
C rotation axis (see input parameter ACHSE in XDS.DATA) are:           *
C 0  1  0   if the crystal rotates clockwise when proceeding to the    *
C           next data frame and the camera is viewed from above.       *
C 0 -1  0   if the crystal rotates counterclockwise.                   *
C                                                                      *
C Detector position:                                                   *
C The swing axis coincides with the rotation axis and a positive swing *
C angle CHI (or 2-theta) corresponds to a clockwise rotation of the    *
C detector when viewed from above. In the drawing, the detector is set *
C to a negative swing angle CHI. The orientation of the detector with  *
C respect to this laboratory system is described by a right-handed set *
C of 3 orthonormal vectors ED(.,1), ED(.,2), ED(.,3) (see XDS.DATA).   *
C Only the first two unit vectors must be specified while the third one*
C is automatically determined by XDS. The vectors ED are found from the*
C requirement that a pixel on the detector surface which is represented*
C by the array indices IX, IY in the data frame must map to the lab    *
C coordinates according to the equations                               *
C         x=QX*(IX-XORG)*ED(1,1)+QY*(IY-YORG)*ED(1,2)+F*ED(1,3)        *
C         y=QX*(IX-XORG)*ED(2,1)+QY*(IY-YORG)*ED(2,2)+F*ED(2,3)        *
C         z=QX*(IX-XORG)*ED(3,1)+QY*(IY-YORG)*ED(3,2)+F*ED(3,3).       *
C Here, QX and QY are the size of a pixel (mm) along IX and IY,        *
C respectively. F is the detector to                                   *
C crystal distance (mm), and XORG, YORG are the pixel origin. Hence,   *
C the correct choice of the vectors ED not only depends upon the swing *
C angle CHI but also upon the internal representation of a pixel by the*
C array indices IX, IY in each data frame. For HARVARD-style frames, as*
C interpreted by XDS, pixel coordinates IX=IY=1 correspond to the lower*
C right hand corner of the detector when viewed from the crystal and   *
C the vectors ED(.,1), ED(.,2) are antiparallel to the laboratory x and*
C y axes at swing angle CHI (or 2-theta) = 0. The computed vector      *
C ED(.,3) then points along +z which leads to a positive detector      *
C distance F. Hence, for a swing angle CHI and HARVARD-style frames,   *
C we have  ED(1,1)=-cos(CHI), ED(2,1)= 0.0, ED(3,1)=sin(CHI)           *
C          ED(1,2)= 0.0,      ED(2,2)=-1.0, ED(3,2)= 0.0               *
C and a positive detector distance F. (Recall that CHI is negative in  *
C the example illustrated above.)                                      *
C                                                                      *
C======================================================================*
C  SAMPLE INPUT DATA FOR THE SPECIAL CASE OF A SUPPER ROTATION CAMERA  *
C......................................................................*
C XDS                                                                  *
C SIEMENS /../urml/data/ADN900/xyco2303.12cm     DIRECT   HARVARD      *
C/../urml/data/ADN900/ADN900.????       DIRECT   HARVARD               *
C/../urml/data/ADN.native                                              *
C 1.5418 0.0 0.0 1.0 0.5 0.0 1.0 0.0                                   *
C 1 600 0.0 0.1666666  0.0 1.0 0.0                                     *
C 120.0 256.5  237.3 -0.996195 0.0 -0.087156 0.0 -1.0 0.0   0.001      *
C 19 133.0 56.4 110.0 90.0  90.0  90.0                                 *
C 30 1  0.45   0.45  60                                                *
C......................................................................*
C======================================================================*
C  SAMPLE INPUT DATA FOR THE X100A SIEMENS DETECTOR AT EMBL HEIDELBERG *
C......................................................................*
C XDS                                                                  *
C SIEMENS data$x:[tucker]040893.brs9  ARGONNE DIRECT                   *
C data$x:[tucker.p20]p20.???? ARGONNE DIRECT                           *
C NONE                                                                 *
C 1.5418 0 0 1 0.444 0  1.0 0                                          *
C 1 360 0.0 0.1  0 -1 0                                                *
C 90   258  253  -0.9063077 0.0 0.42261826 0 -1 0 0.001                *
C 91 90 90 74 90 90 90                                                 *
C 5  1  0.50 0.30 30                                                   *
C......................................................................*
C Note that the rotation axis is 0 -1 0 because a positive rotation is *
C counterclockwise when looking down Y for the 3-axis goniostat used   *
C at EMBL-Heidelberg. In the example above CHI was negative; the       *
C direction cosines for the detector X-axis ED(.,1) are                *
C                                                                      *
C     -cos(swing) 0 -sin(swing)                                        *
C                                                                      *
C======================================================================*
C -  SAMPLE INPUT DATA FOR THE MAR RESEARCH IMAGING PLATE DETECTOR     *
C......................................................................*
C XDS                                                                  *
C MAR NPIX=1200 ROFF=0.0 TOFF=0.0                                      *
C data$m:[tucker.test]l20_???.image  MAR DIRECT                        *
C NONE                                                                 *
C 1.5418 0 0 1 0.444 0.0 1.0 0.0                                       *
C 1 42   0.0  1.00   0 1 0                                             *
C 90  595.0 595.0 1 0 0 0 1 0  0.001                                   *
C 96  79.35 79.35 38.34 90 90 90                                       *
C 30 1  0.5  0.4  10                                                   *
C......................................................................*
C======================================================================*
C -  SAMPLE INPUT DATA FOR THE R-AXIS II  IMAGING PLATE DETECTOR       *
C......................................................................*
C XDS                                                                  *
C RAXIS   QX=0.1017 QY=0.105                                           *
C ../frames/V43M1???.OSC    RAXIS DIRECT                               *
C  NONE                                                                *
C 1.5418 0 0 1 0.444 0.0 1.0 0.0                                       *
C 1 21  0.0  1.50   0 1 0                                              *
C -69.4305  951.8 952.8 1 0 0 0 -1 0  0.001                            *
C 168 91.2   91.2   45.87  90.0  90.0 120.0                            *
C  0 1  0.5  0.2  10                                                   *
C......................................................................*
C======================================================================*
C                                                                      *
C CHECKING THE INTERNAL REPRESENTATION OF FRAME DATA                   *
C A simple way of checking how a pixel on the detector surface is      *
C represented by its array indices IX, IY in the data frame as inter-  *
C preted by XDS consists of the following procedure:                   *
C Move the detector to swing angle 0. Sucessively expose the upper     *
C and lower right corners of the detector surface to x-rays and save   *
C each exposure in a separate data frame file.                         *
C Use XDS to find the pixel coordinates IX, IY of the maxima in each   *
C of the 2 data frames by specifying "DIRB" in first line of XDS.DATA. *
C (Do not use anybody elses program as it might have adopted different *
C conventions!)                                                        *
C XDS will then enter interactive mode, ask for the name of the frame  *
C data file and returns the pixel coordinates of the maximum. From     *
C the results it is easy to figure out which way the array indices     *
C IX, IY are running with respect to the laboratory coordinate system. *
C For example, at our installation the maxima were found at            *
C IX=139, IY=482 in the upper right, and IX=125, IY=75 in the lower    *
C right corner of the detector when viewed from the crystal. Hence,    *
C in this case the IX- and IY-lines must be going antiparallel to the  *
C laboratory x and y axes at swing angle 0. For a swing angle CHI      *
C (remember that CHI is negative in the drawing above) this leads to   *
C          ED(1,1)=-cos(CHI), ED(2,1)= 0.0, ED(3,1)=sin(CHI)           *
C          ED(1,2)= 0.0,      ED(2,2)=-1.0, ED(3,2)= 0.0               *
C The vector ED(.,3) (computed by XDS) then points mainly along +z     *
C which leads to a positive detector distance F.                       *
C                                                                      *
C INCORRECT ENANTIOMORPH (contributed by Janet Smith,Purdue University)*
C An incorrect choice of the vectors ED may well lead to incorrect     *
C signs of the anomalous intensity differences as pointed out by       *
C Janet Smith (Purdue University, USA). Because of its importance      *
C to other users of XDS, Janet's report is included here:              *
C We have encountered an enantiomorph problem in data that were        *
C obtained in the following way:                                       *
C                                                                      *
C               3-axis Siemens camera, Siemens software                *
C               Siemens multiwire detector                             *
C               XDS indexing and integration                           *
C                                                                      *
C Following our reading of the XDS documentation, data in the incorrect*
C enantiomorph were produced.  We have obtained the correct sign for   *
C anomalous differences with the following input parameters for the    *
C specified experiment (see drawing above).                            *
C                                                                      *
C               direct beam axis:  0.0  0.0  1.0                       *
C               rotation axis:     0.0  1.0  0.0                       *
C               detector vectors:  -cos(CHI)  0.0  sin(CHI)            *
C                                     0.0    -1.0    0.0               *
C               detector distance: positive                            *
C                                                                      *
C Our problem came in defining positive x and y directions on the      *
C detector. The example in the XDS documentation for the "special case *
C of a 3-axis goniometer" led us in the wrong direction. It now appears*
C that the example for the "special case of a Supper rotation camera"  *
C fits exactly with the situation of the three-axis camera and Harvard-*
C style frames that we use in our laboratory.                          *
C                                                                      *
C While solving our enantiomorph problem, we tried all possible sign   *
C combinations for the nonzero elements of the detector x and y vectors*
C and for the detector distance.  Only two sign combinations, of 32    *
C total, could be indexed and integrated by XDS.  For the experimental *
C setup illustrated above, these were:                                 *
C                                                                      *
C                               -cos(CHI)      0.0      sin(CHI)       *
C correct enantiomorph             0.0        -1.0        0.0          *
C                                        positive distance             *
C                                                                      *
C           and                                                        *
C                                                                      *
C                               -cos(CHI)      0.0      sin(CHI)       *
C incorrect enantiomorph           0.0         1.0        0.0          *
C                                       negative distance              *
C                                                                      *
C - MISLEADING EXAMPLE FOR THE SPECIAL CASE OF A 3-AXIS GONIOMETER     *
C......................................................................*
C XDS                                                                  *
C SIEMENS /../urml/data/ADN900/xyco2303.12cm        DIRECT  HARVARD    *
C/../urml/data/ADN900/ADN900.????          DIRECT  HARVARD             *
C/../urml/data/ADN.native                                              *
C 1.5418 0.0 0.0 1.0 0.5 0.0 1.0 0.0                                   *
C 1 600 0.0 0.1666666  0.0 1.0 0.0                                     *
C -120.0 256.5  237.3 -0.996195 0.0 -0.087156 0.0 1.0 0.0   0.001      *
C 19 133.0 56.4 110.0 90.0  90.0  90.0                                 *
C 30 1  0.45   0.45  60                                                *
C......................................................................*
C  The direct beam direction has coordinates: 0.0 0.0 1.0              *
C  The rotation axis has coordinates: 0.0 , 1.0 , 0.0                  *
C  The swing axis coincides with the rotation axis and a positive      *
C  swing angle CHI corresponds to a clockwise rotation when looking    *
C  in the direction of the swing axis. Be careful with the sign of     *
C  CHI !!!                                                             *
C  Using data frames as produced by the HARVARD software (reference 4) *
C  we have  for a detector swing angle CHI                             *
C     ED(1,1)=-cos(CHI)   ED(2,1)= 0   ED(3,1)=-sin(CHI)               *
C     ED(1,2)= 0          ED(2,2)= 1   ED(3,2)= 0                      *
C  Since the vector ED(.,3) is pointing from the detector towards the  *
C  crystal we get a negative sign for "F".                             *
C     ------------- End of misleading example ------------------       *
C***********************************************************************
C******************* HOW TO RUN THE XDS-PROGRAM ************************
C***********************************************************************
C                                                                      *
C Very often, failure of the XDS-program to perform its job is caused  *
C by incorrect values of the input parameters in XDS.DATA or a mis-    *
C aligned experimental setup. A simple procedure to obtain sufficiently*
C correct values is described below.                                   *
C                                                                      *
C 1.) CHECK INTERNAL REPRESENTATION OF FRAME DATA                      *
C    This check is carried out as described above under the topic      *
C COORDINATE SYSTEMS AND SAMPLE INPUT DATA. This has to be done        *
C only once for your installation. An incorrect choice of the          *
C detector vectors ED may well lead to incorrect signs of the          *
C anomalous intensity differences.                                     *
C                                                                      *
C 2.) CORRECTION VALUE FOR THE CRYSTAL TO FILM DISTANCE                *
C    Collect a data set of, say 50 frames from a crystal of known cell *
C parameters at swing angle 0 and process using FIXF=0 on the XDS-     *
C input data cards. The correction value is the difference between     *
C the refined value and the scale reading on the instrument. This      *
C will be sufficiently accurate and has to be done only once for       *
C the installation.                                                    *
C                                                                      *
C 3.) CHECK CAMERA ALIGNMENT                                           *
C    Move the detector to swing angle 0 and check that it is o.k. Then *
C attenuate the direct beam and find its pixel positions on the        *
C detector at two different crystal to detector distances, say 10      *
C and 20 cm, by using the 'DIRB' option of XDS. The easiest            *
C procedure is to align the direct beam such that it intersects the    *
C crystal and the rotation axis and gives the same pixel readings at   *
C both 10 and 20 cm to within one pixel. The direct beam direction     *
C is then normal to the detector and the detector origin is the        *
C pixel reading of the direct beam position recorded earlier.          *
C                                                                      *
C 4.) MEASURE SPATIAL CORRECTION (NICOLET/SIEMENS detector)            *
C    After flat field correction mount the brass grid plate on the     *
C detector face and move the detector to the distance you intend to    *
C use for data collection. Put an iron x-ray source exactly (!) at the *
C place later occupied by the crystal (the origin of the laboratory    *
C coordinate system). A misplaced x-ray source will result into        *
C wrong correction values computed by XYCORR which might prevent a     *
C proper indexing of the diffraction spots.                            *
C Collect the detector response for about 60min (depends on the source)*
C and save on a file with a name of your choice. Remove brass plate    *
C and iron source. Don't forget to reset the high voltage of the       *
C detector to CuKa-value.                                              *
C                                                                      *
C 5.) PREPARE INPUT DATA                                               *
C    To avoid confusion with other data create a new subdirectory and  *
C move to it. During the run of the program a number of files will be  *
C created in the current directory with predefined names.              *
C Create a file with name "XDS.DATA" in the current directory.         *
C This file must contain the input data specific for your data         *
C collection run. The format and the values you have to provide are    *
C described in detail in the section about file structures. A sample   *
C XDS.DATA file is listed above.                                       *
C                                                                      *
C 6.) START DATA COLLECTION (NICOLET/SIEMENS detector)                 *
C    Move the detector to the swing angle and the distance you want to *
C to use for data collection and mount the beam stop.                  *
C    Start the HARVARD program to collect a sequence of consecutive    *
C data frames. Start XDS-program. As data collection proceeds a        *
C number of files are created which have the name extension ".LP".     *
C These files report the results (and troubles) from each step.        *
C    If everything went well the main results you want to keep are     *
C on files "XDS.HKL" (corrected intensities of all reflections)        *
C and  "UNIQUE.HKL"  (symmetry averaged reflection intensities and     *
C anomalous intensity differences). However, it is advisible to save   *
C all files on streamer or tape.                                       *
C                                                                      *
C***********************************************************************
C********************** DESCRIPTION OF FILES ***************************
C***********************************************************************
C                                                                      *
C                    DEFINITION OF FILE-TYPES USED                     *
C                                                                      *
C        TEXT = FORMATTED SEQUENTIAL HUMAN READABLE ASCII-TEXT         *
C        BIN  = UNFORMATTED SEQUENTIAL VARIABLE LENGTH RECORD SIZE     *
C        DIR  = UNFORMATTED DIRECT ACCESS FIXED LENGTH RECORD SIZE     *
C                                                                      *
C***********************************************************************
C                                                                      *
C DEVICE    FILE-NAME  TYPE           CONTENTS                         *
C NUMBER                                                               *
C                                                                      *
C BKGPIX  BKGPIX.XDS   DIR   BACKGROUND AT EACH DETECTOR PIXEL         *
C                            CREATED BY: COLSPOT                       *
C                            USED BY   : COLPROF                       *
C  CDR       XDS.DATA  TEXT  USER SUPPLIED INPUT DATA                  *
C                            CREATED BY: CRYSTALLOGRAPHER              *
C                            USED BY   : XDS,XYCORR,COLSPOT,           *
C                                        IDXREF,COLPROF,PROFIT,        *
C                                        CORRECT,GLOREF                *
C  LP                  TEXT  PRINTED OUTPUT FROM EACH PROGRAM STEP     *
C          XYCORR.LP         CREATED BY: XYCORR                        *
C          COLSPOT.LP        CREATED BY: COLSPOT                       *
C          IDXREF.LP         CREATED BY: IDXREF                        *
C          COLPROF.LP        CREATED BY: COLPROF                       *
C          PROFIT.LP         CREATED BY: PROFIT                        *
C          CORRECT.LP        CREATED BY: CORRECT                       *
C          GLOREF.LP         CREATED BY: GLOREF                        *
C MISFIT    MISFITS    TEXT  LISTING OF MISFITS RECOGNIZED BY          *
C                            COMPARISON WITH SYMMETRY EQUIVALENT       *
C                            REFLECTIONS.                              *
C                            CREATED BY: CORRECT                       *
C                            USED BY   : USER FOR INSPECTION           *
C  SPOT     SPOT.XDS   TEXT  LIST OF STRONG DIFFRACTION SPOTS          *
C                            CREATED BY: COLSPOT                       *
C                            USED BY   : IDXREF                        *
C TAPREF    -------    TEXT  OPTIONAL REFERENCE DATA SET (FILE-NAME IS *
C                            SPECIFIED BY USER IN "XDS.DATA")          *
C                            CREATED BY: XDS-FILE OF TYPE UNIQUE.HKL   *
C                                        FROM A PREVIOUS RUN           *
C                            USED BY   : CORRECT                       *
C TAPOTA   UNIQUE.HKL  TEXT  SYMMETRY AVERAGED REFLECTION INTENSITIES  *
C                            AND ANOMALOUS DIFFERENCES AFTER SCALING   *
C                            CREATED BY: CORRECT                       *
C                            USED BY   : CRYSTALLOGRAPHER              *
C TAPOTB     XDS.HKL   DIR   SCALED INTENSITIES OF ALL REFLECTIONS     *
C                            WITHOUT SYMMETRY AVERAGING                *
C                            CREATED BY: CORRECT                       *
C                            USED BY   : CRYSTALLOGRAPHER              *
C  XFRM     -------    ---   CONNECTED WITH EACH DATA FRAME IN         *
C                            SUCCESSION                                *
C                            CREATED BY: HARVARD PROGRAM               *
C                            USED BY   : XYCORR,COLSPOT,COLPROF        *
C XPARM    XPARM.XDS   TEXT  PARAMETERS DESCRIBING DIFFRACTION GEOMETRY*
C                            CREATED BY: IDXREF                        *
C                            USED BY   : COLPROF                       *
C XPROF    PROFIT.HKL  DIR   INTEGRATED INTENSITIES (UNSCALED)         *
C                            CREATED BY: PROFIT                        *
C                            USED BY   : CORRECT,GLOREF                *
C  XREC     XREC.XDS   BIN   INDIVIDUAL REFLECTION PROFILES            *
C                            CREATED BY: COLPROF                       *
C                            USED BY   : PROFIT                        *
C XYCTBL  XYCORR.TABEL DIR   SPATIAL CORRECTION LOOK-UP TABLE          *
C                            CREATED BY: XYCORR                        *
C                            USED BY   : COLSPOT,IDXREF,COLPROF        *
C                                                                      *
C***********************************************************************
C                                                                      *
C                       XDS.DATA    (formatted sequential)             *
C                       ========                                       *
C                                                                      *
C This file contains the input parameters you have to provide to run   *
C the XDS program.(free format)                                        *
C                                                                      *
C line #            DESCRIPTION OF INPUT PARAMETERS                    *
C                                                                      *
C   1      (JOB CARD)List of subroutine calls issued by xds.           *
C          The following routines may be specified in arbitrary order: *
C          DIRB    - XDS will read the JOB- and DEVICE CARD (the first *
C                    two cards in XDS.DATA), enter terminal mode and   *
C                    ask for name, access and type of a data frame. It *
C                    reports the coordinates IX, IY of the pixel with  *
C                    the largest number of counts and stops. All other *
C                    routine calls which may be present on this first  *
C                    line of XDS.DATA will be ignored. If access and/  *
C                    or type of the data frame are omitted, defaults   *
C                    are used according to the value of the parameter  *
C                    "FRMTYP". A compressed data frame is recognized   *
C                    automatically by the suffix .Z attached to the    *
C                    regular file name.                                *
C          XDS     - complete run (normal case), which will call       *
C                    automatically all of the routines listed below.   *
C          XYCORR  - calculate spatial corrections                     *
C          COLSPOT - collects strong diffraction spots from the first  *
C                    few data frames in the range  FFRAME...LFRAME.    *
C          IDXREF  - find crystal orientation from spot locations      *
C                    and refine all parameters.                        *
C          COLPROF - collect 3-dimensional reflection profiles         *
C          PROFIT  - estimate reflection intensities from profiles     *
C          CORRECT - correct intensities for decay, absorption and     *
C                    detector surface sensitivity                      *
C          GLOREF  - refines all diffraction parameters thereby        *
C                    using all observed spots from this data           *
C                    collection run. The unit cell parameters are      *
C                    much more reliably estimated than during the      *
C                    profile collection step. This, however, is only   *
C                    true if the crystal has not slipped and the       *
C                    cell parameters have not changed during data      *
C                    collection.                                       *
C   2      (DEVICE CARD)The first key-word on this card designates the *
C          detector used and must be either SIEMENS or MAR or RAXIS.   *
C             For the SIEMENS detector, the file name of the brass-    *
C          plate image must follow. This name must not be longer than  *
C          50 characters. The name may be followed by the optional     *
C          key-words DIRECT or SEQUENTIAL (at most one of these two)   *
C          and HARVARD or ARGONNE (at most one of these two) to over-  *
C          ride the default setting of the global parameter "FRMTYP".  *
C          The key-words are recognized by their first three characters*
C          The effect of the key-words is restricted to the file       *
C          containing spatial correction data (the brass-plate image). *
C             For the MAR detector, the key-word may optionally be     *
C          followed by NPIX=1200 or 2000 to specify the number of      *
C          pixels along a scan-line for each image, and correction     *
C          values ROFF=radial correction  TOFF=tangential correction   *
C          for the spiral read-out. Default settings are NPIX=1200     *
C          ROFF=0.0 TOFF=0.0.                                          *
C             For the RAXIS detector, the key-word may optionally be   *
C          followed by NPIX=1900 or 950 to specify the number of       *
C          pixels along a scan-line for each image, and                *
C          QX=size of a pixel along a scan line [mm]                   *
C          QY=distance between scan lines [mm].                        *
C          Default settings are NPIX=1900 QX=0.1017 QY=0.105           *
C   3      Name template of data frames. A sequence of 3 (MAR or RAXIS)*
C          or 4 (SIEMENS) question marks within the template indicates *
C          the position for the actual frame number. This number will  *
C          be inserted by xds as required. Intervening blanks within   *
C          the name template are not allowed.                          *
C          The name template may be followed by the optional key-words *
C          DIRECT or SEQUENTIAL (at most one of these two) and HARVARD,*
C          ARGONNE, MAR or RAXIS (at most one of these four) to over   *
C          ride the default setting of the global parameter "FRMTYP".  *
C          The effect of the key-words is restricted to all data       *
C          frames with the given name template.                        *
C   4      File name of a reference data set used for local scaling.   *
C          Each record of this formatted sequential file consists of   *
C          h,k,l,INTENSITY,SIGMA plus optional information.            *
C          Only the first 5 numbers of each record will be read (free  *
C          format). The reflections need not be sorted.                *
C          If no reference data set is available, File name= NONE.     *
C   5      FLAMDA- x-ray wavelength (Angstroem)                        *
C          S0    - x,y,z components of the direct beam wavevector with *
C                  respect to the laboratory coordinate system.        *
C                  The length of S0 will be set to 1/FLAMDA by XDS.    *
C          POL   - Fraction of polarization of direct beam in a plane  *
C                  specified by its normal 'POLPLA'. 0<=POL<=1         *
C          POLPLA- x,y,z components of polarization plane normal       *
C                  For an unpolarized beam hitting the crystal:        *
C                      POL= 0.5                                        *
C                      POLPLA = any vector perpendicular to S0         *
C                  For a monochromator with incident unpolarized beam: *
C                      POL= [cos(2*thetaM)]**2/[1+(cos(2*thetaM))**2]  *
C                      POLPLA = components of the monochromator        *
C                               diffraction plane normal.              *
C   6      FFRAME- The number of the first data frame collected.       *
C          LFRAME- The number of the last  data frame collected.       *
C                  Using the editor, you may change this number during *
C                  the run of subroutines COLPROF or COLSPOT. This may *
C                  be useful if the crystal died earlier ( or lasts    *
C                  longer ) than expected.                             *
C          PHI0  - Spindle position (degrees) at beginning of first    *
C                  data frame (that is frame number 1)                 *
C          DPHI  - Oscillation range (degrees)covered by each data     *
C                  frame. DPHI must be positive.                       *
C          ACHSE - x,y,z components of the rotation axis with respect  *
C                  to the laboratory system. The length of this vector *
C                  will be normalized by the program.                  *
C   7      F     - Signed distance between crystal and detector (mm).  *
C                  Note that "F" may be negative !!!                   *
C          ORGX  - Detector X-coordinate (pixels) of origin,           *
C          ORGY  - Detector Y-coordinate (pixels) of origin.           *
C                  The coordinates of the origin are not corrected     *
C                  for spatial distortion !!!                          *
C                  The corrected origin is defined as that point on    *
C                  the detector which is closest to the crystal.       *
C          ED    - Orientation matrix of the detector with respect to  *
C                  the laboratory system. The lab coordinates of       *
C                  a point  IX,IY (pixels) on the detector are,        *
C                  assuming that IX,IY are already corrected for       *
C                  spatial distortion and XORG=corrected(ORGX),        *
C                                         YORG=corrected(ORGY)  :      *
C                x=QX*(IX-XORG)*ED(1,1)+QY*(IY-YORG)*ED(1,2)+F*ED(1,3) *
C                y=QX*(IX-XORG)*ED(2,1)+QY*(IY-YORG)*ED(2,2)+F*ED(2,3) *
C                z=QX*(IX-XORG)*ED(3,1)+QY*(IY-YORG)*ED(3,2)+F*ED(3,3) *
C                  Here, QX, QY are the lengths of a pixel (mm) along  *
C                  IX and IY, respectively.                            *
C                  Only two orthogonal unit vectors must be given:     *
C                  ED(1,1),ED(2,1),ED(3,1),ED(1,2),ED(2,2),ED(3,2)     *
C                  The third unit vector is then calculated by the     *
C                  program as  ED(.,3)=ED(.,1) X ED(.,2)               *
C                  It may well be that a negative F has to be chosen   *
C                  since the sign of F is effected by the direction of *
C                  the detector normal !!! Figure 1 in reference 2) may*
C                  be misleading.                                      *
C          AIR   - Fraction of intensity loss per mm due to air        *
C                  absorption. Usually AIR=0.001 . Each reflection     *
C                  intensity is multiplied by                          *
C                  EXP(ABS(AIR*F*((1.0/COS(oblique angle))-1.0))),     *
C                  the oblique angle is between diffracted beam and    *
C                  detector normal and assumes values 0...<90 degrees. *
C   8      IGROUP- Space-group number of crystal. The numbers          *
C                  corresponding to each possible space-group          *
C                  are defined in the "INTERNATIONAL TABLES I".        *
C                  At present, only the 65 enantiomorphic space groups *
C                  are implemented. A value of zero for IGROUP         *
C                  indicates that space group and cell parameters      *
C                  are unknown.                                        *
C          CELL  - Unit cell parameters a,b,c (Angstroem) and          *
C                  alpha,beta,gamma (degrees).                         *
C   9      MINUTE- Number of minutes the program should wait that an   *
C                  expected data frame-file will be available.         *
C          FIXF  - Refinement control variable                         *
C                  0: refine detector to crystal distance, direct      *
C                     beam direction and unit cell orientation.        *
C                     The cell parameters are fixed.                   *
C                  1: fix detector to crystal distance and refine      *
C                     direct beam direction, unit cell orientation     *
C                     and independent cell parameters.                 *
C          DIVRAD- Half-angular size (degrees) of x-ray source         *
C                  as seen from origin of coordinate system.           *
C                  Approximately, DIVRAD=arctan(diameter of spot/2F)   *
C          DIVBET- Half-angular size (degrees) of mosaic spread        *
C                  of crystal. Approximately,                          *
C                  DIVBET=0.5*(angular life-time of a spot passing     *
C                         perpendicular through the Ewald sphere)      *
C          DELFRM- Maximum number of frames between Friedel-pairs      *
C                  to be included to estimate anomalous dispersion     *
C  10      REIDX - Integer array of 12 numbers providing a possibility *
C                  of reindexing the reflections in the final CORRECT  *
C                  step. The meaning of the 12 numbers is defined as:  *
C                  H' =REIDX(1)*H+REIDX( 2)*K+REIDX( 3)*L+REIDX( 4)    *
C                  K' =REIDX(5)*H+REIDX( 6)*K+REIDX( 7)*L+REIDX( 8)    *
C                  L' =REIDX(9)*H+REIDX(10)*K+REIDX(11)*L+REIDX(12)    *
C                  where H',K',L' are the new indices. In case this    *
C                  data card is omitted it is assumed that reindexing  *
C                  is not required, that is H'=H, K'=K, L'=L .         *
C                                                                      *
C***********************************************************************
C                                                                      *
C                       XDS.HKL  (unformatted direct access)           *
C                       =======                                        *
C                                                                      *
C              DESCRIPTION OF MAIN OUTPUT FILE                         *
C                                                                      *
C The corrected reflection intensities are saved on this file in the   *
C current directory. This file is an unformatted direct access file    *
C of record length 68 bytes for each reflection. The file is sorted    *
C with respect to the unique reflection indices. 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                       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                                                                      *
C***********************************************************************
C                                                                      *
C                       MISFITS (formatted sequential)                 *
C                       =======                                        *
C                                                                      *
C Each line contains information about a rejected reflection which     *
C has been recognized only by a comparison with symmetry equivalent    *
C reflections. Format is:      FORMAT(6I5,3E12.4,2I4,3I8)              *
C                                                                      *
C  HA,KA,LA,H,K,L,FFADD,SDADD,RLP,FFRM,LFRM,XCAL,YCAL,PHICAL           *
C                                                                      *
C The definition of symbols is as described for file XDS.HKL           *
C                                                                      *
C***********************************************************************
C                                                                      *
C                       SPOT.XDS   (formatted sequential)              *
C                       ========                                       *
C                                                                      *
C  The file contains a list of strong observed diffraction spots.      *
C  The spots are located by "COLSPOT" and written to file as           *
C     IX*10,IY*10,PHI*100,INTENSITY      using  FORMAT(4I7)            *
C  The spot positions IX,IY (pixels) are already corrected for         *
C  spatial distortion, PHI (degrees) is observed spindle position.     *
C  The file is sorted in decreasing spot intensities.                  *
C   This file is read subsequently by "IDXREF" and indices are         *
C  attached to each spot. Indices 0 0 0 are used to indicate a spot    *
C  that could not be indexed. On return, the original file contents    *
C  is replaced by                                                      *
C     IX*10,IY*10,PHI*100,INTENSITY,H,K,L      using  FORMAT(4I7,3I5)  *
C  for each spot, and H,K,L are the reflection indices.                *
C  In case of problems with the autoindexing routine it may be         *
C  useful to inspect this file and remove weak spots near the end.     *
C                                                                      *
C***********************************************************************
C                                                                      *
C                       BKGPIX.XDS (unformatted direct access)         *
C                       ==========                                     *
C                                                                      *
C                   Record structure                                   *
C   The file contains NY records each of length 2*NX bytes, where      *
C  NX,NY are the number of pixels along the detector X- and Y-axis.    *
C                                                                      *
C                     Contents                                         *
C   The file contains an image of the array : INTEGER*2 IBKG(NX*NY)    *
C  such that IBKG(IX+NX*(IY-1)) is the sum of background values at     *
C  pixel position  IX,IY (0