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.
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 +146 -118
  15. package/dist/crystalClasses.d.ts.map +1 -1
  16. package/dist/crystalClasses.js +163 -124
  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 +9 -17
  115. package/dist/siteSymmetry.d.ts.map +1 -1
  116. package/dist/siteSymmetry.js +62 -47
  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 +12 -4
  145. package/dist/tensors/rowEchelon.d.ts.map +1 -1
  146. package/dist/tensors/rowEchelon.js +24 -11
  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 +173 -68
  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 +234 -160
  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 -69
  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 +71 -64
  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 +29 -17
  199. package/src/tensors/rowEchelon.ts +28 -9
  200. package/src/tensors/tensorForm.ts +260 -89
  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
@@ -1,36 +1,45 @@
1
1
  /**
2
2
  * Public API for the point groups: the 32 crystallographic point groups (crystal classes) and the
3
3
  * 90 magnetic point groups with time reversal (32 grey, 58 black-and-white). Lookup, settings,
4
- * operations, generators and symbols, in the ITC convention (default) or the Birss convention.
4
+ * operations, generators and symbols, as ITC gives them (CLAUDE.md, "Pure ITC").
5
5
  */
6
6
 
7
- import { INVERSION, det, matricesEqual } from '../linalg.js';
7
+ import { checkOptions, SETTING_KEYS, shown } from '../checks.js';
8
+ import { INVERSION, det, inverse, matricesEqual, multiply, type Mat3 } from '../linalg.js';
8
9
  import { EPSILON } from '../tolerances.js';
10
+ import { compactSymbol } from '../notation.js';
11
+ import { compose, operation, operationsEqual, type CartesianOperation, type Operation } from '../operations.js';
9
12
  import {
10
- MAX_GROUP_ORDER,
11
- closeGroup,
12
- compose,
13
- operationsEqual,
14
- transformOperation,
15
- type Operation,
16
- } from '../operations.js';
17
- import { inItaOrder, itaGeneratorOperations } from './itaOrder.js';
18
- import type { CrystalSystem } from '../lattice.js';
19
- import { POINT_GROUP_DATA, POINT_GROUP_KEYS, type PointGroupKey, type SettingData } from './data.js';
13
+ ITC_CLASSES,
14
+ itcBasis,
15
+ itcCartesianGenerators,
16
+ itcCartesianOperations,
17
+ itcClass,
18
+ itcLatticeGenerators,
19
+ itcLatticeOperations,
20
+ itcSetting,
21
+ } from './itcData.js';
22
+ import type { IntMat3 } from './itaOrder.js';
23
+ import {
24
+ ITC_BLACK_WHITE,
25
+ itcBlackWhiteClassSetting,
26
+ itcBlackWhiteOperations,
27
+ itcBlackWhiteSetting,
28
+ } from './itcMagneticData.js';
29
+ import { crystalFamily, latticeSystemsOfSystem, type CrystalSystem, type LatticeSystem } from '../lattice.js';
20
30
  import {
21
- BLACK_WHITE_DATA,
22
31
  MAGNETIC_POINT_GROUP_KEYS,
32
+ POINT_GROUP_KEYS,
23
33
  TIME_REVERSAL,
24
34
  greySchoenflies,
35
+ type BlackWhitePointGroupKey,
25
36
  type MagneticPointGroupKey,
26
- } from './magneticData.js';
37
+ type PointGroupKey,
38
+ } from './keys.js';
27
39
  import { primedSymbols } from './magneticSymbols.js';
40
+ import { deepFreeze } from '../freeze.js';
28
41
 
29
- export { POINT_GROUP_KEYS, type PointGroupKey } from './data.js';
30
- export { MAGNETIC_POINT_GROUP_KEYS, type MagneticPointGroupKey } from './magneticData.js';
31
-
32
- /** `'itc'`: International Tables for Crystallography (default). `'birss'`: Birss, Symmetry and Magnetism (1966). */
33
- export type Convention = 'itc' | 'birss';
42
+ export { MAGNETIC_POINT_GROUP_KEYS, POINT_GROUP_KEYS, type MagneticPointGroupKey, type PointGroupKey } from './keys.js';
34
43
 
35
44
  /**
36
45
  * Type of a magnetic point group. `'I'`: a crystallographic point group, no operation with time
@@ -42,7 +51,7 @@ export type PointGroupType = 'I' | 'II' | 'III';
42
51
 
43
52
  /**
44
53
  * A point group with the properties that are fixed by its operations. None of them depends on the
45
- * setting or the convention (docs/conventions.md, "Properties").
54
+ * setting (docs/conventions.md, "Properties").
46
55
  */
