aboutsummaryrefslogtreecommitdiff
path: root/scripts/create-mtz
blob: c51454e6d98aa9c4f1fd8efd001c7054bfafdea5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

OUTFILE=`echo $1 | sed -e 's/\.hkl$/.mtz/'`
TMPHKL=`echo $1 | sed -e 's/\.hkl$/.temp.hkl/'`

echo " Input: $1"
echo "Output: $OUTFILE"
if [ -e $TMPHKL -o -e $OUTFILE ]; then
	echo "   I'm about to write to the following files, but one or more"
	echo "   of them already exist:"
	echo "   " $OUTFILE
	echo "   " $TMPHKL
	echo "   To confirm that you want to continue, which will DESTROY the"
	echo "   current contents of these files, type 'y' and press enter."
	read conf
	if [ $conf != y ]; then
		echo "Not confirmed."
		exit 1
	else
		echo "Proceeding"
	fi
fi

grep -v "End of reflections" $1 > $TMPHKL

echo "Running 'f2mtz'..."
f2mtz HKLIN $TMPHKL HKLOUT $OUTFILE > out.html << EOF
TITLE Reflections from CrystFEL
NAME PROJECT wibble CRYSTAL wibble DATASET wibble
CELL 100 100 100  90  90 90
SYMM P1
SKIP 1
LABOUT H K L IMEAN SIGIMEAN
CTYPE  H H H J     Q
FORMAT '(3(F3.0,1X),F10.2,10X,F10.2)'
EOF

if [ $? -ne 0 ]; then echo "Failed."; exit; fi

echo "Done."