symcrys 0.10.1 → 0.12.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 (248) 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/coordinates.d.ts +143 -0
  15. package/dist/coordinates.d.ts.map +1 -0
  16. package/dist/coordinates.js +198 -0
  17. package/dist/coordinates.js.map +1 -0
  18. package/dist/crystalClasses.d.ts +170 -117
  19. package/dist/crystalClasses.d.ts.map +1 -1
  20. package/dist/crystalClasses.js +190 -121
  21. package/dist/crystalClasses.js.map +1 -1
  22. package/dist/freeze.d.ts +7 -0
  23. package/dist/freeze.d.ts.map +1 -0
  24. package/dist/freeze.js +15 -0
  25. package/dist/freeze.js.map +1 -0
  26. package/dist/index.d.ts +13 -10
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +5 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/indices.d.ts +30 -20
  31. package/dist/indices.d.ts.map +1 -1
  32. package/dist/indices.js +101 -31
  33. package/dist/indices.js.map +1 -1
  34. package/dist/lattice.d.ts +15 -1
  35. package/dist/lattice.d.ts.map +1 -1
  36. package/dist/lattice.js +30 -1
  37. package/dist/lattice.js.map +1 -1
  38. package/dist/linalg.d.ts +2 -2
  39. package/dist/linalg.d.ts.map +1 -1
  40. package/dist/linalg.js +3 -3
  41. package/dist/linalg.js.map +1 -1
  42. package/dist/magnetic.d.ts +14 -10
  43. package/dist/magnetic.d.ts.map +1 -1
  44. package/dist/magnetic.js +10 -6
  45. package/dist/magnetic.js.map +1 -1
  46. package/dist/notation.d.ts +16 -0
  47. package/dist/notation.d.ts.map +1 -0
  48. package/dist/notation.js +66 -0
  49. package/dist/notation.js.map +1 -0
  50. package/dist/operations.d.ts +40 -26
  51. package/dist/operations.d.ts.map +1 -1
  52. package/dist/operations.js +48 -60
  53. package/dist/operations.js.map +1 -1
  54. package/dist/plane.d.ts +297 -80
  55. package/dist/plane.d.ts.map +1 -1
  56. package/dist/plane.js +289 -94
  57. package/dist/plane.js.map +1 -1
  58. package/dist/pointGroups/crystalForms.d.ts +6 -21
  59. package/dist/pointGroups/crystalForms.d.ts.map +1 -1
  60. package/dist/pointGroups/crystalForms.js +9 -16
  61. package/dist/pointGroups/crystalForms.js.map +1 -1
  62. package/dist/pointGroups/crystalFormsData.d.ts +4 -1
  63. package/dist/pointGroups/crystalFormsData.d.ts.map +1 -1
  64. package/dist/pointGroups/crystalFormsData.js +64 -1
  65. package/dist/pointGroups/crystalFormsData.js.map +1 -1
  66. package/dist/pointGroups/elements.d.ts +19 -17
  67. package/dist/pointGroups/elements.d.ts.map +1 -1
  68. package/dist/pointGroups/elements.js +65 -83
  69. package/dist/pointGroups/elements.js.map +1 -1
  70. package/dist/pointGroups/identify.d.ts +10 -18
  71. package/dist/pointGroups/identify.d.ts.map +1 -1
  72. package/dist/pointGroups/identify.js +27 -79
  73. package/dist/pointGroups/identify.js.map +1 -1
  74. package/dist/pointGroups/itaOrder.d.ts +15 -14
  75. package/dist/pointGroups/itaOrder.d.ts.map +1 -1
  76. package/dist/pointGroups/itaOrder.js +116 -94
  77. package/dist/pointGroups/itaOrder.js.map +1 -1
  78. package/dist/pointGroups/itcData.d.ts +96 -0
  79. package/dist/pointGroups/itcData.d.ts.map +1 -0
  80. package/dist/pointGroups/itcData.js +336 -0
  81. package/dist/pointGroups/itcData.js.map +1 -0
  82. package/dist/pointGroups/itcMagneticData.d.ts +55 -0
  83. package/dist/pointGroups/itcMagneticData.d.ts.map +1 -0
  84. package/dist/pointGroups/itcMagneticData.js +172 -0
  85. package/dist/pointGroups/itcMagneticData.js.map +1 -0
  86. package/dist/pointGroups/keys.d.ts +32 -0
  87. package/dist/pointGroups/keys.d.ts.map +1 -0
  88. package/dist/pointGroups/keys.js +120 -0
  89. package/dist/pointGroups/keys.js.map +1 -0
  90. package/dist/pointGroups/magneticSymbols.d.ts +6 -5
  91. package/dist/pointGroups/magneticSymbols.d.ts.map +1 -1
  92. package/dist/pointGroups/magneticSymbols.js +15 -12
  93. package/dist/pointGroups/magneticSymbols.js.map +1 -1
  94. package/dist/pointGroups/orbits.d.ts +23 -42
  95. package/dist/pointGroups/orbits.d.ts.map +1 -1
  96. package/dist/pointGroups/orbits.js +20 -62
  97. package/dist/pointGroups/orbits.js.map +1 -1
  98. package/dist/pointGroups/pointGroups.d.ts +145 -68
  99. package/dist/pointGroups/pointGroups.d.ts.map +1 -1
  100. package/dist/pointGroups/pointGroups.js +455 -243
  101. package/dist/pointGroups/pointGroups.js.map +1 -1
  102. package/dist/pointGroups/properties.d.ts +21 -22
  103. package/dist/pointGroups/properties.d.ts.map +1 -1
  104. package/dist/pointGroups/properties.js +40 -37
  105. package/dist/pointGroups/properties.js.map +1 -1
  106. package/dist/pointGroups/seitzData.d.ts +26 -0
  107. package/dist/pointGroups/seitzData.d.ts.map +1 -0
  108. package/dist/pointGroups/seitzData.js +130 -0
  109. package/dist/pointGroups/seitzData.js.map +1 -0
  110. package/dist/pointGroups/shubnikovData.d.ts +11 -0
  111. package/dist/pointGroups/shubnikovData.d.ts.map +1 -0
  112. package/dist/pointGroups/shubnikovData.js +101 -0
  113. package/dist/pointGroups/shubnikovData.js.map +1 -0
  114. package/dist/pointGroups/wyckoff.d.ts +70 -40
  115. package/dist/pointGroups/wyckoff.d.ts.map +1 -1
  116. package/dist/pointGroups/wyckoff.js +98 -91
  117. package/dist/pointGroups/wyckoff.js.map +1 -1
  118. package/dist/pointGroups/wyckoffData.d.ts +7 -4
  119. package/dist/pointGroups/wyckoffData.d.ts.map +1 -1
  120. package/dist/pointGroups/wyckoffData.js +789 -168
  121. package/dist/pointGroups/wyckoffData.js.map +1 -1
  122. package/dist/siteSymmetry.d.ts +8 -16
  123. package/dist/siteSymmetry.d.ts.map +1 -1
  124. package/dist/siteSymmetry.js +34 -24
  125. package/dist/siteSymmetry.js.map +1 -1
  126. package/dist/spaceGroups/affine.d.ts.map +1 -1
  127. package/dist/spaceGroups/affine.js +3 -2
  128. package/dist/spaceGroups/affine.js.map +1 -1
  129. package/dist/spaceGroups/cell.d.ts +43 -31
  130. package/dist/spaceGroups/cell.d.ts.map +1 -1
  131. package/dist/spaceGroups/cell.js +173 -85
  132. package/dist/spaceGroups/cell.js.map +1 -1
  133. package/dist/spaceGroups/describe.d.ts +13 -10
  134. package/dist/spaceGroups/describe.d.ts.map +1 -1
  135. package/dist/spaceGroups/describe.js +11 -10
  136. package/dist/spaceGroups/describe.js.map +1 -1
  137. package/dist/spaceGroups/planeGroupData.d.ts +3 -1
  138. package/dist/spaceGroups/planeGroupData.d.ts.map +1 -1
  139. package/dist/spaceGroups/planeGroupData.js +25 -8
  140. package/dist/spaceGroups/planeGroupData.js.map +1 -1
  141. package/dist/spaceGroups/planeGroups.d.ts.map +1 -1
  142. package/dist/spaceGroups/planeGroups.js +2 -1
  143. package/dist/spaceGroups/planeGroups.js.map +1 -1
  144. package/dist/spaceGroups/planeLattice.d.ts +78 -0
  145. package/dist/spaceGroups/planeLattice.d.ts.map +1 -0
  146. package/dist/spaceGroups/planeLattice.js +143 -0
  147. package/dist/spaceGroups/planeLattice.js.map +1 -0
  148. package/dist/spaceGroups/planePointGroups.d.ts +6 -2
  149. package/dist/spaceGroups/planePointGroups.d.ts.map +1 -1
  150. package/dist/spaceGroups/planePointGroups.js +14 -2
  151. package/dist/spaceGroups/planePointGroups.js.map +1 -1
  152. package/dist/spaceGroups/positions.d.ts +48 -19
  153. package/dist/spaceGroups/positions.d.ts.map +1 -1
  154. package/dist/spaceGroups/positions.js +166 -67
  155. package/dist/spaceGroups/positions.js.map +1 -1
  156. package/dist/spaceGroups/rational.d.ts +18 -0
  157. package/dist/spaceGroups/rational.d.ts.map +1 -1
  158. package/dist/spaceGroups/rational.js +58 -0
  159. package/dist/spaceGroups/rational.js.map +1 -1
  160. package/dist/tensors/propertyTable.d.ts +3 -1
  161. package/dist/tensors/propertyTable.d.ts.map +1 -1
  162. package/dist/tensors/propertyTable.js +17 -10
  163. package/dist/tensors/propertyTable.js.map +1 -1
  164. package/dist/tensors/rowEchelon.d.ts +3 -3
  165. package/dist/tensors/rowEchelon.d.ts.map +1 -1
  166. package/dist/tensors/rowEchelon.js +4 -4
  167. package/dist/tensors/rowEchelon.js.map +1 -1
  168. package/dist/tensors/tensorForm.d.ts +75 -34
  169. package/dist/tensors/tensorForm.d.ts.map +1 -1
  170. package/dist/tensors/tensorForm.js +171 -67
  171. package/dist/tensors/tensorForm.js.map +1 -1
  172. package/dist/tensors/tensorProperties.d.ts +10 -9
  173. package/dist/tensors/tensorProperties.d.ts.map +1 -1
  174. package/dist/tensors/tensorProperties.js +22 -12
  175. package/dist/tensors/tensorProperties.js.map +1 -1
  176. package/dist/tensors/voigt.d.ts +56 -0
  177. package/dist/tensors/voigt.d.ts.map +1 -0
  178. package/dist/tensors/voigt.js +188 -0
  179. package/dist/tensors/voigt.js.map +1 -0
  180. package/dist/tolerances.d.ts +56 -1
  181. package/dist/tolerances.d.ts.map +1 -1
  182. package/dist/tolerances.js +51 -1
  183. package/dist/tolerances.js.map +1 -1
  184. package/dist/version.d.ts +1 -1
  185. package/dist/version.js +1 -1
  186. package/package.json +1 -1
  187. package/src/cell.ts +78 -51
  188. package/src/checks.ts +84 -0
  189. package/src/closure.ts +214 -0
  190. package/src/coordinates.ts +370 -0
  191. package/src/crystalClasses.ts +271 -157
  192. package/src/freeze.ts +14 -0
  193. package/src/index.ts +33 -12
  194. package/src/indices.ts +102 -42
  195. package/src/lattice.ts +41 -1
  196. package/src/linalg.ts +3 -3
  197. package/src/magnetic.ts +24 -11
  198. package/src/notation.ts +73 -0
  199. package/src/operations.ts +78 -71
  200. package/src/plane.ts +531 -151
  201. package/src/pointGroups/crystalForms.ts +11 -44
  202. package/src/pointGroups/crystalFormsData.ts +66 -1
  203. package/src/pointGroups/elements.ts +82 -92
  204. package/src/pointGroups/identify.ts +38 -97
  205. package/src/pointGroups/itaOrder.ts +117 -101
  206. package/src/pointGroups/itcData.ts +404 -0
  207. package/src/pointGroups/itcMagneticData.ts +206 -0
  208. package/src/pointGroups/keys.ts +144 -0
  209. package/src/pointGroups/magneticSymbols.ts +18 -17
  210. package/src/pointGroups/orbits.ts +41 -89
  211. package/src/pointGroups/pointGroups.ts +593 -298
  212. package/src/pointGroups/properties.ts +44 -40
  213. package/src/pointGroups/seitzData.ts +147 -0
  214. package/src/pointGroups/shubnikovData.ts +103 -0
  215. package/src/pointGroups/wyckoff.ts +137 -112
  216. package/src/pointGroups/wyckoffData.ts +793 -170
  217. package/src/siteSymmetry.ts +43 -40
  218. package/src/spaceGroups/affine.ts +3 -2
  219. package/src/spaceGroups/cell.ts +227 -116
  220. package/src/spaceGroups/describe.ts +23 -19
  221. package/src/spaceGroups/planeGroupData.ts +28 -9
  222. package/src/spaceGroups/planeGroups.ts +2 -1
  223. package/src/spaceGroups/planeLattice.ts +208 -0
  224. package/src/spaceGroups/planePointGroups.ts +23 -3
  225. package/src/spaceGroups/positions.ts +202 -78
  226. package/src/spaceGroups/rational.ts +59 -0
  227. package/src/tensors/propertyTable.ts +26 -14
  228. package/src/tensors/rowEchelon.ts +4 -3
  229. package/src/tensors/tensorForm.ts +258 -88
  230. package/src/tensors/tensorProperties.ts +34 -14
  231. package/src/tensors/voigt.ts +268 -0
  232. package/src/tolerances.ts +66 -1
  233. package/src/version.ts +1 -1
  234. package/dist/pointGroups/data.d.ts +0 -75
  235. package/dist/pointGroups/data.d.ts.map +0 -1
  236. package/dist/pointGroups/data.js +0 -212
  237. package/dist/pointGroups/data.js.map +0 -1
  238. package/dist/pointGroups/magneticData.d.ts +0 -66
  239. package/dist/pointGroups/magneticData.d.ts.map +0 -1
  240. package/dist/pointGroups/magneticData.js +0 -184
  241. package/dist/pointGroups/magneticData.js.map +0 -1
  242. package/dist/spaceGroups/snap.d.ts +0 -20
  243. package/dist/spaceGroups/snap.d.ts.map +0 -1
  244. package/dist/spaceGroups/snap.js +0 -103
  245. package/dist/spaceGroups/snap.js.map +0 -1
  246. package/src/pointGroups/data.ts +0 -305
  247. package/src/pointGroups/magneticData.ts +0 -328
  248. package/src/spaceGroups/snap.ts +0 -121
