blob: baadbf274bd7d486f83963a2c397b29ca7908bbd (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#!/bin/sh
PDB=$1
SYMM=$2
RESOLUTION=$3
PG=$4
if [ "x$PDB" = "x" ]; then
echo "Syntax: $0 <PDB file> <space group> [<resolution>] [<point group>]"
echo
echo "The space group and point group must be consistent, it's just"
echo "that I don't know how to convert the space group to a point"
echo "group."
exit
fi
if [ "x$SYMM" = "x" ]; then
echo "Syntax: $0 <PDB file> <space group> [<resolution>]"
exit
fi
if [ "x$RESOLUTION" = "x" ]; then
echo "Resolution not given. Using 3 Angstroms."
RESOLUTION=3
fi
if [ "x$PG" = "x" ]; then
echo "Point group not given. Output will not contain symmetry information."
PG=unknown
fi
echo "Running sfall to calculate structure factors..."
sfall XYZIN $PDB HKLOUT ${PDB}.mtz > gen-sfs.html << EOF
MODE SFCALC XYZIN
RESOLUTION $RESOLUTION 1000
FORM NGAUSS 5
SYMM $SYMM
END
EOF
if [ $? -ne 0 ]; then
echo "Failed! Please examine gen-sfs.html for more information."
exit 1
fi
echo "Running cad to get the right asymmetric unit..."
cad HKLIN1 ${PDB}.mtz HKLOUT ${PDB}-sorted.mtz >> gen-sfs.html <<EOF
TITLE Sorted blah
LABIN FILE 1 E1=FC E2=PHIC
CTYPE FILE 1 E1=F E2=P
EOF
if [ $? -ne 0 ]; then
echo "Failed! Please examine gen-sfs.html for more information."
exit 1
fi
echo "Running sftools to expand reflections to P1..."
sftools << EOF
READ ${PDB}-sorted.mtz
EXPAND
WRITE ${PDB}-P1.mtz
STOP
EOF
echo "Converting structure factors to text..."
mtz2various hklin ${PDB}-P1.mtz hklout ${PDB}-temp.hkl >> gen-sfs.html <<EOF
LABIN H=H K=K L=L FC=FC PHIC=PHIC
OUTPUT USER '(3I6,2F9.1)'
EOF
if [ $? -ne 0 ]; then
echo "Failed! Please examine gen-sfs.html for more information."
exit 1
fi
rm -f ${PDB}-P1.mtz
rm -f ${PDB}.mtz
perl < ${PDB}-temp.hkl > ${PDB}.hkl << WIBBLE
use strict;
my \$line;
open(FILE, "${PDB}-temp.hkl");
printf("CrystFEL reflection list version 2.0\n");
printf("Symmetry: ${PG}\n");
printf(" h k l I phase sigma(I) nmeas\n");
while ( \$line = <FILE> ) {
if ( \$line =~ /^\s*([\d\-]+)\s+([\d\-]+)\s+([\d\-]+)\s+([\d\-\.]+)\s+([\d\-\.]+)/ ) {
my \$h = \$1;
my \$k = \$2;
my \$l = \$3;
my \$intensity = \$4*\$4; # Square to convert F->I
my \$phase = \$5;
printf("%4i %4i %4i %10.2f %8.2f %10.2f %7i\n",
\$h, \$k, \$l, \$intensity, \$phase, 0.0, 1);
} else {
printf(STDERR "Couldn't understand line '%s'\n", \$line);
}
}
close(FILE);
printf("End of reflections\n");
WIBBLE
exit
rm -f ${PDB}-temp.hkl
|