symcrys 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +11 -2
  2. package/dist/plane.d.ts +262 -0
  3. package/dist/plane.d.ts.map +1 -0
  4. package/dist/plane.js +300 -0
  5. package/dist/plane.js.map +1 -0
  6. package/dist/spaceGroups/affine.d.ts +81 -0
  7. package/dist/spaceGroups/affine.d.ts.map +1 -0
  8. package/dist/spaceGroups/affine.js +245 -0
  9. package/dist/spaceGroups/affine.js.map +1 -0
  10. package/dist/spaceGroups/cell.d.ts +60 -0
  11. package/dist/spaceGroups/cell.d.ts.map +1 -0
  12. package/dist/spaceGroups/cell.js +305 -0
  13. package/dist/spaceGroups/cell.js.map +1 -0
  14. package/dist/spaceGroups/describe.d.ts +51 -0
  15. package/dist/spaceGroups/describe.d.ts.map +1 -0
  16. package/dist/spaceGroups/describe.js +101 -0
  17. package/dist/spaceGroups/describe.js.map +1 -0
  18. package/dist/spaceGroups/planeGroupData.d.ts +44 -0
  19. package/dist/spaceGroups/planeGroupData.d.ts.map +1 -0
  20. package/dist/spaceGroups/planeGroupData.js +371 -0
  21. package/dist/spaceGroups/planeGroupData.js.map +1 -0
  22. package/dist/spaceGroups/planeGroups.d.ts +28 -0
  23. package/dist/spaceGroups/planeGroups.d.ts.map +1 -0
  24. package/dist/spaceGroups/planeGroups.js +61 -0
  25. package/dist/spaceGroups/planeGroups.js.map +1 -0
  26. package/dist/spaceGroups/planePointGroups.d.ts +31 -0
  27. package/dist/spaceGroups/planePointGroups.d.ts.map +1 -0
  28. package/dist/spaceGroups/planePointGroups.js +77 -0
  29. package/dist/spaceGroups/planePointGroups.js.map +1 -0
  30. package/dist/spaceGroups/positions.d.ts +65 -0
  31. package/dist/spaceGroups/positions.d.ts.map +1 -0
  32. package/dist/spaceGroups/positions.js +200 -0
  33. package/dist/spaceGroups/positions.js.map +1 -0
  34. package/dist/spaceGroups/rational.d.ts +43 -0
  35. package/dist/spaceGroups/rational.d.ts.map +1 -0
  36. package/dist/spaceGroups/rational.js +95 -0
  37. package/dist/spaceGroups/rational.js.map +1 -0
  38. package/dist/spaceGroups/snap.d.ts +20 -0
  39. package/dist/spaceGroups/snap.d.ts.map +1 -0
  40. package/dist/spaceGroups/snap.js +103 -0
  41. package/dist/spaceGroups/snap.js.map +1 -0
  42. package/dist/version.d.ts +1 -1
  43. package/dist/version.d.ts.map +1 -1
  44. package/dist/version.js +1 -1
  45. package/dist/version.js.map +1 -1
  46. package/package.json +7 -2
  47. package/src/plane.ts +562 -0
  48. package/src/spaceGroups/affine.ts +315 -0
  49. package/src/spaceGroups/cell.ts +382 -0
  50. package/src/spaceGroups/describe.ts +149 -0
  51. package/src/spaceGroups/planeGroupData.ts +407 -0
  52. package/src/spaceGroups/planeGroups.ts +75 -0
  53. package/src/spaceGroups/planePointGroups.ts +90 -0
  54. package/src/spaceGroups/positions.ts +267 -0
  55. package/src/spaceGroups/rational.ts +115 -0
  56. package/src/spaceGroups/snap.ts +121 -0
  57. package/src/version.ts +1 -1
