symcrys 0.6.1 → 0.7.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 (50) hide show
  1. package/README.md +2 -2
  2. package/dist/crystalClasses.d.ts +94 -0
  3. package/dist/crystalClasses.d.ts.map +1 -1
  4. package/dist/crystalClasses.js +79 -0
  5. package/dist/crystalClasses.js.map +1 -1
  6. package/dist/index.d.ts +4 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/magnetic.d.ts +2 -0
  11. package/dist/magnetic.d.ts.map +1 -1
  12. package/dist/magnetic.js +2 -0
  13. package/dist/magnetic.js.map +1 -1
  14. package/dist/pointGroups/crystalForms.d.ts +70 -0
  15. package/dist/pointGroups/crystalForms.d.ts.map +1 -0
  16. package/dist/pointGroups/crystalForms.js +69 -0
  17. package/dist/pointGroups/crystalForms.js.map +1 -0
  18. package/dist/pointGroups/crystalFormsData.d.ts +32 -0
  19. package/dist/pointGroups/crystalFormsData.d.ts.map +1 -0
  20. package/dist/pointGroups/crystalFormsData.js +518 -0
  21. package/dist/pointGroups/crystalFormsData.js.map +1 -0
  22. package/dist/pointGroups/elements.d.ts +5 -1
  23. package/dist/pointGroups/elements.d.ts.map +1 -1
  24. package/dist/pointGroups/elements.js +6 -2
  25. package/dist/pointGroups/elements.js.map +1 -1
  26. package/dist/pointGroups/identify.d.ts +75 -0
  27. package/dist/pointGroups/identify.d.ts.map +1 -0
  28. package/dist/pointGroups/identify.js +193 -0
  29. package/dist/pointGroups/identify.js.map +1 -0
  30. package/dist/pointGroups/orbits.d.ts +85 -0
  31. package/dist/pointGroups/orbits.d.ts.map +1 -0
  32. package/dist/pointGroups/orbits.js +134 -0
  33. package/dist/pointGroups/orbits.js.map +1 -0
  34. package/dist/pointGroups/wyckoff.d.ts +40 -1
  35. package/dist/pointGroups/wyckoff.d.ts.map +1 -1
  36. package/dist/pointGroups/wyckoff.js +55 -27
  37. package/dist/pointGroups/wyckoff.js.map +1 -1
  38. package/dist/version.d.ts +1 -1
  39. package/dist/version.js +1 -1
  40. package/package.json +1 -1
  41. package/src/crystalClasses.ts +146 -0
  42. package/src/index.ts +12 -0
  43. package/src/magnetic.ts +17 -0
  44. package/src/pointGroups/crystalForms.ts +143 -0
  45. package/src/pointGroups/crystalFormsData.ts +539 -0
  46. package/src/pointGroups/elements.ts +6 -2
  47. package/src/pointGroups/identify.ts +255 -0
  48. package/src/pointGroups/orbits.ts +228 -0
  49. package/src/pointGroups/wyckoff.ts +59 -26
  50. package/src/version.ts +1 -1
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The point group of a list of operations, and the operations described geometrically, for any
3
+ * list (for instance the operations left after distorting a crystal; docs/conventions.md, "Point
4
+ * group of a list of operations"). Shared by both entry points.
5
+ */
6
+ import { type Vec3 } from '../linalg.js';
7
+ import { type Operation } from '../operations.js';
8
+ import { type OperationKind } from './elements.js';
9
+ import { type MagneticPointGroupKey } from './pointGroups.js';
10
+ /** Options of `pointGroupOf` and `describeOperationsOf`. */
11
+ export interface PointGroupOfOptions {
12
+ /**
13
+ * Two matrices are the same operation if no entry differs by this much or more, and a matrix
14
+ * counts as orthogonal and crystallographic within it. Default `EPSILON` (10⁻⁶); a caller whose
15
+ * matrices carry rounding errors passes a larger value, below 0.1.
16
+ */
17
+ readonly tolerance?: number;
18
+ }
19
+ /** The point group of a list of operations: its key, and the setting if the operations are exactly those of one. */
20
+ export interface IdentifiedPointGroup {
21
+ /** The key of the point group the operations generate. */
22
+ readonly key: MagneticPointGroupKey;
23
+ /**
24
+ * The 1-based index of the setting whose operations the group equals, in the Cartesian frame of
25
+ * symcrys; absent if the group is the point group in another orientation.
26
+ */
27
+ readonly setting?: number;
28
+ }
29
+ /** An axis in the Cartesian frame only, for operations that are not tied to a lattice. */
30
+ export interface CartesianAxis {
31
+ /** Unit vector; its first non-zero component, in the order x, y, z, is positive. */
32
+ readonly cartesian: Vec3;
33
+ }
34
+ /** One operation of any list described geometrically (`describeOperationsOf`). */
35
+ export interface CartesianOperationDescription {
36
+ /** What the operation is, without time reversal. */
37
+ readonly kind: OperationKind;
38
+ /**
39
+ * The n of the symbol n or n̄: 1 for the identity and the inversion, 2 for a mirror (m = 2̄),
40
+ * otherwise the order of the rotation part.
41
+ */
42
+ readonly order: number;
43
+ /** Rotation axis, rotoinversion axis or mirror normal; absent for the identity and the inversion. */
44
+ readonly axis?: CartesianAxis;
45
+ /**
46
+ * For n ≥ 3: `'+'` if the rotation part turns by +360°/n about `axis` (counter-clockwise seen
47
+ * from the tip of `axis` looking towards the origin), `'-'` if by −360°/n.
48
+ */
49
+ readonly sense?: '+' | '-';
50
+ /** True if the operation is combined with time reversal (a primed operation). */
51
+ readonly timeReversal: boolean;
52
+ }
53
+ /**
54
+ * The point group generated by a list of Cartesian operations, for instance those left after
55
+ * distorting a crystal: its key, and the setting whose operations it equals in the frame of symcrys
56
+ * (absent if the group is the point group in another orientation). The list is closed into a group
57
+ * first, two matrices being equal when no entry differs by `tolerance` (default `EPSILON`) or more.
58
+ * Time reversal counts: a list with time reversal gives a magnetic point group. Returns undefined
59
+ * if the operations generate no point group (an operation of order 5, a group larger than 96).
60
+ * Throws a RangeError for a matrix that is not orthogonal (within `tolerance`, at least
61
+ * `EPSILON`). The classes `1` and `-1` have one setting and no orientation, so they always have
62
+ * setting 1.
63
+ */
64
+ export declare function pointGroupOf(operations: readonly Operation[], options?: PointGroupOfOptions): IdentifiedPointGroup | undefined;
65
+ /**
66
+ * Each operation of a list described geometrically, in the order of the list: kind, n, the
67
+ * Cartesian axis (rotation or rotoinversion axis, mirror normal) with its first non-zero component,
68
+ * in the order x, y, z, positive, and for n ≥ 3 the sense about that axis. The axes are not named
69
+ * by lattice directions, since the list need not belong to a setting; for a point group given by its
70
+ * key, `describeOperations` names them. Throws a RangeError for a matrix that is not orthogonal or
71
+ * not a crystallographic operation (a rotation part by an angle other than 360°/n, n = 1, 2, 3, 4,
72
+ * 6), both within `tolerance` (default `EPSILON`, as for `pointGroupOf`).
73
+ */
74
+ export declare function describeOperationsOf(operations: readonly Operation[], options?: PointGroupOfOptions): readonly CartesianOperationDescription[];
75
+ //# sourceMappingURL=identify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../../src/pointGroups/identify.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAmC,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAE1B,4DAA4D;AAC5D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,oHAAoH;AACpH,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,qBAAqB,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,0FAA0F;AAC1F,MAAM,WAAW,aAAa;IAC5B,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED,kFAAkF;AAClF,MAAM,WAAW,6BAA6B;IAC5C,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qGAAqG;IACrG,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IAC3B,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAiHD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,oBAAoB,GAAG,SAAS,CAelC;AAkCD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,SAAS,6BAA6B,EAAE,CAI1C"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * The point group of a list of operations, and the operations described geometrically, for any
3
+ * list (for instance the operations left after distorting a crystal; docs/conventions.md, "Point
4
+ * group of a list of operations"). Shared by both entry points.
5
+ */
6
+ import { det, multiply, trace } from '../linalg.js';
7
+ import { checkOrthogonal, checkTimeReversal } from '../operations.js';
8
+ import { EPSILON } from '../tolerances.js';
9
+ import { axialVector, rotationAxis } from './elements.js';
10
+ import { MAGNETIC_POINT_GROUP_KEYS, operations as groupOperations, settings, } from './pointGroups.js';
11
+ /** Throws unless mᵀm = 1 within the tolerance (a matrix with rounding errors passes with a larger one). */
12
+ function checkOrthogonalWithin(m, what, tolerance) {
13
+ if (tolerance <= EPSILON) {
14
+ checkOrthogonal(m, what);
15
+ return;
16
+ }
17
+ for (let i = 0; i < 3; i++) {
18
+ for (let j = 0; j < 3; j++) {
19
+ const d = m[0][i] * m[0][j] + m[1][i] * m[1][j] + m[2][i] * m[2][j];
20
+ if (!(Math.abs(d - (i === j ? 1 : 0)) < tolerance)) {
21
+ throw new RangeError(`${what} is not an orthogonal (Cartesian) matrix: ${JSON.stringify(m)}`);
22
+ }
23
+ }
24
+ }
25
+ }
26
+ /** No point group has more than 96 operations (m-3m1'). */
27
+ const MAX_ORDER = 96;
28
+ function toleranceOf(options) {
29
+ const t = options?.tolerance ?? EPSILON;
30
+ if (!(typeof t === 'number' && t > 0 && t < 0.1))
31
+ throw new RangeError(`Invalid tolerance: ${String(t)}`);
32
+ return t;
33
+ }
34
+ /**
35
+ * How far the trace of a matrix with entries within `tolerance` may lie from an integer: three
36
+ * diagonal entries, so three times the tolerance (at least that of `EPSILON`).
37
+ */
38
+ const traceTolerance = (tolerance) => 3 * Math.max(tolerance, EPSILON);
39
+ const same = (a, b, tolerance) => a.timeReversal === b.timeReversal &&
40
+ a.matrix.every((row, i) => row.every((v, j) => Math.abs(v - b.matrix[i][j]) < tolerance));
41
+ /** The kind of an operation (rounded trace, sign of the determinant, time reversal): equal operations have the same. */
42
+ const kindOf = (op) => `${Math.round(trace(op.matrix))}${det(op.matrix) > 0 ? '+' : '-'}${op.timeReversal ? "'" : ''}`;
43
+ /**
44
+ * The group the operations generate, or undefined if it is larger than any point group. The
45
+ * operations of the list that are not yet in the group are taken as generators, and the group is
46
+ * grown by multiplying each element by each generator until nothing new appears; a new operation
47
+ * is compared only with the operations of its kind.
48
+ */
49
+ function close(ops, tolerance) {
50
+ const identity = {
51
+ matrix: [
52
+ [1, 0, 0],
53
+ [0, 1, 0],
54
+ [0, 0, 1],
55
+ ],
56
+ timeReversal: false,
57
+ };
58
+ const group = [];
59
+ const byKind = new Map();
60
+ const has = (op) => (byKind.get(kindOf(op)) ?? []).some((g) => same(g, op, tolerance));
61
+ const push = (op) => {
62
+ group.push(op);
63
+ const k = kindOf(op);
64
+ const list = byKind.get(k);
65
+ if (list)
66
+ list.push(op);
67
+ else
68
+ byKind.set(k, [op]);
69
+ };
70
+ push(identity);
71
+ const generators = [];
72
+ for (const s of ops) {
73
+ if (has(s))
74
+ continue;
75
+ generators.push(s);
76
+ for (let i = 0; i < group.length; i++) {
77
+ for (const t of generators) {
78
+ const product = {
79
+ matrix: multiply(group[i].matrix, t.matrix),
80
+ timeReversal: group[i].timeReversal !== t.timeReversal,
81
+ };
82
+ if (has(product))
83
+ continue;
84
+ if (group.length >= MAX_ORDER)
85
+ return undefined;
86
+ push(product);
87
+ }
88
+ }
89
+ }
90
+ return group;
91
+ }
92
+ /**
93
+ * How many operations of each kind a group has: determinant, trace and time reversal of each. For
94
+ * the 122 point groups these counts are all different (a test checks it), and since the 122 are
95
+ * all point groups up to orientation, the counts identify the point group of any finite group of
96
+ * crystallographic operations.
97
+ */
98
+ const signature = (ops, tolerance = EPSILON) => ops
99
+ .map((op) => {
100
+ const t = trace(op.matrix);
101
+ const rounded = Math.round(t);
102
+ if (Math.abs(t - rounded) > traceTolerance(tolerance))
103
+ return 'x'; // not a crystallographic operation
104
+ return `${Math.round(det(op.matrix))}:${rounded}${op.timeReversal ? "'" : ''}`;
105
+ })
106
+ .sort()
107
+ .join(' ');
108
+ let bySignature;
109
+ function keyOfSignature(s) {
110
+ if (!bySignature) {
111
+ bySignature = new Map();
112
+ for (const key of MAGNETIC_POINT_GROUP_KEYS)
113
+ bySignature.set(signature(groupOperations(key)), key);
114
+ }
115
+ return bySignature.get(s);
116
+ }
117
+ /**
118
+ * The point group generated by a list of Cartesian operations, for instance those left after
119
+ * distorting a crystal: its key, and the setting whose operations it equals in the frame of symcrys
120
+ * (absent if the group is the point group in another orientation). The list is closed into a group
121
+ * first, two matrices being equal when no entry differs by `tolerance` (default `EPSILON`) or more.
122
+ * Time reversal counts: a list with time reversal gives a magnetic point group. Returns undefined
123
+ * if the operations generate no point group (an operation of order 5, a group larger than 96).
124
+ * Throws a RangeError for a matrix that is not orthogonal (within `tolerance`, at least
125
+ * `EPSILON`). The classes `1` and `-1` have one setting and no orientation, so they always have
126
+ * setting 1.
127
+ */
128
+ export function pointGroupOf(operations, options) {
129
+ const tolerance = toleranceOf(options);
130
+ checkTimeReversal(operations);
131
+ operations.forEach((op, i) => checkOrthogonalWithin(op.matrix, `Operation ${i}`, tolerance));
132
+ const group = close(operations, tolerance);
133
+ if (!group)
134
+ return undefined;
135
+ const key = keyOfSignature(signature(group, tolerance));
136
+ if (!key)
137
+ return undefined;
138
+ // The operations passed in generate the group; if each is an operation of a setting of the same
139
+ // order, the group is that setting. Products are not compared, since their errors add up.
140
+ const setting = settings(key, 'itc').find((s) => {
141
+ const ops = groupOperations(key, { convention: 'itc', setting: s.index });
142
+ return ops.length === group.length && operations.every((g) => ops.some((op) => same(g, op, tolerance)));
143
+ });
144
+ return Object.freeze(setting ? { key, setting: setting.index } : { key });
145
+ }
146
+ /**
147
+ * The axis signed so that its first non-zero component, in the order x, y, z, is positive; a
148
+ * component smaller than the tolerance counts as zero.
149
+ */
150
+ function signed(v, tolerance) {
151
+ const first = v.find((x) => Math.abs(x) >= Math.max(tolerance, EPSILON)) ?? 0;
152
+ return first < 0 ? { axis: [-v[0] + 0, -v[1] + 0, -v[2] + 0], flip: true } : { axis: v, flip: false };
153
+ }
154
+ const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
155
+ function describe(op, i, tolerance) {
156
+ checkOrthogonalWithin(op.matrix, `Operation ${i}`, tolerance);
157
+ const notCrystallographic = `Operation ${i} is not a crystallographic point operation`;
158
+ // The trace of the rotation part is an integer exactly for the angles 360°/n, n = 1, 2, 3, 4, 6.
159
+ const t = det(op.matrix) > 0 ? trace(op.matrix) : -trace(op.matrix);
160
+ if (Math.abs(t - Math.round(t)) > traceTolerance(tolerance))
161
+ throw new RangeError(notCrystallographic);
162
+ // The order from the trace of the rotation part, 1 + 2 cos(360°/n): 3, −1, 0, 1, 2 for n = 1, 2, 3, 4, 6.
163
+ const n = { 3: 1, [-1]: 2, 0: 3, 1: 4, 2: 6 }[Math.round(t)];
164
+ if (n === undefined)
165
+ throw new RangeError(notCrystallographic);
166
+ const r = (det(op.matrix) > 0 ? op.matrix : op.matrix.map((row) => row.map((v) => -v)));
167
+ const proper = det(op.matrix) > 0;
168
+ const timeReversal = op.timeReversal;
169
+ if (n === 1)
170
+ return Object.freeze({ kind: proper ? 'identity' : 'inversion', order: 1, timeReversal });
171
+ const { axis } = signed(rotationAxis(r, n), tolerance);
172
+ const frozenAxis = Object.freeze({ cartesian: Object.freeze(axis) });
173
+ const kind = proper ? 'rotation' : n === 2 ? 'mirror' : 'rotoinversion';
174
+ if (n === 2)
175
+ return Object.freeze({ kind, order: 2, axis: frozenAxis, timeReversal });
176
+ const sense = dot(axialVector(r), axis) > 0 ? '+' : '-';
177
+ return Object.freeze({ kind, order: n, axis: frozenAxis, sense, timeReversal });
178
+ }
179
+ /**
180
+ * Each operation of a list described geometrically, in the order of the list: kind, n, the
181
+ * Cartesian axis (rotation or rotoinversion axis, mirror normal) with its first non-zero component,
182
+ * in the order x, y, z, positive, and for n ≥ 3 the sense about that axis. The axes are not named
183
+ * by lattice directions, since the list need not belong to a setting; for a point group given by its
184
+ * key, `describeOperations` names them. Throws a RangeError for a matrix that is not orthogonal or
185
+ * not a crystallographic operation (a rotation part by an angle other than 360°/n, n = 1, 2, 3, 4,
186
+ * 6), both within `tolerance` (default `EPSILON`, as for `pointGroupOf`).
187
+ */
188
+ export function describeOperationsOf(operations, options) {
189
+ const tolerance = toleranceOf(options);
190
+ checkTimeReversal(operations);
191
+ return Object.freeze(operations.map((op, i) => describe(op, i, tolerance)));
192
+ }
193
+ //# sourceMappingURL=identify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/pointGroups/identify.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAwB,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAkB,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAsB,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,yBAAyB,EACzB,UAAU,IAAI,eAAe,EAC7B,QAAQ,GAET,MAAM,kBAAkB,CAAC;AAiD1B,2GAA2G;AAC3G,SAAS,qBAAqB,CAAC,CAAO,EAAE,IAAY,EAAE,SAAiB;IACrE,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;QACzB,eAAe,CAAC,CAAC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M,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAoB,EAAE,CAAC,CAAC;IACxF,MAAM,IAAI,GAAkB,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC;IACvF,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC;IACtF,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACxD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;AAClF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAgC,EAChC,OAA6B;IAE7B,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Operations in the lattice basis and orbits of faces and directions (docs/conventions.md,
3
+ * "Lattice basis and orbits"). Shared by both entry points.
4
+ */
5
+ import { type Mat3, type Vec3 } from '../linalg.js';
6
+ import { type Operation } from '../operations.js';
7
+ import type { Uvw } from '../symmetryDirections.js';
8
+ import { type MagneticPointGroupKey, type SettingOptions } from './pointGroups.js';
9
+ import type { Hkl } from './wyckoff.js';
10
+ /**
11
+ * The operations of a point group in the conventional lattice basis (a, b, c; for the trigonal
12
+ * classes the hexagonal axes), in the order and with the time reversal of `operations` for the same
13
+ * setting and convention: integer matrices W acting on the coordinates of a lattice vector [uvw],
14
+ * W = B⁻¹·R·B with the basis B of `latticeBasis` and the Cartesian matrix R. They do not depend on
15
+ * the cell angles, so they exist for every family; for the monoclinic and triclinic families a, b,
16
+ * c are taken along x, y, z, as for the Wyckoff positions. In the ITC convention they are the
17
+ * matrices of ITA's general position (6th ed., Table 3.2.3.2). Not orthogonal in general: pass
18
+ * them to no function that takes Cartesian operations (docs/conventions.md, "Lattice basis and
19
+ * orbits").
20
+ */
21
+ export declare function latticeOperations(key: MagneticPointGroupKey, options?: SettingOptions): readonly Operation[];
22
+ /** One face of the orbit of a face: its Miller indices and the operations that map the given face onto it. */
23
+ export interface FaceOrbitEntry {
24
+ /** Miller indices (hkl) of the face, in the conventional basis (hexagonal axes: without i). */
25
+ readonly hkl: Hkl;
26
+ /** Indices into `operations` (same setting and convention) of the operations that map the given face onto this one, ascending. */
27
+ readonly operations: readonly number[];
28
+ }
29
+ /** One direction of the orbit of a lattice direction: its indices and the operations that map the given direction onto it. */
30
+ export interface DirectionOrbitEntry {
31
+ /** The lattice direction [uvw] in the conventional basis. */
32
+ readonly uvw: Uvw;
33
+ /** Indices into `operations` (same setting and convention) of the operations that map the given direction onto this one, ascending. */
34
+ readonly operations: readonly number[];
35
+ }
36
+ /**
37
+ * The orbit of a face (hkl) or of a lattice direction [uvw] under a point group, exactly, in the
38
+ * lattice basis: the distinct faces (directions), in the order in which the operations reach them
39
+ * (so in the ITC convention the given face first), each with the indices of the operations that map
40
+ * the given one onto it. A face transforms with the inverse transpose of a lattice operation,
41
+ * h' = W⁻ᵀ·h, a direction with the operation itself, u' = W·u. The number of entries is the
42
+ * multiplicity of the face (direction), and the operations of the first entry, if it is the given
43
+ * one, are its site symmetry. Time reversal plays no part. Throws a RangeError unless exactly one of
44
+ * `hkl` and `uvw` is given, as three integers not all zero (hexagonal axes: three indices, without
45
+ * i).
46
+ */
47
+ export declare function orbit(key: MagneticPointGroupKey, indices: {
48
+ readonly hkl: Hkl;
49
+ }, options?: SettingOptions): readonly FaceOrbitEntry[];
50
+ export declare function orbit(key: MagneticPointGroupKey, indices: {
51
+ readonly uvw: Uvw;
52
+ }, options?: SettingOptions): readonly DirectionOrbitEntry[];
53
+ export declare function orbit(key: MagneticPointGroupKey, indices: {
54
+ readonly hkl: Hkl;
55
+ } | {
56
+ readonly uvw: Uvw;
57
+ }, options?: SettingOptions): readonly FaceOrbitEntry[] | readonly DirectionOrbitEntry[];
58
+ /** Options of `orbitOf`. */
59
+ export interface OrbitOptions {
60
+ /**
61
+ * Two images count as one pole if their unit vectors are closer than this (Euclidean distance).
62
+ * Default 10⁻⁶; a caller whose directions carry rounding errors passes a larger value.
63
+ */
64
+ readonly tolerance?: number;
65
+ }
66
+ /** One pole of the orbit of a direction under a list of operations. */
67
+ export interface OrbitPole {
68
+ /** The image of the given direction as a Cartesian unit vector (the first operation's image where several coincide). */
69
+ readonly direction: Vec3;
70
+ /** Indices into the given operations of those that map the direction here, ascending. */
71
+ readonly operations: readonly number[];
72
+ }
73
+ /**
74
+ * The orbit of a direction (any non-zero vector, Cartesian, e.g. a face normal) under a list of
75
+ * operations, for instance those of a distorted crystal: the images of its unit vector under each
76
+ * operation, coinciding images merged (closer than `tolerance`, default `EPSILON`, as for
77
+ * `siteSymmetry`), in the order in which the operations reach them, each with the indices of the
78
+ * operations that map the direction there. The list is taken as it is, not closed into a group.
79
+ * Time reversal is ignored. Throws a RangeError for a zero vector and for a matrix that is not
80
+ * orthogonal (Cartesian; not one of `latticeOperations`).
81
+ */
82
+ export declare function orbitOf(operations: readonly {
83
+ readonly matrix: Mat3;
84
+ }[], direction: Vec3, options?: OrbitOptions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;IAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAAE,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,SAAS,mBAAmB,EAAE,CAAC;AAClC,wBAAgB,KAAK,CACnB,GAAG,EAAE,qBAAqB,EAC1B,OAAO,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAAE,EACtD,OAAO,CAAC,EAAE,cAAc,GACvB,SAAS,cAAc,EAAE,GAAG,SAAS,mBAAmB,EAAE,CAAC;AAsC9D,4BAA4B;AAC5B,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,uEAAuE;AACvE,MAAM,WAAW,SAAS;IACxB,wHAAwH;IACxH,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,yFAAyF;IACzF,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACrB,UAAU,EAAE,SAAS;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,EAAE,EAChD,SAAS,EAAE,IAAI,EACf,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,SAAS,EAAE,CAuBtB"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Operations in the lattice basis and orbits of faces and directions (docs/conventions.md,
3
+ * "Lattice basis and orbits"). Shared by both entry points.
4
+ */
5
+ import { crystalFamily, latticeBasis } from '../lattice.js';
6
+ import { apply, inverse, multiply } from '../linalg.js';
7
+ import { checkOrthogonal } from '../operations.js';
8
+ import { siteTolerance } from '../siteSymmetry.js';
9
+ import { operations as groupOperations, pointGroup, } from './pointGroups.js';
10
+ const IDENTITY = [
11
+ [1, 0, 0],
12
+ [0, 1, 0],
13
+ [0, 0, 1],
14
+ ];
15
+ /**
16
+ * The conventional basis a, b, c (columns) in the Cartesian frame of a point group: that of
17
+ * `latticeBasis`, and for the monoclinic and triclinic families a, b, c along x, y, z, as for the
18
+ * Wyckoff positions (the integer matrices do not depend on the cell angles).
19
+ */
20
+ function conventionalBasis(key) {
21
+ const family = crystalFamily(pointGroup(key).crystalSystem);
22
+ return family === 'monoclinic' || family === 'triclinic' ? IDENTITY : latticeBasis(family);
23
+ }
24
+ /** An integer matrix from one that should be one; throws if it is not (a data error). */
25
+ function integer(m, what) {
26
+ const r = m.map((row) => row.map((v) => Math.round(v) + 0));
27
+ if (!m.every((row, i) => row.every((v, j) => Math.abs(v - r[i][j]) < 1e-9))) {
28
+ throw new Error(`${what} is not an integer matrix in the lattice basis: ${JSON.stringify(m)}`);
29
+ }
30
+ return r;
31
+ }
32
+ const deepFreeze = (m) => Object.freeze(m.map((row) => Object.freeze([...row])));
33
+ const latticeCache = new WeakMap();
34
+ /**
35
+ * The operations of a point group in the conventional lattice basis (a, b, c; for the trigonal
36
+ * classes the hexagonal axes), in the order and with the time reversal of `operations` for the same
37
+ * setting and convention: integer matrices W acting on the coordinates of a lattice vector [uvw],
38
+ * W = B⁻¹·R·B with the basis B of `latticeBasis` and the Cartesian matrix R. They do not depend on
39
+ * the cell angles, so they exist for every family; for the monoclinic and triclinic families a, b,
40
+ * c are taken along x, y, z, as for the Wyckoff positions. In the ITC convention they are the
41
+ * matrices of ITA's general position (6th ed., Table 3.2.3.2). Not orthogonal in general: pass
42
+ * them to no function that takes Cartesian operations (docs/conventions.md, "Lattice basis and
43
+ * orbits").
44
+ */
45
+ export function latticeOperations(key, options) {
46
+ const ops = groupOperations(key, options);
47
+ let result = latticeCache.get(ops);
48
+ if (!result) {
49
+ const b = conventionalBasis(key);
50
+ const bInv = inverse(b);
51
+ result = Object.freeze(ops.map((op, i) => Object.freeze({
52
+ matrix: deepFreeze(integer(multiply(multiply(bInv, op.matrix), b), `Operation ${i} of ${key}`)),
53
+ timeReversal: op.timeReversal,
54
+ })));
55
+ latticeCache.set(ops, result);
56
+ }
57
+ return result;
58
+ }
59
+ /** The inverse of an integer matrix of determinant ±1, exactly (the adjugate). */
60
+ function integerInverse(w) {
61
+ return integer(inverse(w), 'The inverse of a lattice operation');
62
+ }
63
+ /** Indices of a face or a lattice direction, checked: three integers, not all zero. */
64
+ function indicesOf(value, name) {
65
+ if (!Array.isArray(value) ||
66
+ value.length !== 3 ||
67
+ !value.every((x) => typeof x === 'number' && Number.isSafeInteger(x)) ||
68
+ value.every((x) => x === 0)) {
69
+ throw new RangeError(`${name} must be three (safe) integers, not all zero: ${JSON.stringify(value)}`);
70
+ }
71
+ return [value[0] + 0, value[1] + 0, value[2] + 0];
72
+ }
73
+ export function orbit(key, indices, options) {
74
+ const given = (indices ?? {});
75
+ const hasHkl = given.hkl !== undefined;
76
+ const hasUvw = given.uvw !== undefined;
77
+ if (hasHkl === hasUvw)
78
+ throw new RangeError('orbit: give either hkl (a face) or uvw (a lattice direction)');
79
+ const field = hasHkl ? 'hkl' : 'uvw';
80
+ const v = indicesOf(hasHkl ? given.hkl : given.uvw, field);
81
+ const ws = latticeOperations(key, options).map((op) => (hasHkl ? integerInverseTranspose(op.matrix) : op.matrix));
82
+ const images = [];
83
+ ws.forEach((w, i) => {
84
+ const image = apply(w, v).map((x) => x + 0);
85
+ const k = image.join(',');
86
+ const entry = images.find((e) => e.key === k);
87
+ if (entry)
88
+ entry.operations.push(i);
89
+ else
90
+ images.push({ key: k, value: image, operations: [i] });
91
+ });
92
+ return Object.freeze(images.map((e) => Object.freeze({ [field]: Object.freeze(e.value), operations: Object.freeze(e.operations) })));
93
+ }
94
+ const inverseTransposeCache = new WeakMap();
95
+ function integerInverseTranspose(w) {
96
+ let r = inverseTransposeCache.get(w);
97
+ if (!r) {
98
+ const inv = integerInverse(w);
99
+ r = deepFreeze([0, 1, 2].map((i) => [0, 1, 2].map((j) => inv[j][i])));
100
+ inverseTransposeCache.set(w, r);
101
+ }
102
+ return r;
103
+ }
104
+ /**
105
+ * The orbit of a direction (any non-zero vector, Cartesian, e.g. a face normal) under a list of
106
+ * operations, for instance those of a distorted crystal: the images of its unit vector under each
107
+ * operation, coinciding images merged (closer than `tolerance`, default `EPSILON`, as for
108
+ * `siteSymmetry`), in the order in which the operations reach them, each with the indices of the
109
+ * operations that map the direction there. The list is taken as it is, not closed into a group.
110
+ * Time reversal is ignored. Throws a RangeError for a zero vector and for a matrix that is not
111
+ * orthogonal (Cartesian; not one of `latticeOperations`).
112
+ */
113
+ export function orbitOf(operations, direction, options) {
114
+ const tolerance = siteTolerance(options);
115
+ operations.forEach((op, i) => checkOrthogonal(op.matrix, `Operation ${i}`));
116
+ const n = Math.hypot(direction[0], direction[1], direction[2]);
117
+ if (!(n > 0) || !Number.isFinite(n))
118
+ throw new RangeError(`Not a direction: ${JSON.stringify(direction)}`);
119
+ const u = [direction[0] / n, direction[1] / n, direction[2] / n];
120
+ const poles = [];
121
+ operations.forEach((op, i) => {
122
+ const w = apply(op.matrix, u);
123
+ const pole = poles.find((p) => Math.hypot(p.direction[0] - w[0], p.direction[1] - w[1], p.direction[2] - w[2]) < tolerance);
124
+ if (pole)
125
+ pole.operations.push(i);
126
+ else
127
+ poles.push({ direction: w, operations: [i] });
128
+ });
129
+ return Object.freeze(poles.map((p) => Object.freeze({
130
+ direction: Object.freeze(p.direction),
131
+ operations: Object.freeze(p.operations),
132
+ })));
133
+ }
134
+ //# sourceMappingURL=orbits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orbits.js","sourceRoot":"","sources":["../../src/pointGroups/orbits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAwB,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAkB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAA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C,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvE,MAAM,KAAK,GAAgD,EAAE,CAAC;IAC9D,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QAC3B,MAAM,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CACrB,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CACnG,CAAC;QACF,IAAI,IAAI;YAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YAC7B,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAClB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACd,MAAM,CAAC,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAoB;QACxD,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC;KACxC,CAAC,CACH,CACF,CAAC;AACJ,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * ITA's letters, multiplicities and oriented site-symmetry symbols, a representative face, and the
4
4
  * Wyckoff position of any direction (docs/conventions.md, "Site symmetry and Wyckoff positions").
5
5
  */
6
- import { type Vec3 } from '../linalg.js';
6
+ import { type Mat3, type Vec3 } from '../linalg.js';
7
7
  import { type PointGroupKey, type SettingOptions } from './pointGroups.js';
8
8
  import { type SiteSymmetryOptions } from '../siteSymmetry.js';
9
9
  /** A face (hkl): three Miller indices in the conventional basis (for hexagonal axes without i = −(h + k)). */
@@ -38,6 +38,45 @@ export interface WyckoffPosition {
38
38
  }
39
39
  /** Convention and setting (`SettingOptions`) and the tolerance of `siteSymmetry` (`SiteSymmetryOptions`). */
40
40
  export type WyckoffOptions = SettingOptions & SiteSymmetryOptions;
41
+ /** The values substituted into ITA's Miller indices for the numeric representative. */
42
+ export declare const REPRESENTATIVE_VALUES: Readonly<Record<'h' | 'k' | 'l', number>>;
43
+ /** Printed Miller indices (three, or four for hexagonal axes) as three numbers, with the given values of h, k, l. */
44
+ export declare function numericHkl(miller: string, values?: Readonly<Record<"h" | "k" | "l", number>>): Hkl;
45
+ export declare const IDENTITY: Mat3;
46
+ /** The face normal of (hkl) as a Cartesian unit vector: h a* + k b* + l c* with the reciprocal basis B⁻ᵀ. */
47
+ export declare function normal(basis: Mat3, hkl: Hkl): Vec3;
48
+ /**
49
+ * A printed pattern carried by a signed permutation r of the axes (new axis i = r[i][j] × old axis j).
50
+ * Only for components that are `0`, a number, or a plain letter with an optional `-` (as in `mm2`); a
51
+ * letter is renamed after its new position. A factor such as `2x` throws.
52
+ */
53
+ export declare function permutePattern(pattern: string, r: Mat3, letters: string): string;
54
+ /**
55
+ * The signed permutation r that carries setting 1 of a class into `setting` (new axis i = r[i][j] ×
56
+ * old axis j), for the settings ITA does not print (`mm2` settings 2 and 3). Throws if the frame of
57
+ * the setting is not a permutation of that of setting 1.
58
+ */
59
+ export declare function permutationFromSetting1(key: PointGroupKey, setting: number): Mat3;
60
+ /**
61
+ * The entry of a table printed per setting (Wyckoff positions, face forms) for a setting of a class:
62
+ * the one with the ITC short symbol (and unique axis) of the setting, or undefined if ITA does not
63
+ * print the setting.
64
+ */
65
+ export declare function printedEntry<E extends {
66
+ readonly symbol: string;
67
+ readonly uniqueAxis?: 'b' | 'c';
68
+ }>(table: readonly E[], key: PointGroupKey, setting: number): E | undefined;
69
+ /**
70
+ * The lattice basis in which the Cartesian normals of the representatives are computed; monoclinic
71
+ * and triclinic: a, b, c along x, y, z (docs/conventions.md, "Site symmetry and Wyckoff positions").
72
+ */
73
+ export declare function faceBasis(key: PointGroupKey): Mat3;
74
+ /**
75
+ * The setting index for a table that exists for the crystal classes in the ITC convention only
76
+ * (`what`: 'Wyckoff positions', 'Crystal forms'); throws a RangeError for a magnetic point group
77
+ * with time reversal and for another convention.
78
+ */
79
+ export declare function itcSetting(key: PointGroupKey, options?: SettingOptions, what?: string): number;
41
80
  /**
42
81
  * The Wyckoff positions of a point group for directions, in ITA's printed order (general position
43
82
  * first), for the 32 crystal classes and in the ITC convention only (throws a RangeError for a
@@ -1 +1 @@
1
- {"version":3,"file":"wyckoff.d.ts","sourceRoot":"","sources":["../../src/pointGroups/wyckoff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAwC,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA+B,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG3F,8GAA8G;AAC9G,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,yFAAyF;IACzF,QAAQ,CAAC,WAAW,E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