aboutsummaryrefslogtreecommitdiff
path: root/scripts/mtz2hkl
blob: e1c98251fd09fe1c446939cc7240ee1f962b5414 (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
#!/bin/sh

mtz2various hklin $1 hklout $2.temp <<EOF
LABIN H=H K=K L=L I=IMEAN SIGI=SIGIMEAN
OUTPUT USER '(3I4,2F15.1)'
EOF

perl < $2.temp > $2 << WIBBLE
use strict;

my \$line;
open(FILE, "$2.temp");

printf("CrystFEL reflection list version 2.0\n");
printf("Symmetry: 1\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;
                my \$sigi = \$5;

                printf("%4i %4i %4i %10.2f %s %10.2f %7i\n",
                       \$h, \$k, \$l, \$intensity, "       -", \$sigi, 1);

        } else {
		printf(STDERR "Couldn't understand line '%s'\n", \$line);
        }

}
close(FILE);
printf("End of reflections\n");
WIBBLE
exit