AMORE  Write-up



      * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
      * * * * * * * * * * * * * * AMoRe * * * * * * * * * * * * * * * * * * *
      * * * * a package for A-utomatic Mo-lecular Re-placement  * * * * * * *
      * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

                                         Multi sunt vocati, pauci vero electi

          AMoRe is a suite of programs aimed at locating model electron
      densities within the asymmetric unit of a crystal cell.
      Jorge Navaza (1994), Acta Crystallographica A50, 157-163. "AMoRe: an
      Automated Package for Molecular Replacement".


      PROGRAMS:

          Preliminary programs to cast input data into a suitable
      representation:

      sorting         packs and sorts H,K,L,Fob. The packing is cell and
                      space-group dependent.

      patting         calculates the Patterson function.

      tabling         calculates array of "continuous" Fourier coefficients
                      from model coordinates. Puts the input model in a small
                      box. First translates the coordinates so that the
                      centre of mass - CoM - is at the origin, and rotates
                      the coordinates so that the principal axes of inertia
                      of the model are parallel to the box axes. The search
                      model may also be an electron density. The model
                      transform is finely sampled to allow structure factors
                      and gradients of the rotating model to be accurately
                      interpolated from this array.

          Main molecular replacement programs:

      roting          calculates spherical-harmonics expansions of crystal
                      and model Patterson functions and computes rotation
                      functions.

      traing          computes n-body fast translation functions. The output
                      is, for each orientation, the correlation coefficients
                      and R-factors of the top peaks of fast translation
                      functions.

      fiting          performs least-squares fast rigid-body refinement.

          Auxiliary programs:

      oic             prepares inputs to main molecular replacement programs
                      by selecting and combining intermediate results.

      mr2ic           works out the final rotations and translations to
                      apply to the initial models.

      job             creates a starting set of inputs and a script with a
                      tentative protocol to solve the molecular replacement
                      problem.

      entorno         sets the environment variables AMOREX, AMOREF and NTYP.


          The package may be used at three different levels of automation:

      LEVEL-1: inputs to the main programs are prepared by the user. In
      general, they need information produced in previous steps (e.g.
      positions to be refined).

      LEVEL-2: inputs to the main molecular replacement programs are created
      by program oic, which selects and combines available potential
      solutions. Information produced in previous steps may be used in order
      to create efficient inputs for oic (e.g. cutoff values to skip
      potential solutions). The procedures oic_roting, oic_traing and
      oic_fiting are the concatenations of oic with the main molecular
      replacement programs.

      LEVEL-3: a starting set of inputs and a script with a tentative
      protocol to solve the molecular replacement problem, are created by
      program job. The input is general purpose control parameters (e.g.
      translation function options, number of peaks to select).


          The package is structured in directories, which are created by
      executing a setup command. Their content is:

      ./      aide-memoire and scripts.

      ./d/    factor.d = ascii file of atomic form-factors.
              hkl.d = ascii file of H,K,L,Fob.
              xyz{#}.d = ascii file of coordinates of model number {#} ;
                         {#} = 1,NTYP.
              map{#}.d = binary file of electron density of model number {#}.
              data.d = ascii file of main AMoRe input.

      ./e/    program command-files.

      ./f/    binary files created by the main programs.

      ./i/    inputs to all programs; names with prescribed syntax (e.g.
              dato.i3 , sort.i1 , oic{NOM}.i2 ).

      ./o/    outputs of main programs, named {$}.s .
"ENDOF introduction"
#=======================================================================
echo job
cat >job <<"ENDOF job"

      --------------------------JOB------------------------------------------

          job creates default inputs and a script with a tentative protocol
      to solve the molecular replacement problem. It makes default
      assignments of logical units,

      Calling command: csh ./e/job

      Input:           ./d/data.d = main AMoRe input described below.
                       ./i/dato.i3 = input described below.

      Output:          ./amore = script with protocol for the actual
                                 molecular replacement problem.
                       ./d/data.d = original input plus an addendum with
                                    logical-units assignments.
                       ./i/sort.i1 = input for sorting.
                       ./i/patt.i1 = input for patting.
                       ./i/tabl.i1 = input for tabling.
                       ./i/oicrd.i2 = input for "oic roting" (cross-rotation
                                      function calculation).
                       ./i/oicto.i2 = input for "oic traing", one-body mode.
                       ./i/oictn.i2 = input for "oic traing", n-body mode.
                       ./i/oicfd.i2 = input for "oic fiting".


      -----------------------------------------------------------------------
      ./d/data.d
      --------------------------INPUT----------------------------------------
       ** D44HEL **
      99.7 167.3 84.7 90. 90. 90.
      x,y,z * 1/2+x,1/2-y,-z * 1/2-x,-y,1/2+z * -x,1/2+y,1/2-z * end
      0
      95.    0.
      15.    3.5
      2   2  2
      --------------------------DESCRIPTION----------------------------------

              1) Title (format A80).

              2) Cell.

              3) Symmetry operations (lower case), finishing '* end'.

              4) NORT
                      Code to define an orthogonal reference frame.

              5) PERC BADD
                      PERC = uses only the PERC % highest Fob.
                      BADD = B-factor added to Fob (e.g. -5 to sharpen data).

              6) DMAX DMIN
                      Resolution limits used for the molecular replacement
                      problem (in angstroms).

              7) NTYP MOL1 ... MOLn
                      NTYP = number of different models.
                      MOL{#} = number of molecules of type {#} in the a.u.
      -----------------------------------------------------------------------


      -----------------------------------------------------------------------
      ./i/dato.i3
      --------------------------INPUT----------------------------------------
      job  +*+*+*+*+*+*+*+*+*
      xyz
      1.   6     0.5  2.5
      c-o  50    0.3  30
      p-t  10    0.5  30
      10
      20.
      --------------------------DESCRIPTION----------------------------------

              1) Keyword (format A4) = 'job '.

              2) AKEY (format A5)
                      Keyword defining mode: if 'xyz  ' reads coordinates; if
                      'map  ' reads electron density map.

              3) RATE LMIN CUTR STEP
                      RATE = defines the integration radius as RATE * Molrad,
                             where Molrad = radius of the smallest sphere,
                             with origin at CoM, containing the whole
                             molecule.
                      LMIN = spherical-harmonics expansions begin with
                             l = LMIN; the l-expansion controls the angular
                             resolution.
                      CUTR = cutoff in rotation function output; first
                             selects all peaks above
                             CUTR * maximum-peak-height.
                      STEP = step size for Alpha, Beta and Gamma (in
                             degrees).

              4) TKEY NUMR CUTT NPIC (format A5,*)
                      TKEY = if 'c-o' compute centred-overlap; if 'p-t'
                             compute phased-translation ('p-t-f' when phases
                             are available); if 'h-l' compute harada-lifchitz
                             translation function; if 'c-c' compute
                             correlation-coefficient.
                      NUMR = selects up to a maximum of NUMR orientations for
                             input to one-body translations.
                      CUTT = cutoff in fast translation function output;
                             first selects all peaks above
                             CUTT * maximum-peak-height of c-o, p-t, h-l or
                             c-c fast translation function.
                      NPIC = number of peaks to output of translation
                             function. The program computes correlations and
                             R-factors.

              5) Same as previous card, but for n-body translations (it must
                 be present, even if not used).

              6) NUMT
                      Selects up to a maximum of NUMT positions to refine.

              7) CUTD
                      Cutoff to eliminate positions with CoM-to-CoM distance
                      less than CUTD angstroms.
      -----------------------------------------------------------------------





      **************************EXAMPLE**************************************

          The data.d file corresponds to a crystal with two molecules of the
      complex Fab-Lysozyme in the asymmetric unit, and two search models
      (Fab = 1 , Lysozyme = 2). job proposes the following protocol:

      -----------------------------------------------------------------------
      # amore
       ./e/sorting
      set k="1"
      while ($k <=  2)
       ./e/tabling $k
       ./e/oic_roting rd $k or$k
       ./e/oic_traing to or$k o${k}t
       set k=`expr $k + 1`
      end
      cat ./o/o*t.s > ./o/ot1.s
      set k="1"
      while ($k <  4)
       set m=`expr $k + 1`
       ./e/oic_traing tn ot$k ot$m
       set k=`expr $k + 1`
      end
       ./e/oic_fiting fd ot4 of4
       ./e/mr2ic of4 mr2ic
      -----------------------------------------------------------------------

      Note that all the one-body translation outputs (./o/o{#}t.s) have been
      concatenated into the single file ./o/ot1.s .

          However, since we may expect the Fab positions to be determined
      more easily than the Lysozymes, it is worth executing the programs in a
      different order:

      -----------------------------------------------------------------------
      # amore
       ./e/sorting
      set k="1"
      while ($k <=  2)
       ./e/tabling $k
       ./e/oic_roting rd $k or$k
       set k=`expr $k + 1`
      end
       ./e/oic_traing to or1 ot1
       ./e/oic_traing tn ot1 ot2
       ./e/oic_fiting fd ot2 of2
       ./e/oic_traing tn or2 of2 ot3
       ./e/oic_traing tn ot3 ot4
       ./e/oic_fiting fd ot4 of4
       ./e/mr2ic of4 mr2ic
      -----------------------------------------------------------------------

      Note that fast rigid-body refinement is performed on the 2-body
      translation output.
"ENDOF job"
#=======================================================================
echo sorting
cat >sorting <<"ENDOF sorting"

      --------------------------SORTING--------------------------------------

          sorting packs and sorts H,K,L,Fob for use in later programs. The
      packing is cell and space-group dependent.

      Calling command: ./e/sorting

      Input:           ./d/hkl.d = ascii file of H,K,L,Fob.
                       ./i/sort.i1 = input described below.

      Output:          ./f/xudi = binary file of packed and sorted H,K,L,Fob.
                       ./o/sort.s = sorting output.


      -----------------------------------------------------------------------
      ./i/sort.i1
      --------------------------INPUT----------------------------------------
      sorting +*+*+*+*+*+*+*+*+*+*+*
          1   10    9
       ** D44HEL **
      99.7 167.3 84.7 90. 90. 90.
      x,y,z * 1/2+x,1/2-y,-z * 1/2-x,-y,1/2+z * -x,1/2+y,1/2-z * end
           15.00      3.50
      --------------------------DESCRIPTION----------------------------------

              1) Keyword (format A7) = 'sorting'.

              2) LUN1 LUN2 LUN3
                      Logical units:
                      LUN1 = input ascii file of H,K,L,Fob (./d/hkl.d).
                      LUN2 = output binary file of packed and sorted
                             H,K,L,Fob (./f/xudi).
                      LUN3 = sorting output (./o/sort.s).

              3) Title (format A80).

              4) Cell.

              5) Symmetry operations (lower case), finishing '* end'.

              6) DMAX DMIN
                      Resolution limits. Performs statistics for data within
                      this resolution range.
      -----------------------------------------------------------------------
