#!/bin/sh 
#   Program to calculate self rotation function.

set -e

polarrfn    				\
HKLIN  $CEXAM/toxd/toxd.mtz   \
MAPOUT $CCP4_SCR/self.map  plot $CCP4_SCR/polarrfn \
<< 'END-polarrfn'
TITLE self rotn
SELF  25 0 !Intergration radius & smoothing radius
MAP    ! Writes out map
LIMITS     0 90 5      0 180 5    15 190 5
# Start point(3) End Point(3) & interval(3)
RESOLUTION 10 5
CRYSTAL  FILE 1  ORTH 1 FLIM 0 10000 BFAC 0  
#  FILE HLKINi i
#  ORTH used with peak option, 1 brookland default
#  FLIMIT Maximum & Minimum F
#  BFAC used to sharpen data (0 (default) has no effect) 
LABI FILE 1 F=FTOXD3 SIGF=SIGFTOXD3
FIND 15 30  ! Threshold and number of peaks
NOPRINT
PLOT 10.0 10.0
END
END-polarrfn

# convert to PostScript
pltdev -i $CCP4_SCR/polarrfn.plo -o $CCP4_SCR/polarrfn.ps

# this generates a stereographic net to overlay on the plot

stnet plot $CCP4_SCR/net.plo
pltdev -i $CCP4_SCR/net.plo -o $CCP4_SCR/net.ps

rm -f $CCP4_SCR/polarrfn.plo $CCP4_SCR/net.plo
#