@@ -0,0 +1,305 @@
1
+ /**
2
+ * The asymmetric unit of a plane group and its symmetry elements in the conventional cell, as numbers
3
+ * (CLAUDE.md, "The API of `symcrys/plane`"): the asymmetric unit as inequalities with its vertices,
4
+ * the elements as rotation centres with their order and as mirror and glide lines with the segment
5
+ * that lies in the cell [0, 1]². Exact, in the lattice basis; drawing them stays with the
6
+ * applications. Internal for now.
7
+ */
8
+ import {} from './affine.js';
9
+ import { describePlaneOperation } from './describe.js';
10
+ import { planeGroupEntry, planeGroupOperations } from './planeGroups.js';
11
+ import { ONE, safeProduct, safeSum, ZERO, add, multiply, parseRational, rational, rationalsEqual, scale, subtract, toNumber, } from './rational.js';
12
+ const linAdd = (p, q) => [add(p[0], q[0]), add(p[1], q[1]), add(p[2], q[2])];
13
+ const linScale = (k, p) => [multiply(k, p[0]), multiply(k, p[1]), multiply(k, p[2])];
14
+ const isConstant = (p) => p[0][0] === 0 && p[1][0] === 0;
15
+ /**
16
+ * Reads a linear expression as ITA prints the bounds of an asymmetric unit: `x`, `2/3`, `1/2 - x`,
17
+ * `(1 + y)/2`, `x/2`, `2x`. Throws on anything else.
18
+ */
19
+ function parseLinear(text) {
20
+ const s = text.replace(/\s+/g, '');
21
+ let i = 0;
22
+ const fail = () => {
23
+ throw new RangeError(`Cannot read the linear expression "${text}"`);
24
+ };
25
+ function number() {
26
+ const m = /^\d+(?:\/\d+)?/.exec(s.slice(i));
27
+ if (!m)
28
+ return undefined;
29
+ i += m[0].length;
30
+ return parseRational(m[0]);
31
+ }
32
+ function factor() {
33
+ if (s[i] === '(') {
34
+ i++;
35
+ const e = sum();
36
+ if (s[i++] !== ')')
37
+ fail();
38
+ return e;
39
+ }
40
+ const k = number();
41
+ if (s[i] === 'x' || s[i] === 'y') {
42
+ const v = s[i++];
43
+ const c = k ?? ONE;
44
+ return v === 'x' ? [c, ZERO, ZERO] : [ZERO, c, ZERO];
45
+ }
46
+ if (k === undefined)
47
+ return fail();
48
+ return [ZERO, ZERO, k];
49
+ }
50
+ function term() {
51
+ let e = factor();
52
+ while (s[i] === '/') {
53
+ i++;
54
+ const d = number() ?? fail();
55
+ e = linScale(rational(d[1], d[0]), e);
56
+ }
57
+ return e;
58
+ }
59
+ function sum() {
60
+ let sign = 1;
61
+ if (s[i] === '-' || s[i] === '+')
62
+ sign = s[i++] === '-' ? -1 : 1;
63
+ let e = linScale(rational(sign), term());
64
+ while (s[i] === '+' || s[i] === '-') {
65
+ const k = s[i++] === '-' ? -1 : 1;
66
+ e = linAdd(e, linScale(rational(k), term()));
67
+ }
68
+ return e;
69
+ }
70
+ const e = sum();
71
+ if (i !== s.length)
72
+ fail();
73
+ return e;
74
+ }
75
+ function gcd(a, b) {
76
+ return b === 0 ? Math.abs(a) : gcd(b, a % b);
77
+ }
78
+ /** p ≤ 0 as an inequality with integer coefficients without a common factor. */
79
+ function toInequality(p) {
80
+ const lcm = p.reduce((l, r) => safeProduct(l, r[1]) / gcd(l, r[1]), 1);
81
+ const [a, b, c0] = p.map((r) => safeProduct(r[0], lcm / r[1]));
82
+ const g = gcd(gcd(a, b), c0) || 1;
83
+ return [a / g + 0, b / g + 0, -c0 / g + 0];
84
+ }
85
+ /** Reads the printed block "Asymmetric unit", e.g. `0 <= x <= 1/2; y <= min(1 - x, (1 + x)/2)`. */
86
+ export function parseAsymmetricUnit(text) {
87
+ const out = [];
88
+ for (const clause of text.split(';')) {
89
+ const sides = clause.split('<=').map((side) => {
90
+ const m = /^\s*min\((.*)\)\s*$/.exec(side);
91
+ if (!m)
92
+ return [parseLinear(side)];
93
+ // min(A, B): split at the comma outside parentheses.
94
+ let depth = 0;
95
+ const inner = m[1];
96
+ for (let k = 0; k < inner.length; k++) {
97
+ if (inner[k] === '(')
98
+ depth++;
99
+ else if (inner[k] === ')')
100
+ depth--;
101
+ else if (inner[k] === ',' && depth === 0)
102
+ return [parseLinear(inner.slice(0, k)), parseLinear(inner.slice(k + 1))];
103
+ }
104
+ throw new RangeError(`Cannot read "${side}"`);
105
+ });
106
+ if (sides.length < 2)
107
+ throw new RangeError(`Not an inequality: "${clause}"`);
108
+ for (let k = 0; k + 1 < sides.length; k++) {
109
+ for (const lhs of sides[k]) {
110
+ for (const rhs of sides[k + 1]) {
111
+ const p = linAdd(lhs, linScale(rational(-1), rhs));
112
+ if (isConstant(p))
113
+ throw new RangeError(`No variable in "${clause}"`);
114
+ out.push(toInequality(p));
115
+ }
116
+ }
117
+ }
118
+ }
119
+ return out;
120
+ }
121
+ const r = (n) => rational(n);
122
+ /** a·x + b·y − c for a point. */
123
+ const excess = (q, p) => subtract(add(scale(q[0], p[0]), scale(q[1], p[1])), r(q[2]));
124
+ /** The vertices of the polygon {q_i ≤ 0}, counter-clockwise from the lowest (y, then x). */
125
+ function polygon(inequalities) {
126
+ const points = [];
127
+ for (let i = 0; i < inequalities.length; i++) {
128
+ for (let j = i + 1; j < inequalities.length; j++) {
129
+ const [a1, b1, c1] = inequalities[i];
130
+ const [a2, b2, c2] = inequalities[j];
131
+ const cross = (u, v, x, y) => safeSum(safeProduct(u, v), -safeProduct(x, y));
132
+ const det = cross(a1, b2, a2, b1);
133
+ if (det === 0)
134
+ continue;
135
+ const p = [rational(cross(c1, b2, c2, b1), det), rational(cross(a1, c2, a2, c1), det)];
136
+ if (inequalities.every((q) => excess(q, p)[0] <= 0) && !points.some((v) => samePoint(v, p)))
137
+ points.push(p);
138
+ }
139
+ }
140
+ if (points.length < 3)
141
+ throw new RangeError('The asymmetric unit is not a polygon');
142
+ const cx = points.reduce((s, p) => s + toNumber(p[0]), 0) / points.length;
143
+ const cy = points.reduce((s, p) => s + toNumber(p[1]), 0) / points.length;
144
+ const angle = (p) => Math.atan2(toNumber(p[1]) - cy, toNumber(p[0]) - cx);
145
+ points.sort((p, q) => angle(p) - angle(q));
146
+ const lowest = points.reduce((k, p, i) => {
147
+ const q = points[k];
148
+ const dy = toNumber(subtract(p[1], q[1]));
149
+ return dy < 0 || (dy === 0 && toNumber(subtract(p[0], q[0])) < 0) ? i : k;
150
+ }, 0);
151
+ return [...points.slice(lowest), ...points.slice(0, lowest)];
152
+ }
153
+ const samePoint = (p, q) => rationalsEqual(p[0], q[0]) && rationalsEqual(p[1], q[1]);
154
+ const unitCache = new Map();
155
+ /**
156
+ * The asymmetric unit of a plane group as ITA prints it, a convex polygon: its vertices and, for each
157
+ * edge, the inequality a·x + b·y ≤ c that holds it. Printed inequalities that hold no edge are
158
+ * left out. Frozen.
159
+ */
160
+ export function planeAsymmetricUnit(key) {
161
+ const entry = planeGroupEntry(key);
162
+ let unit = unitCache.get(entry.symbol);
163
+ if (!unit) {
164
+ const printed = parseAsymmetricUnit(entry.asymmetricUnit);
165
+ const vertices = polygon(printed);
166
+ const inequalities = vertices.map((p, i) => {
167
+ const q = vertices[(i + 1) % vertices.length];
168
+ const edge = printed.find((e) => excess(e, p)[0] === 0 && excess(e, q)[0] === 0);
169
+ if (!edge)
170
+ throw new Error(`No printed inequality of ${entry.symbol} holds an edge`);
171
+ return Object.freeze(edge);
172
+ });
173
+ unit = Object.freeze({
174
+ vertices: Object.freeze(vertices.map((v) => Object.freeze(v))),
175
+ inequalities: Object.freeze(inequalities),
176
+ });
177
+ unitCache.set(entry.symbol, unit);
178
+ }
179
+ return unit;
180
+ }
181
+ // ---------------------------------------------------------------------------------------------
182
+ // Symmetry elements in the cell
183
+ const inCell = (p) => p.every((v) => v[0] >= 0 && v[0] <= v[1]);
184
+ /**
185
+ * The lattice shifts t, |t_i| ≤ 3, added to each coset representative (W, w), w in [0, 1). Enough to
186
+ * reach every element that meets the cell: a centre p in [0, 1]² of (W, w + t) has
187
+ * t = (I − W)p − w, and the entries of I − W (at most 2 on the diagonal, 1 off it) give
188
+ * (I − W)p in [−2, 3]; a line through p in the cell, taken with its glide g along it reduced to
189
+ * g = d/2 (in a plane group s is 0 or 1/2, and |d_i| ≤ 2, so |g_i| ≤ 1), has t = (I − W)p + g − w, where for a reflection (I − W)p lies in [−1, 2].
190
+ */
191
+ const SHIFTS = [];
192
+ for (let i = -3; i <= 3; i++)
193
+ for (let j = -3; j <= 3; j++)
194
+ SHIFTS.push([r(i), r(j)]);
195
+ /**
196
+ * The segment of the line through p along d in [0, 1]², or undefined if it has no length there.
197
+ * Exact: the parameter λ of p + λd is bounded by each coordinate.
198
+ */
199
+ function clip(p, d) {
200
+ let lo;
201
+ let hi;
202
+ for (let k = 0; k < 2; k++) {
203
+ if (d[k] === 0) {
204
+ if (p[k][0] < 0 || p[k][0] > p[k][1])
205
+ return undefined;
206
+ continue;
207
+ }
208
+ // 0 ≤ p_k + λ d_k ≤ 1
209
+ const a = rational(-p[k][0], p[k][1] * d[k]);
210
+ const b = rational(p[k][1] - p[k][0], p[k][1] * d[k]);
211
+ const [l, h] = d[k] > 0 ? [a, b] : [b, a];
212
+ if (lo === undefined || toNumber(subtract(l, lo)) > 0)
213
+ lo = l;
214
+ if (hi === undefined || toNumber(subtract(h, hi)) < 0)
215
+ hi = h;
216
+ }
217
+ if (lo === undefined || hi === undefined || toNumber(subtract(hi, lo)) <= 0)
218
+ return undefined;
219
+ const at = (lambda) => [add(p[0], scale(d[0], lambda)), add(p[1], scale(d[1], lambda))];
220
+ return [at(lo), at(hi)];
221
+ }
222
+ /** s mod 1 in [0, 1). */
223
+ function frac(s) {
224
+ const n = Math.floor(s[0] / s[1]);
225
+ return subtract(s, r(n));
226
+ }
227
+ const elementCache = new Map();
228
+ /**
229
+ * The symmetry elements of a plane group in its conventional cell [0, 1]², boundary included: every
230
+ * rotation centre with the highest order of a rotation about it, and every mirror and glide line
231
+ * that crosses the cell, with the segment inside it. A line that carries a glide is a glide line
232
+ * with its shortest glide vector along the line (between 0 and the lattice vector). Frozen.
233
+ */
234
+ export function planeCellElements(key) {
235
+ const entry = planeGroupEntry(key);
236
+ const cached = elementCache.get(entry.symbol);
237
+ if (cached)
238
+ return cached;
239
+ const rotations = [];
240
+ const lines = [];
241
+ for (const op of planeGroupOperations(entry.symbol)) {
242
+ for (const t of SHIFTS) {
243
+ const shifted = {
244
+ matrix: op.matrix,
245
+ translation: [add(op.translation[0], t[0]), add(op.translation[1], t[1])],
246
+ };
247
+ const d = describePlaneOperation(shifted);
248
+ if (d.kind === 'rotation') {
249
+ const p = [...(d.location ?? [])];
250
+ if (!inCell(p))
251
+ continue;
252
+ const known = rotations.find((x) => samePoint(x.point, p));
253
+ if (!known)
254
+ rotations.push({ order: d.order, point: p });
255
+ else
256
+ known.order = Math.max(known.order, d.order);
257
+ }
258
+ else if (d.kind === 'mirror' || d.kind === 'glide') {
259
+ const dir = d.direction ?? [0, 0];
260
+ const p = d.location ?? [];
261
+ // The glide vector is s·dir; s modulo 1, since a lattice translation along the line changes nothing.
262
+ const g = d.glide ?? [ZERO, ZERO];
263
+ const s = frac(dir[0] !== 0 ? rational(g[0][0], g[0][1] * dir[0]) : rational(g[1][0], g[1][1] * dir[1]));
264
+ // The line is the set of x with (−dir_y, dir_x)·x = c.
265
+ const c = add(scale(-dir[1], p[0]), scale(dir[0], p[1]));
266
+ if (lines.some((l) => l.direction[0] === dir[0] &&
267
+ l.direction[1] === dir[1] &&
268
+ rationalsEqual(l.c, c) &&
269
+ rationalsEqual(l.s, s))) {
270
+ continue;
271
+ }
272
+ const segment = clip(p, dir);
273
+ if (!segment)
274
+ continue;
275
+ lines.push({
276
+ kind: s[0] === 0 ? 'mirror' : 'glide',
277
+ direction: [dir[0], dir[1]],
278
+ normal: d.normal ?? [0, 0],
279
+ s,
280
+ c,
281
+ segment,
282
+ });
283
+ }
284
+ }
285
+ }
286
+ const num = (v) => toNumber(v);
287
+ rotations.sort((a, b) => b.order - a.order || num(a.point[1]) - num(b.point[1]) || num(a.point[0]) - num(b.point[0]));
288
+ lines.sort((a, b) => a.direction[0] - b.direction[0] ||
289
+ a.direction[1] - b.direction[1] ||
290
+ num(a.segment[0][1]) - num(b.segment[0][1]) ||
291
+ num(a.segment[0][0]) - num(b.segment[0][0]));
292
+ const result = Object.freeze({
293
+ rotations: Object.freeze(rotations.map((x) => Object.freeze({ order: x.order, point: Object.freeze(x.point) }))),
294
+ lines: Object.freeze(lines.map((l) => Object.freeze({
295
+ kind: l.kind,
296
+ direction: Object.freeze(l.direction),
297
+ normal: Object.freeze([...l.normal]),
298
+ glide: Object.freeze([scale(l.direction[0], l.s), scale(l.direction[1], l.s)]),
299
+ segment: Object.freeze(l.segment.map((p) => Object.freeze([...p]))),
300
+ }))),
301
+ });
302
+ elementCache.set(entry.symbol, result);
303
+ return result;
304
+ }
305
+ //# sourceMappingURL=cell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell.js","sourceRoot":"","sources":["../../src/spaceGroups/cell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAuB,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBA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AAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QAChH,KAAK,EAAE,MAAM,CAAC,MAAM,CAClB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACd,MAAM,CAAC,MAAM,CAAC;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAA8B;YAClE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAA8B;YACjE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9E,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAuC;SAC1G,CAAC,CACH,CACF;KACF,CAAC,CAAC;IACH,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The geometric description of an operation of a plane group, as ITA gives it under "Symmetry
3
+ * operations" (ITA 2016, § 2.1.3.9, pp. 160–161): what it is, its order and sense, where its
4
+ * symmetry element lies and its glide part. Structured data; the symbols such as `g(1/2,1/2) x,x`
5
+ * stay with the applications (CLAUDE.md, "Symmetry elements as structured data").
6
+ */
7
+ import { type ExactOperation } from './affine.js';
8
+ import { type Rational } from './rational.js';
9
+ /**
10
+ * What an operation of a plane group is: `'mirror'` (a reflection in a line, as `'mirror'` of the
11
+ * point groups) and `'glide'` (a glide reflection).
12
+ */
13
+ export type PlaneOperationKind = 'identity' | 'translation' | 'rotation' | 'mirror' | 'glide';
14
+ /** One operation of a plane group described geometrically, in the lattice basis. */
15
+ export interface PlaneOperationDescription {
16
+ /** What the operation is. */
17
+ readonly kind: PlaneOperationKind;
18
+ /** The order n of its linear part: 1 for identity and translation, 2 for a mirror or glide. */
19
+ readonly order: number;
20
+ /** For a rotation with n ≥ 3: `'+'` if it turns a towards b, `'-'` otherwise. */
21
+ readonly sense?: '+' | '-';
22
+ /** For a translation: the translation vector. */
23
+ readonly translation?: readonly Rational[];
24
+ /**
25
+ * For a rotation: its centre. For a mirror or glide: a point of its line, on y = 0 unless the line
26
+ * is parallel to it, then on x = 0. Not reduced modulo the lattice: the centre of `-y,x+1/2` is
27
+ * (−1/4, 1/4).
28
+ */
29
+ readonly location?: readonly Rational[];
30
+ /** For a mirror or glide: the direction of its line, the shortest integer vector, first non-zero component positive. */
31
+ readonly direction?: readonly [number, number];
32
+ /**
33
+ * For a mirror or glide: the normal of its line in the lattice basis, its symmetry direction in
34
+ * the sense of ITA Table 2.1.3.1: the shortest integer vector along the columns of W − I, first
35
+ * non-zero component positive. Without a metric it is not the perpendicular of `direction`: in a
36
+ * hexagonal basis the normal of a line along [1,0] is [1,2].
37
+ */
38
+ readonly normal?: readonly [number, number];
39
+ /**
40
+ * For a glide: the glide vector (w + W·w)/2, not reduced modulo the lattice. An operation whose
41
+ * glide vector is a non-zero lattice vector is a glide, as it is geometrically, although the
42
+ * symmetry element of its coset is the mirror line, which ITA lists.
43
+ */
44
+ readonly glide?: readonly Rational[];
45
+ }
46
+ /**
47
+ * Describes an operation of a plane group; the result is frozen. Throws unless the operation is two-dimensional with the
48
+ * linear part of a crystallographic plane point group (determinant ±1, order 1, 2, 3, 4 or 6).
49
+ */
50
+ export declare function describePlaneOperation(op: ExactOperation): PlaneOperationDescription;
51
+ //# sourceMappingURL=describe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/spaceGroups/describe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAmC,KAAK,cAAc,EAAkB,MAAM,aAAa,CAAC;AACnG,OAAO,EAAwC,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEpF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9F,oFAAoF;AACpF,MAAM,WAAW,yBAAyB;IACxC,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IAC3B,iDAAiD;IACjD,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IACxC,wHAAwH;IACxH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CACtC;AA8BD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,cAAc,GAAG,yBAAyB,CAmEpF"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * The geometric description of an operation of a plane group, as ITA gives it under "Symmetry
3
+ * operations" (ITA 2016, § 2.1.3.9, pp. 160–161): what it is, its order and sense, where its
4
+ * symmetry element lies and its glide part. Structured data; the symbols such as `g(1/2,1/2) x,x`
5
+ * stay with the applications (CLAUDE.md, "Symmetry elements as structured data").
6
+ */
7
+ import { determinant, dimensionOf, trace } from './affine.js';
8
+ import { ZERO, add, multiply, rational, scale } from './rational.js';
9
+ function gcd(a, b) {
10
+ return b === 0 ? Math.abs(a) : gcd(b, a % b);
11
+ }
12
+ /** The shortest integer vector along the non-zero column of a 2 × 2 matrix of rank 1, first non-zero component positive. */
13
+ function primitiveColumn(m) {
14
+ const col = m[0][0] !== 0 || m[1][0] !== 0 ? [m[0][0], m[1][0]] : [m[0][1], m[1][1]];
15
+ const g = gcd(col[0], col[1]);
16
+ const sign = col[0] < 0 || (col[0] === 0 && col[1] < 0) ? -1 : 1;
17
+ return [(sign * col[0]) / g + 0, (sign * col[1]) / g + 0];
18
+ }
19
+ function power(m, n) {
20
+ let p = [
21
+ [1, 0],
22
+ [0, 1],
23
+ ];
24
+ for (let k = 0; k < n; k++) {
25
+ p = p.map((row) => [0, 1].map((j) => row[0] * m[0][j] + row[1] * m[1][j]));
26
+ }
27
+ return p;
28
+ }
29
+ const isIdentity = (m) => m[0][0] === 1 && m[0][1] === 0 && m[1][0] === 0 && m[1][1] === 1;
30
+ /** The order of the rotation part of a proper plane operation, from its trace (also in a hexagonal basis). */
31
+ const ORDER_BY_TRACE = { 2: 1, [-2]: 2, [-1]: 3, 0: 4, 1: 6 };
32
+ /**
33
+ * Describes an operation of a plane group; the result is frozen. Throws unless the operation is two-dimensional with the
34
+ * linear part of a crystallographic plane point group (determinant ±1, order 1, 2, 3, 4 or 6).
35
+ */
36
+ export function describePlaneOperation(op) {
37
+ if (dimensionOf(op) !== 2) {
38
+ throw new RangeError('Not an operation of the plane');
39
+ }
40
+ const w = op.matrix;
41
+ const t = op.translation;
42
+ const det = determinant(w);
43
+ if (det === 1) {
44
+ const n = ORDER_BY_TRACE[trace(w)];
45
+ if (n === undefined || !isIdentity(power(w, n))) {
46
+ throw new RangeError(`Not a crystallographic rotation: ${JSON.stringify(w)}`);
47
+ }
48
+ if (n === 1) {
49
+ return t.every((v) => v[0] === 0)
50
+ ? { kind: 'identity', order: 1 }
51
+ : { kind: 'translation', order: 1, translation: [...t] };
52
+ }
53
+ // The centre p solves (I − W) p = w; det(I − W) = 2 − trace W ≠ 0 for a rotation.
54
+ const a = [
55
+ [1 - w[0][0], -w[0][1]],
56
+ [-w[1][0], 1 - w[1][1]],
57
+ ];
58
+ const d = a[0][0] * a[1][1] - a[0][1] * a[1][0];
59
+ const inv = rational(1, d);
60
+ const location = [
61
+ multiply(add(scale(a[1][1], t[0]), scale(-a[0][1], t[1])), inv),
62
+ multiply(add(scale(-a[1][0], t[0]), scale(a[0][0], t[1])), inv),
63
+ ];
64
+ const description = { kind: 'rotation', order: n, location: Object.freeze(location) };
65
+ // The sense: the sign of a × W·a with a = (1, 0), the same in any right-handed basis.
66
+ return Object.freeze(n === 2 ? description : { ...description, sense: w[1][0] > 0 ? '+' : '-' });
67
+ }
68
+ if (det !== -1 || trace(w) !== 0 || !isIdentity(power(w, 2))) {
69
+ throw new RangeError(`Not a crystallographic reflection: ${JSON.stringify(w)}`);
70
+ }
71
+ // A mirror or glide: W² = I. Glide vector g = (w + W·w)/2, along the line; the line is the set of p with (I − W) p = w − g.
72
+ const wt = [add(scale(w[0][0], t[0]), scale(w[0][1], t[1])), add(scale(w[1][0], t[0]), scale(w[1][1], t[1]))];
73
+ const half = rational(1, 2);
74
+ const glide = [multiply(add(t[0], wt[0]), half), multiply(add(t[1], wt[1]), half)];
75
+ const s = [add(t[0], scale(-1, glide[0])), add(t[1], scale(-1, glide[1]))];
76
+ const direction = primitiveColumn([
77
+ [w[0][0] + 1, w[0][1]],
78
+ [w[1][0], w[1][1] + 1],
79
+ ]);
80
+ const normal = primitiveColumn([
81
+ [w[0][0] - 1, w[0][1]],
82
+ [w[1][0], w[1][1] - 1],
83
+ ]);
84
+ // (I − W) has rank 1; one of its non-zero rows a gives a·p = s_i. A point on y = 0 if the line meets it.
85
+ const a = [
86
+ [1 - w[0][0], -w[0][1]],
87
+ [-w[1][0], 1 - w[1][1]],
88
+ ];
89
+ const i = a[0][0] !== 0 || a[0][1] !== 0 ? 0 : 1;
90
+ const location = a[i][0] !== 0 ? [multiply(s[i], rational(1, a[i][0])), ZERO] : [ZERO, multiply(s[i], rational(1, a[i][1]))];
91
+ const line = {
92
+ order: 2,
93
+ location: Object.freeze(location),
94
+ direction: Object.freeze(direction),
95
+ normal: Object.freeze(normal),
96
+ };
97
+ return Object.freeze(glide.some((v) => v[0] !== 0)
98
+ ? { kind: 'glide', ...line, glide: Object.freeze(glide) }
99
+ : { kind: 'mirror', ...line });
100
+ }
101
+ //# sourceMappingURL=describe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/spaceGroups/describe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAuC,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAiB,MAAM,eAAe,CAAC;AAyCpF,SAAS,GAAG,CAAC,CAAS,EAAE,CAAS;IAC/B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,4HAA4H;AAC5H,SAAS,eAAe,CAAC,CAAY;IACnC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAA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CAClB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC,CAAC,EAAE,IAAI,EAAE,OAAgB,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAClE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,GAAG,IAAI,EAAE,CACzC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The 17 plane groups as ITA prints them (6th ed., 2016, Chapter 2.2, pp. 176–192, plane group n on
3
+ * p. 175 + n). The same data are in references/itc/vol-a-2016-plane-groups.md, which the reference
4
+ * test re-parses and compares with this file; change both only by transcription from print.
5
+ *
6
+ * Notation as in the transcription: a leading `-` is an overbar; coordinates in the lattice basis
7
+ * a, b; `<=` for ≤. The oriented site-symmetry symbols without the spaces of the print.
8
+ */
9
+ /** A crystal system of the plane, as ITA names it. */
10
+ export type PlaneSystem = 'oblique' | 'rectangular' | 'square' | 'hexagonal';
11
+ /** [multiplicity, Wyckoff letter, oriented site symmetry, coordinates of the (0,0)+ set]. */
12
+ export type PlaneWyckoffRow = readonly [number, string, string, readonly string[]];
13
+ /** One plane group as printed. */
14
+ export interface PlaneGroupEntry {
15
+ /** Number of the plane group, 1 to 17. */
16
+ readonly number: number;
17
+ /** Short Hermann–Mauguin symbol, e.g. `p2mg`. */
18
+ readonly symbol: string;
19
+ /** Full Hermann–Mauguin symbol, e.g. `p1m1`. */
20
+ readonly fullSymbol: string;
21
+ /** The plane point group, e.g. `2mm`. */
22
+ readonly pointGroup: string;
23
+ /** The crystal system. */
24
+ readonly system: PlaneSystem;
25
+ /** Printed page. */
26
+ readonly page: number;
27
+ /** The block "Origin" as printed, e.g. `at 21g`. */
28
+ readonly origin: string;
29
+ /** The block "Asymmetric unit" as printed. */
30
+ readonly asymmetricUnit: string;
31
+ /** The vertices of the asymmetric unit, where printed (hexagonal groups). */
32
+ readonly vertices?: readonly string[];
33
+ /** Centring translations besides (0,0): `['1/2,1/2']` for the c groups. */
34
+ readonly centring: readonly string[];
35
+ /** The general position, (0,0)+ set, in ITA's numbering. */
36
+ readonly generalPosition: readonly string[];
37
+ /** "Generators selected": numbers in the general position, after (1) and the integer translations (and the centring). */
38
+ readonly generators: readonly number[];
39
+ /** The Wyckoff positions in printed order, general position first. */
40
+ readonly wyckoff: readonly PlaneWyckoffRow[];
41
+ }
42
+ /** The 17 plane groups in ITA's order. */
43
+ export declare const PLANE_GROUP_DATA: readonly PlaneGroupEntry[];
44
+ //# sourceMappingURL=planeGroupData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planeGroupData.d.ts","sourceRoot":"","sources":["../../src/spaceGroups/planeGroupData.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE7E,6FAA6F;AAC7F,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;AAEnF,kCAAkC;AAClC,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0BAA0B;IAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8CAA8C;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