#!/bin/sh 
#
# Run truncate after scala to give F's from intensities
# 
set -e

# bug # 3192 - run-all examples produce harvest files - well to counteract
# this here set HARVESTHOME to somewhere in $CCP4_SCR

HARVESTHOME=$CCP4_SCR
export HARVESTHOME

na4tomtz hklin $CEXAM/data/aucn.na4 hklout $CCP4_SCR/aucn

#
# first need to sort mtz file output from mosflm or combat
#
sortmtz hklin $CCP4_SCR/aucn.mtz hklout $CCP4_SCR/aucn_sor.mtz <<EOF-sort
H K L M/ISYM BATCH I SIGI
EOF-sort
#
# Scala - calculating batch scale factors & merging
# Simple case - single scale and B factor for each batch
# see $CEXAM/unix/non-runnable/scala.exam for other examples
#
scala hklin $CCP4_SCR/aucn_sor.mtz \
      hklout   $CCP4_SCR/aucn_mrg.mtz \
      scales   $CCP4_SCR/aucn.scales \
      rogues   $CCP4_SCR/aucn.rogues \
      normplot $CCP4_SCR/aucn.norm \
      anomplot $CCP4_SCR/aucn.anom \
       << eof-scala
run 1 all
sdcorr  1.8 0.02
scales batch  bfactor on
output unmerged
anomalous on
eof-scala

chef hklin1 $CCP4_SCR/aucn_mrg.mtz  <<EOF-chef
labin BASE = BATCH
print comp rdcu
range width 1 max 10
end
EOF-chef



