#!/usr/bin/env sh
FILE1=$1
FILE2=$2
OUTPUT_FILE=$3
if [ -z "$FILE1" -o -z "$FILE2" -o -z "$OUTPUT_FILE" ]
then
echo "convert_to_mtz.sh IN_FILE1.cif IN_FILE2.cif OUT_FILE.mtz"
exit 1
fi
FILE1_MTZ=$FILE1.mtz
FILE2_MTZ=$FILE2.mtz
echo "converting ${FILE1} to MTZ"
cif2mtz hklin $FILE1 hklout $FILE1_MTZ <<eof
END
eof
echo "converting ${FILE2} to MTZ"
cif2mtz hklin $FILE2 hklout $FILE2_MTZ <<eof
END
eof
echo "merging ${FILE1_MTZ} and ${FILE2_MTZ} to ${OUTPUT_FILE}"
mtzutils hklin1 $FILE1_MTZ hklin2 $FILE2_MTZ hklout $OUTPUT_FILE <<eof
EXCLUDE 2 FOM
END
eof