47
56
  export interface PointGroup<K extends MagneticPointGroupKey = PointGroupKey> {
48
57
  /** The key (docs/conventions.md, "Keys"). */
@@ -65,45 +74,92 @@ export interface PointGroup<K extends MagneticPointGroupKey = PointGroupKey> {
65
74
  * does not change a polar vector, so a magnetic group is polar if its crystal class is.
66
75
  */
67
76
  readonly polar: boolean;
68
- /** Chiral (enantiomorphic class): proper rotations only, with or without time reversal. */
69
- readonly chiral: boolean;
77
+ /**
78
+ * Enantiomorphic: proper rotations only, with or without time reversal. ITA § 3.2.2.1.3 (p. 738):
79
+ * "All these terms [enantiomorphism, enantiomerism, chirality, dissymmetry] refer to the same
80
+ * symmetry restriction, the absence of improper rotations (rotoinversions, rotoreflections)".
81
+ */
82
+ readonly enantiomorphic: boolean;
70
83
  /** The Laue class: the centrosymmetric crystal class generated by the crystal class and the inversion. */
71
84
  readonly laueClass: PointGroupKey;
72
85
  }
73
86
 
74
87
  /** A setting of a point group: an orientation of its symmetry directions in the Cartesian frame (docs/conventions.md, "Settings"). */
75
88
  export interface Setting {
76
- /** 1-based; the same physical frame in both conventions. */
89
+ /** 1-based. */
77
90
  readonly index: number;
78
- /** Short symbol of the setting in the requested convention. */
91
+ /** Short symbol of the setting. */
79
92
  readonly symbol: string;
80
93
  /** Full symbol, symmetry directions separated by single spaces. */
81
94
  readonly fullSymbol: string;
95
+ /** Monoclinic settings only: the unique axis. */
96
+ readonly uniqueAxis?: 'a' | 'b' | 'c';
97
+ /** Trigonal settings only: the axes of the conventional basis, `'hexagonal'` or `'rhombohedral'`. */
98
+ readonly axes?: 'hexagonal' | 'rhombohedral';
99
+ /** True for the ITC default setting. */
100
+ readonly isDefault: boolean;
101
+ }
102
+
103
+ /**
104
+ * The criteria of ITA's headlines (Table 3.2.3.2) that choose among the settings a symbol names:
105
+ * the options of `findPointGroup`, and with `setting` those of every function of a group in a
106
+ * setting.
107
+ */
108
+ export interface AxesOptions {
109
+ /**
110
+ * The axes, as ITA's headlines name them: `'rhombohedral'` chooses the setting with rhombohedral
111
+ * axes of a trigonal group, `'hexagonal'` one with hexagonal axes, which every group of the
112
+ * hexagonal family has. A RangeError for another family.
113
+ */
114
+ readonly axes?: 'hexagonal' | 'rhombohedral';
82
115
  /**
83
- * Monoclinic: the unique axis. Orthorhombic `mm2`: the axis of the twofold rotation. In the
84
- * magnetic API also: orthorhombic groups with three settings, the axis that is c in setting 1;
85
- * `2'm'm`, with six settings, two for each axis, the normal of the mirror plane without time
86
- * reversal (there the axis does not identify a setting).
116
+ * The unique axis of a monoclinic group, as ITA's headlines name it (`'b'`, the standard, `'c'`,
117
+ * `'a'`). A RangeError for another system.
87
118
  */
88
119
  readonly uniqueAxis?: 'a' | 'b' | 'c';
89
- /** True for the default setting of the requested convention. */
90
- readonly isDefault: boolean;
91
120
  }
92
121
 
93
- /** Which convention and which setting a function answers in. */
94
- export interface SettingOptions {
95
- /** Default `'itc'`. */
96
- readonly convention?: Convention;
97
- /** 1-based setting index; default: the default setting of the convention. */
98
- readonly setting?: number;
122
+ /** Which setting: by index or symbol, and by the criteria of ITA's headlines. */
123
+ export interface SettingOptions extends AxesOptions {
124
+ /**
125
+ * The setting: its 1-based index, or a symbol, read as `findPointGroup` reads it (spaces ignored:
126
+ * `'312'`, `'3 1 2'`, `'1 1 2'`). A symbol that several settings share (the key `'32'`, `'2'` for
127
+ * unique axis b, c and a) gives the standard (ITC default) setting, unless `axes` or `uniqueAxis`
128
+ * chooses another. Default: the ITC default setting.
129
+ */
130
+ readonly setting?: number | string;
131
+ }
132
+
133
+ /**
134
+ * The second argument of `findPointGroup`: the criteria, checked. A string is the convention that
135
+ * up to 0.10 came here (`findPointGroup(symbol, 'birss')`), a RangeError that names the change.
136
+ */
137
+ function criteriaArgument(arg: unknown): AxesOptions | undefined {
138
+ if (arg === undefined) return undefined;
139
+ if (typeof arg === 'string') rejectConventionArgument(2);
140
+ checkOptions(arg, ['axes', 'uniqueAxis'], 'findPointGroup');
141
+ // The values are checked here, before a group is found, so that a wrong value is an error also
142
+ // for a symbol that names no group.
143
+ const { axes, uniqueAxis } = arg as AxesOptions;
144
+ if (axes !== undefined && axes !== 'hexagonal' && axes !== 'rhombohedral') {
145
+ throw new RangeError(`axes must be 'hexagonal' or 'rhombohedral', not ${shown(axes)}`);
146
+ }
147
+ if (uniqueAxis !== undefined && uniqueAxis !== 'a' && uniqueAxis !== 'b' && uniqueAxis !== 'c') {
148
+ throw new RangeError(`uniqueAxis must be 'a', 'b' or 'c', not ${shown(uniqueAxis)}`);
149
+ }
150
+ return arg as AxesOptions;
99
151
  }
100
152
 
101
- /** Convention, setting and form of a symbol. */
153
+ /** Setting and form of a symbol. */
102
154
  export interface SymbolOptions extends SettingOptions {
103
155
  /**
104
- * `'short'` (default): short symbol of the setting, e.g. `321` (ITC) for class `32`.
156
+ * `'short'` (default): short symbol of the setting, e.g. `321` for class `32` (ITA Table
157
+ * 3.2.3.2); in the magnetic API the default setting of a grey or black-and-white group has its
158
+ * key as short symbol (`32'` as ITC Vol. D Table 1.5.2.3 prints it; `321'`, the class key and `1'`).
105
159
  * `'full'`: full symbol, positions separated by spaces, e.g. `-3 2/m 1`.
106
- * `'schoenflies'`: Schoenflies symbol, subscripts written inline (`C3v`, `D2d`, `Oh`).
160
+ * `'schoenflies'`: Schoenflies symbol, subscripts written inline (`C3v`, `D2d`, `Oh`); `C3i` for
161
+ * the class -3 in the crystallographic API (ITA), `S6` in the magnetic API (ITC Vol. D: `S6(C3)`,
162
+ * `D3d(S6)`).
107
163
  */
108
164
  readonly form?: 'short' | 'full' | 'schoenflies';
109
165
  }
@@ -119,58 +175,58 @@ interface GroupData {
119
175
  readonly crystalClass: GroupData;
120
176
  readonly crystalSystem: CrystalSystem;
121
177
  readonly schoenflies: string;
122
- /** Generators in the stored (Birss) frame, which is setting 1. */
123
- readonly generators: readonly Operation[];
124
- readonly settings: readonly { readonly frame: SettingData['frame']; readonly uniqueAxis?: 'a' | 'b' | 'c' }[];
178
+ /** The ITC default setting (itcData.ts, itcMagneticData.ts). */
125
179
  readonly itcDefault: number;
126
- /** Type I only: the stored symbols of each setting. */
127
- readonly symbols?: readonly SettingData[];
180
+ /** The number of settings. */
181
+ readonly settingCount: number;
128
182
  }
129
183
 
184
+ /** The ITC default setting of a class, from the ITC class data (itcData.ts). */
185
+ function itcDefaultOf(key: PointGroupKey): number {
186
+ return itcClass(key).settings.find((s) => s.isDefault)!.index;
187
+ }
188
+
189
+ // Built from the ITC data, in their order (that of POINT_GROUP_KEYS and
190
+ // BLACK_WHITE_POINT_GROUP_KEYS).
130
191
  const BY_KEY = new Map<string, GroupData>();
131
- for (const d of POINT_GROUP_DATA) {
192
+ for (const c of ITC_CLASSES) {
132
193
  const self: GroupData = {
133
- key: d.key,
194
+ key: c.key,
134
195
  type: 'I',
135
196
  get crystalClass() {
136
197
  return self;
137
198
  },
138
- crystalSystem: d.crystalSystem,
139
- schoenflies: d.schoenflies,
140
- generators: d.generators,
141
- settings: d.settings,
142
- itcDefault: d.itcDefault,
143
- symbols: d.settings,
199
+ crystalSystem: c.crystalSystem,
200
+ schoenflies: c.schoenflies,
201
+ itcDefault: itcDefaultOf(c.key),
202
+ settingCount: c.settings.length,
144
203
  };
145
- BY_KEY.set(d.key, self);
204
+ BY_KEY.set(c.key, self);
146
205
  }
147
- // Grey groups: the class and time reversal (ITC Vol. D, eq. (1.5.2.1)). birss-app generates them
148
- // from the generators of the class followed by 1', without the identity generator of class 1.
149
- for (const d of POINT_GROUP_DATA) {
150
- const crystalClass = BY_KEY.get(d.key)!;
151
- const key: MagneticPointGroupKey = `${d.key}1'`;
206
+ // Grey groups: the class and time reversal (ITC Vol. D, eq. (1.5.2.1)).
207
+ for (const c of ITC_CLASSES) {
208
+ const crystalClass = BY_KEY.get(c.key)!;
209
+ const key: MagneticPointGroupKey = `${c.key}1'`;
152
210
  BY_KEY.set(key, {
153
211
  key,
154
212
  type: 'II',
155
213
  crystalClass,
156
- crystalSystem: d.crystalSystem,
157
- schoenflies: greySchoenflies(d.schoenflies),
158
- generators: [...(d.key === '1' ? [] : d.generators), TIME_REVERSAL],
159
- settings: d.settings,
160
- itcDefault: d.itcDefault,
214
+ crystalSystem: c.crystalSystem,
215
+ schoenflies: greySchoenflies(c.schoenflies),
216
+ itcDefault: crystalClass.itcDefault,
217
+ settingCount: crystalClass.settingCount,
161
218
  });
162
219
  }
163
- for (const d of BLACK_WHITE_DATA) {
164
- const crystalClass = BY_KEY.get(d.crystalClass)!;
165
- BY_KEY.set(d.key, {
166
- key: d.key,
220
+ for (const g of ITC_BLACK_WHITE) {
221
+ const crystalClass = BY_KEY.get(g.crystalClass)!;
222
+ BY_KEY.set(g.key, {
223
+ key: g.key,
167
224
  type: 'III',
168
225
  crystalClass,
169
226
  crystalSystem: crystalClass.crystalSystem,
170
- schoenflies: d.schoenflies,
171
- generators: d.generators,
172
- settings: d.settings,
173
- itcDefault: d.itcDefault,
227
+ schoenflies: g.schoenflies,
228
+ itcDefault: g.settings.find((s) => s.isDefault)!.index,
229
+ settingCount: g.settings.length,
174
230
  });
175
231
  }
176
232
 
@@ -186,108 +242,215 @@ export function isMagneticPointGroupKey(key: string): key is MagneticPointGroupK
186
242
 
187
243
  function data(key: string): GroupData {
188
244
  const d = BY_KEY.get(key);
189
- if (!d) throw new RangeError(`Unknown point group key: ${JSON.stringify(key)}`);
245
+ if (!d) throw new RangeError(`Unknown point group key: ${shown(key)}`);
190
246
  return d;
191
247
  }
192
248
 
193
- function convention(options?: SettingOptions): Convention {
194
- const c = options?.convention ?? 'itc';
195
- if (c !== 'itc' && c !== 'birss') throw new RangeError(`Unknown convention: ${JSON.stringify(c)}`);
196
- return c;
249
+ /**
250
+ * Throws for a second argument of `settings` or `findPointGroup`, which took a convention up to
251
+ * 0.10 (`settings('32', 'birss')`): TypeScript refuses it, plain JavaScript would ignore it and
252
+ * answer for the ITC frame. Internal.
253
+ */
254
+ export function rejectConventionArgument(argumentCount: number): void {
255
+ if (argumentCount > 1) {
256
+ throw new RangeError(
257
+ 'The convention argument was removed in symcrys 0.11.0: symcrys follows ITC only (CHANGELOG.md, 0.11.0)',
258
+ );
259
+ }
197
260
  }
198
261
 
199
- function defaultSetting(d: GroupData, c: Convention): number {
200
- return c === 'itc' ? d.itcDefault : 1;
262
+ /** The settings a symbol names, spaces ignored: by its key, its short or full symbol, or Birss's cubic form. */
263
+ function settingsNamed(d: GroupData, text: string): number[] {
264
+ const compactText = compact(text);
265
+ const target = birssCubic(compactText) === d.key ? d.key : compactText;
266
+ return allSettings(d).filter((i) => {
267
+ if (target === d.key && i === d.itcDefault) return true;
268
+ const s = settingSymbols(d, i);
269
+ return compact(s.short) === target || compact(derivedSymbols(d, i).short) === target || compact(s.full) === target;
270
+ });
201
271
  }
202
272
 
203
- /** The requested setting index, checked; the convention's default if none is given. */
204
- function settingIndex(d: GroupData, options?: SettingOptions): number {
205
- const c = convention(options);
206
- const index = options?.setting ?? defaultSetting(d, c);
207
- if (!Number.isInteger(index) || index < 1 || index > d.settings.length) {
208
- throw new RangeError(`Point group ${d.key} has no setting ${String(index)} (settings 1 to ${d.settings.length})`);
273
+ const allSettings = (d: GroupData): number[] => Array.from({ length: d.settingCount }, (_, i) => i + 1);
274
+
275
+ /** The settings of `d`, listed for an error message. */
276
+ function listSettings(d: GroupData, indices: readonly number[]): string {
277
+ return indices
278
+ .map((i) => {
279
+ const axes = settingAxes(d, i);
280
+ const unique = settingUniqueAxis(d, i);
281
+ const note = axes ? `, ${axes} axes` : unique ? `, unique axis ${unique}` : '';
282
+ return `${i}: ${settingSymbols(d, i).short} (${settingSymbols(d, i).full}${note})`;
283
+ })
284
+ .join(', ');
285
+ }
286
+
287
+ /** `axes` and `uniqueAxis` of the options, checked against the family of the group. */
288
+ function criteriaOf(
289
+ d: GroupData,
290
+ options: SettingOptions | undefined,
291
+ ): { readonly axes?: 'hexagonal' | 'rhombohedral'; readonly uniqueAxis?: 'a' | 'b' | 'c' } {
292
+ const axes = options?.axes;
293
+ const uniqueAxis = options?.uniqueAxis;
294
+ if (axes !== undefined) {
295
+ if (axes !== 'hexagonal' && axes !== 'rhombohedral') {
296
+ throw new RangeError(`axes must be 'hexagonal' or 'rhombohedral', not ${shown(axes)}`);
297
+ }
298
+ if (crystalFamily(d.crystalSystem) !== 'hexagonal') {
299
+ throw new RangeError(
300
+ `Point group ${d.key} (${d.crystalSystem}): axes applies to the trigonal and hexagonal groups`,
301
+ );
302
+ }
303
+ }
304
+ if (uniqueAxis !== undefined) {
305
+ if (uniqueAxis !== 'a' && uniqueAxis !== 'b' && uniqueAxis !== 'c') {
306
+ throw new RangeError(`uniqueAxis must be 'a', 'b' or 'c', not ${shown(uniqueAxis)}`);
307
+ }
308
+ if (d.crystalSystem !== 'monoclinic') {
309
+ throw new RangeError(`Point group ${d.key} (${d.crystalSystem}): uniqueAxis applies to the monoclinic groups`);
310
+ }
209
311
  }
210
- return index;
312
+ return { ...(axes ? { axes } : {}), ...(uniqueAxis ? { uniqueAxis } : {}) };
211
313
  }
212
314
 
213
- function freezeOperation(op: Operation): Operation {
214
- const [r0, r1, r2] = op.matrix;
215
- return Object.freeze({
216
- matrix: Object.freeze([Object.freeze([...r0]), Object.freeze([...r1]), Object.freeze([...r2])] as const),
217
- timeReversal: op.timeReversal,
218
- }) as Operation;
315
+ /** Whether setting `i` meets the criteria (`axes: 'hexagonal'` holds for every hexagonal group). */
316
+ function meets(d: GroupData, i: number, c: ReturnType<typeof criteriaOf>): boolean {
317
+ if (c.axes && (settingAxes(d, i) ?? 'hexagonal') !== c.axes) return false;
318
+ if (c.uniqueAxis && settingUniqueAxis(d, i) !== c.uniqueAxis) return false;
319
+ return true;
219
320
  }
220
321
 
221
- const generatorCache = new Map<string, readonly Operation[]>();
222
- const operationCache = new Map<string, readonly Operation[]>();
322
+ /**
323
+ * The setting among `candidates` that meets the criteria: the only one, or the standard (ITC
324
+ * default) where it is one of several, as a name without a criterion means the standard (Thomas,
325
+ * 2026-11-23, #96). None, or several without the standard, is a RangeError that lists them.
326
+ */
327
+ function choose(
328
+ d: GroupData,
329
+ candidates: readonly number[],
330
+ criteria: ReturnType<typeof criteriaOf>,
331
+ what: string,
332
+ ): number {
333
+ const met = candidates.filter((i) => meets(d, i, criteria));
334
+ if (met.length === 1) return met[0]!;
335
+ if (met.includes(d.itcDefault)) return d.itcDefault;
336
+ const crit = [criteria.axes && `${criteria.axes} axes`, criteria.uniqueAxis && `unique axis ${criteria.uniqueAxis}`]
337
+ .filter(Boolean)
338
+ .join(', ');
339
+ const asked = what ? [what, crit].filter(Boolean).join(', ') : `with ${crit}`;
340
+ throw new RangeError(
341
+ met.length === 0
342
+ ? `Point group ${d.key} has no setting ${asked} (settings ${listSettings(d, allSettings(d))})`
343
+ : `Point group ${d.key}: ${asked} names ${met.length} settings; give the index (${listSettings(d, met)})`,
344
+ );
345
+ }
223
346
 
224
- /** The stored generators carried into the frame of a setting: the generators of the Birss convention. */
225
- function settingGenerators(d: GroupData, index: number): readonly Operation[] {
226
- const cacheKey = `${d.key}#${index}`;
227
- let result = generatorCache.get(cacheKey);
228
- if (!result) {
229
- const frame = d.settings[index - 1].frame;
230
- result = Object.freeze(d.generators.map((g) => freezeOperation(transformOperation(g, frame))));
231
- generatorCache.set(cacheKey, result);
347
+ /** The requested setting index, checked; the ITC default if none is given. */
348
+ function settingIndex(d: GroupData, options?: SettingOptions): number {
349
+ const criteria = criteriaOf(d, options);
350
+ const requested = options?.setting;
351
+ if (requested !== undefined && requested !== null && typeof requested !== 'number' && typeof requested !== 'string') {
352
+ throw new RangeError(`The setting must be an index or a symbol, not ${shown(requested)}`);
232
353
  }
233
- return result;
354
+ if (typeof requested === 'string') {
355
+ const named = settingsNamed(d, requested);
356
+ if (named.length === 0) {
357
+ throw new RangeError(
358
+ `Point group ${d.key} has no setting ${shown(requested)} (settings ${listSettings(d, allSettings(d))})`,
359
+ );
360
+ }
361
+ return choose(d, named, criteria, shown(requested));
362
+ }
363
+ if (requested === undefined || requested === null) return choose(d, allSettings(d), criteria, '');
364
+ const count = d.settingCount;
365
+ if (!Number.isInteger(requested) || requested < 1 || requested > count) {
366
+ throw new RangeError(`Point group ${d.key} has no setting ${String(requested)} (settings 1 to ${count})`);
367
+ }
368
+ if (!meets(d, requested, criteria)) {
369
+ throw new RangeError(
370
+ `Point group ${d.key}: setting ${requested} does not have the ${[criteria.axes && `${criteria.axes} axes`, criteria.uniqueAxis && `unique axis ${criteria.uniqueAxis}`].filter(Boolean).join(', ')} (settings ${listSettings(d, allSettings(d))})`,
371
+ );
372
+ }
373
+ return requested;
234
374
  }
235
375
 
376
+ /**
377
+ * The index of the requested setting (an index or a symbol; the ITC default if none), checked.
378
+ * Internal: for the modules that cache by setting.
379
+ */
380
+ export function settingIndexOf(key: MagneticPointGroupKey, options?: SettingOptions): number {
381
+ return settingIndex(data(key), options);
382
+ }
383
+
384
+ function freezeOperation(op: CartesianOperation): CartesianOperation {
385
+ const [r0, r1, r2] = op.cartesian;
386
+ return Object.freeze({
387
+ cartesian: Object.freeze([Object.freeze([...r0]), Object.freeze([...r1]), Object.freeze([...r2])] as const),
388
+ timeReversal: op.timeReversal,
389
+ }) as CartesianOperation;
390
+ }
391
+
392
+ const operationCache = new Map<string, readonly CartesianOperation[]>();
393
+
236
394
  /** The operation of `ops` with the matrix of `op`, whatever its time reversal. */
237
- function withMatrix(ops: readonly Operation[], op: Operation): Operation {
238
- const found = ops.find((x) => matricesEqual(x.matrix, op.matrix));
395
+ function withMatrix(ops: readonly CartesianOperation[], op: CartesianOperation): CartesianOperation {
396
+ const found = ops.find((x) => matricesEqual(x.cartesian, op.cartesian));
239
397
  if (!found) throw new Error('Operation of the crystal class missing in the magnetic group');
240
398
  return found;
241
399
  }
242
400
 
243
- const classSettingCache = new Map<string, number>();
244
-
245
401
  /**
246
402
  * The setting of the crystal class whose frame is that of setting `index` of the group: the one
247
403
  * in which the class has the operations of the group without their time reversal. For a class and
248
- * a grey group it is `index` itself. A black-and-white group may have its settings in another
249
- * order than its class, and settings its class does not tell apart (docs/conventions.md,
404
+ * a grey group it is `index` itself; for a black-and-white group, the class setting named by its
405
+ * ITC symbol without primes (itcMagneticData.ts). A black-and-white group may have its settings in
406
+ * another order than its class, and settings its class does not tell apart (docs/conventions.md,
250
407
  * "Settings").
251
408
  */
252
409
  function classSetting(d: GroupData, index: number): number {
253
- if (d.type !== 'III') return index;
254
- const cacheKey = `${d.key}#${index}`;
255
- let result = classSettingCache.get(cacheKey);
256
- if (!result) {
257
- const ops = closeGroup(settingGenerators(d, index));
258
- const c = d.crystalClass;
259
- result =
260
- c.settings.findIndex((_, i) => {
261
- const classOps = settingOperations(c, i + 1);
262
- return (
263
- classOps.length === ops.length && classOps.every((x) => ops.some((y) => matricesEqual(x.matrix, y.matrix)))
264
- );
265
- }) + 1;
266
- if (!result) throw new Error(`Point group ${d.key}, setting ${index}: no setting of class ${c.key} has this frame`);
267
- classSettingCache.set(cacheKey, result);
268
- }
269
- return result;
410
+ return d.type === 'III' ? itcBlackWhiteClassSetting(d.key as BlackWhitePointGroupKey, index) : index;
270
411
  }
271
412
 
272
- const itaGeneratorCache = new Map<string, readonly Operation[]>();
413
+ /** The unique axis of a monoclinic setting; undefined in other systems. */
414
+ function settingUniqueAxis(d: GroupData, index: number): 'a' | 'b' | 'c' | undefined {
415
+ return d.type === 'III'
416
+ ? itcBlackWhiteSetting(d.key as BlackWhitePointGroupKey, index).uniqueAxis
417
+ : itcSetting(d.crystalClass.key as PointGroupKey, index).uniqueAxis;
418
+ }
419
+
420
+ /** The axes of a trigonal setting, `'hexagonal'` or `'rhombohedral'`; undefined in other systems. */
421
+ function settingAxes(d: GroupData, index: number): 'hexagonal' | 'rhombohedral' | undefined {
422
+ return d.type === 'III'
423
+ ? itcBlackWhiteSetting(d.key as BlackWhitePointGroupKey, index).axes
424
+ : itcSetting(d.crystalClass.key as PointGroupKey, index).axes;
425
+ }
273
426
 
274
427
  /**
275
- * ITA's generators of a setting (see `generators`); throws if setting 1 of a class has none. For a
428
+ * The crystal class of a group and the setting of the class whose frame and basis the requested
429
+ * setting of the group has. Internal: for the modules that need the basis or the symmetry
430
+ * directions of a setting.
431
+ */
432
+ export function classSettingOf(
433
+ key: MagneticPointGroupKey,
434
+ options?: SettingOptions,
435
+ ): { readonly key: PointGroupKey; readonly index: number } {
436
+ const d = data(key);
437
+ return { key: d.crystalClass.key as PointGroupKey, index: classSetting(d, settingIndex(d, options)) };
438
+ }
439
+
440
+ const itaGeneratorCache = new Map<string, readonly CartesianOperation[]>();
441
+
442
+ /**
443
+ * ITA's generators of a setting (see `generators`); for a class from the ITC class data. For a
276
444
  * magnetic group: ITA's generators of its class in the same frame, each with the time reversal it
277
445
  * has in the group; for a grey group followed by time reversal 1'.
278
446
  */
279
- function settingItaGenerators(d: GroupData, index: number): readonly Operation[] {
447
+ function settingItaGenerators(d: GroupData, index: number): readonly CartesianOperation[] {
280
448
  const cacheKey = `${d.key}#${index}`;
281
449
  let result = itaGeneratorCache.get(cacheKey);
282
450
  if (!result) {
283
- let gens: Operation[];
451
+ let gens: CartesianOperation[];
284
452
  if (d.type === 'I') {
285
- const ita = itaGeneratorOperations(d.key, index, d.crystalSystem);
286
- if (ita) gens = ita;
287
- else {
288
- if (index === 1) throw new Error(`Point group ${d.key}: no ITA generators for setting 1`);
289
- gens = settingItaGenerators(d, 1).map((op) => transformOperation(op, d.settings[index - 1].frame));
290
- }
453
+ gens = itcCartesianGenerators(d.key as PointGroupKey, index).map((m) => operation(m));
291
454
  } else {
292
455
  const classGens = settingItaGenerators(d.crystalClass, classSetting(d, index));
293
456
  gens =
@@ -301,72 +464,25 @@ function settingItaGenerators(d: GroupData, index: number): readonly Operation[]
301
464
  return result;
302
465
  }
303
466
 
304
- const birssOperationCache = new Map<string, readonly Operation[]>();
305
-
306
- /**
307
- * The operations of a setting in the Birss convention, in birss-app's order (docs/conventions.md,
308
- * "Birss convention and birss-app"): the generators of the setting first, then repeated passes
309
- * that append every new product g·h of two operations found before the pass, in the order of g,
310
- * then h, until a pass adds nothing.
311
- */
312
- function birssOperations(d: GroupData, index: number): readonly Operation[] {
313
- const cacheKey = `${d.key}#${index}`;
314
- let result = birssOperationCache.get(cacheKey);
315
- if (!result) {
316
- const group = [...settingGenerators(d, index)];
317
- for (let changed = true; changed;) {
318
- changed = false;
319
- const size = group.length;
320
- for (let i = 0; i < size; i++) {
321
- for (let j = 0; j < size; j++) {
322
- const product = compose(group[i], group[j]);
323
- if (!group.some((g) => operationsEqual(g, product))) {
324
- if (group.length >= MAX_GROUP_ORDER) throw new Error(`Point group ${d.key}: closure does not terminate`);
325
- group.push(product);
326
- changed = true;
327
- }
328
- }
329
- }
330
- }
331
- if (!sameSet(group, settingOperations(d, index))) {
332
- throw new Error(`Point group ${d.key}, setting ${index}: Birss operations differ from the closure`);
333
- }
334
- result = Object.freeze(group.map(freezeOperation));
335
- birssOperationCache.set(cacheKey, result);
336
- }
337
- return result;
338
- }
339
-
340
467
  /**
341
468
  * The operations of a setting in ITA's order (docs/conventions.md, "Order of the operations"). A
342
- * crystal class: for a setting ITA lists, coset by coset from ITA's generators; for a setting ITA
343
- * does not list (today `mm2` settings 2 and 3), the order of setting 1, carried into the frame of
344
- * the setting. Setting 1 is always one ITA lists; throws if its generators are missing or do not
345
- * give the closure. A black-and-white group: the operations of its class in the same frame, in
346
- * that order, each with the time reversal it has in the group. A grey group: the operations of its
347
- * class, then the same sequence combined with time reversal.
469
+ * crystal class: from the ITC class data (itcData.ts), built coset by coset from ITA's generators.
470
+ * A black-and-white group: the operations of its class in the setting its ITC symbol names, in
471
+ * that order, each with the time reversal its symbol gives (itcMagneticData.ts). A grey group: the
472
+ * operations of its class, then the same sequence combined with time reversal.
348
473
  */
349
- function settingOperations(d: GroupData, index: number): readonly Operation[] {
474
+ function settingOperations(d: GroupData, index: number): readonly CartesianOperation[] {
350
475
  const cacheKey = `${d.key}#${index}`;
351
476
  let result = operationCache.get(cacheKey);
352
477
  if (!result) {
353
- const closed = closeGroup(settingGenerators(d, index));
354
- let ordered: Operation[] | undefined;
478
+ let ordered: CartesianOperation[];
355
479
  if (d.type === 'I') {
356
- ordered = inItaOrder(d.key, index, d.crystalSystem, closed);
357
- if (!ordered) {
358
- if (index === 1) throw new Error(`Point group ${d.key}: no ITA generators for setting 1`);
359
- ordered = settingOperations(d, 1).map((op) => transformOperation(op, d.settings[index - 1].frame));
360
- }
480
+ ordered = itcCartesianOperations(d.key as PointGroupKey, index).map((m) => operation(m));
481
+ } else if (d.type === 'II') {
482
+ const classOps = settingOperations(d.crystalClass, index);
483
+ ordered = [...classOps, ...classOps.map((op) => compose(TIME_REVERSAL, op))];
361
484
  } else {
362
- const classOps = settingOperations(d.crystalClass, classSetting(d, index));
363
- ordered =
364
- d.type === 'II'
365
- ? [...classOps, ...classOps.map((op) => compose(TIME_REVERSAL, op))]
366
- : classOps.map((op) => withMatrix(closed, op));
367
- }
368
- if (!sameSet(ordered, closed)) {
369
- throw new Error(`Point group ${d.key}, setting ${index}: ordered operations differ from the closure`);
485
+ ordered = [...itcBlackWhiteOperations(d.key as BlackWhitePointGroupKey, index)];
370
486
  }
371
487
  result = Object.freeze(ordered.map(freezeOperation));
372
488
  operationCache.set(cacheKey, result);
@@ -374,53 +490,61 @@ function settingOperations(d: GroupData, index: number): readonly Operation[] {
374
490
  return result;
375
491
  }
376
492
 
377
- /** True if `a` is `b` in some order: equal length, no operation twice in `a`, every one of `a` in `b`. */
378
- function sameSet(a: readonly Operation[], b: readonly Operation[]): boolean {
379
- return (
380
- a.length === b.length &&
381
- a.every((op, i) => b.some((x) => operationsEqual(x, op)) && !a.slice(0, i).some((x) => operationsEqual(x, op)))
382
- );
383
- }
384
-
385
493
  const symbolCache = new Map<string, { readonly short: string; readonly full: string }>();
386
494
 
387
495
  /**
388
- * Short and full symbol of a setting in a convention. A crystal class: as stored. A grey group:
389
- * the symbols of its class followed by `1'`. A black-and-white group: the symbols of its class in
390
- * the same frame, with the primes of its operations (magneticSymbols.ts).
496
+ * Short and full symbol of a setting as symcrys gives them (#137 B2): those of `derivedSymbols`,
497
+ * except that the default setting of a grey or black-and-white group has its key as short symbol:
498
+ * that of ITC Vol. D Table 1.5.2.3 for a black-and-white group (`32'`, not `32'1`), the class key
499
+ * followed by `1'` for a grey group (`321'`, not `3211'`). A crystal class keeps
500
+ * ITA's symbol (`321`) in both entry points.
501
+ */
502
+ function settingSymbols(d: GroupData, index: number): { readonly short: string; readonly full: string } {
503
+ const derived = derivedSymbols(d, index);
504
+ return d.type !== 'I' && index === d.itcDefault ? { short: d.key, full: derived.full } : derived;
505
+ }
506
+
507
+ /**
508
+ * Short and full symbol of a setting by the rule. A crystal class: from the ITC class data
509
+ * (itcData.ts). A grey group: the symbols of its class followed by `1'`. A black-and-white group:
510
+ * the symbols of its class in the same frame, with the primes of its operations
511
+ * (magneticSymbols.ts).
391
512
  */
392
- function settingSymbols(d: GroupData, index: number, c: Convention): { readonly short: string; readonly full: string } {
393
- if (d.symbols) return d.symbols[index - 1][c];
394
- const cacheKey = `${d.key}#${index}#${c}`;
513
+ function derivedSymbols(d: GroupData, index: number): { readonly short: string; readonly full: string } {
514
+ if (d.type === 'I') {
515
+ const s = itcSetting(d.key as PointGroupKey, index);
516
+ return Object.freeze({ short: s.short, full: s.full });
517
+ }
518
+ const cacheKey = `${d.key}#${index}`;
395
519
  let result = symbolCache.get(cacheKey);
396
520
  if (!result) {
397
- const classSymbols = settingSymbols(d.crystalClass, classSetting(d, index), c);
521
+ const classSymbols = derivedSymbols(d.crystalClass, classSetting(d, index));
398
522
  result = Object.freeze(
399
523
  d.type === 'II'
400
524
  ? { short: `${classSymbols.short}1'`, full: `${classSymbols.full} 1'` }
401
- : primedSymbols(classSymbols, d.crystalSystem, c, settingOperations(d, index)),
525
+ : primedSymbols(classSymbols, d.crystalSystem, settingOperations(d, index)),
402
526
  );
403
527
  symbolCache.set(cacheKey, result);
404
528
  }
405
529
  return result;
406
530
  }
407
531
 
408
- // --- properties fixed by the operations (setting 1, the frame all stored data share) ---------------
532
+ // --- properties fixed by the operations (setting 1; a class and its Laue class share its frame) ----
409
533
 
410
534
  /** Contains the inversion, not combined with time reversal. */
411
- function hasInversion(ops: readonly Operation[]): boolean {
412
- return ops.some((op) => !op.timeReversal && matricesEqual(op.matrix, INVERSION));
535
+ function hasInversion(ops: readonly CartesianOperation[]): boolean {
536
+ return ops.some((op) => !op.timeReversal && matricesEqual(op.cartesian, INVERSION));
413
537
  }
414
538
 
415
539
  /**
416
540
  * Some direction is left unchanged by every operation: the group average of the matrices, which
417
541
  * projects onto the invariant vectors, is not zero.
418
542
  */
419
- function hasFixedDirection(ops: readonly Operation[]): boolean {
543
+ function hasFixedDirection(ops: readonly CartesianOperation[]): boolean {
420
544
  for (let i = 0; i < 3; i++) {
421
545
  for (let j = 0; j < 3; j++) {
422
546
  let sum = 0;
423
- for (const op of ops) sum += op.matrix[i][j];
547
+ for (const op of ops) sum += op.cartesian[i][j];
424
548
  if (Math.abs(sum / ops.length) > EPSILON) return true;
425
549
  }
426
550
  }
@@ -434,13 +558,13 @@ function laueClassOf(crystalClass: GroupData): PointGroupKey {
434
558
  const cached = laueCache.get(crystalClass.key);
435
559
  if (cached) return cached;
436
560
  const ops = settingOperations(crystalClass, 1);
437
- const inversion: Operation = { matrix: INVERSION, timeReversal: false };
561
+ const inversion: CartesianOperation = { cartesian: INVERSION, timeReversal: false };
438
562
  const withInversion = [...ops];
439
563
  for (const op of ops) {
440
564
  const product = compose(inversion, op);
441
565
  if (!withInversion.some((x) => operationsEqual(x, product))) withInversion.push(product);
442
566
  }
443
- const sameSet = (other: readonly Operation[]): boolean =>
567
+ const sameSet = (other: readonly CartesianOperation[]): boolean =>
444
568
  other.length === withInversion.length && other.every((x) => withInversion.some((y) => operationsEqual(x, y)));
445
569
  const laue = POINT_GROUP_KEYS.find((key) => sameSet(settingOperations(data(key), 1)));
446
570
  if (!laue) throw new Error(`No centrosymmetric class matches ${crystalClass.key} with the inversion`);
@@ -467,7 +591,7 @@ export function pointGroup<K extends MagneticPointGroupKey>(key: K): PointGroup<
467
591
  order: ops.length,
468
592
  centrosymmetric: hasInversion(ops),
469
593
  polar: hasFixedDirection(ops),
470
- chiral: ops.every((op) => det(op.matrix) > 0),
594
+ enantiomorphic: ops.every((op) => det(op.cartesian) > 0),
471
595
  laueClass: laueClassOf(d.crystalClass),
472
596
  });
473
597
  groupCache.set(d.key, g);
@@ -477,7 +601,7 @@ export function pointGroup<K extends MagneticPointGroupKey>(key: K): PointGroup<
477
601
 
478
602
  /** All 32 crystal classes, in the order of `POINT_GROUP_KEYS` (by crystal system, as in ITA). */
479
603
  export function pointGroups(): readonly PointGroup[] {
480
- return POINT_GROUP_KEYS.map((key) => pointGroup(key));
604
+ return deepFreeze(POINT_GROUP_KEYS.map((key) => pointGroup(key)));
481
605
  }
482
606
 
483
607
  /**
@@ -486,7 +610,7 @@ export function pointGroups(): readonly PointGroup[] {
486
610
  * groups (type III) in the order of ITC Vol. D Table 1.5.2.3.
487
611
  */
488
612
  export function magneticPointGroups(): readonly PointGroup<MagneticPointGroupKey>[] {
489
- return MAGNETIC_POINT_GROUP_KEYS.map((key) => pointGroup(key));
613
+ return deepFreeze(MAGNETIC_POINT_GROUP_KEYS.map((key) => pointGroup(key)));
490
614
  }
491
615
 
492
616
  /**
@@ -498,60 +622,154 @@ export function crystalClassOf(key: MagneticPointGroupKey): PointGroupKey {
498
622
  return data(key).crystalClass.key as PointGroupKey;
499
623
  }
500
624
 
501
- /** The settings of a point group, with symbols and the default of the given convention (default `'itc'`). */
502
- export function settings(key: MagneticPointGroupKey, conventionName: Convention = 'itc'): readonly Setting[] {
625
+ /**
626
+ * The lattice systems of a point group: those whose lattices its crystal class can act on (ITA
627
+ * § 1.3.4.4.2 and Table 1.3.4.1, p. 39). One for every class but the trigonal ones, which belong to
628
+ * the hexagonal (hP) or the rhombohedral (hR) lattice system depending on the basis, so they give
629
+ * both, `['hexagonal', 'rhombohedral']`. The holohedry of each is `holohedry(latticeSystem)`. Throws a
630
+ * RangeError for an unknown key.
631
+ */
632
+ export function latticeSystems(key: MagneticPointGroupKey): readonly LatticeSystem[] {
633
+ return latticeSystemsOfSystem(pointGroup(key).crystalSystem);
634
+ }
635
+
636
+ /** The settings of a point group, with their symbols and the ITC default. */
637
+ export function settings(key: MagneticPointGroupKey): readonly Setting[] {
638
+ rejectConventionArgument(arguments.length);
503
639
  const d = data(key);
504
- const c = convention({ convention: conventionName });
505
- const def = defaultSetting(d, c);
506
- return d.settings.map((s, i) => {
507
- const symbols = settingSymbols(d, i + 1, c);
508
- return Object.freeze({
509
- index: i + 1,
510
- symbol: symbols.short,
511
- fullSymbol: symbols.full,
512
- ...(s.uniqueAxis ? { uniqueAxis: s.uniqueAxis } : {}),
513
- isDefault: i + 1 === def,
514
- });
515
- });
640
+ return deepFreeze(
641
+ Array.from({ length: d.settingCount }, (_, i) => {
642
+ const symbols = settingSymbols(d, i + 1);
643
+ const data =
644
+ d.type === 'III'
645
+ ? itcBlackWhiteSetting(d.key as BlackWhitePointGroupKey, i + 1)
646
+ : itcSetting(d.crystalClass.key as PointGroupKey, i + 1);
647
+ return Object.freeze({
648
+ index: i + 1,
649
+ symbol: symbols.short,
650
+ fullSymbol: symbols.full,
651
+ ...(data.uniqueAxis ? { uniqueAxis: data.uniqueAxis } : {}),
652
+ ...(data.axes ? { axes: data.axes } : {}),
653
+ isDefault: i + 1 === d.itcDefault,
654
+ });
655
+ }),
656
+ );
657
+ }
658
+
659
+ const frozenMatrix = (m: Mat3 | IntMat3): Mat3 =>
660
+ Object.freeze(m.map((row) => Object.freeze(row.map((v) => v + 0)))) as unknown as Mat3;
661
+
662
+ /** An integer matrix from one that should be one; throws if it is not (a data error). Internal. */
663
+ export function integer(m: Mat3, what: string): Mat3 {
664
+ const r = m.map((row) => row.map((v) => Math.round(v) + 0)) as unknown as Mat3;
665
+ if (!m.every((row, i) => row.every((v, j) => Math.abs(v - r[i][j]) < 1e-9))) {
666
+ throw new Error(`${what} is not an integer matrix in the lattice basis: ${shown(m)}`);
667
+ }
668
+ return r;
516
669
  }
517
670
 
518
671
  /**
519
- * All operations of the point group in the requested setting (default: the convention's default
520
- * setting). ITC convention: in ITA's order, identity first, then as ITA numbers the general
521
- * position of the crystal class; an operation of a magnetic group has the number it has in the
522
- * class, and a grey group lists the class first, then the same sequence with time reversal. Birss
523
- * convention: in birss-app's order (docs/conventions.md, "Order of the operations"). The matrices
524
- * are Cartesian (docs/conventions.md, "Cartesian frame").
672
+ * The records of the API for Cartesian operations of a setting: each with its matrix W in the
673
+ * lattice basis of the setting. A crystal class takes W from the exact ITC class data (`exact`, in
674
+ * the same order); a magnetic group computes W = B⁻¹·R·B in the basis B of the setting of its class
675
+ * (itcData.ts, `itcBasis`), which is exact after rounding, since W is an integer matrix.
676
+ */
677
+ function records(
678
+ d: GroupData,
679
+ index: number,
680
+ ops: readonly CartesianOperation[],
681
+ exact: readonly IntMat3[] | undefined,
682
+ ): readonly Operation[] {
683
+ const classKey = d.crystalClass.key as PointGroupKey;
684
+ const b = itcBasis(classKey, classSetting(d, index));
685
+ const bInv = inverse(b);
686
+ return Object.freeze(
687
+ ops.map((op, i) =>
688
+ Object.freeze({
689
+ matrix: frozenMatrix(
690
+ exact ? exact[i] : integer(multiply(multiply(bInv, op.cartesian), b), `Operation ${i} of ${d.key}`),
691
+ ),
692
+ cartesian: op.cartesian,
693
+ timeReversal: op.timeReversal,
694
+ }),
695
+ ),
696
+ );
697
+ }
698
+
699
+ const recordCache = new Map<string, readonly Operation[]>();
700
+
701
+ /**
702
+ * All operations of the point group in the requested setting (default: the ITC default setting),
703
+ * in ITA's order: identity first, then as ITA numbers the general position of the crystal class; an
704
+ * operation of a magnetic group has the number it has in the class, and a grey group lists the
705
+ * class first, then the same sequence with time reversal (docs/conventions.md, "Order of the
706
+ * operations"). Each operation is ITA's matrix W in the lattice basis of the setting (`matrix`) with
707
+ * the same operation as a Cartesian matrix (`cartesian`) and its time reversal (docs/conventions.md,
708
+ * "Operations").
525
709
  */
526
710
  export function operations(key: MagneticPointGroupKey, options?: SettingOptions): readonly Operation[] {
711
+ checkOptions(options, SETTING_KEYS, 'operations');
527
712
  const d = data(key);
528
713
  const index = settingIndex(d, options);
529
- return convention(options) === 'birss' ? birssOperations(d, index) : settingOperations(d, index);
714
+ const cacheKey = `${d.key}#${index}`;
715
+ let result = recordCache.get(cacheKey);
716
+ if (!result) {
717
+ const exact = d.type === 'I' ? itcLatticeOperations(d.key as PointGroupKey, index) : undefined;
718
+ result = records(d, index, settingOperations(d, index), exact);
719
+ recordCache.set(cacheKey, result);
720
+ }
721
+ return result;
530
722
  }
531
723
 
532
724
  /**
533
- * Generators of the point group in the requested setting (docs/conventions.md, "Generators"). ITC
534
- * convention: ITA's selected generators in printed order, without the identity and ITA's lattice
535
- * translations, so the list is empty for `1`; for `mm2` settings 2 and 3, which ITA does not list,
536
- * those of setting 1 carried into their frame; for a magnetic group, those of its class with the
537
- * time reversal they have in the group, for a grey group followed by `1'`. Birss convention:
538
- * birss-app's generators (for `1` the identity, as in birss-app).
725
+ * Generators of the point group in the requested setting (docs/conventions.md, "Generators"): ITA's
726
+ * selected generators in printed order, without the identity and ITA's lattice translations, so
727
+ * the list is empty for `1`; for the settings ITA does not print (`mm2` settings 2 and 3, monoclinic unique axis a), those of setting 1 carried
728
+ * into their frame; for a magnetic group, those of its class with the time reversal they
729
+ * have in the group, for a grey group followed by `1'`.
539
730
  */
540
731
  export function generators(key: MagneticPointGroupKey, options?: SettingOptions): readonly Operation[] {
732
+ checkOptions(options, SETTING_KEYS, 'generators');
541
733
  const d = data(key);
542
734
  const index = settingIndex(d, options);
543
- return convention(options) === 'birss' ? settingGenerators(d, index) : settingItaGenerators(d, index);
735
+ const cacheKey = `${d.key}#${index}#generators`;
736
+ let result = recordCache.get(cacheKey);
737
+ if (!result) {
738
+ const exact = d.type === 'I' ? itcLatticeGenerators(d.key as PointGroupKey, index) : undefined;
739
+ result = records(d, index, settingItaGenerators(d, index), exact);
740
+ recordCache.set(cacheKey, result);
741
+ }
742
+ return result;
743
+ }
744
+
745
+ /**
746
+ * A Schoenflies symbol as ITC Vol. D writes it (#137 B3): `S6` for the class -3, where ITA writes
747
+ * `C3i` (Table 3.2.1.2), as the crystallographic API does, and so `S6R` for its grey group. The
748
+ * black-and-white groups store their symbols as Vol. D prints them (`S6(C3)`, `D3d(S6)`,
749
+ * `C6h(S6)`; itcMagneticData.ts).
750
+ */
751
+ const volDSchoenflies = (s: string): string => s.replace(/C3i/g, 'S6');
752
+
753
+ /** The Schoenflies symbol of a crystal class as ITA writes it (`C3i`). Internal: for the crystallographic API. */
754
+ export function itaSchoenflies(key: PointGroupKey): string {
755
+ return data(key).schoenflies;
544
756
  }
545
757
 
546
- /** A symbol of the point group in the requested convention and setting. */
758
+ /**
759
+ * A symbol of the point group in the requested setting. The default setting of a grey or
760
+ * black-and-white group has its key as short symbol (`32'`, as ITC Vol. D Table 1.5.2.3 prints it;
761
+ * `321'`), a crystal class ITA's symbol (`321`), and the Schoenflies symbols follow ITC Vol. D
762
+ * (`S6`, `D3d(S6)`; docs/conventions.md, "Symbols").
763
+ */
547
764
  export function symbol(key: MagneticPointGroupKey, options?: SymbolOptions): string {
765
+ checkOptions(options, [...SETTING_KEYS, 'form'], 'symbol');
548
766
  const d = data(key);
549
767
  const form = options?.form ?? 'short';
550
- const s = settingSymbols(d, settingIndex(d, options), convention(options));
551
- if (form === 'schoenflies') return d.schoenflies;
768
+ const s = settingSymbols(d, settingIndex(d, options));
769
+ if (form === 'schoenflies') return volDSchoenflies(d.schoenflies);
552
770
  if (form === 'short') return s.short;
553
771
  if (form === 'full') return s.full;
554
- throw new RangeError(`Unknown symbol form: ${JSON.stringify(form)}`);
772
+ throw new RangeError(`Unknown symbol form: ${shown(form)}`);
555
773
  }
556
774
 
557
775
  /** A point group in a given setting. */
@@ -562,66 +780,91 @@ export interface PointGroupInSetting<K extends MagneticPointGroupKey = PointGrou
562
780
  readonly setting: number;
563
781
  }
564
782
 
565
- const compact = (s: string): string => s.replace(/\s+/g, '');
783
+ /** A symbol in the spelling of this library without spaces (notation.ts). */
784
+ const compact = compactSymbol;
566
785
 
567
786
  function find(
568
- hm: string,
569
- conventionName: Convention,
787
+ symbol: string,
570
788
  classesOnly: boolean,
789
+ options: AxesOptions | undefined,
571
790
  ): PointGroupInSetting<MagneticPointGroupKey> | undefined {
572
- const c = convention({ convention: conventionName });
573
- if (typeof hm !== 'string') return undefined;
574
- const target = compact(hm);
791
+ // A symbol that names no group is not found; a value that is no symbol at all is wrong input.
792
+ if (typeof symbol !== 'string')
793
+ throw new RangeError(`findPointGroup takes a symbol (a string), not ${shown(symbol)}`);
794
+ const target = compact(symbol);
575
795
  const candidates = [...BY_KEY.values()].filter((d) => !classesOnly || d.type === 'I');
576
- /** The settings of `d` whose symbol of this form is the target. */
577
- const named = (d: GroupData, form: 'short' | 'full'): number[] =>
578
- d.settings.map((_, j) => j + 1).filter((i) => compact(settingSymbols(d, i, c)[form]) === target);
579
- /** One setting named: that one. Several (a monoclinic short symbol) or none (a key): the default. */
580
- const pick = (d: GroupData, settingsNamed: number[]): PointGroupInSetting<MagneticPointGroupKey> => ({
581
- key: d.key,
582
- setting: settingsNamed.length === 1 ? settingsNamed[0]! : defaultSetting(d, c),
583
- });
584
- const byKey = candidates.find((d) => d.key === target);
585
- if (byKey) return pick(byKey, named(byKey, 'short'));
586
- for (const form of ['short', 'full'] as const) {
587
- for (const d of candidates) {
588
- const settingsNamed = named(d, form);
589
- if (settingsNamed.length > 0) return pick(d, settingsNamed);
590
- }
796
+ // The key, a short or full symbol of a setting (spaces ignored), Birss's cubic form; then a
797
+ // Schoenflies symbol, ITA's `C3i` or ITC Vol. D's `S6` alike, which names the group and not an
798
+ // orientation (Thomas, 2026-11-23, #96). A symbol of several groups is an error.
799
+ let found = candidates.map((d) => ({ d, named: settingsNamed(d, symbol) })).filter((m) => m.named.length > 0);
800
+ if (found.length === 0) {
801
+ const inVolD = volDSchoenflies(target);
802
+ found = candidates
803
+ .filter((d) => volDSchoenflies(d.schoenflies) === inVolD)
804
+ .map((d) => ({ d, named: allSettings(d) }));
805
+ }
806
+ if (found.length > 1) {
807
+ throw new RangeError(
808
+ `The symbol ${shown(symbol)} names several point groups: ${found.map((m) => m.d.key).join(', ')}`,
809
+ );
591
810
  }
592
- return undefined;
811
+ if (found.length === 0) return undefined;
812
+ const { d, named } = found[0]!;
813
+ // A name that several settings share gives the standard, unless axes or uniqueAxis chooses another.
814
+ return { key: d.key, setting: choose(d, named, criteriaOf(d, options), shown(symbol)) };
815
+ }
816
+
817
+ /**
818
+ * Birss prints the cubic groups without the overbar on the 3, which takes the prime of the mirror
819
+ * before it (Birss Tables 3 and 6: `m3m`, `m'3` for `m-3m`, `m'-3'`): the symbol with the overbar,
820
+ * which the caller looks up as a key (the cubic groups have one setting); undefined for any other
821
+ * symbol.
822
+ */
823
+ function birssCubic(compactTarget: string): string | undefined {
824
+ const m = /^m('?)3(?!')(.*)$/.exec(compactTarget);
825
+ return m ? `m${m[1]}-3${m[1]}${m[2]}` : undefined;
593
826
  }
594
827
 
595
828
  /**
596
- * Finds a crystal class by a Hermann–Mauguin symbol in the given convention (default `'itc'`): the
597
- * short symbol of a setting, a full symbol, or the key (spaces are ignored). A symbol that names
598
- * one setting gives that setting; the key, and a short symbol that several settings share (the
599
- * monoclinic ones: `2` for unique axis b and c), give the default setting of the convention.
600
- * Returns undefined if nothing matches, also for a value that is not a string and for the
601
- * symbol of a magnetic group with time reversal (`findMagneticPointGroup`). Symbols are written as
602
- * in this library: `-` for the overbar, also in the Birss convention (`m-3m`, where Birss prints
603
- * `m3m`; docs/conventions.md, "Where ITC and Birss differ").
829
+ * Finds a crystal class by a symbol, read tolerantly.
830
+ * It reads, spaces ignored (#96; docs/conventions.md, "Reading symbols"): the key; the short or
831
+ * full symbol of a setting (`312`, `1 1 2`); a Schoenflies symbol, ITA's or ITC Vol. D's (`D3`,
832
+ * `C3i`, `S6`); Birss's cubic symbols without the overbar on the 3 (`m3m`). A symbol that names
833
+ * several settings (the key `32`, which is also the symbol of the setting with rhombohedral axes;
834
+ * `2` for unique axis b, c and a; any Schoenflies symbol) gives the standard (ITC default) setting,
835
+ * unless the options `axes` or `uniqueAxis` choose another, as the headlines of ITA name the
836
+ * settings (the option `axes` set to `'rhombohedral'` for the key `32`).
837
+ *
838
+ * Spellings: the overbar as `-`, `−`, a combining overbar or `¯` after the digit (`m3̄m`), `bar3` (also with a backslash and braces, as in LaTeX);
839
+ * Schoenflies subscripts also as Unicode or LaTeX subscripts (`C₃ᵥ`, `C_{3v}`). Returns undefined if nothing matches,
840
+ * also for a value that is not a string and for the symbol of a magnetic group with time reversal
841
+ * (`findMagneticPointGroup`); a symbol that names several groups is a RangeError that lists them.
604
842
  */
605
- export function findPointGroup(hm: string, conventionName: Convention = 'itc'): PointGroupInSetting | undefined {
606
- return find(hm, conventionName, true) as PointGroupInSetting | undefined;
843
+ export function findPointGroup(symbol: string, options?: AxesOptions): PointGroupInSetting | undefined {
844
+ if (arguments.length > 2) rejectConventionArgument(arguments.length);
845
+ return deepFreeze(find(symbol, true, criteriaArgument(options)) as PointGroupInSetting | undefined);
607
846
  }
608
847
 
609
848
  /**
610
- * Finds one of the 122 magnetic point groups (the 32 crystal classes included) by a symbol in the
611
- * given convention (default `'itc'`): the short symbol of a setting, a full symbol, or the key
612
- * (spaces are ignored). A prime `'` marks time reversal: `4'/mmm'`, `2221'`. A symbol that names
613
- * one setting gives that setting; the key, and a short symbol that several settings share (the
614
- * monoclinic ones: `2'` for unique axis b and c), give the default setting of the convention. In
615
- * the Birss convention two keys are the Birss symbol of a setting that is not the default
616
- * (`mm'm'` and `6'/mmm'`, setting 2; Birss prints `m'm'm` and `6'/mm'm` for these groups) and give
617
- * that setting, like any symbol. Returns undefined if nothing matches, also for a value that is
618
- * not a string. Symbols are written as in this library: `-` for the overbar, also in the Birss
619
- * convention (`m'-3'm`, where Birss prints `m'3m`; docs/conventions.md, "Where ITC and Birss
620
- * differ").
849
+ * Finds one of the 122 magnetic point groups (the 32 crystal classes included) by a symbol, read
850
+ * tolerantly. A prime marks time reversal: `4'/mmm'`, `2221'`.
851
+ * It reads, spaces ignored (#96; docs/conventions.md, "Reading symbols"): the key; the short or
852
+ * full symbol of a setting (`312`, `1 1 2`); a Schoenflies symbol, ITA's or ITC Vol. D's (`D3`,
853
+ * `C3i`, `S6`); Birss's cubic symbols without the overbar on the 3 (`m3m`). A symbol that names
854
+ * several settings (the key `32`, which is also the symbol of the setting with rhombohedral axes;
855
+ * `2` for unique axis b, c and a; any Schoenflies symbol) gives the standard (ITC default) setting,
856
+ * unless the options `axes` or `uniqueAxis` choose another, as the headlines of ITA name the
857
+ * settings (the option `axes` set to `'rhombohedral'` for the key `32`).
858
+ *
859
+ * Spellings: the overbar as `-`, `−`, a combining overbar or `¯` after the digit (`m3̄m`), `bar3` (also with a backslash and braces, as in LaTeX);
860
+ * the prime as `'`, `′`, `ʹ` or `’`; Schoenflies subscripts also as Unicode or LaTeX subscripts (`D₃d(S₆)`, `D_{3d}`).
861
+ * Returns undefined if nothing matches, also for a value that is not a string; a symbol that names
862
+ * several groups is a RangeError that lists them.
621
863
  */
622
864
  export function findMagneticPointGroup(
623
- hm: string,
624
- conventionName: Convention = 'itc',
865
+ symbol: string,
866
+ options?: AxesOptions,
625
867
  ): PointGroupInSetting<MagneticPointGroupKey> | undefined {
626
- return find(hm, conventionName, false);
868
+ if (arguments.length > 2) rejectConventionArgument(arguments.length);
869
+ return deepFreeze(find(symbol, false, criteriaArgument(options)));
627
870
  }