C
C     T R E O R     T R E O R     T R E O R     T R E O R
C
C
C        TTTTTTT  RRRR     EEEEEE     OOOOO    RRRR     99999    000000
C           T     R   R    E         O     O   R   R   9     9  0    00  
C           T     R   R    E         O     O   R   R   9     9  0   0 0   
C           T     RRRR     EEEEEE    O     O   RRRR     999999  0  0  0
C           T     R   R    E         O     O   R   R         9  0 0   0
C           T     R    R   E         O     O   R    R        9  00    0
C           T     R     R  EEEEEE     OOOOO    R     R       9  000000
C
C     JUNE 1995
C          Within this section JUNE 1995 to JUNE 1992 a very short
C          description for the lazy user (who does not want to read
C          the complete documentation file) is given.
C
C          The normal treor run is:
C
C          Title line
C          Data lines (20-25 lines, only one d-value, col.1-16, on each line)
C          A blank line 
C          CHOICE=4,  (if D-values were used on the data lines)
C          VOL=-2000, (note the minus sign. --- a treor90 run)
C          END* (stop card)
C    
C          It is now possible to interrupt the calculations. This can 
C          be done by the letter i on the keyboard. Then the  program
C          will stop soon. The reason for this  option  is  that  one 
C          should never hesitate to give VOL eq. a negative value i.e.
C          the most efficient test of all symmetries. One can  always
C          stop for example time consuming triclinic tests  from  the
C          keyboard. (This option is only available on the PC version
C          of the program)
C
C          If no solution is found rerun the problem, but include the
C          following keyword line:
C          D1=0.0003, D2=0.0005,
C          (note the , after each keyword value)
C          Another test is to set
C          IDIV=0,
C          which means that the first seven lines will not be  changed
C          by (what treor may erronously judge as) higher order lines. 
C          The parameters MERIT and NIX may also be changed. See below
C          The first accepted solution may not be the best one. 
C          Therefore, follow the instructions on the  condensed output
C          file.
C          Note the keywords must be given by upper case characters.
C          Do not print the long output file. Use your editor and look
C          for the most promising M-TEST lines. 
C     
C          This program should be used to find a physical plausible
C          solution of the indexing problem. The refinement is only
C          preliminar (not Hess weighted). Especially lines at high
C          diffraction angles may be unindexed by treor. 
C          In final refinements all lines, all extinction conditions,
C          Hess weights (i.e. all diffraction angles should be given
C          equal weights) and all knowledge about intensity distribution
C          between overlaps (if available) should be used.
C          From this department a flexible dialouge program, (version
C          930101 of PIRUM) may be distributed.  
C          Program NBS*AIDS83 is (probably ?) recommended by ICDD.
C
C     JUNE 1992
..
..
C
C     R E F E R E N C E S
C
C
C     Basic principles. Werner,P.-E., Z.Kristallogr. 120 (1964) 375-387
C
C     TREOR, a semi-exhaustive trial-and-error powder indexing  program
C     for all symmetries. Werner,P.-E.,  Eriksson,L.  and  Westdahl,M.,
C     J. Appl. Crystallogr. 18 (1985) 367-370
C
C     Refinement of unit cell. Werner,P.-E.,Arkiv Kemi 31(1969) 513-516
C
C     Figure of merit. De Wolff,P.M.,J.Appl.Crystallogr. 1(1968)108-113
C
C     Geometrical ambiguities. Mighell, A.D. and  Santoro, A., J. Appl.
C     Crystallogr. 8 (1975) 372
C
C
C     WARNING!
C     A zero point error is much more serious than statistical  errors
C     of the same magnitude.
C
C     Sigma(Two theta) should be less than 0.02 deg.
C
C
C
C                *******************************************
C                * DO NOT WASTE COMPUTER TIME ON BAD DATA. *
C                *******************************************
C
C
C     The least-squares refinement of the unit cell dimensions  should
C     normally not be considered as the ultimate refinement. The  main
C     purpose of this program is to FIND the unit  cell.  The  program
C     PIRUM (version 930101) may be  used  for  ultimate  refinements. 
C     PIRUM (version 930101) is a dialouge version of  the  old  PIRUM
C     ( cf. ref. /Refinement of unit cell/ given  above. )  Extinction
C     conditions, Hess weights and max.  accepted  deviations  between
C     observed and calculated 2theta in degrees are normally  used  in
C     version 930101 of PIRUM. In old PIRUM versions, parameters  like
C     D1, D2, and SSQTL (See keyword list below) were used.
C     (cf. also the NBS*AIDS83 program. PIRUM is designed to  be  more
C     user-friendly, however.)
C     
C     WARNING. You should not accept unindexed lines  unless  you  are 
C     able to explain them. On the other hand, you should not  put  in
C     uncertain (doubtful) lines in this program. They may  be  tested
C     later by a refinement program (ex. PIRUM).    
C
C
C
C
C     I N P U T   D A T A
C
C
C     LINE ONE.          TITLE  Any text in col.2-80
C
C
C     LINE SET TWO.      Format(F16.6,3X,A4)
C                        SQ (=Sine square theta) in  the  field  F16.6 
C                        and intensity information in  the  A4  field.
C                        The intensity in the A4  field  is  optional.
C                        It is never used by the program. It  is  also
C                        possible to use other types of input data  in
C                        the F16.6 field. (Avoid col.1).  See  keyword
C                        CHOICE below.
C                        The SQ data must be given in order,  starting
C                        with the low order lines.Generally the  first
C                        20-30 lines should be used. Remainging  lines
C                        (if any) may be used in later  final  refine-
C                        ments. (Program PIRUM).
C
C
C     STOP LINE FOR LINE SET TWO IS A BLANK LINE (OR A NEGATIVE SQ)
C
C
C     LINE SET THREE.    GENERAL INSTRUCTIONS.
C
C     All parameters in line set three have preset values.
C     A preset value is denoted 'NORMAL VALUE 'below.
C     Any 'NORMAL VALUE' may be changed in the following way:
C
C        KEYWORD1=VALUE1, KEYWORD2 = VALUE2,
C        KEYWORD3=VALUE3,   .......,    END* 
C
C     1. The keywords are listed below
C     2. You must not forget =
C     3. The value may be given in  free  format ( integer or real ).
C     4. You must not forget ,
C
C     You may use arbitrary positions on the lines.
C     All blanks are irrelevant.
C     The number of lines is arbitrary. You may give one or more
C     parameters on each line.
C    
C     Line set three must end with the keyword  END*  (OBS. asterisk)
C
C
C
C
C     LINE SET THREE EXAMPLES:   (TREOR, not normal TREOR90 examples)
C
C     EXAMPLE 1.Next line (except C in col.1) represents a line set 3
C     END*
C
C     UNIT CELLS OBTAINED BY THE PROGRAM SHOULD BE CAREFULLY CHECKED
C
C     A. If M(20) is less than 10 or more than one line is  unindexed
C        within the 20 first observed lines the solution is  probably
C        meaningless. Is any low-order line wrong ?
C     B. Check for common factors in the quadratic forms.
C        Example: A teragonal pattern may have H*H + K*K = 5*N
C        i.e. the A-axis is 2.3607 ( square root of 5) times  shorter
C        than given on the output list.
C        Example: If all H, K or L are even, the  corresponding  cell
C        axis should be divided by 2.
C     C. If the unit cell obtained is centered,  derive  a  primitive
C        cell. ( Run program MODCELL or a corresponding NBS  program)
C     D. Reduce the primitive cell and derive the conventional  cell.
C        (Run program REDUCT or a corresponding NBS program)
C     E. Hexagonal and tetragonal  cells  are  sometimes  indexed  as 
C        orthorhombic. Example: A=B*1.7321 i.e. a possible  hexagonal
C        cell.
C     F. Check for geometrical ambiguities. See reference  above.  It
C        is also strongly recommended to chech cubic, tetragonal  and
C        hexagonal solutions by an orthorhombic test.  Put  KS=0  and
C        THS=0 and re-run the problem.
C        There are two reasons for this procedure....
C        1. It may help you to identify geometrical ambiguities.
C        2. It has been found that sometimes very small  orthorhombic
C           unit cells can be indexed  in  an  acceptable  way ( i.e.
C           fullfill the De Wolff criteria) by a larger unit cell  of
C           higher symmetry. Although the unit  cells  are  sometimes
C           related to each other, the relations are often  difficult
C           to detect, and therefore it is often  convenient  to  let
C           the program derive both solutions.
C     G. The De Wolff figure of merits are derived from  the  assump-
C        tion that no systematic extinctions  are  present  and  that
C        all lines are indexed. A high figure of merit has no meaning
C        unless all lines are indexed.  The De Wolff figure of  merit
C        will increase in the  final  refinement  made  with  program
C        PIRUM, where the systematic extinctions can  be  taken  into
C        account.
C     H. If possible, use the density and  formula  weight  to  check 
C        that the unit cell contains an integral  number  of  formula
C        units.
C     I. If a cell axis is more than 20 A....be suspicious!
C        It has been found that the De  Wolff  figure  of  merit  may
C        fail in such cases. (Require M(20) > 20)
C     J. If one cell edge is much shorter than the others..........be
C        suspicious! It may be a dominant zone  problem  and  the  De
C        Wolff test may fail. (This problem is usually not severe  in 
C        TREOR90, where short  axis  tests  are  made  prior  to  the
C        general tests.)
C     K. If a table starts with...NOT REFINED UNIT CELL...
C        two parameters are probably  almost identical ( the symmetry
C        may be higher) and the trial cell  parameters  are  used  to 
C        print the list.
C     L. If no satisfactory solution is found ( See the keywords  NIX
C        and MERIT), the program may end  with  a  small  table  con-
C        taining a difference analysis. The program is  described  in
C        Z. Kristallogr.120 (1964) p.381-382 (Werner,P.-E.)  where it
C        is named I1. The  most  interesting  differences  are  those 
C        that have high multiplicities  (on the top of the list)  and 
C        are not too small (to the right of the list). In the present
C        state of the program, the difference table  is  usually  not
C        needed. 
C     M. Why not solve the crystal structure from your powder  data ?
C        This is the ultimate way to prove the unit cell!
C
C
C
C
C
C
C
C     K E Y W O R D    L I S T
C
C     KEYWORD. NORMAL    COMMENT.
C              VALUE.
C
C
C     KS      =6         Max H+K+L for this line.
C
C                        OBS. If KS=0 cubic test omitted.
C
C     THS     =4         Max H+K+L for these lines.
C
C                        OBS. If THS=0 tetragonal and hexagonal tests
C                             omitted.
C
C     OS1     =3         Max H+K+L for this line.
C
C                        OBS. If OS1=0 orthorhombic test omitted.
C
C
C     SELECT  =0         If SELECT is non zero the orthorhombic base lines
C                        are (SELECT,1,2) (SELECT,1,3) and (SELECT,2,3)
C
C                        If SELECT is greater than 5 the monoclinic base lines
C                        are (SELECT,1,2,3) (SELECT,1,2,4) and (SELECT,1,3,4)
C
C     MERIT   =10        The De Wolff figure of merit required as stop limit.
C                        Ref:   De Wolff,P.M.   J. Appl. Crystallogr.
C                        1 (1968) 108-113
C                        ( For cubic, tetragonal and hexagonal symmetries
C                        are the different quadratic forms as given in
C                        Int. Tabl. of X-Ray Crystallogr. (1968) Vol.2
C                        p.109-145 used in the calculation of the number of
C                        theoretical lines.)
C        
C                        OBS. The figure of merit calculations are not
C                        strictly valid unless all 20 first lines are indexed.
C
C     NIX     =1         If a cell after least squares refinemnet has a figure
C                        of merit equal to or greater than MERIT and the
C                        number of not indexable lines among the USE first
C                        lines is less than or equal to NIX, the calculations
C                        are stopped.
C
C     IDIV    =1         The 7 first lines are adjusted by (eventually
C                        occurring) higher order lines.
C                        If IDIV=0 no corrections.
C                        Usually the default value 1 is o.k. There are
C                        exeptions, however.   If indexing is not
C                        successful, you may try IDIV=0
C
C     WAVE    =1.5405981 Wave length. (in Angstroem)
C                        As a rule one should not change WAVE
C                        If D-values are used in the input data file (See
C                        CHOICE=4) one can always pretend that WAVE was
C                        1.5405981 A. WAVE is then a formal parameter only
C                        related to D1, SSQTL and D2 (See below).
C
C     VOL     =2000      Max cell volume (in Angstroem**3)
C                        A new option available in TREOR90 is to give a
C                        negative value of VOL, ex. VOL=-2000. 
C                        See comments number 16 on the top of this list.
C                     
C     CEM     =25        Max cell edge (in Angstroem)
C                        The CPU-time is strongly dependent on VOL and CEM
C
C     D1      =0.0002    See D2 below.
C
C     SSQTL   =0.05      See D2 below.
C
C     D2      =0.0004    A line is regarded as indexed if..
C                        sine square theta is less than SSQTL and
C                        Abs(sine square theta observed minus sine square
C                        theta calculated) is less than D1 or...
C                        if sine square theta is greater than SSQTL and
C                        the corresponding difference is less than D2.
C
C                        OBS. D1, SSQTL and D2 are used in the trial indexing
C                             part as well as in the least squares refinements
C                        OBS. D1, SSQTL and D2 are dependent on WAVE
C                        OBS. D2 is also used in the difference analysis.
C
C
C     CHOICE  =0         Indicator defining SQ on card set two..
C                        CHOICE=0   SQ=Sine square theta
C                              =1   SQ=1/(D*D)    (D-spaceing in Angstroem)
C                              =2   SQ=Theta      (Theta=Bragg angle in deg.)
C                              =3   SQ=2*Theta
C                              =4   SQ=D
C
C     END*               This keyword denotes the end of the parameter list.
C                        (i.e. end of card set three)
C
