symcrys 0.10.1 → 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.
Files changed (218) hide show
  1. package/README.md +6 -6
  2. package/dist/cell.d.ts +19 -16
  3. package/dist/cell.d.ts.map +1 -1
  4. package/dist/cell.js +63 -35
  5. package/dist/cell.js.map +1 -1
  6. package/dist/checks.d.ts +29 -0
  7. package/dist/checks.d.ts.map +1 -0
  8. package/dist/checks.js +79 -0
  9. package/dist/checks.js.map +1 -0
  10. package/dist/closure.d.ts +43 -0
  11. package/dist/closure.d.ts.map +1 -0
  12. package/dist/closure.js +201 -0
  13. package/dist/closure.js.map +1 -0
  14. package/dist/crystalClasses.d.ts +145 -117
  15. package/dist/crystalClasses.d.ts.map +1 -1
  16. package/dist/crystalClasses.js +161 -121
  17. package/dist/crystalClasses.js.map +1 -1
  18. package/dist/freeze.d.ts +7 -0
  19. package/dist/freeze.d.ts.map +1 -0
  20. package/dist/freeze.js +15 -0
  21. package/dist/freeze.js.map +1 -0
  22. package/dist/index.d.ts +11 -10
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +4 -3
  25. package/dist/index.js.map +1 -1
  26. package/dist/indices.d.ts +31 -5
  27. package/dist/indices.d.ts.map +1 -1
  28. package/dist/indices.js +104 -13
  29. package/dist/indices.js.map +1 -1
  30. package/dist/lattice.d.ts +15 -1
  31. package/dist/lattice.d.ts.map +1 -1
  32. package/dist/lattice.js +30 -1
  33. package/dist/lattice.js.map +1 -1
  34. package/dist/linalg.d.ts +2 -2
  35. package/dist/linalg.d.ts.map +1 -1
  36. package/dist/linalg.js +3 -3
  37. package/dist/linalg.js.map +1 -1
  38. package/dist/magnetic.d.ts +12 -10
  39. package/dist/magnetic.d.ts.map +1 -1
  40. package/dist/magnetic.js +8 -6
  41. package/dist/magnetic.js.map +1 -1
  42. package/dist/notation.d.ts +16 -0
  43. package/dist/notation.d.ts.map +1 -0
  44. package/dist/notation.js +66 -0
  45. package/dist/notation.js.map +1 -0
  46. package/dist/operations.d.ts +40 -26
  47. package/dist/operations.d.ts.map +1 -1
  48. package/dist/operations.js +48 -60
  49. package/dist/operations.js.map +1 -1
  50. package/dist/plane.d.ts +141 -79
  51. package/dist/plane.d.ts.map +1 -1
  52. package/dist/plane.js +147 -77
  53. package/dist/plane.js.map +1 -1
  54. package/dist/pointGroups/crystalForms.d.ts +6 -21
  55. package/dist/pointGroups/crystalForms.d.ts.map +1 -1
  56. package/dist/pointGroups/crystalForms.js +9 -16
  57. package/dist/pointGroups/crystalForms.js.map +1 -1
  58. package/dist/pointGroups/crystalFormsData.d.ts +4 -1
  59. package/dist/pointGroups/crystalFormsData.d.ts.map +1 -1
  60. package/dist/pointGroups/crystalFormsData.js +64 -1
  61. package/dist/pointGroups/crystalFormsData.js.map +1 -1
  62. package/dist/pointGroups/elements.d.ts +19 -17
  63. package/dist/pointGroups/elements.d.ts.map +1 -1
  64. package/dist/pointGroups/elements.js +65 -83
  65. package/dist/pointGroups/elements.js.map +1 -1
  66. package/dist/pointGroups/identify.d.ts +10 -18
  67. package/dist/pointGroups/identify.d.ts.map +1 -1
  68. package/dist/pointGroups/identify.js +27 -79
  69. package/dist/pointGroups/identify.js.map +1 -1
  70. package/dist/pointGroups/itaOrder.d.ts +15 -14
  71. package/dist/pointGroups/itaOrder.d.ts.map +1 -1
  72. package/dist/pointGroups/itaOrder.js +116 -94
  73. package/dist/pointGroups/itaOrder.js.map +1 -1
  74. package/dist/pointGroups/itcData.d.ts +96 -0
  75. package/dist/pointGroups/itcData.d.ts.map +1 -0
  76. package/dist/pointGroups/itcData.js +336 -0
  77. package/dist/pointGroups/itcData.js.map +1 -0
  78. package/dist/pointGroups/itcMagneticData.d.ts +55 -0
  79. package/dist/pointGroups/itcMagneticData.d.ts.map +1 -0
  80. package/dist/pointGroups/itcMagneticData.js +172 -0
  81. package/dist/pointGroups/itcMagneticData.js.map +1 -0
  82. package/dist/pointGroups/keys.d.ts +32 -0
  83. package/dist/pointGroups/keys.d.ts.map +1 -0
  84. package/dist/pointGroups/keys.js +120 -0
  85. package/dist/pointGroups/keys.js.map +1 -0
  86. package/dist/pointGroups/magneticSymbols.d.ts +6 -5
  87. package/dist/pointGroups/magneticSymbols.d.ts.map +1 -1
  88. package/dist/pointGroups/magneticSymbols.js +15 -12
  89. package/dist/pointGroups/magneticSymbols.js.map +1 -1
  90. package/dist/pointGroups/orbits.d.ts +23 -42
  91. package/dist/pointGroups/orbits.d.ts.map +1 -1
  92. package/dist/pointGroups/orbits.js +20 -62
  93. package/dist/pointGroups/orbits.js.map +1 -1
  94. package/dist/pointGroups/pointGroups.d.ts +135 -67
  95. package/dist/pointGroups/pointGroups.d.ts.map +1 -1
  96. package/dist/pointGroups/pointGroups.js +409 -244
  97. package/dist/pointGroups/pointGroups.js.map +1 -1
  98. package/dist/pointGroups/properties.d.ts +21 -22
  99. package/dist/pointGroups/properties.d.ts.map +1 -1
  100. package/dist/pointGroups/properties.js +40 -37
  101. package/dist/pointGroups/properties.js.map +1 -1
  102. package/dist/pointGroups/seitzData.d.ts +26 -0
  103. package/dist/pointGroups/seitzData.d.ts.map +1 -0
  104. package/dist/pointGroups/seitzData.js +130 -0
  105. package/dist/pointGroups/seitzData.js.map +1 -0
  106. package/dist/pointGroups/wyckoff.d.ts +70 -40
  107. package/dist/pointGroups/wyckoff.d.ts.map +1 -1
  108. package/dist/pointGroups/wyckoff.js +98 -91
  109. package/dist/pointGroups/wyckoff.js.map +1 -1
  110. package/dist/pointGroups/wyckoffData.d.ts +7 -4
  111. package/dist/pointGroups/wyckoffData.d.ts.map +1 -1
  112. package/dist/pointGroups/wyckoffData.js +789 -168
  113. package/dist/pointGroups/wyckoffData.js.map +1 -1
  114. package/dist/siteSymmetry.d.ts +8 -16
  115. package/dist/siteSymmetry.d.ts.map +1 -1
  116. package/dist/siteSymmetry.js +34 -24
  117. package/dist/siteSymmetry.js.map +1 -1
  118. package/dist/spaceGroups/affine.d.ts.map +1 -1
  119. package/dist/spaceGroups/affine.js +3 -2
  120. package/dist/spaceGroups/affine.js.map +1 -1
  121. package/dist/spaceGroups/cell.d.ts +43 -31
  122. package/dist/spaceGroups/cell.d.ts.map +1 -1
  123. package/dist/spaceGroups/cell.js +173 -85
  124. package/dist/spaceGroups/cell.js.map +1 -1
  125. package/dist/spaceGroups/describe.d.ts +12 -10
  126. package/dist/spaceGroups/describe.d.ts.map +1 -1
  127. package/dist/spaceGroups/describe.js +11 -10
  128. package/dist/spaceGroups/describe.js.map +1 -1
  129. package/dist/spaceGroups/planeGroupData.d.ts +1 -1
  130. package/dist/spaceGroups/planeGroupData.d.ts.map +1 -1
  131. package/dist/spaceGroups/planeGroupData.js +8 -8
  132. package/dist/spaceGroups/planeGroupData.js.map +1 -1
  133. package/dist/spaceGroups/planeGroups.d.ts.map +1 -1
  134. package/dist/spaceGroups/planeGroups.js +2 -1
  135. package/dist/spaceGroups/planeGroups.js.map +1 -1
  136. package/dist/spaceGroups/positions.d.ts +48 -19
  137. package/dist/spaceGroups/positions.d.ts.map +1 -1
  138. package/dist/spaceGroups/positions.js +166 -67
  139. package/dist/spaceGroups/positions.js.map +1 -1
  140. package/dist/tensors/propertyTable.d.ts +3 -1
  141. package/dist/tensors/propertyTable.d.ts.map +1 -1
  142. package/dist/tensors/propertyTable.js +17 -10
  143. package/dist/tensors/propertyTable.js.map +1 -1
  144. package/dist/tensors/rowEchelon.d.ts +3 -3
  145. package/dist/tensors/rowEchelon.d.ts.map +1 -1
  146. package/dist/tensors/rowEchelon.js +4 -4
  147. package/dist/tensors/rowEchelon.js.map +1 -1
  148. package/dist/tensors/tensorForm.d.ts +75 -34
  149. package/dist/tensors/tensorForm.d.ts.map +1 -1
  150. package/dist/tensors/tensorForm.js +171 -67
  151. package/dist/tensors/tensorForm.js.map +1 -1
  152. package/dist/tensors/tensorProperties.d.ts +10 -9
  153. package/dist/tensors/tensorProperties.d.ts.map +1 -1
  154. package/dist/tensors/tensorProperties.js +22 -12
  155. package/dist/tensors/tensorProperties.js.map +1 -1
  156. package/dist/tolerances.d.ts +56 -1
  157. package/dist/tolerances.d.ts.map +1 -1
  158. package/dist/tolerances.js +51 -1
  159. package/dist/tolerances.js.map +1 -1
  160. package/dist/version.d.ts +1 -1
  161. package/dist/version.js +1 -1
  162. package/package.json +1 -1
  163. package/src/cell.ts +78 -51
  164. package/src/checks.ts +84 -0
  165. package/src/closure.ts +214 -0
  166. package/src/crystalClasses.ts +232 -157
  167. package/src/freeze.ts +14 -0
  168. package/src/index.ts +21 -10
  169. package/src/indices.ts +108 -18
  170. package/src/lattice.ts +41 -1
  171. package/src/linalg.ts +3 -3
  172. package/src/magnetic.ts +14 -9
  173. package/src/notation.ts +73 -0
  174. package/src/operations.ts +78 -71
  175. package/src/plane.ts +253 -127
  176. package/src/pointGroups/crystalForms.ts +11 -44
  177. package/src/pointGroups/crystalFormsData.ts +66 -1
  178. package/src/pointGroups/elements.ts +82 -92
  179. package/src/pointGroups/identify.ts +38 -97
  180. package/src/pointGroups/itaOrder.ts +117 -101
  181. package/src/pointGroups/itcData.ts +404 -0
  182. package/src/pointGroups/itcMagneticData.ts +206 -0
  183. package/src/pointGroups/keys.ts +144 -0
  184. package/src/pointGroups/magneticSymbols.ts +18 -17
  185. package/src/pointGroups/orbits.ts +41 -89
  186. package/src/pointGroups/pointGroups.ts +540 -297
  187. package/src/pointGroups/properties.ts +44 -40
  188. package/src/pointGroups/seitzData.ts +147 -0
  189. package/src/pointGroups/wyckoff.ts +137 -112
  190. package/src/pointGroups/wyckoffData.ts +793 -170
  191. package/src/siteSymmetry.ts +43 -40
  192. package/src/spaceGroups/affine.ts +3 -2
  193. package/src/spaceGroups/cell.ts +227 -116
  194. package/src/spaceGroups/describe.ts +22 -19
  195. package/src/spaceGroups/planeGroupData.ts +9 -9
  196. package/src/spaceGroups/planeGroups.ts +2 -1
  197. package/src/spaceGroups/positions.ts +202 -78
  198. package/src/tensors/propertyTable.ts +26 -14
  199. package/src/tensors/rowEchelon.ts +4 -3
  200. package/src/tensors/tensorForm.ts +258 -88
  201. package/src/tensors/tensorProperties.ts +34 -14
  202. package/src/tolerances.ts +66 -1
  203. package/src/version.ts +1 -1
  204. package/dist/pointGroups/data.d.ts +0 -75
  205. package/dist/pointGroups/data.d.ts.map +0 -1
  206. package/dist/pointGroups/data.js +0 -212
  207. package/dist/pointGroups/data.js.map +0 -1
  208. package/dist/pointGroups/magneticData.d.ts +0 -66
  209. package/dist/pointGroups/magneticData.d.ts.map +0 -1
  210. package/dist/pointGroups/magneticData.js +0 -184
  211. package/dist/pointGroups/magneticData.js.map +0 -1
  212. package/dist/spaceGroups/snap.d.ts +0 -20
  213. package/dist/spaceGroups/snap.d.ts.map +0 -1
  214. package/dist/spaceGroups/snap.js +0 -103
  215. package/dist/spaceGroups/snap.js.map +0 -1
  216. package/src/pointGroups/data.ts +0 -305
  217. package/src/pointGroups/magneticData.ts +0 -328
  218. 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 { det, multiply, trace, type Mat3, type Vec3 } from '../linalg.js';
