2.22                     ********************
                                 * MAPORTH WRITE-UP *
                                 ********************
        
           This program orthogonalizes an electron density map for later use 
        with programs LSQROT or LSQROTGEN. This program is only needed if one 
        wants to refine the noncrystallographic symmetry operator(s), and even 
        then only if the unit cell is not orthogonal. One generally extracts a 
        region from the map encompassing one dimer, trimer etc. with MAPVIEW 
        or EXTRMAP, and inputs only the extracted map here for 
        orthogonalization. One can optionally othogonalize an input mask file 
        in addition to the map if desired, as may be the case if the mask will
        be used to delineate volumes to use in the refinement. 
        
                                 INPUT DATA (UNIT 5)
         
         CARD I      PAMFIL      (free format)
        
                     PAMFIL = Input file specifying cell parameters, symmetry,
                              used only to get "running log" file.
        
             
        
         CARD II     INPMAP      (free format)
        
                     INPMAP = Input (non-orthogonal) map, from EXTRMAP or 
                              MAPVIEW
        
        
        
         CARD III    IRANGE      (free format)
        
                 IRANGE     = 0 for normal operation.
        
                            = 1 to simply compute orthogonal coordinates for 
                              all points in input map, and ouput range (in
                              orthogonal coordinates) which just encompasses 
                              all of the input map. The range can then be used 
                              to determine map parameters for a subsequent run 
                              with IRANGE=0.
        
                                 
        
               ******** following CARDS read only if IRANGE = 0 ********
        
         CARD IV     OUTMAP      (free format)
        
                     OUTMAP = Output map file to contain orthogonal map.
                                                                        
        
        
         CARD V  a', b', c'      (free format)
        
               a'  =   Cell lengths (in angstroms) for the output orthogonal
                       map. They should be large enough to cover the same
               b'  =   volume as the input map, when it is referenced in the
                       orthogonal system. New orthogonal cell a',b',c' has a'
               c'  =   along old a, b' along old c* cross old a, c' along a'
                       cross b' ( i.e. old c*)
        
        
         
         CARD VI  MGX,MGY,MGZ,LXMN,LXMX,LYMN,LYMX,LZMN,LZMX       (free format)
        
        MGX = 
               Number of grid points defining one "cell length" along
        MGY =  the respective orthogonal axis. Implicitly defines grid
               spacing as del x = a'/MGX, del y = b'/MGY and del z = c'/MGZ
        MGZ =
        
        LXMN, LXMX =  
                     Minimum, maximum grid index defining output map region 
        LYMN, LYMX = such that  x (fractional) = LX * (del x) / a' etc. 
                     There are no restrictions on magnitudes or signs.
        LZMN, LZMX = 
        
        
        
         CARD VII     IMASK       (free format)
        
          IMASK    = 0 For no mask input.
                   = 1 for input mask corresponding to input map. The mask will
                     also be "orthogonalized" so that it can be used by LSQROT 
                     or LSQROTGEN.
        
                     
                 ******** following cards read ONLY if MASK=1 ********
        
         CARD VIII   INPMSK      (free format)
        
                     INPMSK = Input mask file, from MAPVIEW or EXTRMSK
        
        
        
         CARD IX     OUTMSK      (free format)
        
                     OUTMSK = Output (orthogonal) mask file
        
        
        
         NOTES:  If a mask is input, it must coincide exactly with the input 
                 map.
                                            
                             
                                ******** FILES ********
        
        
                 INPUT MAP FILE (BINARY) 
        
        record 1)  A,B,C,AL,BE,GA,NX,NY,NZ,IXMN,IYMN,IZMN,IXMX,IYMX,IZMX
        
        with first 6 values REAL*4, next 9 INTEGER*4, lengths in Angstroms,
        angles in degrees.
        
        NX = 
              Number of grid points defining one "cell length" along
        NY =  respective axis. Implicitly defines grid spacing as 
              del x = A/NX, del y = B/NY and del z = C/NZ
        NZ =
        
        IXMN, IXMX =  
                     Minimum, maximum grid index defining map region such
        IYMN, IYMX = that  x (fractional) = IX * (del x) / A  etc. 
                     There are no restrictions on magnitudes or signs.
        IZMN, IZMX = 
        
        The map follows as (IYMX-IYMN+1)*(IZMX-IZMN+1) records, with
        each containing one row (IXMX-IXMN+1 REAL*4 values) along X,
        starting at IXMN. Y is slowest varying, i.e. the file could have
        been created with the following FORTRAN code:
        
               DO 30 IY=IYMN,IYMX
               DO 20 IZ=IZMN,IZMX
        20     WRITE(LU)(RHO(IX,IY,IZ),IX=IXMN,IXMX)
        30     CONTINUE
        
        
        
                INPUT MASK FILE (BINARY) 
        
        Header record identical to map file.
        
        Mask records similar to normal map records except that
        the mask values are written as FORTRAN type "BYTE" (INTEGER*1).
        Only grid points with mask values of 0, 10, 20, 30, 40 etc will
        be transformed (i.e. inside envelope masks 1,2,3,4,5 etc,
        respectively).
        
                                                   
        
                OUTPUT MAP FILE (BINARY) 
        
        Identical (in structure) to input map file, but cell, map and
        density values correspond to the orthogonal "cell".
                                                     
        
                OUTPUT MASK FILE (BINARY) 
        
        Header record identical to map file.
        
        Mask records similar to normal MASK records, but cell, map and
        mask values correspond to the orthogonal "cell".