aboutsummaryrefslogtreecommitdiff
path: root/scripts/create-xscale
blob: 6d9def4acd83bed2aa3192238a675a3ea58cc31d (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
#!/usr/bin/perl -w

use strict;

# When you've edited the relevant parameters, delete this comment and the
# following two lines
printf("You need to edit this script first, to set the space group and ".
       "cell parameters.\n");
exit(1);

open(FH, $ARGV[0]);

printf("!FORMAT=XDS_ASCII   MERGE=TRUE   FRIEDEL'S_LAW=TRUE\n");
printf("!SPACE_GROUP_NUMBER=182\n");
printf("!UNIT_CELL_CONSTANTS=      281.00    281.00   165.00 90.000 90.000    120.000\n");
printf("!NUMBER_OF_ITEMS_IN_EACH_DATA_RECORD=5\n");
printf("!X-RAY_WAVELENGTH= -1.0\n");
printf("!ITEM_H=1\n");
printf("!ITEM_K=2\n");
printf("!ITEM_L=3\n");
printf("!ITEM_IOBS=4\n");
printf("!ITEM_SIGMA(IOBS)=5\n");
printf("!END_OF_HEADER\n");

my $line;
while ( $line = <FH> ) {

	chomp($line);

	if ( $line =~ /^\s+([0-9\-]+)\s+([0-9\-]+)\s+([0-9\-]+)\s+([0-9\.\-]+)\s+([\-]+)\s+([0-9\.\-]+)/ ) {

		my $h = $1;
		my $k = $2;
		my $l = $3;
		my $int = $4;
		my $sig = $6;  # Yes, it's meant to be $6 not $5 ($5 is phase)

		printf("%6i %6i %5i %9.2f %9.2f\n", $h, $k, $l, $int, $sig);

	} else {

		printf(STDERR "Unrecognised: '%s'\n", $line);

	}

}

printf("!END_OF_DATA");

close(FH);