quadserchk

by julia kowal last modified Apr 19, 2012 04:49 PM
Cross-correlation searching program.
C  QUADSERCHK
C
C   Remember to change version number in first write statement.
C       VX1.0   JMB     1988     MODIFIED FROM QUADSERCH2
C       VX1.1   RH      19.9.88  DIMENSIONS OF MDC, MDR EXPANDEDRA
C       VX1.2   RH      3.11.88  PLOT CHARACTERS CHANGED FOR SPEED.
C       VX1.3   RH     11.12.88  Changed plot characters, & profile printout.
C       VX1.4   RH     22.12.88  Performs profile fit over elliptical area.
C       VX1.5   RH       1.4.90  INCREASE KDC,KDR max dimensions.
C       VX1.6   RH       1.7.90  some useful control card instructions.
C       VX2.0   RH       1.1.92  convert to UNIX for Alliant
C       VX2.1   RH       9.7.94  test BIGFACTR to avoid edge of profile
C       VX2.2   RH      29.8.94  read in entire image to avoid diskio overhead
C       VX2.3   RH       3.9.94  test negative values BIGFACTR as above
C       VX2.4   RH      14.4.95  normalise PROFILE(avoid overflow)+9030 format
C       VX2.5   RH      29.4.95  add date and time to plots
C       VX2.6   RH       1.6.95  double precision CCFCALC summations
C       VX2.7   RH      25.7.95  ENCODE debug for Alpha
C       VX2.8   JMS     03.5.96  ARRAY put in common to be compatible with sgi
C       VX2.9   JMS    13.06.96  Variable NCALLPROF initialized to 0
C       VX3.0   RH     15.08.97  increase dimensions of search to 240
C       VX3.1   RH      4.12.97  optional real or reciprocal space latt params
C                                 input card 4 changed, therefore QUADSERCHC 
C       VX3.2   RH      11.3.98  add QUADSERCHC to plot title
C       VX4.0   RH      23.8.00  convert to plot2000 direct postscript output
C       VX5.0   HS     31.10.05  2dx
C
C  MODIFIED JUN 1987 TO HANDLE RECTANGULAR IMAGES.   JMB.
C  MODIFIED FROM PROFSERCH DEC 1986.   JMB.
C
C  NOW PREDICTS DIFFERENCE BETWEEN LATTICE POSITION AND SEARCH POSITION
C  FROM LOCAL AREA NEAR POINT, OF DIMENSIONS +/- NRANGE IN A AND B.
C  ON FIRST PASS ONLY THE AREA ALREADY PASSED IN THE SEARCH PROCEDURE
C  CONTAINS USEABLE INFORMATION; 
C  IN OPTIONAL SECOND PASS THE AREA AHEAD
C  OF THE CURRENT POINT CONTAINS USEABLE INFORMATION STORED FROM PASS 1.
C
C  CROSS-CORRELATION SEARCHING PROGRAM 15.8.84
C  SEARCHES A CROSS-CORRELATION MAP CALCULATED
C  SEPARATELY BY THE FFT METHOD BUT GIVES OUTPUT IN SIMILAR FORMAT
C  TO THE CORNELL REAL-SPACE PROGRAM CCOR.
C
C  THIS PROGRAM PRODUCES :-
C        1. The file 'PROFDATA'; it contains the data for use in CCUNBENDA.
C           First the information previously transferrd in file 'PIXPARMS';
C           Then the list of best correlation peak positions and the
C           heights of their correlation peaks.   
C        2. A plot of the lattice positions searched in which; 1) error 
C           vectors are shown X10; 2) peak heights are shown as grey levels.
C        3. The file 'ERRORS'; this contains a list of the differences
C           between actual positions of peaks and lattice positions. It
C           can be used in a second pass through this program if some
C           patches gave bad correlation peaks first time through and look
C           as if they could be improved with hindsight
C
C-------CORRELATION PEAKS ARE SEARCHED FOR AROUND THEIR
C-------EXPECTED POSITION BASED ON INPUT LATTICE PARAMETERS
C
C UNIX compile and link as below
C f77 -o quadserchb.exe quadserchb.for ${IMAGELIB}/imlib.a \ 
C                                          ${IMAGELIB}/genlib.a \
C                                          ${IMAGELIB}/plot82lib.a
C
C   FILE STRUCTURE IS
C     INPUT:
C
C     CARDS ON UNIT 5 : 
C       1       IPASS,NRANGE            ! controls search learning algorithm.
C       2       FILENAME                ! name of cross-correlation file
C       3       ISIZEX,ISIZEY           ! SIZE OF TRANSFORM
C       4       ASTR1,ASTR2,BSTR1,BSTR2,LREAL
C                                       ! Lattice vectors, real(T) or recip(F)
C       5       MINA,MAXA,MINB,MAXB     ! NUMBER UNIT CELLS TO SEARCH
C       6       KDC,KDR                 ! RADIUS OF CORR SEARCH
C       7       IC,IR                   ! POSN OF SEARCH START (0,0 IS ORIGIN)
C       8       IPRNT                   ! YES/NO FOR DETAILED PRINTOUT
C       9       RADLIMP,RADLIMQ,RADANGP ! ELLIPTICAL CUTOFF.
C
C         IPASS -0 no error input or output, simple search only.
C               -1 writes error file with peak positions for use in later pass.
C               -2 reads error file for use in better initial peak predict.
C               -3 reads and writes error file for use in better initial peak predict.
C         NRANGE- range of previous peaks used in prediction of next peak posn.
C         ISIZEX- size of transform in x-pixels (eg. 3000,3000)
C         ISIZEY-                  and y-pixels
C         ASTR1 - reciprocal space lattice vectors.
C         ASTR2 -       ""
C         BSTR1 -       ""
C         BSTR2 -       ""
C         LREAL - use real space params if T, recip space if F
C         MINA  - number of unit cells to search for in each direction from
C         MAXA  - search origin IC,IR  e.g.(-120,120,-120,120)
C         MINB  -   ""
C         MAXB  -   ""
C         KDC   - search over +/- this number of pixels on each side of the
C         KDR   - predicted centre of each correlation peak.
C         IC    - position of search origin for the first correlation peak
C         IR    - relative to corner of image at 0,0 -  e.g.(1500,1500)
C         IPRNT - more (Y) or less (N) printout
C         RADLIMP- radius for profile fit in profile units in one direction
C         RADLIMQ- same in orthogonal direction -- (20x smaller than pixels)
C         RADANGP- angle relative to x-axis of RADLIMP (elliptical)
C
C     INPUT FILES :
C         ERRORS      - (Created if IPASS=1); Read if IPASS=2,3; Contains
C                     - list of XERROR,YERROR,PEAK found when IPASS=1
C                     - not written or read if IPASS=0
C         ERROUT      - (Created if IPASS=3); Contains
C                     - list of XERROR,YERROR,PEAK found when IPASS=3
C                     - not written or read if IPASS=0v1
C         PROFILE     - Profile used for matching against correlation peaks.
C                     - This has been previously obtained from procedure
C                     - AUTOCORRL
C     OUTPUT FILES:
C         PROFDATA    - File contains;
C                     - Parameters to be transferred between programs,
C                     - including data read in here, maximum value of 
C                     - peak height, raw list of correlation peak positions
C                     - and heights produced by this program and to be used
C                     - by CCUNBENDA
C         ERRORS      - Produced when IPASS=1v2; File contains list of
C                        XERROR(IA,IB),YERROR(IA,IB),PEAK(IA,IB)
C