symcrys 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/dist/crystalClasses.d.ts +222 -0
- package/dist/crystalClasses.d.ts.map +1 -0
- package/dist/crystalClasses.js +295 -0
- package/dist/crystalClasses.js.map +1 -0
- package/dist/index.d.ts +11 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/lattice.d.ts +5 -1
- package/dist/lattice.d.ts.map +1 -1
- package/dist/lattice.js +3 -1
- package/dist/lattice.js.map +1 -1
- package/dist/magnetic.d.ts +36 -0
- package/dist/magnetic.d.ts.map +1 -0
- package/dist/magnetic.js +22 -0
- package/dist/magnetic.js.map +1 -0
- package/dist/operations.d.ts +10 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +25 -0
- package/dist/operations.js.map +1 -1
- package/dist/pointGroups/data.d.ts +36 -1
- package/dist/pointGroups/data.d.ts.map +1 -1
- package/dist/pointGroups/data.js +29 -21
- package/dist/pointGroups/data.js.map +1 -1
- package/dist/pointGroups/elements.d.ts +16 -6
- package/dist/pointGroups/elements.d.ts.map +1 -1
- package/dist/pointGroups/elements.js +7 -2
- package/dist/pointGroups/elements.js.map +1 -1
- package/dist/pointGroups/magneticData.d.ts +66 -0
- package/dist/pointGroups/magneticData.d.ts.map +1 -0
- package/dist/pointGroups/magneticData.js +184 -0
- package/dist/pointGroups/magneticData.js.map +1 -0
- package/dist/pointGroups/magneticSymbols.d.ts +22 -0
- package/dist/pointGroups/magneticSymbols.d.ts.map +1 -0
- package/dist/pointGroups/magneticSymbols.js +103 -0
- package/dist/pointGroups/magneticSymbols.js.map +1 -0
- package/dist/pointGroups/pointGroups.d.ts +102 -24
- package/dist/pointGroups/pointGroups.d.ts.map +1 -1
- package/dist/pointGroups/pointGroups.js +293 -47
- package/dist/pointGroups/pointGroups.js.map +1 -1
- package/dist/pointGroups/properties.d.ts +25 -16
- package/dist/pointGroups/properties.d.ts.map +1 -1
- package/dist/pointGroups/properties.js +46 -56
- package/dist/pointGroups/properties.js.map +1 -1
- package/dist/pointGroups/wyckoff.d.ts +4 -1
- package/dist/pointGroups/wyckoff.d.ts.map +1 -1
- package/dist/pointGroups/wyckoff.js +6 -2
- package/dist/pointGroups/wyckoff.js.map +1 -1
- package/dist/siteSymmetry.d.ts +2 -1
- package/dist/siteSymmetry.d.ts.map +1 -1
- package/dist/siteSymmetry.js.map +1 -1
- package/dist/tensors/propertyTable.d.ts +45 -0
- package/dist/tensors/propertyTable.d.ts.map +1 -0
- package/dist/tensors/propertyTable.js +41 -0
- package/dist/tensors/propertyTable.js.map +1 -0
- package/dist/tensors/tensorForm.d.ts +21 -10
- package/dist/tensors/tensorForm.d.ts.map +1 -1
- package/dist/tensors/tensorForm.js +23 -24
- package/dist/tensors/tensorForm.js.map +1 -1
- package/dist/tensors/tensorProperties.d.ts +30 -0
- package/dist/tensors/tensorProperties.d.ts.map +1 -0
- package/dist/tensors/tensorProperties.js +44 -0
- package/dist/tensors/tensorProperties.js.map +1 -0
- package/dist/version.d.ts +6 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +6 -2
- package/dist/version.js.map +1 -1
- package/package.json +6 -2
- package/src/crystalClasses.ts +451 -0
- package/src/index.ts +32 -38
- package/src/lattice.ts +5 -1
- package/src/magnetic.ts +88 -0
- package/src/operations.ts +31 -0
- package/src/pointGroups/data.ts +33 -22
- package/src/pointGroups/elements.ts +27 -8
- package/src/pointGroups/magneticData.ts +328 -0
- package/src/pointGroups/magneticSymbols.ts +110 -0
- package/src/pointGroups/pointGroups.ts +388 -65
- package/src/pointGroups/properties.ts +47 -56
- package/src/pointGroups/wyckoff.ts +17 -2
- package/src/siteSymmetry.ts +2 -1
- package/src/tensors/propertyTable.ts +89 -0
- package/src/tensors/tensorForm.ts +39 -28
- package/src/tensors/tensorProperties.ts +50 -0
- package/src/version.ts +6 -2
|
@@ -0,0 +1,328 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hermann–Mauguin symbols of the black-and-white point groups. The symbol of such a group in a
|
|
3
|
+
* given frame is the symbol of its crystal class in that frame, each position carrying a prime if
|
|
4
|
+
* the operation it names is combined with time reversal (ITC Vol. D, § 1.5.2.1, Table 1.5.2.3).
|
|
5
|
+
* So no symbols are stored for these groups: they follow from the symbols of the class
|
|
6
|
+
* (data.ts) and the operations (docs/conventions.md, "Symbols").
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { matricesEqual, type Mat3, type Vec3 } from '../linalg.js';
|
|
10
|
+
import { crystalFamily, latticeBasis, type CrystalFamily, type CrystalSystem } from '../lattice.js';
|
|
11
|
+
import type { Operation } from '../operations.js';
|
|
12
|
+
import { LATTICE_SYMMETRY_DIRECTIONS } from '../symmetryDirections.js';
|
|
13
|
+
|
|
14
|
+
/** The Cartesian direction of the first symmetry direction of each position of the full symbol. */
|
|
15
|
+
function positionDirections(family: CrystalFamily, convention: 'itc' | 'birss'): readonly Vec3[] {
|
|
16
|
+
const positions = LATTICE_SYMMETRY_DIRECTIONS[family];
|
|
17
|
+
// Birss reads position 2 of the hexagonal family along y and position 3 along x
|
|
18
|
+
// (docs/conventions.md, "Where ITC and Birss differ").
|
|
19
|
+
const ordered =
|
|
20
|
+
convention === 'birss' && family === 'hexagonal' ? [positions[0], positions[2], positions[1]] : positions;
|
|
21
|
+
// Monoclinic: a, b, c along x, y, z, exact for the unique axis, the only one with an element.
|
|
22
|
+
const b: Mat3 =
|
|
23
|
+
family === 'monoclinic' || family === 'triclinic'
|
|
24
|
+
? [
|
|
25
|
+
[1, 0, 0],
|
|
26
|
+
[0, 1, 0],
|
|
27
|
+
[0, 0, 1],
|
|
28
|
+
]
|
|
29
|
+
: latticeBasis(family);
|
|
30
|
+
return ordered.map(([uvw]) => [
|
|
31
|
+
b[0][0] * uvw[0] + b[0][1] * uvw[1] + b[0][2] * uvw[2],
|
|
32
|
+
b[1][0] * uvw[0] + b[1][1] * uvw[1] + b[1][2] * uvw[2],
|
|
33
|
+
b[2][0] * uvw[0] + b[2][1] * uvw[1] + b[2][2] * uvw[2],
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Proper rotation by 360°/n about the direction u (Rodrigues' formula), times `sign`. */
|
|
38
|
+
function rotation(u: Vec3, n: number, sign: 1 | -1): Mat3 {
|
|
39
|
+
const length = Math.hypot(u[0], u[1], u[2]);
|
|
40
|
+
const [x, y, z] = [u[0] / length, u[1] / length, u[2] / length];
|
|
41
|
+
const a = (2 * Math.PI) / n;
|
|
42
|
+
const c = Math.cos(a);
|
|
43
|
+
const s = Math.sin(a);
|
|
44
|
+
const t = 1 - c;
|
|
45
|
+
const r = [
|
|
46
|
+
[t * x * x + c, t * x * y - s * z, t * x * z + s * y],
|
|
47
|
+
[t * x * y + s * z, t * y * y + c, t * y * z - s * x],
|
|
48
|
+
[t * x * z - s * y, t * y * z + s * x, t * z * z + c],
|
|
49
|
+
];
|
|
50
|
+
return r.map((row) => row.map((v) => sign * v)) as unknown as Mat3;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** `'` if the operation with this matrix is combined with time reversal in `ops`, otherwise ``. */
|
|
54
|
+
function prime(ops: readonly Operation[], matrix: Mat3, what: string): string {
|
|
55
|
+
const op = ops.find((x) => matricesEqual(x.matrix, matrix));
|
|
56
|
+
if (!op) throw new Error(`${what}: the group does not contain the operation its symbol names`);
|
|
57
|
+
return op.timeReversal ? "'" : '';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** One position (`N`, `-N`, `N/m`, `m`, `1`) with the primes of the operations along `u`. */
|
|
61
|
+
function primedToken(token: string, u: Vec3 | undefined, ops: readonly Operation[], what: string): string {
|
|
62
|
+
if (token === '1') return token;
|
|
63
|
+
const parts = /^(?:(-?)([1-6]))?(\/?m)?$/.exec(token);
|
|
64
|
+
if (!parts || token === '') throw new Error(`${what}: unreadable position ${JSON.stringify(token)}`);
|
|
65
|
+
const [, bar, n, mirror] = parts;
|
|
66
|
+
let result = '';
|
|
67
|
+
if (n) {
|
|
68
|
+
// -1 is the inversion and needs no direction; every other axis lies along u.
|
|
69
|
+
if (n === '1') result = `${bar}1${prime(ops, rotation([0, 0, 1], 1, -1), what)}`;
|
|
70
|
+
else {
|
|
71
|
+
if (!u) throw new Error(`${what}: no symmetry direction for position ${token}`);
|
|
72
|
+
result = `${bar}${n}${prime(ops, rotation(u, Number(n), bar ? -1 : 1), what)}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (mirror) {
|
|
76
|
+
if (!u) throw new Error(`${what}: no symmetry direction for position ${token}`);
|
|
77
|
+
result += `${mirror}${prime(ops, rotation(u, 2, -1), what)}`;
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The positions of a short symbol: `N`, `-N`, `N/m`, `m`. */
|
|
83
|
+
function shortTokens(symbol: string): string[] {
|
|
84
|
+
const list = symbol.match(/-?[1-6](\/m)?|m/g) ?? [];
|
|
85
|
+
if (list.join('') !== symbol) throw new Error(`Unreadable symbol: ${symbol}`);
|
|
86
|
+
return list;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The symbols of a black-and-white group in one frame: the short and the full symbol of its
|
|
91
|
+
* crystal class in that frame, in the given convention, with primes taken from `ops`, the
|
|
92
|
+
* operations of the group in that frame.
|
|
93
|
+
*/
|
|
94
|
+
export function primedSymbols(
|
|
95
|
+
classSymbols: { readonly short: string; readonly full: string },
|
|
96
|
+
system: CrystalSystem,
|
|
97
|
+
convention: 'itc' | 'birss',
|
|
98
|
+
ops: readonly Operation[],
|
|
99
|
+
): { short: string; full: string } {
|
|
100
|
+
const family = crystalFamily(system);
|
|
101
|
+
const directions = positionDirections(family, convention);
|
|
102
|
+
const what = `Symbol ${classSymbols.short}`;
|
|
103
|
+
const fullTokens = classSymbols.full.split(' ');
|
|
104
|
+
const full = fullTokens.map((t, i) => primedToken(t, directions[i], ops, what)).join(' ');
|
|
105
|
+
const tokens = shortTokens(classSymbols.short);
|
|
106
|
+
// A monoclinic short symbol has one position: the one of the unique axis in the full symbol.
|
|
107
|
+
const offset = family === 'monoclinic' && tokens.length === 1 ? fullTokens.findIndex((t) => t !== '1') : 0;
|
|
108
|
+
const short = tokens.map((t, i) => primedToken(t, directions[i + offset], ops, what)).join('');
|
|
109
|
+
return { short, full };
|
|
110
|
+
}
|