2.03                      *******************
                                  * FSFOUR WRITE-UP *
                                  *******************
        
        PURPOSE- To calculate three dimensional Fourier transforms (maps)
                 when given a set of Fourier coefficients and control cards.
        
           This program will calculate maps by using a multivariate variable 
        radix fast Fourier transform algorithm. the only restrictions are that 
        the number of grid points along each axis is even, and is a product of 
        the factors 2, 3, 4, or 5.  Each factor can be used more than once.  
        The program is fully general so that all space groups can be handled.  
        The input structure factors must fall in the following range:
                               -NX/2 < h < NX/2
            			-NY/2 < k < NY/2
            			-NZ/2 < l < NZ/2 
        where NX, NY, NZ are the number of grid points along the a, b, and c 
        axes, respectively.  Input structure factors outside the range will be 
        omitted from the calculation.
        
        
                                 INPUT DATA  (UNIT 5)
        
         CARD 1     PAMFIL         (free format)
        
                    PAMFIL = Name of input file containing cell and symmetry
                             information.
        
        
         CARD 2     TITLE          (free format)
        
                    TITLE = anything
        
        
         CARD 3  NCENT,NX,NY,NZ,MAPTYP,IPRINT,NPIC,NORN,INPF,GSP,DCUT
                                   (free format)
        
                                      NCENT = 0 for noncentrosymmetric
                                                space groups
                                            = 1 for centrosymmetric
                                                space groups
        
                             
                                        NX  = number of grid points along the 
                                              a,b and c axes, respectively. If 
                                        NY  = an input value is inconsistant 
                                              withthe factoring scheme, the 
                                        NZ  = next largest acceptable value 
                                              will be used. If zero, see GSP 
                                              below.
        
        
                               MAPTYP   = Fourier coefficient selection integer
                                        = 1 for FO*exp(i*PHIC)
                                        = 2 for FC*exp(i*PHIC)
                                        = 3 for (FO-FC)*exp(i*PHIC)
                                        = 4 for (2*FO-FC)*exp(i*PHIC)
                                        = 5 for (FO-FC)**2
                                            (difference Pattersons)
                                        = 6 for FO**2 
                                        = 7 for FC**2
                                        = 8 for -i*(FH+ - FH-)*exp(i*PHIH+)
                                            (Bijvoet difference Fourier)
                                        = 9 for (3*FO-2*FC)*exp(i*PHIC)        
       
 
                                  IPRINT   = 0 for no printing of map
                                           = 1 for printing of map
        
        
                                      NPIC = number of non-hydrogen atoms
                                             in the asymmetric unit. (Not
                                             used within the program but
                                             is passed on to program PSRCH
                                             via the map file. Should not 
                                             exceed 140).
        
        
                                      NORN = 0 for XZ sections
                                           = 1 for YZ sections
                                           = 2 for XY sections
                                               ***** CAUTION *****
                                               If the map file is to be
                                               input to programs PSRCH,
                                               MAPINV, MAPVIEW, GMAP or CTOUR,
                                               NORN must be 0. 
                                  
        
                                  INPF = 0 for binary reflection file input.
                                       = 1 for formatted reflection file input.
                                  
        
                                       GSP = Desired grid spacing in angstroms.
                                             Defaults to 1.0, applied only if
                                             NX=NY=NZ=0 to determine number of
                                             grid points along each axis.
                                               
       
                                      DCUT = minimum d spacing cutoff, in 
                                             angstroms, for acceptance of
                                             input reflections. 
        

         CARD 4     INPREF      (free format)
        
                    INPREF = Name of input reflection file.
                            
        
         CARD 5     MAPFIL      (free format)
        
                    MAPFIL = Name of output map file.
                                                     
        
        
         CARD 6     LEVEL, (XLIM(I), I=1,3)   (free format)
        
         ***** this card should be included ONLY if IPRINT is nonzero ***** 
        
                                    LEVEL= scan level, if peaks are greater
                                           than scan level, the peak will be
                                           underlined with **, if zero,
                                           defaults to 100
        
        
                                 XLIM(1) =
        
                                 XLIM(2) = printing limits. map will be
                                           printed from 0 to XLIM (fractional)
                                 XLIM(3) = along each axis
        
        
        
                       ********* NOTES ON THE PROGRAM **********
        
           The input reflection file is terminated by an end of file, and 
        should contain records with  H, K, L, FOBS, FCAL, PHI where the first 
        three variables are INTEGERS and the remainder REALS. PHI should be in 
        degrees. The file may either be formatted or binary as indicated by 
        the parameter INPF. If it is formatted the format is assumed to be
        ( 3I4, 2F10.2, F7.2). If the input file contains records with
        H,K,L,FPH,FP,PHI then MAPTYP=5 can be used to compute isomorphous
        difference Pattersons (PHI is not used). If the input records contain 
        H,K,L,F(H,K,L),F(-H,-K,-L),PHI(H,K,L), then MAPTYP=5 will compute
        anomalous difference Pattersons, and MAPTYP=8 can be used to 
        compute Bijvoet difference Fouriers. Note that if a binary file is 
        input each record must contain six words even if all of them are not 
        used in the calculation, i.e. PHI is not needed if MAPTYP=5,6 or 7, 
        but some value still must be supplied.
        
           The output map file is binary and contains NSYM + 2 header records 
        followed by the map.  If NORN = 0, the map is written such that each 
        record contains NX density values (one row along x), with NZ 
        consecutive records constituting each section of constant y, i.e. y is 
        slowest varying. If NORN = 1, the positions of x and y are 
        interchanged. If NORN = 2, the positions of y and z are interchanged. 
        All map values are integers scaled as described below.  When NORN=0 
        the map file is suitable for input to programs PSRCH for locating 
        peaks, to MAPINV for modification followed by inversion, to MAPVIEW 
        for interactive contouring and display, to GMAP for conversion to
        TOM/O or CHAIN formats and for creation of skeletons, or to CTOUR to
        create hard copies of contoured plots. If NORN is nonzero the only
        recourse is to print the map within this program.
        
                          ***** SCALING THE DATA *****
                                           
           Two scales are used, one for the binary map file and one for the 
        printed map output,if requested. If the input coefficients were on an 
        absolute scale, then the absolute electron density is obtained as 
        follows:
        
        rho (absolute) = 10.*(printed map value)/(V*scale)   + F000/V
        
        rho (absolute) = (value on binary map output file)/(V*scale)  + F000/V
        
        where V is the unit cell volume and scale is given on the lineprinter 
        output.  F000 is the total number of electrons in the unit cell. Note 
        that even if F000 is supplied on the input file, it will not be used 
        in the program, and must be added as indicated above. Also note that 
        the PRINTED output is limited to two digits per density value, but the 
        density is NOT rescaled to a maximum of 99. This means that values of 
        99 merely imply a density of AT LEAST 99.
        
                        ***** BIJVOET DIFFERENCE FOURIERS *****
        
           When maptyp=8 is selected, and the input reflection file contains 
        records with  H, K, L, F(H,K,L), F(-H,-K,-L), PHI(H,K,L) then a 
        "Bijvoet difference Fourier" will be computed. In this case the map 
        consists of only the "imaginary" part of the electron density, and 
        should show strong positive peaks only at the sites of anomalous
        scatterers (if the hand is correct). The multiplication factor -i is
        applied only after expansion to a hemisphere to effectively
        interchange real and imaginary parts of the density, as the program
        would normally only compute the "real" part.
        
                                   ***** FILES *****
        
        INPREF   -   Input Fourier coefficient file, can be either formatted or
                     binary as determined by input parameter INPF. Records
                     should contain h, k, l, Fobs, Fcal, Phi  with h,k,l 
                     INTEGERS and Fobs, Fcal, Phi REALS. Phi is in degrees. If 
                     INPF=1, then file should be formatted with 
                     FORMAT(3I4,2F10.2,F7.2)
        
        MAPFIL  -    Binary map file output. Contains NSYM+2 header records 
                     followed by the map, as described earlier. 

        2.04                      *******************
                                  * MAPINV WRITE-UP *
                                  *******************
        
        PURPOSE- To calculate three dimensional Fourier coefficients
                 (structure factors) when given an electron density
                 map and control cards.
        
           This program will calculate structure factors by using a 
        multivariate variable radix fast Fourier transform algorithm to invert 
        an electron density map. The program is fully general so that all 
        space groups can be handled.  It is assumed that the input map was 
        prepared by program FSFOUR.  Structure factors may be calculated for
        reflections in the following range:
           		h .ge. -NX/2  and  h .lt. NX/2
           		k .ge. -NY/2  and  k .lt. NY/2
           		l .ge. 0      and  l .lt. NZ/2
        where NX, NY, NZ are the number of grid points along the a, b, and c 
        axes, respectively, in the input map.
        
        
                            INPUT DATA  (UNIT 5)
        
         CARD 1     PAMFIL               (free format)
        
                    PAMFIL = Name of input file containing cell and symmetry
                             parameters.
        
        
         CARD 2     TITLE                (free format)
        
                    TITLE = anything
        
        
         CARD 3     MAPFIL               (free format)
        
                    MAPFIL = Name of input map file.
        
        
         CARD 4     SFOUT                (free format)
        
                    SFOUT = Name of output structure factor file.
               
        
         CARD 5  IPRNT, IPAIR, HMIN, HMAX, KMIN, KMAX, LMAX  (free format)
        
                                  IPRNT = 0 for no printing of structure
                                            factors.
                                        = 1 for printout
        
        
                                  IPAIR = 0 for no pairing of calculated
                                            structure factors with observed
                                            data.
                                        = 1 to combine calculated structure
                                            factors with observed data 
                                            (supplied on auxilliary file) and 
                                            output R factor to the line printer
                                        = 2 same as 1, but a separate file with
                                            the combined data is also written.
                                            
        
                                  HMIN  =
        
                                            limiting values defining range of
                                  HMAX  =
        
                                            indices for which structure factors
                                  KMIN  =
        
                                            will be calculated
                                  KMAX  =
        
                                            (LMIN is always 0)
                                  LMAX  =
        
                            
         CARD 5A   AUXINP         (free format)
        
              ***** This card should be included ONLY if IPAIR > 0 *****
        
         AUXINP = Name of input file containing auxilliary structure
                  factors for scaling.
                   
        
         CARD 5B   AUXOUT         (free format)
        
              ***** This card should be included ONLY if IPAIR = 2 *****
        
         AUXOUT = Name of output file to contain calculated structure
                  factors scaled to (and paired with) the auxilliary
                  structure factors.
        
        
         CARD 6  SC, F000, IMOD, IRHOMN     (free format)
        
        
                             SC  =   scale factor applied to calculated
                                     structure factors (see below).
                                     If 0. defaults to 1.
        
                            F000 =   total number of electrons in the unit 
                                     cell (see below).
        
                            IMOD = 0 for no modification of map prior to
                                     transformation
        
                                 = 1 to modify map prior to transformation  
                                     according to input criterion
        
                                 =-1 same as 1 but the resulting density
                                     is also squared prior to transformation.
        
                          IRHOMN =   modification criterion (applied if   
                                     IMOD .ne.0). If (rho input + IRHOMN) < 0, 
                                     rho will be reset to 0.  If F000 is
                                     supplied, IRHOMN is automatically set to 
                                     correspond to non-negativity of electron 
                                     density.
        
        
                      ********** NOTES ON THE PROGRAM **********
        
           The input map file MAPFIL is assumed to have been generated with 
        program FSFOUR. It is binary, terminated with an end of file, and 
        after a few header records, contains the electron density map 
        represented as records (of integers) along x. y is the slowest varying 
        coordinate.
        
        All calculated structure factors within the index range specified will 
        be output to file SFOUT. Note that this may include redundant 
        (symmetry related) as well as systematically absent reflections, if 
        they they fall within the specified index range.  The output file is 
        binary, with records of H,K,L,FCALC,FCALC,PHI and is terminated by an 
        end of file. H,K and L are INTEGERS whereas FCALC and PHI are REALS. 
        PHI is in degrees. Note that FCALC is duplicated within each record so 
        that the file structure is consistant with the input required by 
        program FSFOUR.
        
        If IPAIR > 0, then in addition to file SFOUT, an input file AUXINP of 
        observed structure factor amplitudes will be paired with the 
        corresponding calculated amplitudes and phases, and the combined data 
        used in one cycle of least squares refinement of a scale factor. The 
        resulting R factor between observed and calculated  amplitudes is then 
        output to the lineprinter. Note that the input reflection data on file 
        AUXINP is restricted to the same range of indices as the calculated 
        data. If input values fall out of bounds they will be ignored. 
        Therefore, if data were collected with L negative, it will have to be 
        transformed by symmetry before it can be used successfully on file 
        AUXINP.
        
        If IPAIR = 2, the results are identical to those obtained with IPAIR = 
        1, except that the combined (and rescaled) data is also output to a 
        separate file AUXOUT. The new file is of the same form as SFOUT, but 
        with records consisting of H,K,L,FOBS,FCALC,PHICALC for only those 
        reflections which were input on file AUXINP.
        
                             ***** SCALING THE DATA *****
        
        It is often desirable to control the scale of the calculated structure 
        factors. If the input electron density map was generated from 
        structure factors which are related to an absolute scale by:
        
        F(input to FSFOUR) = k * F(absolute)
        
        then k should be input for SC to obtain calculated structure factors 
        on an absolute scale. If sc= 0. (or 1.), then the calculated structure 
        factors will be on the same scale as those used to generate the map 
        (unless IMOD = -1, in which case they will be much larger).  Note that 
        this scaling applies only to the output on file SFOUT (and the 
        lineprinter, if IPRNT .ne.0). If IPAIR .eq. 2, then the calculated 
        structure factors on file AUXOUT will always be scaled for best 
        agreement with those supplied on file AUXINP.
        
        
                             ***** MODIFYING THE MAP *****
        
           The following applies only if IMOD .ne. 0. Inclusion of F000 will 
        result in imposing non-negativity of electron density everywhere in 
        the map prior to inversion, provided SC is reasonably well known. If 
        SC is unknown, then F000 and SC on card 3 should be zero and IRHOMN 
        should be input to control the type and degree of modification. 
        Intelligent use of this parameter would then require knowledge of the 
        input map values prior to running the job.  IRHOMN should be equal to 
        F000/V on the same scale as the input map. If IMOD = -1, IRHOMN is 
        first added to each density value, resulting values below zero are set 
        to zero, and each value is then squared prior to Fourier 
        transformation. This is equivalent to imposing non-negativity, 
        followed by one cycle through the tangent formula.  Phases can 
        therefore be tangent formula refined or extended.
        
        
                             ***** FILE REQUIREMENTS *****
        
        MAPFIL     - input map file, binary, as output by program FSFOUR
        
        
        SFOUT      - output file with all calculated structure factors,
                     binary, six word records as described earlier
        
        AUXINP     - auxilliary input structure factor file (required only 
                     if IPAIR .ne. 0), binary, six word records in same form 
                     as SFOUT (only H,K,L and FOBS are used)
                                                              
        AUXOUT     - output auxilliary structure factor file, binary, six
                     word records as described earlier.

        2.05                     ********************
                                 * PAMFILE WRITE-UP *
                                 ********************
        
           This is not a program, but rather a description of a "standard 
        parameter file" which is read by all programs in the PHASES package, 
        and several auxilliary programs as well. The main purpose of this file 
        is to insure consistency in cell constants, symmetry, lattice type etc 
        throughout all programs, and to eliminate redundant input of these 
        parameters by the user. In addition one can optionally specify the 
        name of a "running log file." If this is done then in addition to 
        normal output to either the screen or individual log files for each 
        program, all printed output is also appended to a single file, 
        preceeded by a time stamp indicating what program was run and when. 
        Thus one can maintain a complete history of all computations and 
        results in a single log file.  The standard paramater file is often 
        referred to generically in program write-ups as "PAMFIL." One should 
        select a name for it which is indicative of the particular structure 
        being worked on, and rapidly communicates to the user that it is a 
        parameter file. For example, PDC.PAM might be a good choice for 
        phasing pyruvate decarboxylase. 
        
           Each standard parameter file should contain the following 
        information in the indicated sequence.
        
        LOGFILE=FILNAME            Where FILENAME is the name of the
                                   desired "running" log file. If no
                                   cumulative log is desired, enter 
                                   LOGFILE=NULL
                                   There must be no spaces immediately
                                   preceeding or following the "=". Upper
                                   or lower case is permitted.
        
        LATTICE=X                  Where "X" is either P,A,B,C,I,F or R
                                   There must be no spaces immediately
                                   preceeding or following the "=". Upper
                                   or lower case is permitted for the word
                                   LATTICE, but only UPPER case for the
                                   single character symbol.
        
                                                        
        A, B, C, ALPHA, BETA, GAMMA      Unit cell constants, in angstroms and 
                                         degrees. Readable in free format, i.e.
                                         at least one blank or comma separating
                                         entries.
                                               
        NSYM                             Number of equivalent positions in the 
                                         space group. Do NOT include 
                                         additional translations associated 
                                         with centering conditions for 
                                         non-primitive lattices, i.e. for 
                                         space group C2  NSYM=2. (this entry 
                                         read in free format). 
        
           The  NSYM symmetry operators follow, one operator per line EXACTLY 
        as indicated in the International Tables for X-Ray Crystallography. 
        The first operator should ALWAYS be X,Y,Z. Note that for rhombohedral
        lattices the HEXAGONAL AXES AND SYMMETRY OPERATORS SHOULD BE USED,
        along with the lattice type R.
                                                          
        
        The following sample serves as a complete template for a parameter
        file, for space group P2(1)2(1)2(1)
        
        LOGFILE=seb.rlog
        LATTICE=P
        45.331 68.33 79.62 90. 90. 90.
        4
        X,Y,Z
        1/2-X,-Y,1/2+Z
        1/2+X,1/2-Y,-Z
        -X,1/2+Y,1/2-Z