"ENDOF sorting"
#=======================================================================
echo patting
cat >patting <<"ENDOF patting"

      --------------------------PATTING--------------------------------------

          patting calculates the Patterson function.

      Calling command: ./e/patting

      Input:           ./f/xudi = binary file of packed and sorted H,K,L,Fob.
                       ./i/patt.i1 = input described below.

      Output:          ./o/patt.s = patting output.

      =======================================================================
          To recover the Patterson function map, erase in script ./e/patting
      the symbol # in line "#/bin/mv $AMOREF/fort.101 patmap". patmap is a
      binary file with several registers:

              real patmap(nx,ny,nz)
              write(file) nx,ny,nz,a,b,c,alpha,beta,gamma
               do iz=1,nz
              write(file) ((patmap(ix,iy,iz),ix=1,nx),iy=1,ny)
               enddo
      where:
              nx,ny,nz = number of sampling points in each direction.
              a,b,c,alpha,beta,gamma = cell parameters (in Angstroms and
                                       degrees).
      =======================================================================


      -----------------------------------------------------------------------
      ./i/patt.i1
      --------------------------INPUT----------------------------------------
      patting +*+*+*+*+*+*+*+*+*+*+*
      2    1  1            :log
         10    9
       ** D44HEL **
      99.7 167.3 84.7 90. 90. 90.
      x,y,z * 1/2+x,1/2-y,-z * 1/2-x,-y,1/2+z * -x,1/2+y,1/2-z * end
           90.      0.
           15.00      3.50      1.00
       0.10  100     1.e-4
      --------------------------DESCRIPTION----------------------------------

              1) Keyword (format A7) = 'patting'.

              2) Printing options.

              3) LUN1 LUN2
                      Logical units:
                      LUN1 = input binary file of packed and sorted H,K,L,Fob
                             (./f/xudi).
                      LUN2 = patting output (./o/patt.s).

              4) Title (format A80).

              5) Cell.

              6) Symmetry operations (lower case), finishing '* end'.

              7) PERC BADD
                      PERC = uses only the PERC % highest Fob.
                      BADD = B-factor added to Fob (e.g. -5 to sharpen data).

              8) DMAX DMIN SHAR
                      DMAX,DMIN = data resolution limits.
                      SHAR = Shannon rate (the greater SHAR, the finer the
                             mesh). Defines the crystal cell sampling as
                             NX ~ 2 * (a/DMIN) * SHAR,
                             NY ~ 2 * (b/DMIN) * SHAR,
                             NZ ~ 2 * (c/DMIN) * SHAR.

              9) CUTP NPIC DELT
                      CUTP = cutoff in Patterson function; selects all peaks
                             above CUTP * maximum-peak-height.
                      NPIC = maximum number of peaks to output of Patterson
                             function.
                      DELT = used in peak-search to avoid spurious peaks.
      -----------------------------------------------------------------------
