symcrys 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -132
- package/dist/crystalClasses.d.ts +211 -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/magnetic.d.ts +35 -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 +8 -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 +34 -0
- 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 +12 -5
- package/dist/pointGroups/elements.d.ts.map +1 -1
- package/dist/pointGroups/elements.js +6 -1
- package/dist/pointGroups/elements.js.map +1 -1
- package/dist/pointGroups/magneticData.d.ts +61 -0
- package/dist/pointGroups/magneticData.d.ts.map +1 -0
- package/dist/pointGroups/magneticData.js +180 -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 +94 -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 +2 -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/tensors/propertyTable.d.ts +35 -0
- package/dist/tensors/propertyTable.d.ts.map +1 -0
- package/dist/tensors/propertyTable.js +32 -0
- package/dist/tensors/propertyTable.js.map +1 -0
- package/dist/tensors/tensorForm.d.ts +16 -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 +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -26
- package/src/crystalClasses.ts +436 -0
- package/src/index.ts +32 -38
- package/src/magnetic.ts +87 -0
- package/src/operations.ts +29 -0
- package/src/pointGroups/data.ts +29 -21
- package/src/pointGroups/elements.ts +23 -7
- package/src/pointGroups/magneticData.ts +322 -0
- package/src/pointGroups/magneticSymbols.ts +110 -0
- package/src/pointGroups/pointGroups.ts +380 -65
- package/src/pointGroups/properties.ts +47 -56
- package/src/pointGroups/wyckoff.ts +15 -2
- package/src/tensors/propertyTable.ts +79 -0
- package/src/tensors/tensorForm.ts +34 -28
- package/src/tensors/tensorProperties.ts +50 -0
- package/src/version.ts +1 -1
package/src/magnetic.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The magnetic API of symcrys (`symcrys/magnetic`): the 122 magnetic point groups, with time
|
|
3
|
+
* reversal. Everything exported here is covered by SemVer (see CLAUDE.md), like the exports of
|
|
4
|
+
* `index.ts`.
|
|
5
|
+
*
|
|
6
|
+
* The functions have the names they have in the crystallographic API (`index.ts`); the import
|
|
7
|
+
* decides which reading a key has. Here a key of type `'I'` (`'32'`) is a white (colourless)
|
|
8
|
+
* group: the symmetry of a magnetically ordered crystal in which time reversal does not occur at
|
|
9
|
+
* all. A crystal without magnetic order has the grey group of its class (quartz: `"321'"`), which
|
|
10
|
+
* allows no time-odd property (docs/conventions.md, "Two entry points").
|
|
11
|
+
*/
|
|
12
|
+
export { VERSION } from './version.js';
|
|
13
|
+
|
|
14
|
+
export type { Mat3, Vec3 } from './linalg.js';
|
|
15
|
+
export type { Operation } from './operations.js';
|
|
16
|
+
export {
|
|
17
|
+
crystalFamily,
|
|
18
|
+
latticeBasis,
|
|
19
|
+
type CrystalFamily,
|
|
20
|
+
type CrystalSystem,
|
|
21
|
+
type FixedAngleFamily,
|
|
22
|
+
} from './lattice.js';
|
|
23
|
+
|
|
24
|
+
import type {
|
|
25
|
+
PointGroupKey as ClassKey,
|
|
26
|
+
MagneticPointGroupKey,
|
|
27
|
+
PointGroup as PointGroupOf,
|
|
28
|
+
PointGroupInSetting as PointGroupInSettingOf,
|
|
29
|
+
} from './pointGroups/pointGroups.js';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The key of a crystal class, one of the 32: the type of `crystalClass` and `laueClass` of a point
|
|
33
|
+
* group and of `holohedry()`. In the crystallographic API this is `PointGroupKey`.
|
|
34
|
+
*/
|
|
35
|
+
export type CrystalClassKey = ClassKey;
|
|
36
|
+
/** The key of a magnetic point group: a crystal class (white group), a grey or a black-and-white group. */
|
|
37
|
+
export type PointGroupKey = MagneticPointGroupKey;
|
|
38
|
+
export type PointGroup<K extends PointGroupKey = PointGroupKey> = PointGroupOf<K>;
|
|
39
|
+
/** A point group in a given setting. */
|
|
40
|
+
export type PointGroupInSetting = PointGroupInSettingOf<PointGroupKey>;
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
MAGNETIC_POINT_GROUP_KEYS as POINT_GROUP_KEYS,
|
|
44
|
+
findMagneticPointGroup as findPointGroup,
|
|
45
|
+
generators,
|
|
46
|
+
isMagneticPointGroupKey as isPointGroupKey,
|
|
47
|
+
magneticPointGroups as pointGroups,
|
|
48
|
+
operations,
|
|
49
|
+
pointGroup,
|
|
50
|
+
settings,
|
|
51
|
+
symbol,
|
|
52
|
+
type Convention,
|
|
53
|
+
type PointGroupType,
|
|
54
|
+
type Setting,
|
|
55
|
+
type SettingOptions,
|
|
56
|
+
type SymbolOptions,
|
|
57
|
+
} from './pointGroups/pointGroups.js';
|
|
58
|
+
export { holohedry, isCentrosymmetricOf, isChiralOf } from './pointGroups/properties.js';
|
|
59
|
+
export { LATTICE_SYMMETRY_DIRECTIONS, type Uvw } from './symmetryDirections.js';
|
|
60
|
+
export {
|
|
61
|
+
describeOperations,
|
|
62
|
+
symmetryDirections,
|
|
63
|
+
type Axis,
|
|
64
|
+
type DirectionElements,
|
|
65
|
+
type OperationDescription,
|
|
66
|
+
type OperationKind,
|
|
67
|
+
type SymmetryDirection,
|
|
68
|
+
} from './pointGroups/elements.js';
|
|
69
|
+
export { siteSymmetry, type SiteSymmetry, type SiteSymmetryOptions } from './siteSymmetry.js';
|
|
70
|
+
export {
|
|
71
|
+
rotateTensor,
|
|
72
|
+
tensorForm,
|
|
73
|
+
tensorFormOf,
|
|
74
|
+
type IntrinsicSymmetry,
|
|
75
|
+
type TensorForm,
|
|
76
|
+
type TensorParity,
|
|
77
|
+
type TensorRank,
|
|
78
|
+
type TensorSpec,
|
|
79
|
+
type TimeParity,
|
|
80
|
+
} from './tensors/tensorForm.js';
|
|
81
|
+
export { TENSOR_PROPERTIES, type TensorProperty, type TensorPropertyName } from './tensors/propertyTable.js';
|
|
82
|
+
export {
|
|
83
|
+
allowedProperties,
|
|
84
|
+
allowedPropertiesOf,
|
|
85
|
+
allowsProperty,
|
|
86
|
+
allowsPropertyOf,
|
|
87
|
+
} from './tensors/tensorProperties.js';
|
package/src/operations.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IDENTITY, conjugate, matricesEqual, multiply, snap, type Mat3 } from './linalg.js';
|
|
7
|
+
import { EPSILON } from './tolerances.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* A point operation: an orthogonal Cartesian matrix (rotation, rotoinversion, mirror, inversion),
|
|
@@ -24,6 +25,34 @@ export function operation(matrix: Mat3): Operation {
|
|
|
24
25
|
return { matrix, timeReversal: false };
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
/** Throws unless `m` is orthogonal (mᵀm = 1 within `EPSILON`): the code assumes Cartesian matrices. */
|
|
29
|
+
export function checkOrthogonal(m: Mat3, what: string): void {
|
|
30
|
+
for (let i = 0; i < 3; i++) {
|
|
31
|
+
for (let j = 0; j < 3; j++) {
|
|
32
|
+
const dot = m[0][i] * m[0][j] + m[1][i] * m[1][j] + m[2][i] * m[2][j];
|
|
33
|
+
// A comparison that is false for NaN, so that a matrix with NaN is refused as well.
|
|
34
|
+
if (!(Math.abs(dot - (i === j ? 1 : 0)) <= EPSILON)) {
|
|
35
|
+
throw new RangeError(`${what} is not an orthogonal (Cartesian) matrix: ${JSON.stringify(m)}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Checks operations that a caller passes in: each must say whether it is combined with time
|
|
43
|
+
* reversal. Without this, an operation that lacks `timeReversal` (as the crystallographic API
|
|
44
|
+
* returns them) would be composed as if it had it in every second product.
|
|
45
|
+
*/
|
|
46
|
+
export function checkTimeReversal(operations: readonly Operation[]): void {
|
|
47
|
+
operations.forEach((op, i) => {
|
|
48
|
+
if (typeof op.timeReversal !== 'boolean') {
|
|
49
|
+
throw new RangeError(
|
|
50
|
+
`Operation ${i}: timeReversal must be true or false, not ${JSON.stringify(op.timeReversal)}; an operation of the magnetic API says whether it is combined with time reversal`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
27
56
|
/** The product a·b: first b, then a. */
|
|
28
57
|
export function compose(a: Operation, b: Operation): Operation {
|
|
29
58
|
return { matrix: snap(multiply(a.matrix, b.matrix)), timeReversal: a.timeReversal !== b.timeReversal };
|
package/src/pointGroups/data.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
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.
|
|
3
4
|
*
|
|
4
5
|
* Generators are stored in the Birss frame (docs/conventions.md); every setting is a rotation of
|
|
5
6
|
* that frame, and the ITC settings are among them. The print anchors and their tests are listed in
|
|
@@ -77,39 +78,39 @@ export interface PointGroupData {
|
|
|
77
78
|
|
|
78
79
|
// --- Matrices in the stored (Birss) frame ---------------------------------------------------------
|
|
79
80
|
|
|
80
|
-
const ROT2_Z = rotationZ(180);
|
|
81
|
-
const ROT2_X = rotationX(180);
|
|
82
|
-
const ROT2_Y = rotationY(180);
|
|
83
|
-
const ROT4_Z = rotationZ(90);
|
|
84
|
-
const ROT3_Z = rotationZ(120);
|
|
85
|
-
const ROT6_Z = rotationZ(60);
|
|
86
|
-
const ROT4_X = rotationX(90);
|
|
87
|
-
const ROTINV4_Z = multiply(ROT4_Z, INVERSION);
|
|
88
|
-
const ROTINV3_Z = multiply(ROT3_Z, INVERSION);
|
|
89
|
-
const ROTINV6_Z = multiply(ROT6_Z, INVERSION);
|
|
90
|
-
const MIRROR_X: Mat3 = [
|
|
81
|
+
export const ROT2_Z = rotationZ(180);
|
|
82
|
+
export const ROT2_X = rotationX(180);
|
|
83
|
+
export const ROT2_Y = rotationY(180);
|
|
84
|
+
export const ROT4_Z = rotationZ(90);
|
|
85
|
+
export const ROT3_Z = rotationZ(120);
|
|
86
|
+
export const ROT6_Z = rotationZ(60);
|
|
87
|
+
export const ROT4_X = rotationX(90);
|
|
88
|
+
export const ROTINV4_Z = multiply(ROT4_Z, INVERSION);
|
|
89
|
+
export const ROTINV3_Z = multiply(ROT3_Z, INVERSION);
|
|
90
|
+
export const ROTINV6_Z = multiply(ROT6_Z, INVERSION);
|
|
91
|
+
export const MIRROR_X: Mat3 = [
|
|
91
92
|
[-1, 0, 0],
|
|
92
93
|
[0, 1, 0],
|
|
93
94
|
[0, 0, 1],
|
|
94
95
|
];
|
|
95
|
-
const MIRROR_Y: Mat3 = [
|
|
96
|
+
export const MIRROR_Y: Mat3 = [
|
|
96
97
|
[1, 0, 0],
|
|
97
98
|
[0, -1, 0],
|
|
98
99
|
[0, 0, 1],
|
|
99
100
|
];
|
|
100
|
-
const MIRROR_Z: Mat3 = [
|
|
101
|
+
export const MIRROR_Z: Mat3 = [
|
|
101
102
|
[1, 0, 0],
|
|
102
103
|
[0, 1, 0],
|
|
103
104
|
[0, 0, -1],
|
|
104
105
|
];
|
|
105
106
|
/** Mirror with normal [1-10] (swaps x and y). */
|
|
106
|
-
const MIRROR_XY: Mat3 = [
|
|
107
|
+
export const MIRROR_XY: Mat3 = [
|
|
107
108
|
[0, 1, 0],
|
|
108
109
|
[1, 0, 0],
|
|
109
110
|
[0, 0, 1],
|
|
110
111
|
];
|
|
111
112
|
/** Threefold rotation about [111], mapping the vector x to y, y to z, z to x. */
|
|
112
|
-
const ROT3_111: Mat3 = [
|
|
113
|
+
export const ROT3_111: Mat3 = [
|
|
113
114
|
[0, 0, 1],
|
|
114
115
|
[1, 0, 0],
|
|
115
116
|
[0, 1, 0],
|
|
@@ -117,31 +118,38 @@ const ROT3_111: Mat3 = [
|
|
|
117
118
|
|
|
118
119
|
// --- Setting frames -------------------------------------------------------------------------------
|
|
119
120
|
|
|
120
|
-
const SAME: Mat3 = [
|
|
121
|
+
export const SAME: Mat3 = [
|
|
121
122
|
[1, 0, 0],
|
|
122
123
|
[0, 1, 0],
|
|
123
124
|
[0, 0, 1],
|
|
124
125
|
];
|
|
125
126
|
/** Monoclinic, c-unique (stored) → b-unique: z → y. Proper rotation. */
|
|
126
|
-
const MONOCLINIC_B: Mat3 = [
|
|
127
|
+
export const MONOCLINIC_B: Mat3 = [
|
|
127
128
|
[-1, 0, 0],
|
|
128
129
|
[0, 0, 1],
|
|
129
130
|
[0, 1, 0],
|
|
130
131
|
];
|
|
131
132
|
/** Orthorhombic: the axis along z (stored) moves to x (cyclic x → y → z → x). */
|
|
132
|
-
const ORTHO_TO_A: Mat3 = [
|
|
133
|
+
export const ORTHO_TO_A: Mat3 = [
|
|
133
134
|
[0, 0, 1],
|
|
134
135
|
[1, 0, 0],
|
|
135
136
|
[0, 1, 0],
|
|
136
137
|
];
|
|
137
138
|
/** Orthorhombic: the axis along z (stored) moves to y (cyclic x → z → y → x). */
|
|
138
|
-
const ORTHO_TO_B: Mat3 = [
|
|
139
|
+
export const ORTHO_TO_B: Mat3 = [
|
|
139
140
|
[0, 1, 0],
|
|
140
141
|
[0, 0, 1],
|
|
141
142
|
[1, 0, 0],
|
|
142
143
|
];
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Orthorhombic, for a group whose three elements all differ: the frames above after exchanging the
|
|
146
|
+
* other two axes (a rotation by 90° about the stored z axis), so the same axis stays unique.
|
|
147
|
+
*/
|
|
148
|
+
export const ORTHO_SWAP: Mat3 = rotationZ(90);
|
|
149
|
+
export const ORTHO_TO_A_SWAP: Mat3 = multiply(ORTHO_TO_A, ORTHO_SWAP);
|
|
150
|
+
export const ORTHO_TO_B_SWAP: Mat3 = multiply(ORTHO_TO_B, ORTHO_SWAP);
|
|
151
|
+
export const ROT45_Z = rotationZ(45);
|
|
152
|
+
export const ROT30_Z = rotationZ(30);
|
|
145
153
|
|
|
146
154
|
// --- Helpers ---------------------------------------------------------------------------------------
|
|
147
155
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
pointGroup,
|
|
15
15
|
symbol,
|
|
16
16
|
type Convention,
|
|
17
|
-
type
|
|
17
|
+
type MagneticPointGroupKey,
|
|
18
18
|
type SettingOptions,
|
|
19
19
|
} from './pointGroups.js';
|
|
20
20
|
|
|
@@ -55,7 +55,11 @@ export interface OperationDescription {
|
|
|
55
55
|
|
|
56
56
|
/** The symmetry elements along one symmetry direction. */
|
|
57
57
|
export interface DirectionElements extends Axis {
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Highest n of a rotation n about this direction; 1 if there is none. In a magnetic group
|
|
60
|
+
* rotations, rotoinversions and mirrors count with and without time reversal;
|
|
61
|
+
* `describeOperations` tells them apart.
|
|
62
|
+
*/
|
|
59
63
|
readonly rotation: number;
|
|
60
64
|
/** Highest n of a rotoinversion n̄ (n = 3, 4, 6) about this direction; 0 if there is none. */
|
|
61
65
|
readonly rotoinversion: number;
|
|
@@ -67,7 +71,10 @@ export interface DirectionElements extends Axis {
|
|
|
67
71
|
export interface SymmetryDirection {
|
|
68
72
|
/** 1-based position in the full symbol. */
|
|
69
73
|
readonly position: number;
|
|
70
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* The symbol at this position of the full symbol, if the full symbol has this position; for a
|
|
76
|
+
* magnetic group with its primes (`4'/m`).
|
|
77
|
+
*/
|
|
71
78
|
readonly symbol?: string;
|
|
72
79
|
readonly directions: readonly DirectionElements[];
|
|
73
80
|
}
|
|
@@ -173,7 +180,7 @@ interface Analysis {
|
|
|
173
180
|
|
|
174
181
|
const cache = new Map<string, Analysis>();
|
|
175
182
|
|
|
176
|
-
function analysis(key:
|
|
183
|
+
function analysis(key: MagneticPointGroupKey, options?: SettingOptions): Analysis {
|
|
177
184
|
const ops = operations(key, options); // checks key, convention and setting
|
|
178
185
|
const c = options?.convention ?? 'itc';
|
|
179
186
|
const setting = options?.setting ?? 0;
|
|
@@ -187,7 +194,13 @@ function analysis(key: PointGroupKey, options?: SettingOptions): Analysis {
|
|
|
187
194
|
const what = `Point group ${key}`;
|
|
188
195
|
const descriptions = Object.freeze(ops.map((op) => describe(op, all, what)));
|
|
189
196
|
|
|
190
|
-
|
|
197
|
+
// The full symbol of a grey group ends in 1', which is no position of the symbol.
|
|
198
|
+
const tokens =
|
|
199
|
+
family === 'triclinic'
|
|
200
|
+
? []
|
|
201
|
+
: symbol(key, { ...options, form: 'full' })
|
|
202
|
+
.split(' ')
|
|
203
|
+
.filter((t) => t !== "1'");
|
|
191
204
|
const directions = Object.freeze(
|
|
192
205
|
positions.map((axes, i) => {
|
|
193
206
|
const elements = axes.map((a) => {
|
|
@@ -247,7 +260,10 @@ function birssSigned(d: OperationDescription): OperationDescription {
|
|
|
247
260
|
* convention with the sign of ITA Table 2.1.3.1, in the Birss convention signed as birss-app signs
|
|
248
261
|
* them (first non-zero Cartesian component positive); the sign fixes what the sense refers to.
|
|
249
262
|
*/
|
|
250
|
-
export function describeOperations(
|
|
263
|
+
export function describeOperations(
|
|
264
|
+
key: MagneticPointGroupKey,
|
|
265
|
+
options?: SettingOptions,
|
|
266
|
+
): readonly OperationDescription[] {
|
|
251
267
|
return analysis(key, options).descriptions;
|
|
252
268
|
}
|
|
253
269
|
|
|
@@ -259,6 +275,6 @@ export function describeOperations(key: PointGroupKey, options?: SettingOptions)
|
|
|
259
275
|
* in both conventions; in the Birss convention an axis of `describeOperations` may be reversed, so
|
|
260
276
|
* match it to a direction by |dot| = 1, not by identity.
|
|
261
277
|
*/
|
|
262
|
-
export function symmetryDirections(key:
|
|
278
|
+
export function symmetryDirections(key: MagneticPointGroupKey, options?: SettingOptions): readonly SymmetryDirection[] {
|
|
263
279
|
return analysis(key, options).directions;
|
|
264
280
|
}
|
|
@@ -0,0 +1,322 @@
|
|
|
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
|
+
export type BlackWhitePointGroupKey = (typeof BLACK_WHITE_POINT_GROUP_KEYS)[number];
|
|
116
|
+
|
|
117
|
+
/** Keys of all 122 magnetic point groups: the 32 crystal classes, the 32 grey groups, the 58 black-and-white groups. */
|
|
118
|
+
export type MagneticPointGroupKey = PointGroupKey | GreyPointGroupKey | BlackWhitePointGroupKey;
|
|
119
|
+
|
|
120
|
+
export const MAGNETIC_POINT_GROUP_KEYS: readonly MagneticPointGroupKey[] = Object.freeze([
|
|
121
|
+
...POINT_GROUP_KEYS,
|
|
122
|
+
...GREY_POINT_GROUP_KEYS,
|
|
123
|
+
...BLACK_WHITE_POINT_GROUP_KEYS,
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
/** The frame of a setting of a black-and-white group. */
|
|
127
|
+
export interface MagneticFrame {
|
|
128
|
+
/** Orthogonal matrix s: the setting's operations are s·W·sᵀ for the stored operations W. */
|
|
129
|
+
readonly frame: Mat3;
|
|
130
|
+
/** Monoclinic: the unique axis; orthorhombic: the axis the stored z axis is carried to. */
|
|
131
|
+
readonly uniqueAxis?: 'a' | 'b' | 'c';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface BlackWhiteData {
|
|
135
|
+
readonly key: BlackWhitePointGroupKey;
|
|
136
|
+
/** The crystal class the group becomes when every prime is dropped. */
|
|
137
|
+
readonly crystalClass: PointGroupKey;
|
|
138
|
+
readonly schoenflies: string;
|
|
139
|
+
/** Generators in the stored (Birss) frame, which is setting 1. */
|
|
140
|
+
readonly generators: readonly Operation[];
|
|
141
|
+
/** Setting 1 first; its frame is the identity. */
|
|
142
|
+
readonly settings: readonly MagneticFrame[];
|
|
143
|
+
/** The ITC default setting (1-based). The Birss default is always setting 1. */
|
|
144
|
+
readonly itcDefault: number;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Time reversal alone: the identity combined with time reversal (1'). */
|
|
148
|
+
export const TIME_REVERSAL: Operation = Object.freeze({ matrix: IDENTITY, timeReversal: true });
|
|
149
|
+
|
|
150
|
+
/** An operation combined with time reversal (a primed operation). */
|
|
151
|
+
const primed = (matrix: Mat3): Operation => ({ matrix, timeReversal: true });
|
|
152
|
+
|
|
153
|
+
function blackWhite(
|
|
154
|
+
key: BlackWhitePointGroupKey,
|
|
155
|
+
crystalClass: PointGroupKey,
|
|
156
|
+
schoenflies: string,
|
|
157
|
+
generators: Operation[],
|
|
158
|
+
frames: Mat3[],
|
|
159
|
+
itcDefault = 1,
|
|
160
|
+
uniqueAxes?: ('a' | 'b' | 'c')[],
|
|
161
|
+
): BlackWhiteData {
|
|
162
|
+
const settings = frames.map((frame, i): MagneticFrame =>
|
|
163
|
+
uniqueAxes ? { frame, uniqueAxis: uniqueAxes[i] } : { frame },
|
|
164
|
+
);
|
|
165
|
+
return { key, crystalClass, schoenflies, generators, settings, itcDefault };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The 58 black-and-white groups. The generators are birss-app's (CLAUDE.md, "birss-app is the
|
|
170
|
+
* reference where print leaves a choice open"); the group they generate is checked against Birss's
|
|
171
|
+
* 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
|
|
172
|
+
* ITC default is the frame in which the key, read along ITA's symmetry directions, describes the
|
|
173
|
+
* group, which is the frame of the operators printed in Table 1.5.2.3.
|
|
174
|
+
*/
|
|
175
|
+
export const BLACK_WHITE_DATA: readonly BlackWhiteData[] = [
|
|
176
|
+
blackWhite("-1'", '-1', 'Ci(C1)', [primed(INVERSION)], [SAME]),
|
|
177
|
+
blackWhite("2'", '2', 'C2(C1)', [primed(ROT2_Z)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
|
|
178
|
+
blackWhite("m'", 'm', 'Cs(C1)', [primed(MIRROR_Z)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
|
|
179
|
+
blackWhite("2'/m'", '2/m', 'C2h(Ci)', [primed(ROT2_Z), operation(INVERSION)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
|
|
180
|
+
blackWhite("2/m'", '2/m', 'C2h(C2)', [operation(ROT2_Z), primed(INVERSION)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
|
|
181
|
+
blackWhite("2'/m", '2/m', 'C2h(Cs)', [primed(ROT2_Z), primed(INVERSION)], [SAME, MONOCLINIC_B], 2, ['c', 'b']),
|
|
182
|
+
blackWhite("2'2'2", '222', 'D2(C2)', [operation(ROT2_Z), primed(ROT2_X)], [SAME, ORTHO_TO_A, ORTHO_TO_B], 1, [
|
|
183
|
+
'c',
|
|
184
|
+
'a',
|
|
185
|
+
'b',
|
|
186
|
+
]),
|
|
187
|
+
blackWhite("m'm'2", 'mm2', 'C2v(C2)', [operation(ROT2_Z), primed(MIRROR_X)], [SAME, ORTHO_TO_A, ORTHO_TO_B], 1, [
|
|
188
|
+
'c',
|
|
189
|
+
'a',
|
|
190
|
+
'b',
|
|
191
|
+
]),
|
|
192
|
+
// Its three elements all differ, so exchanging two axes gives another orientation: six settings.
|
|
193
|
+
// Settings 1 to 3 are birss-app's; 4 to 6 exchange the other two axes at the same unique axis.
|
|
194
|
+
blackWhite(
|
|
195
|
+
"2'm'm",
|
|
196
|
+
'mm2',
|
|
197
|
+
'C2v(Cs)',
|
|
198
|
+
[operation(MIRROR_Z), primed(ROT2_X)],
|
|
199
|
+
[SAME, ORTHO_TO_A, ORTHO_TO_B, ORTHO_SWAP, ORTHO_TO_A_SWAP, ORTHO_TO_B_SWAP],
|
|
200
|
+
1,
|
|
201
|
+
['c', 'a', 'b', 'c', 'a', 'b'],
|
|
202
|
+
),
|
|
203
|
+
blackWhite(
|
|
204
|
+
"mm'm'",
|
|
205
|
+
'mmm',
|
|
206
|
+
'D2h(C2h)',
|
|
207
|
+
[operation(ROT2_Z), operation(INVERSION), primed(ROT2_X)],
|
|
208
|
+
[SAME, ORTHO_TO_A, ORTHO_TO_B],
|
|
209
|
+
2,
|
|
210
|
+
['c', 'a', 'b'],
|
|
211
|
+
),
|
|
212
|
+
blackWhite("m'm'm'", 'mmm', 'D2h(D2)', [operation(ROT2_Z), operation(ROT2_X), primed(INVERSION)], [SAME]),
|
|
213
|
+
blackWhite(
|
|
214
|
+
"mmm'",
|
|
215
|
+
'mmm',
|
|
216
|
+
'D2h(C2v)',
|
|
217
|
+
[operation(ROT2_Z), operation(MIRROR_X), primed(INVERSION)],
|
|
218
|
+
[SAME, ORTHO_TO_A, ORTHO_TO_B],
|
|
219
|
+
1,
|
|
220
|
+
['c', 'a', 'b'],
|
|
221
|
+
),
|
|
222
|
+
blackWhite("4'", '4', 'C4(C2)', [primed(ROT4_Z)], [SAME]),
|
|
223
|
+
blackWhite("-4'", '-4', 'S4(C2)', [primed(ROTINV4_Z)], [SAME]),
|
|
224
|
+
blackWhite("4'/m", '4/m', 'C4h(C2h)', [primed(ROT4_Z), operation(INVERSION)], [SAME]),
|
|
225
|
+
blackWhite("4/m'", '4/m', 'C4h(C4)', [operation(ROT4_Z), primed(INVERSION)], [SAME]),
|
|
226
|
+
blackWhite("4'/m'", '4/m', 'C4h(S4)', [primed(ROT4_Z), primed(INVERSION)], [SAME]),
|
|
227
|
+
blackWhite("4'22'", '422', 'D4(D2)', [primed(ROT4_Z), operation(ROT2_X)], [SAME, ROT45_Z]),
|
|
228
|
+
blackWhite("42'2'", '422', 'D4(C4)', [operation(ROT4_Z), primed(ROT2_X)], [SAME]),
|
|
229
|
+
blackWhite("4'mm'", '4mm', 'C4v(C2v)', [primed(ROT4_Z), operation(MIRROR_X)], [SAME, ROT45_Z]),
|
|
230
|
+
blackWhite("4m'm'", '4mm', 'C4v(C4)', [operation(ROT4_Z), primed(MIRROR_X)], [SAME]),
|
|
231
|
+
blackWhite("-4'2m'", '-42m', 'D2d(D2)', [primed(ROTINV4_Z), operation(ROT2_X)], [SAME, ROT45_Z]),
|
|
232
|
+
blackWhite("-4'm2'", '-42m', 'D2d(C2v)', [primed(ROTINV4_Z), operation(MIRROR_Y)], [SAME, ROT45_Z]),
|
|
233
|
+
blackWhite("-42'm'", '-42m', 'D2d(S4)', [operation(ROTINV4_Z), primed(ROT2_X)], [SAME, ROT45_Z]),
|
|
234
|
+
blackWhite(
|
|
235
|
+
"4'/mmm'",
|
|
236
|
+
'4/mmm',
|
|
237
|
+
'D4h(D2h)',
|
|
238
|
+
[primed(ROT4_Z), operation(ROT2_X), operation(INVERSION)],
|
|
239
|
+
[SAME, ROT45_Z],
|
|
240
|
+
),
|
|
241
|
+
blackWhite("4/mm'm'", '4/mmm', 'D4h(C4h)', [operation(ROT4_Z), operation(INVERSION), primed(ROT2_X)], [SAME]),
|
|
242
|
+
blackWhite("4/m'm'm'", '4/mmm', 'D4h(D4)', [operation(ROT4_Z), operation(ROT2_X), primed(INVERSION)], [SAME]),
|
|
243
|
+
blackWhite("4/m'mm", '4/mmm', 'D4h(C4v)', [operation(ROT4_Z), operation(MIRROR_X), primed(INVERSION)], [SAME]),
|
|
244
|
+
blackWhite(
|
|
245
|
+
"4'/m'm'm",
|
|
246
|
+
'4/mmm',
|
|
247
|
+
'D4h(D2d)',
|
|
248
|
+
[operation(ROTINV4_Z), operation(ROT2_Y), primed(INVERSION)],
|
|
249
|
+
[SAME, ROT45_Z],
|
|
250
|
+
),
|
|
251
|
+
blackWhite("-3'", '-3', 'C3i(C3)', [operation(ROT3_Z), primed(INVERSION)], [SAME]),
|
|
252
|
+
blackWhite("32'", '32', 'D3(C3)', [operation(ROT3_Z), primed(ROT2_Y)], [SAME, ROT30_Z], 2),
|
|
253
|
+
blackWhite("3m'", '3m', 'C3v(C3)', [operation(ROT3_Z), primed(MIRROR_Y)], [SAME, ROT30_Z], 2),
|
|
254
|
+
blackWhite("-3m'", '-3m', 'D3d(C3i)', [operation(ROT3_Z), operation(INVERSION), primed(ROT2_Y)], [SAME, ROT30_Z], 2),
|
|
255
|
+
blackWhite("-3'm'", '-3m', 'D3d(D3)', [operation(ROT3_Z), operation(ROT2_Y), primed(INVERSION)], [SAME, ROT30_Z], 2),
|
|
256
|
+
blackWhite(
|
|
257
|
+
"-3'm",
|
|
258
|
+
'-3m',
|
|
259
|
+
'D3d(C3v)',
|
|
260
|
+
[operation(ROT3_Z), operation(MIRROR_Y), primed(INVERSION)],
|
|
261
|
+
[SAME, ROT30_Z],
|
|
262
|
+
2,
|
|
263
|
+
),
|
|
264
|
+
blackWhite("6'", '6', 'C6(C3)', [primed(ROT6_Z)], [SAME]),
|
|
265
|
+
blackWhite("-6'", '-6', 'C3h(C3)', [primed(ROTINV6_Z)], [SAME]),
|
|
266
|
+
blackWhite("6'/m'", '6/m', 'C6h(C3i)', [primed(ROT6_Z), operation(INVERSION)], [SAME]),
|
|
267
|
+
blackWhite("6/m'", '6/m', 'C6h(C6)', [operation(ROT6_Z), primed(INVERSION)], [SAME]),
|
|
268
|
+
blackWhite("6'/m", '6/m', 'C6h(C3h)', [primed(ROT6_Z), primed(INVERSION)], [SAME]),
|
|
269
|
+
blackWhite("6'22'", '622', 'D6(D3)', [primed(ROT6_Z), operation(ROT2_Y)], [SAME, ROT30_Z], 2),
|
|
270
|
+
blackWhite("62'2'", '622', 'D6(C6)', [operation(ROT6_Z), primed(ROT2_Y)], [SAME]),
|
|
271
|
+
blackWhite("6'mm'", '6mm', 'C6v(C3v)', [primed(ROT6_Z), operation(MIRROR_Y)], [SAME, ROT30_Z], 2),
|
|
272
|
+
blackWhite("6m'm'", '6mm', 'C6v(C6)', [operation(ROT6_Z), primed(MIRROR_Y)], [SAME]),
|
|
273
|
+
blackWhite("-6'2m'", '-6m2', 'D3h(D3)', [primed(ROTINV6_Z), operation(ROT2_Y)], [SAME, ROT30_Z], 2),
|
|
274
|
+
blackWhite("-6'm2'", '-6m2', 'D3h(C3v)', [primed(ROTINV6_Z), operation(MIRROR_Y)], [SAME, ROT30_Z], 2),
|
|
275
|
+
blackWhite("-6m'2'", '-6m2', 'D3h(C3h)', [operation(ROTINV6_Z), primed(MIRROR_Y)], [SAME, ROT30_Z], 2),
|
|
276
|
+
blackWhite(
|
|
277
|
+
"6'/m'mm'",
|
|
278
|
+
'6/mmm',
|
|
279
|
+
'D6h(D3d)',
|
|
280
|
+
[primed(ROT6_Z), operation(ROT2_Y), operation(INVERSION)],
|
|
281
|
+
[SAME, ROT30_Z],
|
|
282
|
+
2,
|
|
283
|
+
),
|
|
284
|
+
blackWhite("6/mm'm'", '6/mmm', 'D6h(C6h)', [operation(ROT6_Z), operation(INVERSION), primed(ROT2_Y)], [SAME]),
|
|
285
|
+
blackWhite("6/m'm'm'", '6/mmm', 'D6h(D6)', [operation(ROT6_Z), operation(ROT2_Y), primed(INVERSION)], [SAME]),
|
|
286
|
+
blackWhite("6/m'mm", '6/mmm', 'D6h(C6v)', [operation(ROT6_Z), operation(MIRROR_Y), primed(INVERSION)], [SAME]),
|
|
287
|
+
blackWhite("6'/mmm'", '6/mmm', 'D6h(D3h)', [primed(ROT6_Z), operation(ROT2_Y), primed(INVERSION)], [SAME, ROT30_Z]),
|
|
288
|
+
blackWhite(
|
|
289
|
+
"m'-3'",
|
|
290
|
+
'm-3',
|
|
291
|
+
'Th(T)',
|
|
292
|
+
[operation(ROT2_Z), operation(ROT2_X), operation(ROT3_111), primed(INVERSION)],
|
|
293
|
+
[SAME],
|
|
294
|
+
),
|
|
295
|
+
blackWhite(
|
|
296
|
+
"4'32'",
|
|
297
|
+
'432',
|
|
298
|
+
'O(T)',
|
|
299
|
+
[operation(ROT2_Z), operation(ROT2_X), operation(ROT3_111), primed(ROT4_Z)],
|
|
300
|
+
[SAME],
|
|
301
|
+
),
|
|
302
|
+
blackWhite(
|
|
303
|
+
"-4'3m'",
|
|
304
|
+
'-43m',
|
|
305
|
+
'Td(T)',
|
|
306
|
+
[operation(ROT2_Z), operation(ROT2_X), operation(ROT3_111), primed(ROTINV4_Z)],
|
|
307
|
+
[SAME],
|
|
308
|
+
),
|
|
309
|
+
blackWhite("m-3m'", 'm-3m', 'Oh(Th)', [operation(INVERSION), operation(ROT3_111), primed(ROT4_Z)], [SAME]),
|
|
310
|
+
blackWhite("m'-3'm'", 'm-3m', 'Oh(O)', [operation(ROT4_Z), operation(ROT3_111), primed(INVERSION)], [SAME]),
|
|
311
|
+
blackWhite("m'-3'm", 'm-3m', 'Oh(Td)', [operation(ROTINV4_Z), operation(ROT3_111), primed(INVERSION)], [SAME]),
|
|
312
|
+
];
|
|
313
|
+
|
|
314
|
+
/** Schoenflies symbol of a grey group: that of its class with the subscript R (ITC Vol. D, Table 1.5.2.1). */
|
|
315
|
+
export const greySchoenflies = (classSymbol: string): string => `${classSymbol}R`;
|
|
316
|
+
|
|
317
|
+
/** The data of the crystal class with this key. */
|
|
318
|
+
export function classData(key: PointGroupKey) {
|
|
319
|
+
const d = POINT_GROUP_DATA.find((x) => x.key === key);
|
|
320
|
+
if (!d) throw new RangeError(`Unknown crystal class: ${JSON.stringify(key)}`);
|
|
321
|
+
return d;
|
|
322
|
+
}
|