@@ -1,305 +0,0 @@
1
- /**
2
- * The 32 crystallographic point groups (crystal classes) as data: generators, settings and symbols.
3
- * The 90 magnetic point groups built on them are in magneticData.ts.
4
- *
5
- * Generators are stored in the Birss frame (docs/conventions.md); every setting is a rotation of
6
- * that frame, and the ITC settings are among them. The print anchors and their tests are listed in
7
- * docs/conventions.md, "Sources"; never derive data here from symcrys output.
8
- */
9
-
10
- import { IDENTITY, INVERSION, multiply, rotationX, rotationY, rotationZ, type Mat3 } from '../linalg.js';
11
- import { operation, type Operation } from '../operations.js';
12
- import type { CrystalSystem } from '../lattice.js';
13
-
14
- /** Keys of the 32 crystal classes: the ITC short symbol of the class (docs/conventions.md, "Keys"). */
15
- export const POINT_GROUP_KEYS = Object.freeze([
16
- '1',
17
- '-1',
18
- '2',
19
- 'm',
20
- '2/m',
21
- '222',
22
- 'mm2',
23
- 'mmm',
24
- '4',
25
- '-4',
26
- '4/m',
27
- '422',
28
- '4mm',
29
- '-42m',
30
- '4/mmm',
31
- '3',
32
- '-3',
33
- '32',
34
- '3m',
35
- '-3m',
36
- '6',
37
- '-6',
38
- '6/m',
39
- '622',
40
- '6mm',
41
- '-6m2',
42
- '6/mmm',
43
- '23',
44
- 'm-3',
45
- '432',
46
- '-43m',
47
- 'm-3m',
48
- ] as const);
49
-
50
- /** The key of one of the 32 crystal classes (`POINT_GROUP_KEYS`). */
51
- // `Extract<…, string>` is the same type; written so, the documentation (TypeDoc) names it instead of
52
- // listing the 32 keys at every use.
53
- export type PointGroupKey = Extract<(typeof POINT_GROUP_KEYS)[number], string>;
54
-
55
- /** A symbol in one convention: the short symbol of the setting and the full symbol, positions separated by spaces. */
56
- interface SymbolForms {
57
- readonly short: string;
58
- readonly full: string;
59
- }
60
-
61
- export interface SettingData {
62
- /** Orthogonal matrix s: the setting's operations are s·W·sᵀ for the stored operations W. */
63
- readonly frame: Mat3;
64
- /** Monoclinic: the unique axis; orthorhombic mm2: the axis of the twofold rotation. */
65
- readonly uniqueAxis?: 'a' | 'b' | 'c';
66
- readonly itc: SymbolForms;
67
- readonly birss: SymbolForms;
68
- }
69
-
70
- export interface PointGroupData {
71
- readonly key: PointGroupKey;
72
- readonly crystalSystem: CrystalSystem;
73
- readonly schoenflies: string;
74
- /** Generators in the stored (Birss) frame, which is setting 1. */
75
- readonly generators: readonly Operation[];
76
- /** Setting 1 first; its frame is the identity. */
77
- readonly settings: readonly SettingData[];
78
- /** The ITC default setting (1-based). The Birss default is always setting 1. */
79
- readonly itcDefault: number;
80
- }
81
-
82
- // --- Matrices in the stored (Birss) frame ---------------------------------------------------------
83
-
84
- export const ROT2_Z = rotationZ(180);
85
- export const ROT2_X = rotationX(180);
86
- export const ROT2_Y = rotationY(180);
87
- export const ROT4_Z = rotationZ(90);
88
- export const ROT3_Z = rotationZ(120);
89
- export const ROT6_Z = rotationZ(60);
90
- export const ROT4_X = rotationX(90);
91
- export const ROTINV4_Z = multiply(ROT4_Z, INVERSION);
92
- export const ROTINV3_Z = multiply(ROT3_Z, INVERSION);
93
- export const ROTINV6_Z = multiply(ROT6_Z, INVERSION);
94
- export const MIRROR_X: Mat3 = [
95
- [-1, 0, 0],
96
- [0, 1, 0],
97
- [0, 0, 1],
98
- ];
99
- export const MIRROR_Y: Mat3 = [
100
- [1, 0, 0],
101
- [0, -1, 0],
102
- [0, 0, 1],
103
- ];
104
- export const MIRROR_Z: Mat3 = [
105
- [1, 0, 0],
106
- [0, 1, 0],
107
- [0, 0, -1],
108
- ];
109
- /** Mirror with normal [1-10] (swaps x and y). */
110
- export const MIRROR_XY: Mat3 = [
111
- [0, 1, 0],
112
- [1, 0, 0],
113
- [0, 0, 1],
114
- ];
115
- /** Threefold rotation about [111], mapping the vector x to y, y to z, z to x. */
116
- export const ROT3_111: Mat3 = [
117
- [0, 0, 1],
118
- [1, 0, 0],
119
- [0, 1, 0],
120
- ];
121
-
122
- // --- Setting frames -------------------------------------------------------------------------------
123
-
124
- export const SAME: Mat3 = [
125
- [1, 0, 0],
126
- [0, 1, 0],
127
- [0, 0, 1],
128
- ];
129
- /** Monoclinic, c-unique (stored) → b-unique: z → y. Proper rotation. */
130
- export const MONOCLINIC_B: Mat3 = [
131
- [-1, 0, 0],
132
- [0, 0, 1],
133
- [0, 1, 0],
134
- ];
135
- /** Orthorhombic: the axis along z (stored) moves to x (cyclic x → y → z → x). */
136
- export const ORTHO_TO_A: Mat3 = [
137
- [0, 0, 1],
138
- [1, 0, 0],
139
- [0, 1, 0],
140
- ];
141
- /** Orthorhombic: the axis along z (stored) moves to y (cyclic x → z → y → x). */
142
- export const ORTHO_TO_B: Mat3 = [
143
- [0, 1, 0],
144
- [0, 0, 1],
145
- [1, 0, 0],
146
- ];
147
- /**
148
- * Orthorhombic, for a group whose three elements all differ: the frames above after exchanging the
149
- * other two axes (a rotation by 90° about the stored z axis), so the same axis stays unique.
150
- */
151
- export const ORTHO_SWAP: Mat3 = rotationZ(90);
152
- export const ORTHO_TO_A_SWAP: Mat3 = multiply(ORTHO_TO_A, ORTHO_SWAP);
153
- export const ORTHO_TO_B_SWAP: Mat3 = multiply(ORTHO_TO_B, ORTHO_SWAP);
154
- export const ROT45_Z = rotationZ(45);
155
- export const ROT30_Z = rotationZ(30);
156
-
157
- // --- Helpers ---------------------------------------------------------------------------------------
158
-
159
- const ops = (...matrices: Mat3[]): Operation[] => matrices.map(operation);
160
-
161
- /** A setting whose symbols are the same in both conventions. */
162
- function setting(frame: Mat3, short: string, full: string, uniqueAxis?: 'a' | 'b' | 'c'): SettingData {
163
- const forms = { short, full };
164
- return uniqueAxis ? { frame, uniqueAxis, itc: forms, birss: forms } : { frame, itc: forms, birss: forms };
165
- }
166
-
167
- /** A group with one setting whose symbols agree in both conventions. */
168
- function group(
169
- key: PointGroupKey,
170
- crystalSystem: CrystalSystem,
171
- schoenflies: string,
172
- generators: Operation[],
173
- full: string = key,
174
- ): PointGroupData {
175
- return { key, crystalSystem, schoenflies, generators, settings: [setting(SAME, key, full)], itcDefault: 1 };
176
- }
177
-
178
- /**
179
- * Trigonal and hexagonal groups whose two settings differ by 30° about z. Symbol position 2 means
180
- * the a direction (x) in ITC and the y direction in Birss, so each frame carries, in one
181
- * convention, the symbol the other convention gives to the other frame (docs/conventions.md).
182
- * `secondary` is the ITC symbol with the lateral elements in the a direction; ITC's default is
183
- * that frame, setting 2. Birss's default, setting 1, carries Birss's printed short symbol, the key.
184
- */
185
- function trigonalPair(
186
- key: PointGroupKey,
187
- crystalSystem: CrystalSystem,
188
- schoenflies: string,
189
- generators: Operation[],
190
- secondary: SymbolForms,
191
- tertiary: SymbolForms,
192
- ): PointGroupData {
193
- return {
194
- key,
195
- crystalSystem,
196
- schoenflies,
197
- generators,
198
- settings: [
199
- { frame: SAME, itc: tertiary, birss: { short: key, full: secondary.full } },
200
- { frame: ROT30_Z, itc: secondary, birss: tertiary },
201
- ],
202
- itcDefault: 2,
203
- };
204
- }
205
-
206
- function monoclinic(key: PointGroupKey, schoenflies: string, generators: Operation[], full: (axis: string) => string) {
207
- const data: PointGroupData = {
208
- key,
209
- crystalSystem: 'monoclinic',
210
- schoenflies,
211
- generators,
212
- settings: [setting(SAME, key, full('c'), 'c'), setting(MONOCLINIC_B, key, full('b'), 'b')],
213
- itcDefault: 2,
214
- };
215
- return data;
216
- }
217
-
218
- // --- The 32 crystal classes -----------------------------------------------------------------------
219
-
220
- export const POINT_GROUP_DATA: readonly PointGroupData[] = [
221
- group('1', 'triclinic', 'C1', ops(IDENTITY)),
222
- group('-1', 'triclinic', 'Ci', ops(INVERSION)),
223
-
224
- monoclinic('2', 'C2', ops(ROT2_Z), (u) => (u === 'c' ? '1 1 2' : '1 2 1')),
225
- monoclinic('m', 'Cs', ops(MIRROR_Z), (u) => (u === 'c' ? '1 1 m' : '1 m 1')),
226
- monoclinic('2/m', 'C2h', ops(ROT2_Z, INVERSION), (u) => (u === 'c' ? '1 1 2/m' : '1 2/m 1')),
227
-
228
- group('222', 'orthorhombic', 'D2', ops(ROT2_Z, ROT2_X), '2 2 2'),
229
- {
230
- key: 'mm2',
231
- crystalSystem: 'orthorhombic',
232
- schoenflies: 'C2v',
233
- generators: ops(ROT2_Z, MIRROR_X),
234
- settings: [
235
- setting(SAME, 'mm2', 'm m 2', 'c'),
236
- setting(ORTHO_TO_A, '2mm', '2 m m', 'a'),
237
- setting(ORTHO_TO_B, 'm2m', 'm 2 m', 'b'),
238
- ],
239
- itcDefault: 1,
240
- },
241
- group('mmm', 'orthorhombic', 'D2h', ops(ROT2_Z, ROT2_X, INVERSION), '2/m 2/m 2/m'),
242
-
243
- group('4', 'tetragonal', 'C4', ops(ROT4_Z)),
244
- group('-4', 'tetragonal', 'S4', ops(ROTINV4_Z)),
245
- group('4/m', 'tetragonal', 'C4h', ops(ROT4_Z, INVERSION)),
246
- group('422', 'tetragonal', 'D4', ops(ROT4_Z, ROT2_X), '4 2 2'),
247
- group('4mm', 'tetragonal', 'C4v', ops(ROT4_Z, MIRROR_X), '4 m m'),
248
- {
249
- key: '-42m',
250
- crystalSystem: 'tetragonal',
251
- schoenflies: 'D2d',
252
- generators: ops(ROTINV4_Z, ROT2_X),
253
- settings: [setting(SAME, '-42m', '-4 2 m'), setting(ROT45_Z, '-4m2', '-4 m 2')],
254
- itcDefault: 1,
255
- },
256
- group('4/mmm', 'tetragonal', 'D4h', ops(ROT4_Z, ROT2_X, INVERSION), '4/m 2/m 2/m'),
257
-
258
- group('3', 'trigonal', 'C3', ops(ROT3_Z)),
259
- group('-3', 'trigonal', 'C3i', ops(ROTINV3_Z)),
260
- trigonalPair(
261
- '32',
262
- 'trigonal',
263
- 'D3',
264
- ops(ROT3_Z, ROT2_Y),
265
- { short: '321', full: '3 2 1' },
266
- { short: '312', full: '3 1 2' },
267
- ),
268
- trigonalPair(
269
- '3m',
270
- 'trigonal',
271
- 'C3v',
272
- ops(ROT3_Z, MIRROR_Y),
273
- { short: '3m1', full: '3 m 1' },
274
- { short: '31m', full: '3 1 m' },
275
- ),
276
- trigonalPair(
277
- '-3m',
278
- 'trigonal',
279
- 'D3d',
280
- ops(ROT3_Z, ROT2_Y, INVERSION),
281
- { short: '-3m1', full: '-3 2/m 1' },
282
- { short: '-31m', full: '-3 1 2/m' },
283
- ),
284
-
285
- group('6', 'hexagonal', 'C6', ops(ROT6_Z)),
286
- group('-6', 'hexagonal', 'C3h', ops(ROTINV6_Z)),
287
- group('6/m', 'hexagonal', 'C6h', ops(ROT6_Z, INVERSION)),
288
- group('622', 'hexagonal', 'D6', ops(ROT6_Z, ROT2_Y), '6 2 2'),
289
- group('6mm', 'hexagonal', 'C6v', ops(ROT6_Z, MIRROR_Y), '6 m m'),
290
- trigonalPair(
291
- '-6m2',
292
- 'hexagonal',
293
- 'D3h',
294
- ops(ROTINV6_Z, MIRROR_Y),
295
- { short: '-6m2', full: '-6 m 2' },
296
- { short: '-62m', full: '-6 2 m' },
297
- ),
298
- group('6/mmm', 'hexagonal', 'D6h', ops(ROT6_Z, ROT2_Y, INVERSION), '6/m 2/m 2/m'),
299
-
300
- group('23', 'cubic', 'T', ops(ROT2_Z, ROT2_X, ROT3_111), '2 3'),
301
- group('m-3', 'cubic', 'Th', ops(ROT2_Z, ROT2_X, ROT3_111, INVERSION), '2/m -3'),
302
- group('432', 'cubic', 'O', ops(ROT4_Z, ROT4_X, ROT3_111), '4 3 2'),
303
- group('-43m', 'cubic', 'Td', ops(ROTINV4_Z, ROT3_111, MIRROR_XY), '-4 3 m'),
304
- group('m-3m', 'cubic', 'Oh', ops(ROT4_Z, ROT4_X, ROT3_111, INVERSION), '4/m -3 2/m'),
305
- ];
@@ -1,328 +0,0 @@
1
- /**
2
- * The 90 magnetic point groups with time reversal as data: the 32 grey groups (type II) and the 58
3
- * black-and-white groups (type III). With the 32 crystal classes (type I, data.ts) they are the 122
4
- * magnetic point groups.
5
- *
6
- * A grey group is its crystal class P together with all operations of P combined with time
7
- * reversal (ITC Vol. D, eq. (1.5.2.1)); its data follow from the class. A black-and-white group is
8
- * stored like a class: generators in the stored (Birss) frame, here those of birss-app, and the
9
- * frames of its settings. The symbols of a setting are not stored: they are the symbols of the
10
- * crystal class in that frame with the primes the operations carry (magneticSymbols.ts).
11
- * Print anchors and their tests: docs/conventions.md, "Sources".
12
- */
13
-
14
- import { IDENTITY, INVERSION, type Mat3 } from '../linalg.js';
15
- import { operation, type Operation } from '../operations.js';
16
- import {
17
- MIRROR_X,
18
- MIRROR_Y,
19
- MIRROR_Z,
20
- MONOCLINIC_B,
21
- ORTHO_SWAP,
22
- ORTHO_TO_A,
23
- ORTHO_TO_A_SWAP,
24
- ORTHO_TO_B,
25
- ORTHO_TO_B_SWAP,
26
- POINT_GROUP_DATA,
27
- POINT_GROUP_KEYS,
28
- ROT2_X,
29
- ROT2_Y,
30
- ROT2_Z,
31
- ROT30_Z,
32
- ROT3_111,
33
- ROT3_Z,
34
- ROT45_Z,
35
- ROT4_Z,
36
- ROT6_Z,
37
- ROTINV4_Z,
38
- ROTINV6_Z,
39
- SAME,
40
- type PointGroupKey,
41
- } from './data.js';
42
-
43
- /** Keys of the 32 grey groups: the key of the crystal class followed by `1'`. */
44
- export type GreyPointGroupKey = `${PointGroupKey}1'`;
45
-
46
- export const GREY_POINT_GROUP_KEYS: readonly GreyPointGroupKey[] = Object.freeze(
47
- POINT_GROUP_KEYS.map((key): GreyPointGroupKey => `${key}1'`),
48
- );
49
-
50
- /**
51
- * Keys of the 58 black-and-white groups: the short Hermann–Mauguin symbol of ITC Vol. D
52
- * Table 1.5.2.3, in the order of the table (docs/conventions.md, "Keys").
53
- */
54
- export const BLACK_WHITE_POINT_GROUP_KEYS = Object.freeze([
55
- "-1'",
56
- "2'",
57
- "m'",
58
- "2'/m'",
59
- "2/m'",
60
- "2'/m",
61
- "2'2'2",
62
- "m'm'2",
63
- "2'm'm",
64
- "mm'm'",
65
- "m'm'm'",
66
- "mmm'",
67
- "4'",
68
- "-4'",
69
- "4'/m",
70
- "4/m'",
71
- "4'/m'",
72
- "4'22'",
73
- "42'2'",
74
- "4'mm'",
75
- "4m'm'",
76
- "-4'2m'",
77
- "-4'm2'",
78
- "-42'm'",
79
- "4'/mmm'",
80
- "4/mm'm'",
81
- "4/m'm'm'",
82
- "4/m'mm",
83
- "4'/m'm'm",
84
- "-3'",
85
- "32'",
86
- "3m'",
87
- "-3m'",
88
- "-3'm'",
89
- "-3'm",
90
- "6'",
91
- "-6'",
92
- "6'/m'",
93
- "6/m'",
94
- "6'/m",
95
- "6'22'",
96
- "62'2'",
97
- "6'mm'",
98
- "6m'm'",
99
- "-6'2m'",
100
- "-6'm2'",
101
- "-6m'2'",
102
- "6'/m'mm'",
103
- "6/mm'm'",
104
- "6/m'm'm'",
105
- "6/m'mm",
106
- "6'/mmm'",
107
- "m'-3'",
108
- "4'32'",
109
- "-4'3m'",
110
- "m-3m'",
111
- "m'-3'm'",
112
- "m'-3'm",
113
- ] as const);
114
-
115
- /** The key of one of the 58 black-and-white magnetic point groups. */
116
- // `Extract<…, string>`: the same type, named by the documentation (see `PointGroupKey`).
117
- export type BlackWhitePointGroupKey = Extract<(typeof BLACK_WHITE_POINT_GROUP_KEYS)[number], string>;
118
-
119
- /** Keys of all 122 magnetic point groups: the 32 crystal classes, the 32 grey groups, the 58 black-and-white groups. */
120
- export type MagneticPointGroupKey = PointGroupKey | GreyPointGroupKey | BlackWhitePointGroupKey;
121
-
122
- /**
123
- * Keys of the 122 magnetic point groups: the 32 crystal classes (white groups), the 32 grey groups
124
- * and the 58 black-and-white groups, in this order (docs/conventions.md, "Keys").
125
- */
126
- export const MAGNETIC_POINT_GROUP_KEYS: readonly MagneticPointGroupKey[] = Object.freeze([
127
- ...POINT_GROUP_KEYS,
128
- ...GREY_POINT_GROUP_KEYS,
129
- ...BLACK_WHITE_POINT_GROUP_KEYS,
130
- ]);
131
-
132
- /** The frame of a setting of a black-and-white group. */
133
- export interface MagneticFrame {
134
- /** Orthogonal matrix s: the setting's operations are s·W·sᵀ for the stored operations W. */
135
- readonly frame: Mat3;
136
- /** Monoclinic: the unique axis; orthorhombic: the axis the stored z axis is carried to. */
137
- readonly uniqueAxis?: 'a' | 'b' | 'c';
138
- }
139
-
140
- export interface BlackWhiteData {
141
- readonly key: BlackWhitePointGroupKey;
142
- /** The crystal class the group becomes when every prime is dropped. */
143
- readonly crystalClass: PointGroupKey;
144
- readonly schoenflies: string;
145
- /** Generators in the stored (Birss) frame, which is setting 1. */
146
- readonly generators: readonly Operation[];
147
- /** Setting 1 first; its frame is the identity. */
148
- readonly settings: readonly MagneticFrame[];
149
- /** The ITC default setting (1-based). The Birss default is always setting 1. */
150
- readonly itcDefault: number;
151
- }
152
-
153
- /** Time reversal alone: the identity combined with time reversal (1'). */
154
- export const TIME_REVERSAL: Operation = Object.freeze({ matrix: IDENTITY, timeReversal: true });
155
-
156
- /** An operation combined with time reversal (a primed operation). */
157
- const primed = (matrix: Mat3): Operation => ({ matrix, timeReversal: true });
158
-
159
- function blackWhite(
160
- key: BlackWhitePointGroupKey,
161
- crystalClass: PointGroupKey,
162
- schoenflies: string,
163
- generators: Operation[],
164
- frames: Mat3[],
165
- itcDefault = 1,
166
- uniqueAxes?: ('a' | 'b' | 'c')[],
167
- ): BlackWhiteData {
168
- const settings = frames.map((frame, i): MagneticFrame =>
169
- uniqueAxes ? { frame, uniqueAxis: uniqueAxes[i] } : { frame },
170
- );
171
- return { key, crystalClass, schoenflies, generators, settings, itcDefault };
172
- }
173
-
174
- /**
175
- * The 58 black-and-white groups. The generators are birss-app's (CLAUDE.md, "birss-app is the
176
- * reference where print leaves a choice open"); the group they generate is checked against Birss's
177
- * Table 6 and against ITC Vol. D Table 1.5.2.3. Setting frames as for the classes (data.ts), with three more for `2'm'm`; the
178
- * ITC default is the frame in which the key, read along ITA's symmetry directions, describes the
179
- * group, which is the frame of the operators printed in Table 1.5.2.3.
180
- */
181
- export const BLACK_WHITE_DATA: readonly BlackWhiteData[] = [
182
- blackWhite("-1'", '-1', 'Ci(C1)', [primed(INVERSION)], [SAME]),
183
- blackWhite("2'", '2', 'C2(C1)', [primed(ROT2_Z)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
184
- blackWhite("m'", 'm', 'Cs(C1)', [primed(MIRROR_Z)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
185
- blackWhite("2'/m'", '2/m', 'C2h(Ci)', [primed(ROT2_Z), operation(INVERSION)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
186
- blackWhite("2/m'", '2/m', 'C2h(C2)', [operation(ROT2_Z), primed(INVERSION)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
187
- blackWhite("2'/m", '2/m', 'C2h(Cs)', [primed(ROT2_Z), primed(INVERSION)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
188
- blackWhite("2'2'2", '222', 'D2(C2)', [operation(ROT2_Z), primed(ROT2_X)], [SAME, ORTHO_TO_A, ORTHO_TO_B], 1, [
189
- 'c',
190
- 'a',
191
- 'b',
192
- ]),
193
- blackWhite("m'm'2", 'mm2', 'C2v(C2)', [operation(ROT2_Z), primed(MIRROR_X)], [SAME, ORTHO_TO_A, ORTHO_TO_B], 1, [
194
- 'c',
195
- 'a',
196
- 'b',
197
- ]),
198
- // Its three elements all differ, so exchanging two axes gives another orientation: six settings.
199
- // Settings 1 to 3 are birss-app's; 4 to 6 exchange the other two axes at the same unique axis.
200
- blackWhite(
201
- "2'm'm",
202
- 'mm2',
203
- 'C2v(Cs)',
204
- [operation(MIRROR_Z), primed(ROT2_X)],
205
- [SAME, ORTHO_TO_A, ORTHO_TO_B, ORTHO_SWAP, ORTHO_TO_A_SWAP, ORTHO_TO_B_SWAP],
206
- 1,
207
- ['c', 'a', 'b', 'c', 'a', 'b'],
208
- ),
209
- blackWhite(
210
- "mm'm'",
211
- 'mmm',
212
- 'D2h(C2h)',
213
- [operation(ROT2_Z), operation(INVERSION), primed(ROT2_X)],
214
- [SAME, ORTHO_TO_A, ORTHO_TO_B],
215
- 2,
216
- ['c', 'a', 'b'],
217
- ),
218
- blackWhite("m'm'm'", 'mmm', 'D2h(D2)', [operation(ROT2_Z), operation(ROT2_X), primed(INVERSION)], [SAME]),
219
- blackWhite(
220
- "mmm'",
221
- 'mmm',
222
- 'D2h(C2v)',
223
- [operation(ROT2_Z), operation(MIRROR_X), primed(INVERSION)],
224
- [SAME, ORTHO_TO_A, ORTHO_TO_B],
225
- 1,
226
- ['c', 'a', 'b'],
227
- ),
228
- blackWhite("4'", '4', 'C4(C2)', [primed(ROT4_Z)], [SAME]),
229
- blackWhite("-4'", '-4', 'S4(C2)', [primed(ROTINV4_Z)], [SAME]),
230
- blackWhite("4'/m", '4/m', 'C4h(C2h)', [primed(ROT4_Z), operation(INVERSION)], [SAME]),
231
- blackWhite("4/m'", '4/m', 'C4h(C4)', [operation(ROT4_Z), primed(INVERSION)], [SAME]),
232
- blackWhite("4'/m'", '4/m', 'C4h(S4)', [primed(ROT4_Z), primed(INVERSION)], [SAME]),
233
- blackWhite("4'22'", '422', 'D4(D2)', [primed(ROT4_Z), operation(ROT2_X)], [SAME, ROT45_Z]),
234
- blackWhite("42'2'", '422', 'D4(C4)', [operation(ROT4_Z), primed(ROT2_X)], [SAME]),
235
- blackWhite("4'mm'", '4mm', 'C4v(C2v)', [primed(ROT4_Z), operation(MIRROR_X)], [SAME, ROT45_Z]),
236
- blackWhite("4m'm'", '4mm', 'C4v(C4)', [operation(ROT4_Z), primed(MIRROR_X)], [SAME]),
237
- blackWhite("-4'2m'", '-42m', 'D2d(D2)', [primed(ROTINV4_Z), operation(ROT2_X)], [SAME, ROT45_Z]),
238
- blackWhite("-4'm2'", '-42m', 'D2d(C2v)', [primed(ROTINV4_Z), operation(MIRROR_Y)], [SAME, ROT45_Z]),
239
- blackWhite("-42'm'", '-42m', 'D2d(S4)', [operation(ROTINV4_Z), primed(ROT2_X)], [SAME, ROT45_Z]),
240
- blackWhite(
241
- "4'/mmm'",
242
- '4/mmm',
243
- 'D4h(D2h)',
244
- [primed(ROT4_Z), operation(ROT2_X), operation(INVERSION)],
245
- [SAME, ROT45_Z],
246
- ),
247
- blackWhite("4/mm'm'", '4/mmm', 'D4h(C4h)', [operation(ROT4_Z), operation(INVERSION), primed(ROT2_X)], [SAME]),
248
- blackWhite("4/m'm'm'", '4/mmm', 'D4h(D4)', [operation(ROT4_Z), operation(ROT2_X), primed(INVERSION)], [SAME]),
249
- blackWhite("4/m'mm", '4/mmm', 'D4h(C4v)', [operation(ROT4_Z), operation(MIRROR_X), primed(INVERSION)], [SAME]),
250
- blackWhite(
251
- "4'/m'm'm",
252
- '4/mmm',
253
- 'D4h(D2d)',
254
- [operation(ROTINV4_Z), operation(ROT2_Y), primed(INVERSION)],
255
- [SAME, ROT45_Z],
256
- ),
257
- blackWhite("-3'", '-3', 'C3i(C3)', [operation(ROT3_Z), primed(INVERSION)], [SAME]),
258
- blackWhite("32'", '32', 'D3(C3)', [operation(ROT3_Z), primed(ROT2_Y)], [SAME, ROT30_Z], 2),
259
- blackWhite("3m'", '3m', 'C3v(C3)', [operation(ROT3_Z), primed(MIRROR_Y)], [SAME, ROT30_Z], 2),
260
- blackWhite("-3m'", '-3m', 'D3d(C3i)', [operation(ROT3_Z), operation(INVERSION), primed(ROT2_Y)], [SAME, ROT30_Z], 2),
261
- blackWhite("-3'm'", '-3m', 'D3d(D3)', [operation(ROT3_Z), operation(ROT2_Y), primed(INVERSION)], [SAME, ROT30_Z], 2),
262
- blackWhite(
263
- "-3'm",
264
- '-3m',
265
- 'D3d(C3v)',
266
- [operation(ROT3_Z), operation(MIRROR_Y), primed(INVERSION)],
267
- [SAME, ROT30_Z],
268
- 2,
269
- ),
270
- blackWhite("6'", '6', 'C6(C3)', [primed(ROT6_Z)], [SAME]),
271
- blackWhite("-6'", '-6', 'C3h(C3)', [primed(ROTINV6_Z)], [SAME]),
272
- blackWhite("6'/m'", '6/m', 'C6h(C3i)', [primed(ROT6_Z), operation(INVERSION)], [SAME]),
273
- blackWhite("6/m'", '6/m', 'C6h(C6)', [operation(ROT6_Z), primed(INVERSION)], [SAME]),
274
- blackWhite("6'/m", '6/m', 'C6h(C3h)', [primed(ROT6_Z), primed(INVERSION)], [SAME]),
275
- blackWhite("6'22'", '622', 'D6(D3)', [primed(ROT6_Z), operation(ROT2_Y)], [SAME, ROT30_Z], 2),
276
- blackWhite("62'2'", '622', 'D6(C6)', [operation(ROT6_Z), primed(ROT2_Y)], [SAME]),
277
- blackWhite("6'mm'", '6mm', 'C6v(C3v)', [primed(ROT6_Z), operation(MIRROR_Y)], [SAME, ROT30_Z], 2),
278
- blackWhite("6m'm'", '6mm', 'C6v(C6)', [operation(ROT6_Z), primed(MIRROR_Y)], [SAME]),
279
- blackWhite("-6'2m'", '-6m2', 'D3h(D3)', [primed(ROTINV6_Z), operation(ROT2_Y)], [SAME, ROT30_Z], 2),
280
- blackWhite("-6'm2'", '-6m2', 'D3h(C3v)', [primed(ROTINV6_Z), operation(MIRROR_Y)], [SAME, ROT30_Z], 2),
281
- blackWhite("-6m'2'", '-6m2', 'D3h(C3h)', [operation(ROTINV6_Z), primed(MIRROR_Y)], [SAME, ROT30_Z], 2),
282
- blackWhite(
283
- "6'/m'mm'",
284
- '6/mmm',
285
- 'D6h(D3d)',
286
- [primed(ROT6_Z), operation(ROT2_Y), operation(INVERSION)],
287
- [SAME, ROT30_Z],
288
- 2,
289
- ),
290
- blackWhite("6/mm'm'", '6/mmm', 'D6h(C6h)', [operation(ROT6_Z), operation(INVERSION), primed(ROT2_Y)], [SAME]),
291
- blackWhite("6/m'm'm'", '6/mmm', 'D6h(D6)', [operation(ROT6_Z), operation(ROT2_Y), primed(INVERSION)], [SAME]),
292
- blackWhite("6/m'mm", '6/mmm', 'D6h(C6v)', [operation(ROT6_Z), operation(MIRROR_Y), primed(INVERSION)], [SAME]),
293
- blackWhite("6'/mmm'", '6/mmm', 'D6h(D3h)', [primed(ROT6_Z), operation(ROT2_Y), primed(INVERSION)], [SAME, ROT30_Z]),
294
- blackWhite(
295
- "m'-3'",
296
- 'm-3',
297
- 'Th(T)',
298
- [operation(ROT2_Z), operation(ROT2_X), operation(ROT3_111), primed(INVERSION)],
299
- [SAME],
300
- ),
301
- blackWhite(
302
- "4'32'",
303
- '432',
304
- 'O(T)',
305
- [operation(ROT2_Z), operation(ROT2_X), operation(ROT3_111), primed(ROT4_Z)],
306
- [SAME],
307
- ),
308
- blackWhite(
309
- "-4'3m'",
310
- '-43m',
311
- 'Td(T)',
312
- [operation(ROT2_Z), operation(ROT2_X), operation(ROT3_111), primed(ROTINV4_Z)],
313
- [SAME],
314
- ),
315
- blackWhite("m-3m'", 'm-3m', 'Oh(Th)', [operation(INVERSION), operation(ROT3_111), primed(ROT4_Z)], [SAME]),
316
- blackWhite("m'-3'm'", 'm-3m', 'Oh(O)', [operation(ROT4_Z), operation(ROT3_111), primed(INVERSION)], [SAME]),
317
- blackWhite("m'-3'm", 'm-3m', 'Oh(Td)', [operation(ROTINV4_Z), operation(ROT3_111), primed(INVERSION)], [SAME]),
318
- ];
319
-
320
- /** Schoenflies symbol of a grey group: that of its class with the subscript R (ITC Vol. D, Table 1.5.2.1). */
321
- export const greySchoenflies = (classSymbol: string): string => `${classSymbol}R`;
322
-
323
- /** The data of the crystal class with this key. */
324
- export function classData(key: PointGroupKey) {
325
- const d = POINT_GROUP_DATA.find((x) => x.key === key);
326
- if (!d) throw new RangeError(`Unknown crystal class: ${JSON.stringify(key)}`);
327
- return d;
328
- }