"ENDOF patting"
#=======================================================================
echo tabling
cat >tabling <<"ENDOF tabling"

      --------------------------TABLING--------------------------------------

          tabling calculates array of "continuous" Fourier coefficients from
      model coordinates. Puts the model in a small box. First translates the
      coordinates so that the centre of mass - CoM - is at the origin, and
      rotates the coordinates so that the principal axes of inertia of the
      model are parallel to the box axes. The box is put in a big cell in
      order to sample the model transform finely, to allow structure factors
      and gradients of the rotating model to be accurately interpolated from
      this array.

      Calling command: ./e/tabling {#}

      Input:           ./d/factor.d = ascii file of atomic form-factors.
                       ./d/xyz{#}.d = ascii file of coordinates.
                       ./d/map{#}.d = binary file of electron density.
                       ./i/tabl.i1 = input described below.

      Output:          ./f/tabl{#} = binary file of tabulated "continuous"
                                     Fourier coefficients.
                       ./o/tabl{#}.s = tabling output.

      =======================================================================
          If the search model is an electron density (e.g. a low resolution
      envelop), tabling translates it as previously described. The input must
      be a binary file - ./d/map1{#}.d - with several registers:

              real rho(mx,my,mz)
              write(file) mx,my,mz,xlw,ylw,zlw,xup,yup,zup,alpha,beta,gamma
               do iz=1,mz
              write(file) ((rho(ix,iy,iz),ix=1,mx),iy=1,my)
               enddo
      where:
              mx,my,mz = number of sampling points in each direction.
              xlw,ylw,zlw,xup,yup,zup = lower and upper limits (in Angstroms)
                                        of the model box.
              alpha,beta,gamma = model box angles.

      The model box edges are thus a=xup-xlw, b=yup-ylw, c=zup-zlw. This
      should be, as far as possible, the smallest box containing the model
      density. The sampling must be sensibly equal to
              mx ~ 2 * (a/DMIN) * SHAR,
              my ~ 2 * (b/DMIN) * SHAR,
              mz ~ 2 * (c/DMIN) * SHAR,
      where DMIN -the resolution limit of the generated Fourier coefficients-
      and SHAR -the Shannon rate- are given in the input below.
      =======================================================================
          It is also possible to provide the output of tabling without
      executing the program. It must be a binary file - ./f/tabl{#} - with
      two registers:

              complex fto(-1:hsup,-ksup:ksup,-lsup:lsup)
              write(file) a,b,c,alpha,beta,gamma,nort,hsup,ksup,lsup,sqhsup
              write(file) fto
      where:
              a,b,c,alpha,beta,gamma = model cell.
              nort = orthogonalising code.
              hsup,ksup,lsup = maximum indices of the array; the (h,k,l)
                               indices run within the limits (-1:hsup),
                               (-ksup:ksup), (-lsup:lsup), respectively.
              sqhsup = (1/resolution)**2.
              fto = array of complex "continuous" Fourier coefficients.

      In this case, it may be useful to provide also the ./o/tabl{#}.s file,
      which is used by program oic to define the integration radius and the
      model cell for cross-rotation function calculations.
      =======================================================================


      -----------------------------------------------------------------------
      ./i/tabl.i1
      --------------------------INPUT----------------------------------------
      tabling +*+*+*+*+*+*+*+*+*+*+*
      3    1  1  1         :log
          1    2   10    9
       model Fourier coefficients
      xyz
             3.0    0       0.0
             4.0
            3.50      2.00
      --------------------------DESCRIPTION----------------------------------

              1) Keyword (format A7) = 'tabling'.

              2) Printing options.

              3) LUN1 LUN2 LUN3 LUN4
                      Logical units:
                      LUN1 = input ascii file of coordinates (./d/xyz{#}.d).
                      LUN2 = input binary file of electron density
                             (./d/map{#}.d).
                      LUN3 = output binary file of tabulated "continuous"
                             Fourier coefficients (./f/tabl{#}).
                      LUN4 = tabling output (./o/tabl{#}.s).

              4) Title (format A80).

              5) AKEY (format A5)
                      Keyword defining mode: if 'xyz  ' reads coordinates; if
                      'map  ' reads electron density map.

              6) BADD BFLG BREP
                      B-factor flags:
                      BADD = arbitrary "B-factor" to blunt the atomic
                             scattering factor. It is added in direct space
                             (when reading atomic coordinates) and
                             substracted in reciprocal space (in all cases).
                      BFLG = 1, replace all B-factors in input file by BREP.

              7) SBOX
                      Defines the model cell as SBOX * Box, where Box = model
                      box.

              8) DMIN SHAR
                      DMIN = resolution limit of generated Fourier
                             coefficients. In fact program generates past
                             this point to allow for interpolation at the
                             frontier.
                      SHAR = Shannon rate (the greater SHAR, the finer the
                             mesh). Defines the cell sampling as
                             NX ~ 2 * (a/DMIN) * SHAR,
                             NY ~ 2 * (b/DMIN) * SHAR,
                             NZ ~ 2 * (c/DMIN) * SHAR,
                             where a,b,c are the model cell parameters.
      -----------------------------------------------------------------------
"ENDOF tabling"
#=======================================================================
echo roting
cat >roting <<"ENDOF roting"

      --------------------------ROTING---------------------------------------

          roting calculates fast rotation functions (self-, cross- and
      locked-rotation functions).

      Calling command: ./e/roting {INP} {#} {OUT}

      Input:           ./f/xudi = binary file of packed and sorted H,K,L,Fob.
                       ./f/tabl{#} = binary file of tabulated "continuous"
                                     Fourier coefficients for model {#}.
                       ./i/{INP}.i1 = input described below.

      Output:          ./f/elmx{#} = binary file of spherical-harmonics
                                     expansion coefficients for the crystal.
                       ./f/elmn{#} = binary file of spherical-harmonics
                                     expansion coefficients for model {#}.
                       ./o/{OUT}.s = rotation function output.

      =======================================================================
          To recover the rotation function map, erase in script ./e/roting ,
      the symbol # in line "#/bin/mv $AMOREF/fort.103 rotmap". rotmap is a
      binary file with several registers:

              real rotmap(ng,na,nb)
              write(file) ng,na,nb,g,a,(b(n),n=1,nb)
               do ib=1,nb
              write(file) ((rotmap(ig,ia,ib),ig=1,ng),ia=1,na)
               enddo
      where:
              ng,na,nb = number of sampling points in each direction.
              g,a = gamma and alpha Euler cell dimensions (in degrees).
              (b(n), n=1,nb) = beta sampling set (in degrees).
      =======================================================================


      -----------------------------------------------------------------------
      ./i/{INP}.i1 (general form)
      --------------------------INPUT----------------------------------------
      roting  +*+*+*+*+*+*+*+*+*
      3    0  1  0         :log
      gene    ++++++++++++++++++++++
      .....
      elmn    ++++++++++++++++++++++
      .....
      rota    ++++++++++++++++++++++
      .....
      --------------------------DESCRIPTION----------------------------------

              1) Keyword (format A7) = 'roting '.

              2) Printing options.

              3) MKEY (format A4)
                      Keyword defining mode: if 'gene' generates model
                      structure factors in a suitable cell; if 'elmn'
                      calculates spherical- harmonics expansion coefficients
                      for crystal or models; if 'rota' calculates rotation
                      functions. The three modes may be used independently.
                      Different modes:


      -----------------------------------------------------------------------
      'gene' mode
      ------------------------- INPUT ---------------------------------------
      gene    ++++++++++++++++++++++
         11   102
       title : model fragment number  1
         127.790    98.030    90.050    90.000    90.000    90.000
      x,y,z * end
      1
           15.00      3.50
      0
      ------------------------- DESCRIPTION ---------------------------------

              1) MKEY (format A4) = 'gene'.

              2) LUN1 LUN2
                      Logical units:
                      LUN1 = input binary file of tabulated "continuous"
                             Fourier coefficients (./f/tabl{#}).
                      LUN2 = output binary file of packed and sorted Fourier
                             coefficients (as produced by sorting).

              3) Title (format A80).

              4) Model cell for rotation function (default cell = Box +
                 resolution + integration radius).

              5) Symmetry operations (lower case), finishing '* end'.
                 (usually P1).

              6) NORT
                      Code to define an orthogonal reference frame
                      (usually 1).

              7) DMAX DMIN
                      Resolution limits. Generates data within this range.

              8) NBOD
                      Option to generate structure factors with molecules
                      placed at desired positions (usually 0).
      -----------------------------------------------------------------------


      -----------------------------------------------------------------------
      'elmn' mode
      ------------------------- INPUT ---------------------------------------
      elmn    ++++++++++++++++++++++
         10  101
       ** D44HEL **
          99.700   167.300    84.700    90.000    90.000    90.000
      x,y,z * 1/2+x,1/2-y,-z * 1/2-x,-y,1/2+z * -x,1/2+y,1/2-z * end
      0
            95.0       0.0
           15.00      3.50      0.00     42.40
      ------------------------- DESCRIPTION ---------------------------------

              1) MKEY (format A4) = 'elmn'.

              2) LUN1 LUN2
                      Logical units:
                      LUN1 = input binary file of packed and sorted Fourier
                             coefficients (as produced by sorting or gene).
                      LUN2 = output binary file of spherical-harmonics
                             expansion coefficients (./f/elmx{#} or
                             ./f/elmn{#}).

              3) Title (format A80).

              4) Cell.

              5) Symmetry operations (lower case), finishing '* end'.

              6) NORT
                      Code to define an orthogonal reference frame.

              7) PERC BADD
                      PERC = uses only the PERC % highest Fob.
                      BADD = B-factor added to Fob (e.g. -5 to sharpen data).

              8) DMAX DMIN RMIN RMAX
                      DMAX,DMIN = resolution limits.
                      RMIN,RMAX = integration radii.
      -----------------------------------------------------------------------


      -----------------------------------------------------------------------
      'rota' mode
      ------------------------- INPUT ---------------------------------------
      rota    ++++++++++++++++++++++
        101  102    9   11   10
       ** D44HEL **
      cross
          6  500
        2.5
          0    0
        0.5 1000   0.1E-04
      ------------------------- DESCRIPTION ---------------------------------

              1) MKEY (format A4) = 'rota'.

              2) LUN1 LUN2 LUN3 LUN4 LUN5
                      Logical units:
                      LUN1 = input binary file of spherical-harmonics
                             expansion coefficients for fixed crystal
                             (usually ./f/elmx{#}).
                      LUN2 = input binary file of spherical-harmonics
                             expansion coefficients for rotating crystal
                             (usually ./f/elmn{#}).
                      LUN3 = rotation function output (./o/{OUT}.s).
                      LUN4 = input binary file of tabulated "continuous"
                             Fourier coefficients (./f/tabl{#}).
                      LUN5 = input binary file of packed and sorted H,K,L,Fob
                             (./f/xudi).

              3) Title (format A80).

              4) RKEY (format A5)
                      Keyword defining mode: if 'cross' computes
                      cross-rotation function; if 'self' computes
                      self rotation.

              5) LMIN LMAX
                      Expansions between LMIN and LMAX are used. The
                      l-expansion controls the angular resolution. Low order
                      terms are governed by the crystal symmetry; excluding
                      them may reduce the final peak heights, but make the
                      rotation paramaters more precise and make multiple
                      solutions have more equal heights.

              6) STEP
                      Step size for Alpha, Beta and Gamma (in degrees).

              7) NRS1 NRS2
                      Used to produce several shifts prior to the rotation
                      function calculation (usually 0 0). This allows
                      locked-rotation function calculations.

              8) CUTR NPIC DELT
                      CUTR = cutoff in rotation function output; first
                             selects all peaks above
                             CUTR * maximum-peak-height.
                      NPIC = maximum number of peaks to output of rotation
                             function.
                      DELT = used in peak-search to avoid spurious peaks.
      -----------------------------------------------------------------------





      **************************EXAMPLE**************************************

          The self rotation may be calculated by using the following input
      cards:

      --------------------------./i/{INP}.i1---------------------------------
      roting  +*+*+*+*+*+*+*+*+*
      3    0  1  0         :log
      elmn    ++++++++++++++++++++++
         10  101
       ** D44HEL **
          99.700   167.300    84.700    90.000    90.000    90.000
      x,y,z * 1/2+x,1/2-y,-z * 1/2-x,-y,1/2+z * -x,1/2+y,1/2-z * end
      0
            95.0       0.0
           15.00      3.50      0.00     42.40
      rota    ++++++++++++++++++++++
        101    0    9    0    0
       ** D44HEL ** self
      self
          6  500
        2.5
          0    0
        0.2 1000   0.1E-04
      -----------------------------------------------------------------------

          If the expansion-coefficients already exist (./f/elmx{#}), then the
      following input may be used:

      --------------------------./i/{INP}.i1---------------------------------
      roting  +*+*+*+*+*+*+*+*+*
      3    0  1  0         :log
      rota    ++++++++++++++++++++++
        101    0    9    0    0
       ** D44HEL ** self
      self
          6  500
        2.5
          0    0
        0.2 1000   0.1E-04
      -----------------------------------------------------------------------

          Let E1,E2,E3 be Euler angles of a self-rotation peak; its inverse
      has parameters E1'=180-E3, E2'=E2, E3'=180-E1. The locked rotation may
      be calculated by using the following input:

      --------------------------./i/{INP}.i1---------------------------------
      roting  +*+*+*+*+*+*+*+*+*
      3    0  1  0         :log
      rota    ++++++++++++++++++++++
        101  102    9   11    0
       ** D44HEL ** locked
      cross
          6  500
        2.5
          2    0
      0. 0. 0.
      E1' E2' E3'
        0.5 1000   0.1E-04
      -----------------------------------------------------------------------
"ENDOF roting"
#=======================================================================
echo traing
cat >traing <<"ENDOF traing"

      --------------------------TRAING---------------------------------------

          traing calculates fast translation functions. This works either by
      the method of centred-overlap, phased-translation, harada-lifchitz or
      correlation-coefficient.

      Calling command: ./e/traing {INP} {OUT}

      Input:           ./f/xudi = binary file of packed and sorted H,K,L,Fob.
                       ./f/tabl{#} = binary files of tabulated "continuous"
                                     Fourier coefficients; {#} = 1,NTYP.
                       ./i/{INP}.i1 = input described below.

      Output:          ./o/{OUT}.s = translation function output.

      =======================================================================
          To recover the last fast translation function map, erase in script
      ./e/traing , the symbol # in line "#/bin/mv $AMOREF/fort.104 tramap".
      tramap is a binary file with several registers:

              real tramap(nx,ny,nz)
              write(file) nx,ny,nz,a,b,c,alpha,beta,gamma
               do iz=1,nz
              write(file) ((tramap(ix,iy,iz),ix=1,nx),iy=1,ny)
               enddo
      where:
              nx,ny,nz = number of sampling points in each direction.
              a,b,c,alpha,beta,gamma = cell parameters (in Angstroms and
                                       degrees).
      =======================================================================


      -----------------------------------------------------------------------
      ./i/{INP}.i1
      --------------------------INPUT----------------------------------------
      traing  +*+*+*+*+*+*+*+*+*
      7    1 1 0 1 0 1 1   :log
         10    9
       ** D44HEL **
          99.700   167.300    84.700    90.000    90.000    90.000
      x,y,z * 1/2+x,1/2-y,-z * 1/2-x,-y,1/2+z * -x,1/2+y,1/2-z * end
      0
            95.0       0.0
           15.00      3.50      1.75      1.00
       3                  ++++++++++++++++++++
      c-o    0.0
       0.50   30     1.e-4
        >11  102.3   25.7   12.8  0.0755  0.3081  0.4560   27.6 52.1 54.0
        >11  135.5   43.0  320.5  0.4613  0.2053  0.0096   38.6 48.1 41.1
        #12   73.6   68.9  346.3  0.0000  0.0000  0.0000    7.6  0.0
       3                  ++++++++++++++++++++
      c-o    0.0
       0.50   30     1.e-4
        >11  102.3   25.7   12.8  0.0755  0.3081  0.4560   27.6 52.1 54.0
        >11  135.5   43.0  320.5  0.4613  0.2053  0.0096   38.6 48.1 41.1
        #12   74.8   61.6  309.9  0.0000  0.0000  0.0000    4.0  0.0
      .....
      --------------------------DESCRIPTION----------------------------------

              1) Keyword (format A7) = 'traing '.

              2) Printing options.

              3) LUN1 LUN2
                      Logical units:
                      LUN1 = input binary file of packed and sorted H,K,L,Fob
                             (./f/xudi).
                      LUN2 = translation function output (./o/{OUT}.s).

              4) Title (format A80).

              5) Cell.

              6) Symmetry operations (lower case), finishing '* end'.

              7) NORT
                      Code to define an orthogonal reference frame.

              8) PERC BADD
                      PERC = uses only the PERC % highest Fob.
                      BADD = B-factor added to Fob (e.g. -5 to sharpen data).

              9) DMAX DMIN TMIN SHAR
                      DMAX,DMIN = data resolution limits.
                      TMIN = fast translation function resolution (default
                             value is DMIN/2).
                      SHAR = Shannon rate (the greater SHAR, the finer the
                             mesh). Defines the crystal cell sampling as
                             NX ~ 2 * (a/TMIN) * SHAR,
                             NY ~ 2 * (b/TMIN) * SHAR,
                             NZ ~ 2 * (c/TMIN) * SHAR.

      Then add this information which is extracted from roting, traing or
      fiting outputs:

              10) NBOD
                      Number of molecules (n-body mode).

              11) TKEY SCAL (format A5,*)
                      TKEY = if 'c-o' compute centred-overlap; if 'p-t'
                             compute phased-translation ('p-t-f' when phases
                             are available); if 'h-l' compute harada-lifchitz
                             translation function; if 'c-c' compute
                             correlation-coefficient.
                      SCAL = for phased-translation, to scale the phasing
                             model substruction.

              12) CUTT NPIC DELT
                      CUTT = cutoff in fast translation function output;
                             first selects all peaks above
                             CUTT * maximum-peak-height of c-o, p-t, h-l or
                             c-c fast translation function.
                      NPIC = maximum number of peaks to output of translation
                             function. The program computes correlations and
                             R-factors.
                      DELT = used in peak-search to avoid spurious peaks.

              13) LUNi Ai Bi Gi Xi Yi Zi (NBOD cards; i = 1,NBOD)
                      This is a formatted line. The format is decided by the
                      user when installing the package. If NBOD > 1, last
                      will be translated over whole cell while keeping the
                      others fixed; if NBOD = 1, search is done over the
                      Cheshire cell.
                      LUNi = logical-unit number for input tabulated
                             "continuous" Fourier coefficients corresponding
                             to i-th molecule.
                      Ai,Bi,Gi,Xi,Yi,Zi = Euler angles and translations
                                          (fractionnal) for i-th molecule.
                                          Xi,Yi,Zi for the last molecule is
                                          read but not used.

      Repeat 10) to 13) for other positions and orientations.
      -----------------------------------------------------------------------
