-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsginfo_loop_symops.html
executable file
·82 lines (68 loc) · 2.08 KB
/
sginfo_loop_symops.html
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
<html>
<head>
<title>SgInfo Loop SymOps</title>
</head>
<body>
<h2>SgInfo Loop SymOps</h2>
<p>The following template code shows how to loop all
symops.
<p>At first, <samp>nLoopInv</samp> is set using the
<samp>Sg_nLoopInv</samp> macro. <samp>nLoopInv</samp>
can take two values, <samp>1</samp> if the space
group is acentric or there is an inversion operation
off origin, or <samp>2</samp> if the space group
is centric.
<p><samp>iModPositive(i, j)</samp>
at the bottom is a very simple function which
essentially returns <samp>i % j</samp>. However,
if <samp>i % j</samp> is less than <samp>0</samp>,
<samp>iModPositive()</samp> will return
<samp>i % j + j</samp> in order to make the
result positive. In the present example
<samp>iModPositive()</samp> ensures that the
translation components of <samp>SMx</samp>
will always be in the range <samp>[0...(STBF-1)]</samp>.
<p>This isn't too bad, is it?
<hr>
<pre>
#include <stdio.h>
#include <stdlib.h>
#include "sginfo.h"
static void LoopSymOps(const T_SgInfo *SgInfo)
{
int iList, f, i;
int nTrV, iTrV, nLoopInv, iLoopInv;
const int *TrV;
T_RTMx SMx;
const T_RTMx *lsmx;
nLoopInv = Sg_nLoopInv(SgInfo);
nTrV = SgInfo->LatticeInfo->nTrVector;
TrV = SgInfo->LatticeInfo->TrVector;
for (iTrV = 0; iTrV < nTrV; iTrV++, TrV += 3)
{
for (iLoopInv = 0; iLoopInv < nLoopInv; iLoopInv++)
{
if (iLoopInv == 0) f = 1;
else f = -1;
lsmx = SgInfo->ListSeitzMx;
for (iList = 0; iList < SgInfo->nList; iList++, lsmx++)
{
for (i = 0; i < 9; i++)
SMx.s.R[i] = f * lsmx->s.R[i];
for (i = 0; i < 3; i++)
SMx.s.T[i] = <a name="#iModPositive">iModPositive</a>(f * lsmx->s.T[i] + TrV[i], STBF);
/* use SMx at this point
*/
}
}
}
}
</pre>
<hr>
<address>
Ralf W. Grosse-Kunstleve
<<a href="mailto:rwgkio+sginfo@gmail.com"
>rwgkio+sginfo@gmail.com</a>>
</address>
</body>
</html>