8
- import { checkOrthogonalWithin, checkTimeReversal, type Operation } from '../operations.js';
9
- import { EPSILON } from '../tolerances.js';
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̄: 1 for the identity and the inversion, 2 for a mirror (m = 2̄),
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 order: number;
54
- /** Rotation axis, rotoinversion axis or mirror normal; absent for the identity and the inversion. */
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 = (a: Operation, b: Operation, tolerance: number): boolean =>
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 kind of an operation (rounded trace, sign of the determinant, time reversal): equal operations have the same. */
85
- const kindOf = (op: Operation): string =>
86
- `${Math.round(trace(op.matrix))}${det(op.matrix) > 0 ? '+' : '-'}${op.timeReversal ? "'" : ''}`;
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 Operation[], tolerance = EPSILON): string =>
78
+ const signature = (ops: readonly CartesianOperation[], tolerance = EPSILON): string =>
140
79
  ops
141
80
  .map((op) => {
142
- const t = trace(op.matrix);
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.matrix))}:${rounded}${op.timeReversal ? "'" : ''}`;
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 a matrix that is not orthogonal (within `tolerance`, at least
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 Operation[],
174
- options?: PointGroupOfOptions,
112
+ operations: readonly CartesianOperation[],
113
+ options?: ToleranceOptions,
175
114
  ): IdentifiedPointGroup | undefined {
176
- const tolerance = toleranceOf(options);
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, 'itc').find((s) => {
186
- const ops = groupOperations(key, { convention: 'itc', setting: s.index });
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: Operation, i: number, tolerance: number): CartesianOperationDescription {
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.matrix) > 0 ? trace(op.matrix) : -trace(op.matrix);
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.matrix) > 0 ? op.matrix : op.matrix.map((row) => row.map((v) => -v))) as Mat3;
213
- const proper = det(op.matrix) > 0;
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', order: 1, timeReversal });
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 ? 'mirror' : 'rotoinversion';
219
- if (n === 2) return Object.freeze({ kind, order: 2, axis: frozenAxis, timeReversal });
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, order: n, axis: frozenAxis, sense, timeReversal });
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 a matrix that is not orthogonal or
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 Operation[],
236
- options?: PointGroupOfOptions,
174
+ operations: readonly CartesianOperation[],
175
+ options?: ToleranceOptions,
237
176
  ): readonly CartesianOperationDescription[] {
238
- const tolerance = toleranceOf(options);
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
  }