"ENDOF traing"
#=======================================================================
echo fiting
cat >fiting <<"ENDOF fiting"

      --------------------------FITING---------------------------------------

          fiting performs rigid-body refinement: Minimise
      Sig(hkl){Fob*exp(-B*s**2) - Scale*Sig(i)[Fc(Ai,Bi,Gi,Xi,Yi,Zi)]}**2
      with respect to Scale, B and rotation and translation parameters
      (Ai,Bi,Gi,Xi,Yi,Zi).

      Calling command: ./e/fiting {INP} {OUT}

      Input:           ./f/xudi = binary file of packed and sorted H,K,L,Fob.
                       ./f/tabl{#} = binary files of tabulated "continuous"
                                     Fourier coefficients; {#} = 1,NTYP.
                       ./i/{INP}.i1 = input described below.

      Output:          ./o/{OUT}.s = fast rigid-body refinement output.


      -----------------------------------------------------------------------
      ./i/{INP}.i1
      --------------------------INPUT----------------------------------------
      fiting  +*+*+*+*+*+*+*+*+*
      7    1 1 0 1 0 1 1   :log
         10    9
       ** D44HEL **
          99.700   167.300    84.700    90.000    90.000    90.000
      x,y,z * 1/2+x,1/2-y,-z * 1/2-x,-y,1/2+z * -x,1/2+y,1/2-z * end
      0
            95.0       0.0
           15.00      3.50
      inertia tensors    2
        >11  140.3  100.2   78.1
        >12   80.0   66.1   50.0
       3                  ++++++++++++++++++++
       0 1 1 1 1 1 1
          1        10      0.04
        #11  102.3   25.7   12.8  0.0755  0.3081  0.4560   27.6 52.1 54.0
        #11  135.5   43.0  320.5  0.4613  0.2053  0.0096   38.6 48.1 41.1
        #12   74.8   61.6  309.9  0.2951  0.9939  0.8339   43.9 45.5 41.8
      .....
      --------------------------DESCRIPTION----------------------------------

              1) Keyword (format A7) = 'fiting '.

              2) Printing options.

              3) LUN1 LUN2
                      Logical units:
                      LUN1 = input binary file of packed and sorted H,K,L,Fob
                             (./f/xudi).
                      LUN2 = fast rigid-body refinement output (./o/{OUT}.s).

              4) Title (format A80).

              5) Cell.

              6) Symmetry operations (lower case), finishing '* end'.

              7) NORT
                      Code to define an orthogonal reference frame.

              8) PERC BADD
                      PERC = uses only the PERC % highest Fob.
                      BADD = B-factor added to Fob (e.g. -5 to sharpen data).

              9) DMAX DMIN
                      DMAX,DMIN = resolution limits.

              10) NTYP (format *, after column 15)
                      Number of different models whose positions are to be
                      refined.

              11) LABi QXXi QYYi QZZi (NTYP cards; i = 1,NTYP)
                      This is a formatted line. The format is decided by the
                      user when installing the package.
                      LABi = logical-unit number for input inertia moments
                             corresponding to i-th molecule (.o/tabl{#}.s);
                             usually LAB{#} = 10 + {#}.
                      QXXi,QYYi,QZZi = principal moments of inertia for i-th
                                       model.

      Then add this information which is extracted from traing or fiting
      outputs (or roting for space group P1):

              12) NBOD
                      Number of molecules (n-body mode).

              13) Refinement flags (7 flags).
                      Flags for refinement of B-factor, Euler angles and
                      translations. = 0 (no refinement); = 1 (refinement).

              14) NCYC NITE RMSS
                      NCYC = number of times the NBOD bodies are alternately
                             refined. NCYC = 0 refines only the last one.
                      NITE = number of iterations in the least-squares
                             procedure.
                      RMSS = root-mean-square shift (in angstroms).
                             Least-squares stops if the r-m-s correction to
                             positions is less than RMSS.

              15) LUNi Ai Bi Gi Xi Yi Zi (NBOD cards; i = 1,NBOD)
                      This is a formatted line. The format is decided by the
                      user when installing the package. If NBOD > 1, last is
                      refined first, while the others are kept fixed; then
                      proceeds cyclically.
                      LUNi = logical-unit number for input tabulated
                             "continuous" Fourier coefficients corresponding
                             to i-th molecule.
                      Ai,Bi,Gi,Xi,Yi,Zi = Euler angles and translations
                                         (fractionnal) for i-th molecule.

      Repeat 12) to 15) for other positions.
      -----------------------------------------------------------------------
