aboutsummaryrefslogtreecommitdiff
path: root/scripts/create-mtz
blob: 684914a8b991c9aa950164995b97790997dddf91 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh

OUTFILE=`echo $1 | sed -e 's/\.hkl$/.mtz/'`
TMPFILE=`echo $1 | sed -e 's/\.hkl$/.temp.mtz/'`
PDB=../1JB0.pdb

echo " Input: $1"
echo "Output: $OUTFILE"
if [ -e $TMPFILE -o -e $OUTFILE ]; then
	echo "   I'm about to write to the following files, but one or more"
	echo "   of them already exist:"
	echo "   " $TMPFILE
	echo "   " $OUTFILE
	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


# PS1: CELL 281 281 165.2  90  90 120
# Start by putting the CrystFEL intensities into an MTZ file
echo "Running 'f2mtz'..."
f2mtz HKLIN $1 HKLOUT $TMPFILE > out.html << EOF
TITLE Reflections from CrystFEL
NAME PROJECT wibble CRYSTAL wibble DATASET wibble
CELL 139 232 309  90  90 90
SYMM P1
SKIP 1
LABOUT H K L IMEAN SIGIMEAN
CTYPE  H H H J     Q
FORMAT '(F3.0,1X,F3.0,1X,F3.0,1X,F10.2,10X,F10.2)'
EOF

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

# Get the unit cell contents
echo "Running 'rwcontents'..."
rwcontents XYZIN $PDB >> out.html << EOF
NHOH 2.3 lowt
EOF

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


# Run 'truncate' to turn Is into Fs
echo "Running 'truncate'..."
truncate HKLIN $TMPFILE HKLOUT $OUTFILE >> out.html << EOF
TRUNCATE NO
LABIN H=H K=K L=L IMEAN=IMEAN SIGIMEAN=SIGIMEAN
LABOUT H=H K=K L=L IMEAN=IMEAN SIGIMEAN=SIGIMEAN F=F SIGF=SIGF
CONTENTS C 16938  N 3310  O 3548  MG 96  P 3  S 89  CA 1  FE 12  H 17645
EOF

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

rm -f $TMPFILE
echo "Done."