-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenhkl.m
77 lines (64 loc) · 1.6 KB
/
genhkl.m
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
% Generate reflections up to maximum sin(theta)/lambda (sintlmax)
% The program follows the method described in:
% Le Page and Gabe (1979) J. Appl. Cryst., 12, 464-466
function HALL = genhkl(cell,sysconditions,sintlmax)
SEG(:,:,1) = [ 0 0 0; 1 0 0; 0 1 0; 0 0 1];
SEG(:,:,2) = [-1 0 1; -1 0 0; 0 1 0; 0 0 1];
SEG(:,:,3) = [-1 1 0; -1 0 0; 0 1 0; 0 0 -1];
SEG(:,:,4) = [ 0 1 -1; 1 0 0; 0 1 0; 0 0 -1];
nref = 0;
H =[]; % Data of half sphere
HALL =[]; % Friedel mates included
STLALL = [];
sintlH = 0.0;
for i=1:4
segn = i;
% initialize the identifiers
htest = 0;
ktest = 0;
ltest = 0;
HLAST =SEG(1,:,segn);
HSAVE= HLAST;
sintlH=sintl(cell,HSAVE);
while ltest == 0
while ktest == 0
while htest == 0
nref = nref+1;
if nref ~= 1
if sysabs(HLAST,sysconditions) == 0
H=[H; HLAST];
HALL =[HALL; HLAST; -HLAST];
STLALL = [STLALL sintlH sintlH];
else
nref=nref-1;
end
end
HNEW = HLAST+SEG(2,:,segn);
sintlH=sintl(cell,HNEW);
if sintlH <= sintlmax
HLAST = HNEW;
else
htest = 1;
end
end
HLAST(1) = HSAVE(1);
HLAST = HLAST + SEG(3,:,segn);
HNEW = HLAST;
sintlH=sintl(cell,HNEW);
if sintlH > sintlmax
ktest = 1;
end
htest = 0;
end
HLAST(2) = HSAVE(2);
HLAST = HLAST + SEG(4,:,segn);
HNEW = HLAST;
sintlH=sintl(cell,HNEW);
if sintlH > sintlmax
ltest = 1;
end
ktest = 0;
end
end
nref = (nref -1)*2;
HALL = [HALL STLALL'];