"ENDOF fiting"
#=======================================================================
echo mr2ic
cat >mr2ic <<"ENDOF mr2ic"

      --------------------------MR2IC----------------------------------------

          mr2ic reads the rotation and translation applied in tabling to the
      input models, and the refined rotations and translations output from
      fiting, to work out the final rotations and translations parameters to
      apply to the initial models.

      Calling command: ./e/mr2ic {INP} {OUT}

      Standard Input:  Keyword ('mr2ic') and number of solutions to output.

      Input:           ./d/data.d = ascii file of main AMoRe input.
                       ./o/tabl{#}.s = ascii files of tabling outputs;
                                       {#} = 1,NTYP.
                       ./o/{INP}.s = ascii file of fiting output.

      Output:          ./o/{OUT}.s = output positional parameters.
"ENDOF mr2ic"
#=======================================================================
echo oic
cat >oic <<"ENDOF oic"

      --------------------------OIC------------------------------------------

          oic creates inputs to the main molecular replacement programs, by
      selecting and combining potential solutions, which are sorted according
      to the values of the correlation coefficient.

      Calling commands:

      ./e/oic {NOM} {IN1} {OUT}           ; 3 arguments.

      ./e/oic {NOM} {IN1} {IN2} {OUT}     ; 4 arguments.

      Five situations are possible (according to {NOM} and number of
      arguments):
              1) roting input: model dimensions are read from file
                               ./o/{IN1}.s ({IN1}=tabl{#}); 3 arguments.
              2) one-body traing input: orientations to translate are read
                                        from file ./o/{IN1}.s; 3 arguments.
              3) n-body traing input: orientations are read from file
                                      ./o/{IN1}.s , and the fixed position
                                      from file ./o/{IN2}.s . If orientations
                                      are read from a n-body output, only
                                      those corresponding to the last body
                                      are taken into account; 4 arguments.
              4) n-body traing input: the particular case of n-body
                                      translations where the orientations and
                                      the fixed position are read from the
                                      same file ./o/{IN1}.s; 3 arguments.
              5) fiting input: positions to refine are read from file
                               ./o/{IN1}.s; 3 arguments.

      Input:           ./d/data.d = ascii file of main AMoRe input.
                       ./o/tabl{#}.s = ascii files of tabling outputs;
                                       {#} = 1,NTYP.
                       ./o/{IN1}.s , ./o/{IN2}.s = ascii files of roting,
                                                   traing or fiting outputs.
                       ./i/oic{NOM}.i2 = input described below.

      Output:          ./i/{OUT}.i1 = oic output, i.e. input to main
                                      molecular replacement programs.

      =======================================================================
          The oic program needs the ./o/tabl{#}.s file to define the
      integration radius and the model cell for cross-rotation function
      calculations. This file is not created if the "continuous" Fourier
      transform of the search model electron density is not calculated with
      tabling.
      =======================================================================

      Three different input modes:


      -----------------------------------------------------------------------
      ./i/oic{NOM}.i2 (roting mode)
      ------------------------- INPUT ---------------------------------------
      oic roting  +*+*+*+*+*+*+*+*+*
       ** D44HEL **
      model:  1
           15.00      3.50
        1.0
          6
        2.5
        0.5 1000
      ------------------------- DESCRIPTION ---------------------------------

              1) Keyword defining mode (format A10) = 'oic roting'.

              2) Title (format A80).

              3) MTYP (format *, after column 7)
                      Model-identification number.

              4) DMAX DMIN
                      Resolution limits (in angstroms).

              5) RATE
                      Defines the integration radius as RATE * Molrad, where
                      Molrad = radius of the smallest sphere, with origin at
                      CoM, containing the whole molecule.

              6) LMIN
                      spherical-harmonics expansions begin with l = LMIN; the
                      l-expansion controls the angular resolution.

              7) STEP
                      Step size for Alpha, Beta and Gamma (in degrees).

              8) CUTR NPIC
                      CUTR = cutoff in rotation function output; first
                             selects all peaks above
                             CUTR * maximum-peak-height.
                      NPIC = maximum number of peaks to output of rotation
                             function.
      -----------------------------------------------------------------------


      -----------------------------------------------------------------------
      ./i/oic{NOM}.i2 (traing mode)
      ------------------------- INPUT ---------------------------------------
      oic traing  +*+*+*+*+*+*+*+*+*
       ** D44HEL **
      n-body-s      1
      p-t         1.0
        0.0   10
           15.00      3.50
        0.5   30
      fuzz:       2.0
      over:      20.0
      ------------------------- DESCRIPTION ---------------------------------

              1) Keyword defining mode (format A10) = 'oic traing'.

              2) Title (format A80).

              3) BKEY RANK (format A10,*)
                      BKEY = keyword defining mode. Three possibilities:
                                'one-body  '
                                'n-body    '
                                'n-body-s  '.
                             'n-body-s  ' is for the particular case of
                             n-body translations where the orientations to
                             translate and the fixed position are read from
                             the same file.
                      RANK = takes as fixed position the one that appears in
                             RANK-th order of decreasing correlation (for
                             n-body).
      =======================================================================
          When the number of arguments is 4, the oic procedure uses "sed" to
      erase '-s'.
      =======================================================================

              4) TKEY SCAL (format A5,*)
                      TKEY = if 'c-o' compute centred-overlap; if 'p-t'
                             compute phased-translation ('p-t-f' when phases
                             are available); if 'h-l' compute harada-lifchitz
                             translation function; if 'c-c' compute
                             correlation-coefficient.
                      SCAL = for phased-translation, to scale the phasing
                             model substruction.

              5) CORR NUMR
                      CORR = cutoff to select only those solutions with
                             correlation coefficient greater than CORR.
                      NUMR = selects up to a maximum of NUMR orientations for
                             input to translation (in decreasing order of
                             correlation).

              6) DMAX DMIN
                      Resolution limits (in angstroms).

              7) CUTT NPIC
                      CUTT = cutoff in fast translation function output;
                             first selects all peaks above
                             CUTT * maximum-peak-height of c-o, p-t, h-l or
                             c-c fast translation function.
                      NPIC = number of peaks to output of translation
                             function. The program computes correlations and
                             R-factors.

              8) CUTO (format *, after column 5)
                      Cutoff to eliminate orientations differing by less than
                      CUTO degrees.

              9) CUTD (format *, after column 5)
                      Cutoff to eliminate fixed positions with CoM-to-CoM
                      distance less than CUTD angstroms (for n-body).
      -----------------------------------------------------------------------


      -----------------------------------------------------------------------
      ./i/oic{NOM}.i2 (fiting mode)
      ------------------------- INPUT ---------------------------------------
      oic fiting  +*+*+*+*+*+*+*+*+*
       ** D44HEL **
        0.0   10
           15.00      3.50
          1   10      0.01
      fuzz:       2.0
      over:      20.0
      ------------------------- DESCRIPTION ---------------------------------

              1) Keyword defining mode (format A10) = 'oic fiting'.

              2) Title (format A80).

              3) CORR NUMT
                      CORR = cutoff to select only those solutions with
                             correlation coefficient greater than CORR.
                      NUMT = selects up to a maximum of NUMT positions to
                             refine (in decreasing order of correlation).

              4) DMAX DMIN
                      Resolution limits (in angstroms).

              5) NCYC NITE RMSR
                      NCYC = number of times the n-bodies are alternately
                             refined. NCYC = 0 refines only the last one.
                      NITE = number of iterations in the least-squares
                             procedure.
                      RMSR = least-squares stops if the r-m-s correction to
                             positions is less than RMSR * DMIN.

              6) CUTO (format *, after column 5)
                      Cutoff to eliminate orientations differing by less than
                      CUTO degrees (for space group P1).

              7) CUTD (format *, after column 5)
                      Cutoff to eliminate positions with CoM-to-CoM distance
                      less than CUTD angstroms.
      -----------------------------------------------------------------------
