symcrys 0.8.1 → 0.9.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.
- package/README.md +11 -2
- package/dist/plane.d.ts +225 -0
- package/dist/plane.d.ts.map +1 -0
- package/dist/plane.js +219 -0
- package/dist/plane.js.map +1 -0
- package/dist/spaceGroups/affine.d.ts +81 -0
- package/dist/spaceGroups/affine.d.ts.map +1 -0
- package/dist/spaceGroups/affine.js +245 -0
- package/dist/spaceGroups/affine.js.map +1 -0
- package/dist/spaceGroups/cell.d.ts +58 -0
- package/dist/spaceGroups/cell.d.ts.map +1 -0
- package/dist/spaceGroups/cell.js +297 -0
- package/dist/spaceGroups/cell.js.map +1 -0
- package/dist/spaceGroups/describe.d.ts +44 -0
- package/dist/spaceGroups/describe.d.ts.map +1 -0
- package/dist/spaceGroups/describe.js +92 -0
- package/dist/spaceGroups/describe.js.map +1 -0
- package/dist/spaceGroups/planeGroupData.d.ts +44 -0
- package/dist/spaceGroups/planeGroupData.d.ts.map +1 -0
- package/dist/spaceGroups/planeGroupData.js +371 -0
- package/dist/spaceGroups/planeGroupData.js.map +1 -0
- package/dist/spaceGroups/planeGroups.d.ts +28 -0
- package/dist/spaceGroups/planeGroups.d.ts.map +1 -0
- package/dist/spaceGroups/planeGroups.js +61 -0
- package/dist/spaceGroups/planeGroups.js.map +1 -0
- package/dist/spaceGroups/planePointGroups.d.ts +31 -0
- package/dist/spaceGroups/planePointGroups.d.ts.map +1 -0
- package/dist/spaceGroups/planePointGroups.js +77 -0
- package/dist/spaceGroups/planePointGroups.js.map +1 -0
- package/dist/spaceGroups/positions.d.ts +65 -0
- package/dist/spaceGroups/positions.d.ts.map +1 -0
- package/dist/spaceGroups/positions.js +183 -0
- package/dist/spaceGroups/positions.js.map +1 -0
- package/dist/spaceGroups/rational.d.ts +43 -0
- package/dist/spaceGroups/rational.d.ts.map +1 -0
- package/dist/spaceGroups/rational.js +95 -0
- package/dist/spaceGroups/rational.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -2
- package/src/plane.ts +455 -0
- package/src/spaceGroups/affine.ts +315 -0
- package/src/spaceGroups/cell.ts +371 -0
- package/src/spaceGroups/describe.ts +133 -0
- package/src/spaceGroups/planeGroupData.ts +407 -0
- package/src/spaceGroups/planeGroups.ts +75 -0
- package/src/spaceGroups/planePointGroups.ts +90 -0
- package/src/spaceGroups/positions.ts +237 -0
- package/src/spaceGroups/rational.ts +115 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact affine operations of plane and space groups, x' = W·x + w in the lattice basis (ITA
|
|
3
|
+
* notation (W, w)): the matrix W with integer entries and determinant ±1, the translation w with
|
|
4
|
+
* rational components. Written for any dimension d from 1 to 3 (2 for the plane groups, 3 for the
|
|
5
|
+
* space groups). CLAUDE.md, "Plane groups (and later space groups)".
|
|
6
|
+
*/
|
|
7
|
+
import { ZERO, add, checkSafeInteger, formatRational, isInteger, mod1, negate, parseRational, rationalsEqual, safeProduct, safeSum, scale, subtract, toNumber, } from './rational.js';
|
|
8
|
+
/**
|
|
9
|
+
* The default bound on the cosets of a closure: no plane group has more than 12 cosets of the
|
|
10
|
+
* integer translations, no space group in its conventional cell more than 192 (Fm-3m: 48 × 4). A
|
|
11
|
+
* closure in a larger cell (a supercell, a subgroup of index k) passes a larger bound.
|
|
12
|
+
*/
|
|
13
|
+
export const MAX_COSETS = 192;
|
|
14
|
+
/** The coordinate names in ITA's coordinate triplets. */
|
|
15
|
+
const COORDINATES = ['x', 'y', 'z'];
|
|
16
|
+
function checkDimension(d) {
|
|
17
|
+
if (!Number.isInteger(d) || d < 1 || d > 3) {
|
|
18
|
+
throw new RangeError(`The dimension must be 1, 2 or 3, not ${String(d)}`);
|
|
19
|
+
}
|
|
20
|
+
return d;
|
|
21
|
+
}
|
|
22
|
+
/** The dimension d of an operation; throws unless it is consistent (d = 1 to 3, integer matrix). */
|
|
23
|
+
export function dimensionOf(op) {
|
|
24
|
+
const d = op.matrix.length;
|
|
25
|
+
if (d < 1 || d > 3 || op.translation.length !== d || op.matrix.some((row) => row.length !== d)) {
|
|
26
|
+
throw new RangeError(`Not an operation of dimension 1 to 3: ${JSON.stringify(op)}`);
|
|
27
|
+
}
|
|
28
|
+
for (const row of op.matrix) {
|
|
29
|
+
for (const v of row) {
|
|
30
|
+
checkSafeInteger(v, 'A matrix entry');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return d;
|
|
34
|
+
}
|
|
35
|
+
/** The identity of dimension d. */
|
|
36
|
+
export function identity(d) {
|
|
37
|
+
checkDimension(d);
|
|
38
|
+
return {
|
|
39
|
+
matrix: Array.from({ length: d }, (_, i) => Array.from({ length: d }, (_, j) => (i === j ? 1 : 0))),
|
|
40
|
+
translation: Array.from({ length: d }, () => ZERO),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** The pure translation by t, an operation (I, t). */
|
|
44
|
+
export function translationOperation(t) {
|
|
45
|
+
return { matrix: identity(t.length).matrix, translation: [...t] };
|
|
46
|
+
}
|
|
47
|
+
function applyMatrix(m, v) {
|
|
48
|
+
return m.map((row) => row.reduce((sum, mij, j) => add(sum, scale(mij, v[j])), ZERO));
|
|
49
|
+
}
|
|
50
|
+
function multiplyMatrices(a, b) {
|
|
51
|
+
return a.map((row) => b[0].map((_, j) => row.reduce((sum, aik, k) => safeSum(sum, safeProduct(aik, b[k][j])), 0) + 0));
|
|
52
|
+
}
|
|
53
|
+
/** The determinant of an integer matrix of size 1 to 3. */
|
|
54
|
+
export function determinant(m) {
|
|
55
|
+
checkDimension(m.length);
|
|
56
|
+
const p = safeProduct;
|
|
57
|
+
if (m.length === 1)
|
|
58
|
+
return m[0][0];
|
|
59
|
+
if (m.length === 2)
|
|
60
|
+
return safeSum(p(m[0][0], m[1][1]), -p(m[0][1], m[1][0]));
|
|
61
|
+
const minor = (i, j, k, l) => safeSum(p(m[1][i], m[2][j]), -p(m[1][k], m[2][l]));
|
|
62
|
+
return safeSum(safeSum(p(m[0][0], minor(1, 2, 2, 1)), -p(m[0][1], minor(0, 2, 2, 0))), p(m[0][2], minor(0, 1, 1, 0)));
|
|
63
|
+
}
|
|
64
|
+
/** The trace of an integer matrix. */
|
|
65
|
+
export function trace(m) {
|
|
66
|
+
return m.reduce((sum, row, i) => safeSum(sum, row[i]), 0);
|
|
67
|
+
}
|
|
68
|
+
/** Throws unless det W = ±1, as for every operation of a crystallographic group. */
|
|
69
|
+
export function checkUnimodular(op) {
|
|
70
|
+
dimensionOf(op);
|
|
71
|
+
const det = determinant(op.matrix);
|
|
72
|
+
if (det !== 1 && det !== -1) {
|
|
73
|
+
throw new RangeError(`Determinant ${det} is not ±1: ${JSON.stringify(op.matrix)}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** The image of the point x (rational coordinates) under the operation, W·x + w. */
|
|
77
|
+
export function applyToPoint(op, x) {
|
|
78
|
+
return applyMatrix(op.matrix, x).map((v, i) => add(v, op.translation[i]));
|
|
79
|
+
}
|
|
80
|
+
/** The product a·b: first b, then a; (W_a, w_a)(W_b, w_b) = (W_a W_b, W_a w_b + w_a). */
|
|
81
|
+
export function compose(a, b) {
|
|
82
|
+
return {
|
|
83
|
+
matrix: multiplyMatrices(a.matrix, b.matrix),
|
|
84
|
+
translation: applyMatrix(a.matrix, b.translation).map((v, i) => add(v, a.translation[i])),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** The inverse (W⁻¹, −W⁻¹w); throws unless det W = ±1, so that W⁻¹ is an integer matrix. */
|
|
88
|
+
export function inverse(op) {
|
|
89
|
+
checkUnimodular(op);
|
|
90
|
+
const d = op.matrix.length;
|
|
91
|
+
const m = op.matrix;
|
|
92
|
+
const det = determinant(m);
|
|
93
|
+
let inv;
|
|
94
|
+
if (d === 1) {
|
|
95
|
+
inv = [[det]];
|
|
96
|
+
}
|
|
97
|
+
else if (d === 2) {
|
|
98
|
+
inv = [
|
|
99
|
+
[m[1][1] * det, -m[0][1] * det],
|
|
100
|
+
[-m[1][0] * det, m[0][0] * det],
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// The adjugate divided by det, i.e. multiplied by det = ±1: inv[i][j] = cofactor(j, i).
|
|
105
|
+
const cofactor = (i, j) => {
|
|
106
|
+
const r = [0, 1, 2].filter((k) => k !== i);
|
|
107
|
+
const s = [0, 1, 2].filter((k) => k !== j);
|
|
108
|
+
const minor = safeSum(safeProduct(m[r[0]][s[0]], m[r[1]][s[1]]), -safeProduct(m[r[0]][s[1]], m[r[1]][s[0]]));
|
|
109
|
+
return ((i + j) % 2 === 0 ? minor : -minor) * det;
|
|
110
|
+
};
|
|
111
|
+
inv = [0, 1, 2].map((i) => [0, 1, 2].map((j) => cofactor(j, i)));
|
|
112
|
+
}
|
|
113
|
+
inv = inv.map((row) => row.map((v) => v + 0));
|
|
114
|
+
return { matrix: inv, translation: applyMatrix(inv, op.translation).map(negate) };
|
|
115
|
+
}
|
|
116
|
+
/** The operation with its translation reduced modulo 1 into [0, 1): the representative of its coset. */
|
|
117
|
+
export function reduceModLattice(op) {
|
|
118
|
+
return { matrix: op.matrix, translation: op.translation.map(mod1) };
|
|
119
|
+
}
|
|
120
|
+
function matricesEqual(a, b) {
|
|
121
|
+
return a.length === b.length && a.every((row, i) => row.length === b[i].length && row.every((v, j) => v === b[i][j]));
|
|
122
|
+
}
|
|
123
|
+
/** True if a and b are the same operation, translation included. */
|
|
124
|
+
export function operationsEqual(a, b) {
|
|
125
|
+
return (matricesEqual(a.matrix, b.matrix) &&
|
|
126
|
+
a.translation.length === b.translation.length &&
|
|
127
|
+
a.translation.every((t, i) => rationalsEqual(t, b.translation[i])));
|
|
128
|
+
}
|
|
129
|
+
/** True if a and b differ by an integer lattice translation: the same coset of the integer translations. */
|
|
130
|
+
export function equalModLattice(a, b) {
|
|
131
|
+
return (matricesEqual(a.matrix, b.matrix) &&
|
|
132
|
+
a.translation.length === b.translation.length &&
|
|
133
|
+
a.translation.every((t, i) => isInteger(subtract(t, b.translation[i]))));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The group generated by `generators` together with the integer translations, as one operation per
|
|
137
|
+
* coset of the integer translations (translations in [0, 1)). The identity comes first, the others
|
|
138
|
+
* in the order in which the closure finds them (breadth first, each found operation multiplied by
|
|
139
|
+
* the generators from the left); this order has no meaning of its own. A centring translation is
|
|
140
|
+
* passed as a generator. Throws if a generator has a determinant other than ±1 or the closure
|
|
141
|
+
* exceeds `maxCosets`, which no crystallographic group in its conventional cell does.
|
|
142
|
+
*/
|
|
143
|
+
export function closure(generators, options = {}) {
|
|
144
|
+
const d = checkDimension(options.dimension ?? (generators.length > 0 ? dimensionOf(generators[0]) : 0));
|
|
145
|
+
const maxCosets = options.maxCosets ?? MAX_COSETS;
|
|
146
|
+
for (const g of generators) {
|
|
147
|
+
if (dimensionOf(g) !== d) {
|
|
148
|
+
throw new RangeError(`Generators of different dimension: ${d} and ${dimensionOf(g)}`);
|
|
149
|
+
}
|
|
150
|
+
checkUnimodular(g);
|
|
151
|
+
}
|
|
152
|
+
const result = [identity(d)];
|
|
153
|
+
for (let i = 0; i < result.length; i++) {
|
|
154
|
+
for (const g of generators) {
|
|
155
|
+
const product = reduceModLattice(compose(g, result[i]));
|
|
156
|
+
if (!result.some((op) => equalModLattice(op, product))) {
|
|
157
|
+
if (result.length >= maxCosets) {
|
|
158
|
+
throw new RangeError(`The closure exceeds ${maxCosets} cosets: the generators form no crystallographic group`);
|
|
159
|
+
}
|
|
160
|
+
result.push(product);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The terms of one coordinate of a triplet. A term is a sign followed by an integer coefficient and
|
|
168
|
+
* a coordinate, or by a rational; only the first term may omit its sign. The terms must cover the
|
|
169
|
+
* whole text, so that a stray sign (`--x`, `x+`) is an error rather than skipped.
|
|
170
|
+
*/
|
|
171
|
+
const TERM = /([+-]?)(?:(\d*)([xyz])|(\d+(?:\/\d+)?))/y;
|
|
172
|
+
/** One row of a coordinate triplet, e.g. `-x+y+1/3`: integer coefficients and a rational constant. */
|
|
173
|
+
function parseRow(text, d, whole) {
|
|
174
|
+
const coefficients = Array.from({ length: d }, () => 0);
|
|
175
|
+
let constant = ZERO;
|
|
176
|
+
const s = text.replace(/\s/g, '');
|
|
177
|
+
if (s === '') {
|
|
178
|
+
throw new RangeError(`Empty coordinate in "${whole}"`);
|
|
179
|
+
}
|
|
180
|
+
TERM.lastIndex = 0;
|
|
181
|
+
let first = true;
|
|
182
|
+
while (TERM.lastIndex < s.length) {
|
|
183
|
+
const start = TERM.lastIndex;
|
|
184
|
+
const m = TERM.exec(s);
|
|
185
|
+
if (!m || m.index !== start || (!first && m[1] === '')) {
|
|
186
|
+
throw new RangeError(`Cannot read "${s.slice(start)}" in "${whole}"`);
|
|
187
|
+
}
|
|
188
|
+
first = false;
|
|
189
|
+
const sign = m[1] === '-' ? -1 : 1;
|
|
190
|
+
if (m[3] !== undefined) {
|
|
191
|
+
const k = COORDINATES.indexOf(m[3]);
|
|
192
|
+
if (k >= d) {
|
|
193
|
+
throw new RangeError(`Coordinate ${m[3]} in a ${d}-dimensional triplet "${whole}"`);
|
|
194
|
+
}
|
|
195
|
+
const c = m[2] === '' ? 1 : checkSafeInteger(Number(m[2]), 'A coefficient');
|
|
196
|
+
coefficients[k] = safeSum(coefficients[k], sign * c);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
constant = add(constant, scale(sign, parseRational(m[4])));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return { coefficients, constant };
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Reads an operation from its coordinate triplet as ITA prints it in the general position, e.g.
|
|
206
|
+
* `-x+1/2,y` (plane) or `-y,x-y,z+1/3` (space), with `-x` for x̄. The dimension is the number of
|
|
207
|
+
* coordinates. Integer coefficients other than ±1 (as in `2x,x` of a Wyckoff position) are read; a
|
|
208
|
+
* group operation is checked for det ±1 where it is used (`closure`, `inverse`).
|
|
209
|
+
*/
|
|
210
|
+
export function parseOperation(text) {
|
|
211
|
+
const parts = text.split(',');
|
|
212
|
+
const d = parts.length;
|
|
213
|
+
if (d > 3) {
|
|
214
|
+
throw new RangeError(`Not a coordinate triplet: "${text}"`);
|
|
215
|
+
}
|
|
216
|
+
const rows = parts.map((p) => parseRow(p, d, text));
|
|
217
|
+
return { matrix: rows.map((r) => r.coefficients), translation: rows.map((r) => r.constant) };
|
|
218
|
+
}
|
|
219
|
+
/** Writes an operation as ITA prints its coordinate triplet, e.g. `-x+1/2,y`, `x-y,x,z+5/6`. */
|
|
220
|
+
export function formatOperation(op) {
|
|
221
|
+
dimensionOf(op);
|
|
222
|
+
return op.matrix
|
|
223
|
+
.map((row, i) => {
|
|
224
|
+
let s = '';
|
|
225
|
+
row.forEach((c, j) => {
|
|
226
|
+
if (c === 0)
|
|
227
|
+
return;
|
|
228
|
+
const name = COORDINATES[j];
|
|
229
|
+
const magnitude = Math.abs(c) === 1 ? name : `${Math.abs(c)}${name}`;
|
|
230
|
+
s += c < 0 ? `-${magnitude}` : s === '' ? magnitude : `+${magnitude}`;
|
|
231
|
+
});
|
|
232
|
+
const t = op.translation[i];
|
|
233
|
+
if (t[0] !== 0) {
|
|
234
|
+
const f = formatRational(t);
|
|
235
|
+
s += t[0] < 0 || s === '' ? f : `+${f}`;
|
|
236
|
+
}
|
|
237
|
+
return s === '' ? '0' : s;
|
|
238
|
+
})
|
|
239
|
+
.join(',');
|
|
240
|
+
}
|
|
241
|
+
/** The operation as plain data for the API: integer matrix, translation as the nearest doubles. */
|
|
242
|
+
export function toPlain(op) {
|
|
243
|
+
return { matrix: op.matrix.map((row) => [...row]), translation: op.translation.map(toNumber) };
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=affine.js.map
|
|
@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AAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;YACrE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC;QACxE,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YACf,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,CAAC;QACD,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,OAAO,CAAC,EAAkB;IACxC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { type Rational } from './rational.js';
|
|
9
|
+
/** An inequality a·x + b·y ≤ c with integer coefficients without a common factor. */
|
|
10
|
+
export type Inequality = readonly [a: number, b: number, c: number];
|
|
11
|
+
/** The asymmetric unit of a plane group, a convex polygon in the lattice basis. */
|
|
12
|
+
export interface AsymmetricUnit {
|
|
13
|
+
/** Its vertices, counter-clockwise in the lattice basis (a towards b), starting at the vertex with the smallest y, then x. */
|
|
14
|
+
readonly vertices: readonly (readonly Rational[])[];
|
|
15
|
+
/** Its edges as inequalities: inequality i holds the edge from vertex i to vertex i + 1. */
|
|
16
|
+
readonly inequalities: readonly Inequality[];
|
|
17
|
+
}
|
|
18
|
+
/** A rotation centre in the cell. */
|
|
19
|
+
export interface RotationCentre {
|
|
20
|
+
/** The highest order of a rotation about it. */
|
|
21
|
+
readonly order: number;
|
|
22
|
+
/** Its position in [0, 1]². */
|
|
23
|
+
readonly point: readonly Rational[];
|
|
24
|
+
}
|
|
25
|
+
/** A mirror or glide line, the part of it in the cell. */
|
|
26
|
+
export interface SymmetryLine {
|
|
27
|
+
/** `'mirror'` or `'glide'`. */
|
|
28
|
+
readonly kind: 'mirror' | 'glide';
|
|
29
|
+
/** The direction of the line, the shortest integer vector, first non-zero component positive. */
|
|
30
|
+
readonly direction: readonly [number, number];
|
|
31
|
+
/** For a glide line: its glide vector s·direction with 0 < s < 1; for a mirror line (0, 0). */
|
|
32
|
+
readonly glide: readonly Rational[];
|
|
33
|
+
/** The ends of the segment of the line in the cell [0, 1]², in the order of `direction`. */
|
|
34
|
+
readonly segment: readonly [readonly Rational[], readonly Rational[]];
|
|
35
|
+
}
|
|
36
|
+
/** The symmetry elements of a plane group in the cell [0, 1]². */
|
|
37
|
+
export interface CellElements {
|
|
38
|
+
/** The rotation centres, by descending order, then by y and x. */
|
|
39
|
+
readonly rotations: readonly RotationCentre[];
|
|
40
|
+
/** The mirror and glide lines with a segment of non-zero length in the cell, by direction, then by the start of the segment (y, then x). */
|
|
41
|
+
readonly lines: readonly SymmetryLine[];
|
|
42
|
+
}
|
|
43
|
+
/** Reads the printed block "Asymmetric unit", e.g. `0 <= x <= 1/2; y <= min(1 - x, (1 + x)/2)`. */
|
|
44
|
+
export declare function parseAsymmetricUnit(text: string): Inequality[];
|
|
45
|
+
/**
|
|
46
|
+
* The asymmetric unit of a plane group as ITA prints it, a convex polygon: its vertices and, for each
|
|
47
|
+
* edge, the inequality a·x + b·y ≤ c that holds it. Printed inequalities that hold no edge are
|
|
48
|
+
* left out. Frozen.
|
|
49
|
+
*/
|
|
50
|
+
export declare function planeAsymmetricUnit(key: string | number): AsymmetricUnit;
|
|
51
|
+
/**
|
|
52
|
+
* The symmetry elements of a plane group in its conventional cell [0, 1]², boundary included: every
|
|
53
|
+
* rotation centre with the highest order of a rotation about it, and every mirror and glide line
|
|
54
|
+
* that crosses the cell, with the segment inside it. A line that carries a glide is a glide line
|
|
55
|
+
* with its shortest glide vector along the line (between 0 and the lattice vector). Frozen.
|
|
56
|
+
*/
|
|
57
|
+
export declare function planeCellElements(key: string | number): CellElements;
|
|
58
|
+
//# sourceMappingURL=cell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../../src/spaceGroups/cell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAaL,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AAEvB,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAEpE,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC7B,8HAA8H;IAC9H,QAAQ,CAAC,QAAQ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metric 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 n·x = c with the normal n = (−dir_y, dir_x).
|
|
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({ kind: s[0] === 0 ? 'mirror' : 'glide', direction: [dir[0], dir[1]], s, c, segment });
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const num = (v) => toNumber(v);
|
|
280
|
+
rotations.sort((a, b) => b.order - a.order || num(a.point[1]) - num(b.point[1]) || num(a.point[0]) - num(b.point[0]));
|
|
281
|
+
lines.sort((a, b) => a.direction[0] - b.direction[0] ||
|
|
282
|
+
a.direction[1] - b.direction[1] ||
|
|
283
|
+
num(a.segment[0][1]) - num(b.segment[0][1]) ||
|
|
284
|
+
num(a.segment[0][0]) - num(b.segment[0][0]));
|
|
285
|
+
const result = Object.freeze({
|
|
286
|
+
rotations: Object.freeze(rotations.map((x) => Object.freeze({ order: x.order, point: Object.freeze(x.point) }))),
|
|
287
|
+
lines: Object.freeze(lines.map((l) => Object.freeze({
|
|
288
|
+
kind: l.kind,
|
|
289
|
+
direction: Object.freeze(l.direction),
|
|
290
|
+
glide: Object.freeze([scale(l.direction[0], l.s), scale(l.direction[1], l.s)]),
|
|
291
|
+
segment: Object.freeze(l.segment.map((p) => Object.freeze([...p]))),
|
|
292
|
+
}))),
|
|
293
|
+
});
|
|
294
|
+
elementCache.set(entry.symbol, result);
|
|
295
|
+
return result;
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=cell.js.map
|