symcrys 0.10.0 → 0.11.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 +6 -6
- package/dist/cell.d.ts +19 -16
- package/dist/cell.d.ts.map +1 -1
- package/dist/cell.js +63 -35
- package/dist/cell.js.map +1 -1
- package/dist/checks.d.ts +29 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +79 -0
- package/dist/checks.js.map +1 -0
- package/dist/closure.d.ts +43 -0
- package/dist/closure.d.ts.map +1 -0
- package/dist/closure.js +201 -0
- package/dist/closure.js.map +1 -0
- package/dist/crystalClasses.d.ts +146 -118
- package/dist/crystalClasses.d.ts.map +1 -1
- package/dist/crystalClasses.js +163 -124
- package/dist/crystalClasses.js.map +1 -1
- package/dist/freeze.d.ts +7 -0
- package/dist/freeze.d.ts.map +1 -0
- package/dist/freeze.js +15 -0
- package/dist/freeze.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/indices.d.ts +31 -5
- package/dist/indices.d.ts.map +1 -1
- package/dist/indices.js +104 -13
- package/dist/indices.js.map +1 -1
- package/dist/lattice.d.ts +15 -1
- package/dist/lattice.d.ts.map +1 -1
- package/dist/lattice.js +30 -1
- package/dist/lattice.js.map +1 -1
- package/dist/linalg.d.ts +2 -2
- package/dist/linalg.d.ts.map +1 -1
- package/dist/linalg.js +3 -3
- package/dist/linalg.js.map +1 -1
- package/dist/magnetic.d.ts +12 -10
- package/dist/magnetic.d.ts.map +1 -1
- package/dist/magnetic.js +8 -6
- package/dist/magnetic.js.map +1 -1
- package/dist/notation.d.ts +16 -0
- package/dist/notation.d.ts.map +1 -0
- package/dist/notation.js +66 -0
- package/dist/notation.js.map +1 -0
- package/dist/operations.d.ts +40 -26
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +48 -60
- package/dist/operations.js.map +1 -1
- package/dist/plane.d.ts +141 -79
- package/dist/plane.d.ts.map +1 -1
- package/dist/plane.js +147 -77
- package/dist/plane.js.map +1 -1
- package/dist/pointGroups/crystalForms.d.ts +6 -21
- package/dist/pointGroups/crystalForms.d.ts.map +1 -1
- package/dist/pointGroups/crystalForms.js +9 -16
- package/dist/pointGroups/crystalForms.js.map +1 -1
- package/dist/pointGroups/crystalFormsData.d.ts +4 -1
- package/dist/pointGroups/crystalFormsData.d.ts.map +1 -1
- package/dist/pointGroups/crystalFormsData.js +64 -1
- package/dist/pointGroups/crystalFormsData.js.map +1 -1
- package/dist/pointGroups/elements.d.ts +19 -17
- package/dist/pointGroups/elements.d.ts.map +1 -1
- package/dist/pointGroups/elements.js +65 -83
- package/dist/pointGroups/elements.js.map +1 -1
- package/dist/pointGroups/identify.d.ts +10 -18
- package/dist/pointGroups/identify.d.ts.map +1 -1
- package/dist/pointGroups/identify.js +27 -79
- package/dist/pointGroups/identify.js.map +1 -1
- package/dist/pointGroups/itaOrder.d.ts +15 -14
- package/dist/pointGroups/itaOrder.d.ts.map +1 -1
- package/dist/pointGroups/itaOrder.js +116 -94
- package/dist/pointGroups/itaOrder.js.map +1 -1
- package/dist/pointGroups/itcData.d.ts +96 -0
- package/dist/pointGroups/itcData.d.ts.map +1 -0
- package/dist/pointGroups/itcData.js +336 -0
- package/dist/pointGroups/itcData.js.map +1 -0
- package/dist/pointGroups/itcMagneticData.d.ts +55 -0
- package/dist/pointGroups/itcMagneticData.d.ts.map +1 -0
- package/dist/pointGroups/itcMagneticData.js +172 -0
- package/dist/pointGroups/itcMagneticData.js.map +1 -0
- package/dist/pointGroups/keys.d.ts +32 -0
- package/dist/pointGroups/keys.d.ts.map +1 -0
- package/dist/pointGroups/keys.js +120 -0
- package/dist/pointGroups/keys.js.map +1 -0
- package/dist/pointGroups/magneticSymbols.d.ts +6 -5
- package/dist/pointGroups/magneticSymbols.d.ts.map +1 -1
- package/dist/pointGroups/magneticSymbols.js +15 -12
- package/dist/pointGroups/magneticSymbols.js.map +1 -1
- package/dist/pointGroups/orbits.d.ts +23 -42
- package/dist/pointGroups/orbits.d.ts.map +1 -1
- package/dist/pointGroups/orbits.js +20 -62
- package/dist/pointGroups/orbits.js.map +1 -1
- package/dist/pointGroups/pointGroups.d.ts +135 -67
- package/dist/pointGroups/pointGroups.d.ts.map +1 -1
- package/dist/pointGroups/pointGroups.js +409 -244
- package/dist/pointGroups/pointGroups.js.map +1 -1
- package/dist/pointGroups/properties.d.ts +21 -22
- package/dist/pointGroups/properties.d.ts.map +1 -1
- package/dist/pointGroups/properties.js +40 -37
- package/dist/pointGroups/properties.js.map +1 -1
- package/dist/pointGroups/seitzData.d.ts +26 -0
- package/dist/pointGroups/seitzData.d.ts.map +1 -0
- package/dist/pointGroups/seitzData.js +130 -0
- package/dist/pointGroups/seitzData.js.map +1 -0
- package/dist/pointGroups/wyckoff.d.ts +70 -40
- package/dist/pointGroups/wyckoff.d.ts.map +1 -1
- package/dist/pointGroups/wyckoff.js +98 -91
- package/dist/pointGroups/wyckoff.js.map +1 -1
- package/dist/pointGroups/wyckoffData.d.ts +7 -4
- package/dist/pointGroups/wyckoffData.d.ts.map +1 -1
- package/dist/pointGroups/wyckoffData.js +789 -168
- package/dist/pointGroups/wyckoffData.js.map +1 -1
- package/dist/siteSymmetry.d.ts +9 -17
- package/dist/siteSymmetry.d.ts.map +1 -1
- package/dist/siteSymmetry.js +62 -47
- package/dist/siteSymmetry.js.map +1 -1
- package/dist/spaceGroups/affine.d.ts.map +1 -1
- package/dist/spaceGroups/affine.js +3 -2
- package/dist/spaceGroups/affine.js.map +1 -1
- package/dist/spaceGroups/cell.d.ts +43 -31
- package/dist/spaceGroups/cell.d.ts.map +1 -1
- package/dist/spaceGroups/cell.js +173 -85
- package/dist/spaceGroups/cell.js.map +1 -1
- package/dist/spaceGroups/describe.d.ts +12 -10
- package/dist/spaceGroups/describe.d.ts.map +1 -1
- package/dist/spaceGroups/describe.js +11 -10
- package/dist/spaceGroups/describe.js.map +1 -1
- package/dist/spaceGroups/planeGroupData.d.ts +1 -1
- package/dist/spaceGroups/planeGroupData.d.ts.map +1 -1
- package/dist/spaceGroups/planeGroupData.js +8 -8
- package/dist/spaceGroups/planeGroupData.js.map +1 -1
- package/dist/spaceGroups/planeGroups.d.ts.map +1 -1
- package/dist/spaceGroups/planeGroups.js +2 -1
- package/dist/spaceGroups/planeGroups.js.map +1 -1
- package/dist/spaceGroups/positions.d.ts +48 -19
- package/dist/spaceGroups/positions.d.ts.map +1 -1
- package/dist/spaceGroups/positions.js +166 -67
- package/dist/spaceGroups/positions.js.map +1 -1
- package/dist/tensors/propertyTable.d.ts +3 -1
- package/dist/tensors/propertyTable.d.ts.map +1 -1
- package/dist/tensors/propertyTable.js +17 -10
- package/dist/tensors/propertyTable.js.map +1 -1
- package/dist/tensors/rowEchelon.d.ts +12 -4
- package/dist/tensors/rowEchelon.d.ts.map +1 -1
- package/dist/tensors/rowEchelon.js +24 -11
- package/dist/tensors/rowEchelon.js.map +1 -1
- package/dist/tensors/tensorForm.d.ts +75 -34
- package/dist/tensors/tensorForm.d.ts.map +1 -1
- package/dist/tensors/tensorForm.js +173 -68
- package/dist/tensors/tensorForm.js.map +1 -1
- package/dist/tensors/tensorProperties.d.ts +10 -9
- package/dist/tensors/tensorProperties.d.ts.map +1 -1
- package/dist/tensors/tensorProperties.js +22 -12
- package/dist/tensors/tensorProperties.js.map +1 -1
- package/dist/tolerances.d.ts +56 -1
- package/dist/tolerances.d.ts.map +1 -1
- package/dist/tolerances.js +51 -1
- package/dist/tolerances.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/cell.ts +78 -51
- package/src/checks.ts +84 -0
- package/src/closure.ts +214 -0
- package/src/crystalClasses.ts +234 -160
- package/src/freeze.ts +14 -0
- package/src/index.ts +21 -10
- package/src/indices.ts +108 -18
- package/src/lattice.ts +41 -1
- package/src/linalg.ts +3 -3
- package/src/magnetic.ts +14 -9
- package/src/notation.ts +73 -0
- package/src/operations.ts +78 -69
- package/src/plane.ts +253 -127
- package/src/pointGroups/crystalForms.ts +11 -44
- package/src/pointGroups/crystalFormsData.ts +66 -1
- package/src/pointGroups/elements.ts +82 -92
- package/src/pointGroups/identify.ts +38 -97
- package/src/pointGroups/itaOrder.ts +117 -101
- package/src/pointGroups/itcData.ts +404 -0
- package/src/pointGroups/itcMagneticData.ts +206 -0
- package/src/pointGroups/keys.ts +144 -0
- package/src/pointGroups/magneticSymbols.ts +18 -17
- package/src/pointGroups/orbits.ts +41 -89
- package/src/pointGroups/pointGroups.ts +540 -297
- package/src/pointGroups/properties.ts +44 -40
- package/src/pointGroups/seitzData.ts +147 -0
- package/src/pointGroups/wyckoff.ts +137 -112
- package/src/pointGroups/wyckoffData.ts +793 -170
- package/src/siteSymmetry.ts +71 -64
- package/src/spaceGroups/affine.ts +3 -2
- package/src/spaceGroups/cell.ts +227 -116
- package/src/spaceGroups/describe.ts +22 -19
- package/src/spaceGroups/planeGroupData.ts +9 -9
- package/src/spaceGroups/planeGroups.ts +2 -1
- package/src/spaceGroups/positions.ts +202 -78
- package/src/tensors/propertyTable.ts +29 -17
- package/src/tensors/rowEchelon.ts +28 -9
- package/src/tensors/tensorForm.ts +260 -89
- package/src/tensors/tensorProperties.ts +34 -14
- package/src/tolerances.ts +66 -1
- package/src/version.ts +1 -1
- package/dist/pointGroups/data.d.ts +0 -75
- package/dist/pointGroups/data.d.ts.map +0 -1
- package/dist/pointGroups/data.js +0 -212
- package/dist/pointGroups/data.js.map +0 -1
- package/dist/pointGroups/magneticData.d.ts +0 -66
- package/dist/pointGroups/magneticData.d.ts.map +0 -1
- package/dist/pointGroups/magneticData.js +0 -184
- package/dist/pointGroups/magneticData.js.map +0 -1
- package/dist/spaceGroups/snap.d.ts +0 -20
- package/dist/spaceGroups/snap.d.ts.map +0 -1
- package/dist/spaceGroups/snap.js +0 -103
- package/dist/spaceGroups/snap.js.map +0 -1
- package/src/pointGroups/data.ts +0 -305
- package/src/pointGroups/magneticData.ts +0 -328
- package/src/spaceGroups/snap.ts +0 -121
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* group of a list of operations"). Shared by both entry points.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { TOLERANCE_KEYS, checkOptions } from '../checks.js';
|
|
8
|
+
import { det, trace, type Mat3, type Vec3 } from '../linalg.js';
|
|
9
|
+
import { closeWithin, sameWithin } from '../closure.js';
|
|
10
|
+
import { checkCartesianOperations, checkTimeReversal, type CartesianOperation } from '../operations.js';
|
|
11
|
+
import { EPSILON, toleranceOf, type ToleranceOptions } from '../tolerances.js';
|
|
10
12
|
import { axialVector, rotationAxis, type OperationKind } from './elements.js';
|
|
11
13
|
import {
|
|
12
14
|
MAGNETIC_POINT_GROUP_KEYS,
|
|
@@ -15,16 +17,6 @@ import {
|
|
|
15
17
|
type MagneticPointGroupKey,
|
|
16
18
|
} from './pointGroups.js';
|
|
17
19
|
|
|
18
|
-
/** Options of `pointGroupOf` and `describeOperationsOf`. */
|
|
19
|
-
export interface PointGroupOfOptions {
|
|
20
|
-
/**
|
|
21
|
-
* Two matrices are the same operation if no entry differs by this much or more, and a matrix
|
|
22
|
-
* counts as orthogonal and crystallographic within it. Default `EPSILON` (10⁻⁶); a caller whose
|
|
23
|
-
* matrices carry rounding errors passes a larger value, below 0.1.
|
|
24
|
-
*/
|
|
25
|
-
readonly tolerance?: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
20
|
/** The point group of a list of operations: its key, and the setting if the operations are exactly those of one. */
|
|
29
21
|
export interface IdentifiedPointGroup {
|
|
30
22
|
/** The key of the point group the operations generate. */
|
|
@@ -47,11 +39,11 @@ export interface CartesianOperationDescription {
|
|
|
47
39
|
/** What the operation is, without time reversal. */
|
|
48
40
|
readonly kind: OperationKind;
|
|
49
41
|
/**
|
|
50
|
-
* The n of the symbol n or n
|
|
51
|
-
* otherwise the order of the rotation part.
|
|
42
|
+
* The n of the symbol n or n̄ (ITA 2016 § 1.2.1, p. 12: an n-fold rotation): 1 for the identity and the
|
|
43
|
+
* inversion, 2 for a reflection (m = 2̄), otherwise the order of the rotation part.
|
|
52
44
|
*/
|
|
53
|
-
readonly
|
|
54
|
-
/** Rotation axis, rotoinversion axis or mirror
|
|
45
|
+
readonly n: number;
|
|
46
|
+
/** Rotation axis, rotoinversion axis or the normal of the mirror plane; absent for the identity and the inversion. */
|
|
55
47
|
readonly axis?: CartesianAxis;
|
|
56
48
|
/**
|
|
57
49
|
* For n ≥ 3: `'+'` if the rotation part turns by +360°/n about `axis` (counter-clockwise seen
|
|
@@ -65,70 +57,17 @@ export interface CartesianOperationDescription {
|
|
|
65
57
|
/** No point group has more than 96 operations (m-3m1'). */
|
|
66
58
|
const MAX_ORDER = 96;
|
|
67
59
|
|
|
68
|
-
function toleranceOf(options?: PointGroupOfOptions): number {
|
|
69
|
-
const t = options?.tolerance ?? EPSILON;
|
|
70
|
-
if (!(typeof t === 'number' && t > 0 && t < 0.1)) throw new RangeError(`Invalid tolerance: ${String(t)}`);
|
|
71
|
-
return t;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
60
|
/**
|
|
75
61
|
* How far the trace of a matrix with entries within `tolerance` may lie from an integer: three
|
|
76
62
|
* diagonal entries, so three times the tolerance (at least that of `EPSILON`).
|
|
77
63
|
*/
|
|
78
64
|
const traceTolerance = (tolerance: number): number => 3 * Math.max(tolerance, EPSILON);
|
|
79
65
|
|
|
80
|
-
const same =
|
|
81
|
-
a.timeReversal === b.timeReversal &&
|
|
82
|
-
a.matrix.every((row, i) => row.every((v, j) => Math.abs(v - b.matrix[i][j]) < tolerance));
|
|
66
|
+
const same = sameWithin;
|
|
83
67
|
|
|
84
|
-
/** The
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* The group the operations generate, or undefined if it is larger than any point group. The
|
|
90
|
-
* operations of the list that are not yet in the group are taken as generators, and the group is
|
|
91
|
-
* grown by multiplying each element by each generator until nothing new appears; a new operation
|
|
92
|
-
* is compared only with the operations of its kind.
|
|
93
|
-
*/
|
|
94
|
-
function close(ops: readonly Operation[], tolerance: number): Operation[] | undefined {
|
|
95
|
-
const identity: Operation = {
|
|
96
|
-
matrix: [
|
|
97
|
-
[1, 0, 0],
|
|
98
|
-
[0, 1, 0],
|
|
99
|
-
[0, 0, 1],
|
|
100
|
-
],
|
|
101
|
-
timeReversal: false,
|
|
102
|
-
};
|
|
103
|
-
const group: Operation[] = [];
|
|
104
|
-
const byKind = new Map<string, Operation[]>();
|
|
105
|
-
const has = (op: Operation): boolean => (byKind.get(kindOf(op)) ?? []).some((g) => same(g, op, tolerance));
|
|
106
|
-
const push = (op: Operation): void => {
|
|
107
|
-
group.push(op);
|
|
108
|
-
const k = kindOf(op);
|
|
109
|
-
const list = byKind.get(k);
|
|
110
|
-
if (list) list.push(op);
|
|
111
|
-
else byKind.set(k, [op]);
|
|
112
|
-
};
|
|
113
|
-
push(identity);
|
|
114
|
-
const generators: Operation[] = [];
|
|
115
|
-
for (const s of ops) {
|
|
116
|
-
if (has(s)) continue;
|
|
117
|
-
generators.push(s);
|
|
118
|
-
for (let i = 0; i < group.length; i++) {
|
|
119
|
-
for (const t of generators) {
|
|
120
|
-
const product: Operation = {
|
|
121
|
-
matrix: multiply(group[i].matrix, t.matrix),
|
|
122
|
-
timeReversal: group[i].timeReversal !== t.timeReversal,
|
|
123
|
-
};
|
|
124
|
-
if (has(product)) continue;
|
|
125
|
-
if (group.length >= MAX_ORDER) return undefined;
|
|
126
|
-
push(product);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return group;
|
|
131
|
-
}
|
|
68
|
+
/** The group the operations generate within the tolerance, or undefined if it is larger than any point group. */
|
|
69
|
+
const close = (ops: readonly CartesianOperation[], tolerance: number): CartesianOperation[] | undefined =>
|
|
70
|
+
closeWithin(ops, tolerance, MAX_ORDER);
|
|
132
71
|
|
|
133
72
|
/**
|
|
134
73
|
* How many operations of each kind a group has: determinant, trace and time reversal of each. For
|
|
@@ -136,13 +75,13 @@ function close(ops: readonly Operation[], tolerance: number): Operation[] | unde
|
|
|
136
75
|
* all point groups up to orientation, the counts identify the point group of any finite group of
|
|
137
76
|
* crystallographic operations.
|
|
138
77
|
*/
|
|
139
|
-
const signature = (ops: readonly
|
|
78
|
+
const signature = (ops: readonly CartesianOperation[], tolerance = EPSILON): string =>
|
|
140
79
|
ops
|
|
141
80
|
.map((op) => {
|
|
142
|
-
const t = trace(op.
|
|
81
|
+
const t = trace(op.cartesian);
|
|
143
82
|
const rounded = Math.round(t);
|
|
144
83
|
if (Math.abs(t - rounded) > traceTolerance(tolerance)) return 'x'; // not a crystallographic operation
|
|
145
|
-
return `${Math.round(det(op.
|
|
84
|
+
return `${Math.round(det(op.cartesian))}:${rounded}${op.timeReversal ? "'" : ''}`;
|
|
146
85
|
})
|
|
147
86
|
.sort()
|
|
148
87
|
.join(' ');
|
|
@@ -164,26 +103,27 @@ function keyOfSignature(s: string): MagneticPointGroupKey | undefined {
|
|
|
164
103
|
* first, two matrices being equal when no entry differs by `tolerance` (default `EPSILON`) or more.
|
|
165
104
|
* Time reversal counts: a list with time reversal gives a magnetic point group. Returns undefined
|
|
166
105
|
* if the operations generate no point group (an operation of order 5, a group larger than 96).
|
|
167
|
-
* Throws a RangeError for
|
|
106
|
+
* Throws a RangeError for an operation without an orthogonal Cartesian matrix (`cartesian`; within `tolerance`, at least
|
|
168
107
|
* `EPSILON`) and for an operation that does not say whether it is combined with time reversal.
|
|
169
108
|
* The classes `1` and `-1` have one setting and no orientation, so they always have
|
|
170
109
|
* setting 1.
|
|
171
110
|
*/
|
|
172
111
|
export function pointGroupOf(
|
|
173
|
-
operations: readonly
|
|
174
|
-
options?:
|
|
112
|
+
operations: readonly CartesianOperation[],
|
|
113
|
+
options?: ToleranceOptions,
|
|
175
114
|
): IdentifiedPointGroup | undefined {
|
|
176
|
-
|
|
115
|
+
checkOptions(options, TOLERANCE_KEYS, 'pointGroupOf');
|
|
116
|
+
const tolerance = toleranceOf(options, 'operations');
|
|
117
|
+
checkCartesianOperations(operations, tolerance);
|
|
177
118
|
checkTimeReversal(operations);
|
|
178
|
-
operations.forEach((op, i) => checkOrthogonalWithin(op.matrix, `Operation ${i}`, tolerance));
|
|
179
119
|
const group = close(operations, tolerance);
|
|
180
120
|
if (!group) return undefined;
|
|
181
121
|
const key = keyOfSignature(signature(group, tolerance));
|
|
182
122
|
if (!key) return undefined;
|
|
183
123
|
// The operations passed in generate the group; if each is an operation of a setting of the same
|
|
184
124
|
// order, the group is that setting. Products are not compared, since their errors add up.
|
|
185
|
-
const setting = settings(key
|
|
186
|
-
const ops = groupOperations(key, {
|
|
125
|
+
const setting = settings(key).find((s) => {
|
|
126
|
+
const ops = groupOperations(key, { setting: s.index });
|
|
187
127
|
return ops.length === group.length && operations.every((g) => ops.some((op) => same(g, op, tolerance)));
|
|
188
128
|
});
|
|
189
129
|
return Object.freeze(setting ? { key, setting: setting.index } : { key });
|
|
@@ -200,25 +140,24 @@ function signed(v: Vec3, tolerance: number): { axis: Vec3; flip: boolean } {
|
|
|
200
140
|
|
|
201
141
|
const dot = (a: Vec3, b: Vec3): number => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
202
142
|
|
|
203
|
-
function describe(op:
|
|
204
|
-
checkOrthogonalWithin(op.matrix, `Operation ${i}`, tolerance);
|
|
143
|
+
function describe(op: CartesianOperation, i: number, tolerance: number): CartesianOperationDescription {
|
|
205
144
|
const notCrystallographic = `Operation ${i} is not a crystallographic point operation`;
|
|
206
145
|
// The trace of the rotation part is an integer exactly for the angles 360°/n, n = 1, 2, 3, 4, 6.
|
|
207
|
-
const t = det(op.
|
|
146
|
+
const t = det(op.cartesian) > 0 ? trace(op.cartesian) : -trace(op.cartesian);
|
|
208
147
|
if (Math.abs(t - Math.round(t)) > traceTolerance(tolerance)) throw new RangeError(notCrystallographic);
|
|
209
148
|
// 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.
|
|
210
149
|
const n = ({ 3: 1, [-1]: 2, 0: 3, 1: 4, 2: 6 } as Record<number, number>)[Math.round(t)];
|
|
211
150
|
if (n === undefined) throw new RangeError(notCrystallographic);
|
|
212
|
-
const r = (det(op.
|
|
213
|
-
const proper = det(op.
|
|
151
|
+
const r = (det(op.cartesian) > 0 ? op.cartesian : op.cartesian.map((row) => row.map((v) => -v))) as Mat3;
|
|
152
|
+
const proper = det(op.cartesian) > 0;
|
|
214
153
|
const timeReversal = op.timeReversal;
|
|
215
|
-
if (n === 1) return Object.freeze({ kind: proper ? 'identity' : 'inversion',
|
|
154
|
+
if (n === 1) return Object.freeze({ kind: proper ? 'identity' : 'inversion', n: 1, timeReversal });
|
|
216
155
|
const { axis } = signed(rotationAxis(r, n), tolerance);
|
|
217
156
|
const frozenAxis = Object.freeze({ cartesian: Object.freeze(axis) as unknown as Vec3 });
|
|
218
|
-
const kind: OperationKind = proper ? 'rotation' : n === 2 ? '
|
|
219
|
-
if (n === 2) return Object.freeze({ kind,
|
|
157
|
+
const kind: OperationKind = proper ? 'rotation' : n === 2 ? 'reflection' : 'rotoinversion';
|
|
158
|
+
if (n === 2) return Object.freeze({ kind, n: 2, axis: frozenAxis, timeReversal });
|
|
220
159
|
const sense = dot(axialVector(r), axis) > 0 ? '+' : '-';
|
|
221
|
-
return Object.freeze({ kind,
|
|
160
|
+
return Object.freeze({ kind, n, axis: frozenAxis, sense, timeReversal });
|
|
222
161
|
}
|
|
223
162
|
|
|
224
163
|
/**
|
|
@@ -226,16 +165,18 @@ function describe(op: Operation, i: number, tolerance: number): CartesianOperati
|
|
|
226
165
|
* Cartesian axis (rotation or rotoinversion axis, mirror normal) with its first non-zero component,
|
|
227
166
|
* in the order x, y, z, positive, and for n ≥ 3 the sense about that axis. The axes are not named
|
|
228
167
|
* by lattice directions, since the list need not belong to a setting; for a point group given by its
|
|
229
|
-
* key, `describeOperations` names them. Throws a RangeError for
|
|
168
|
+
* key, `describeOperations` names them. Throws a RangeError for an operation without an orthogonal Cartesian matrix (`cartesian`) or
|
|
230
169
|
* not a crystallographic operation (a rotation part by an angle other than 360°/n, n = 1, 2, 3, 4,
|
|
231
170
|
* 6), both within `tolerance` (default `EPSILON`, as for `pointGroupOf`), and for an operation that
|
|
232
171
|
* does not say whether it is combined with time reversal.
|
|
233
172
|
*/
|
|
234
173
|
export function describeOperationsOf(
|
|
235
|
-
operations: readonly
|
|
236
|
-
options?:
|
|
174
|
+
operations: readonly CartesianOperation[],
|
|
175
|
+
options?: ToleranceOptions,
|
|
237
176
|
): readonly CartesianOperationDescription[] {
|
|
238
|
-
|
|
177
|
+
checkOptions(options, TOLERANCE_KEYS, 'describeOperationsOf');
|
|
178
|
+
const tolerance = toleranceOf(options, 'operations');
|
|
179
|
+
checkCartesianOperations(operations, tolerance);
|
|
239
180
|
checkTimeReversal(operations);
|
|
240
181
|
return Object.freeze(operations.map((op, i) => describe(op, i, tolerance)));
|
|
241
182
|
}
|