"ENDOF oic"
#=======================================================================
echo oic_
cat >oic_ <<"ENDOF oic_"

      --------------------------OIC_{$}ING-----------------------------------

          oic_roting, oic_traing and oic_fiting are the concatenations of oic
      with the main molecular replacement programs. They assume the oic
      inputs are called oic{NOM}.i2 .


      -----------------------------------------------------------------------
          oic_roting computes cross-rotation function.

      Calling command:

      ./e/oic_roting  {NOM} {#} {OUT}           ; 2 arguments.
                       equivalent to   ./e/oic {NOM} tabl{#} rot
                                       ./e/roting rot {#} {OUT}
                       {#} = model number.

      Input:           files used by oic and roting.
                       ./i/oic{NOM}.i2 = input to oic, mode roting.

      Output:          ./i/{OUT}.s = cross-rotation function output.
      -----------------------------------------------------------------------


      -----------------------------------------------------------------------
          oic_traing computes fast translation functions.

      Calling commands:

      ./e/oic_traing  {NOM} {ANG} {OUT}         ; 3 arguments.
                       equivalent to   ./e/oic {NOM} {ANG} tra
                                       ./e/traing tra {OUT}

      ./e/oic_traing  {NOM} {ANG} {POS} {OUT}   ; 4 arguments.
                       equivalent to   ./e/oic {NOM} {ANG} {POS} tra
                                       ./e/traing tra {OUT}

      Input:           files used by oic and traing.
                       ./i/oic{NOM}.i2 = input to oic, mode traing.
                       ./o/{ANG}.s = filename of roting, traing or fiting
                                     output; orientations to translate (and
                                     fixed positions in n-body cases) are
                                     read from this file.
                       ./o/{POS}.s = ({POS}.ne.{ANG}) filename of traing or
                                     fiting output (or roting for space group
                                     P1); fixed positions are read from this
                                     file.

      =======================================================================
          If the orientations are read from a n-body output, only those
      corresponding to the last body are taken into account.
      =======================================================================

      Output:          ./i/{OUT}.s = translation function output.
      -----------------------------------------------------------------------


      -----------------------------------------------------------------------
          oic_fiting performs fast rigid-body refinements.

      Calling command:

      ./e/oic_fiting  {NOM} {POS} {OUT}         ; 3 arguments.
                       equivalent to   ./e/oic f{NOM} {POS} fit
                                       ./e/fiting fit {OUT}

      Input:           files used by oic and fiting.
                       ./i/oicf{NOM}.i2 = input to oic, mode fiting.
                       ./o/{POS}.s = filename of traing or fiting output (or
                                     roting for space group P1); positions to
                                     be refined are read from this file.

      Output:          ./i/{OUT}.s = fast rigid-body refinement output.
      -----------------------------------------------------------------------
"ENDOF oic_"