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
package/src/index.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public API of symcrys
|
|
3
|
-
*
|
|
2
|
+
* Public API of symcrys: the crystallographic API, for the 32 crystal classes and without time
|
|
3
|
+
* reversal. The magnetic point groups, time-odd tensors and operations with time reversal are in
|
|
4
|
+
* the magnetic API, `symcrys/magnetic` (`magnetic.ts`), under the same function names
|
|
5
|
+
* (docs/conventions.md, "Two entry points"). Everything exported here and there is covered by
|
|
6
|
+
* SemVer (see CLAUDE.md); everything else is internal.
|
|
4
7
|
*/
|
|
5
8
|
export { VERSION } from './version.js';
|
|
6
9
|
|
|
7
10
|
export type { Mat3, Vec3 } from './linalg.js';
|
|
8
|
-
export type { Operation } from './operations.js';
|
|
9
11
|
export {
|
|
10
12
|
crystalFamily,
|
|
11
13
|
latticeBasis,
|
|
@@ -14,52 +16,44 @@ export {
|
|
|
14
16
|
type FixedAngleFamily,
|
|
15
17
|
} from './lattice.js';
|
|
16
18
|
|
|
19
|
+
export type { Convention, PointGroupKey, Setting, SettingOptions, SymbolOptions } from './pointGroups/pointGroups.js';
|
|
20
|
+
export { LATTICE_SYMMETRY_DIRECTIONS, type Uvw } from './symmetryDirections.js';
|
|
21
|
+
export type { Axis, DirectionElements, OperationKind, SymmetryDirection } from './pointGroups/elements.js';
|
|
22
|
+
export type { SiteSymmetry, SiteSymmetryOptions } from './siteSymmetry.js';
|
|
23
|
+
export type { Hkl, WyckoffOptions, WyckoffPosition } from './pointGroups/wyckoff.js';
|
|
24
|
+
export type { IntrinsicSymmetry, TensorForm, TensorParity, TensorRank } from './tensors/tensorForm.js';
|
|
25
|
+
|
|
17
26
|
export {
|
|
18
27
|
POINT_GROUP_KEYS,
|
|
28
|
+
TENSOR_PROPERTIES,
|
|
29
|
+
allowedProperties,
|
|
30
|
+
allowedPropertiesOf,
|
|
31
|
+
allowsProperty,
|
|
32
|
+
allowsPropertyOf,
|
|
33
|
+
describeOperations,
|
|
19
34
|
findPointGroup,
|
|
20
35
|
generators,
|
|
36
|
+
holohedry,
|
|
37
|
+
isCentrosymmetricOf,
|
|
38
|
+
isChiralOf,
|
|
21
39
|
isPointGroupKey,
|
|
22
40
|
operations,
|
|
23
41
|
pointGroup,
|
|
24
42
|
pointGroups,
|
|
43
|
+
rotateTensor,
|
|
25
44
|
settings,
|
|
45
|
+
siteSymmetry,
|
|
26
46
|
symbol,
|
|
27
|
-
type Convention,
|
|
28
|
-
type PointGroup,
|
|
29
|
-
type PointGroupInSetting,
|
|
30
|
-
type PointGroupKey,
|
|
31
|
-
type PointGroupType,
|
|
32
|
-
type Setting,
|
|
33
|
-
type SettingOptions,
|
|
34
|
-
type SymbolOptions,
|
|
35
|
-
} from './pointGroups/pointGroups.js';
|
|
36
|
-
export { isCentrosymmetric, isChiral, isPiezoelectric, isPolar, laueClass } from './pointGroups/properties.js';
|
|
37
|
-
export { LATTICE_SYMMETRY_DIRECTIONS, type Uvw } from './symmetryDirections.js';
|
|
38
|
-
export {
|
|
39
|
-
describeOperations,
|
|
40
47
|
symmetryDirections,
|
|
41
|
-
type Axis,
|
|
42
|
-
type DirectionElements,
|
|
43
|
-
type OperationDescription,
|
|
44
|
-
type OperationKind,
|
|
45
|
-
type SymmetryDirection,
|
|
46
|
-
} from './pointGroups/elements.js';
|
|
47
|
-
export { siteSymmetry, type SiteSymmetry, type SiteSymmetryOptions } from './siteSymmetry.js';
|
|
48
|
-
export {
|
|
49
|
-
wyckoffPositionOf,
|
|
50
|
-
wyckoffPositions,
|
|
51
|
-
type Hkl,
|
|
52
|
-
type WyckoffOptions,
|
|
53
|
-
type WyckoffPosition,
|
|
54
|
-
} from './pointGroups/wyckoff.js';
|
|
55
|
-
export {
|
|
56
|
-
rotateTensor,
|
|
57
48
|
tensorForm,
|
|
58
49
|
tensorFormOf,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type
|
|
62
|
-
type
|
|
50
|
+
wyckoffPositionOf,
|
|
51
|
+
wyckoffPositions,
|
|
52
|
+
type Operation,
|
|
53
|
+
type OperationDescription,
|
|
54
|
+
type PointGroup,
|
|
55
|
+
type PointGroupInSetting,
|
|
56
|
+
type TensorProperty,
|
|
57
|
+
type TensorPropertyName,
|
|
63
58
|
type TensorSpec,
|
|
64
|
-
|
|
65
|
-
} from './tensors/tensorForm.js';
|
|
59
|
+
} from './crystalClasses.js';
|
package/src/lattice.ts
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import type { Mat3 } from './linalg.js';
|
|
7
7
|
|
|
8
|
+
/** One of the seven crystal systems. */
|
|
8
9
|
export type CrystalSystem =
|
|
9
10
|
'triclinic' | 'monoclinic' | 'orthorhombic' | 'tetragonal' | 'trigonal' | 'hexagonal' | 'cubic';
|
|
10
11
|
|
|
12
|
+
/** One of the six crystal families: the trigonal and the hexagonal system form the hexagonal family. */
|
|
11
13
|
export type CrystalFamily = 'triclinic' | 'monoclinic' | 'orthorhombic' | 'tetragonal' | 'hexagonal' | 'cubic';
|
|
12
14
|
|
|
13
15
|
/** The crystal family of a crystal system: trigonal and hexagonal form the hexagonal family. */
|
|
@@ -38,12 +40,14 @@ const HEXAGONAL = frozen([
|
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* The conventional basis vectors a, b, c as the **columns** of a Cartesian matrix, with unit edge
|
|
41
|
-
* lengths
|
|
43
|
+
* lengths. Hexagonal family (hexagonal axes): x ∥ a, z ∥ c, y = z × x, so b points at 120° from a.
|
|
42
44
|
* Orthorhombic, tetragonal, cubic: x ∥ a, y ∥ b, z ∥ c.
|
|
43
45
|
*
|
|
44
46
|
* The edge lengths are set to 1 because the symmetry directions of these families, and so the
|
|
45
47
|
* point operations, do not depend on them. For a direction [uvw] that is not a symmetry direction,
|
|
46
48
|
* scale the columns by the real edge lengths first.
|
|
49
|
+
*
|
|
50
|
+
* @remarks The matrix is frozen and shared between calls.
|
|
47
51
|
*/
|
|
48
52
|
export function latticeBasis(family: FixedAngleFamily): Mat3 {
|
|
49
53
|
switch (family) {
|
package/src/magnetic.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
/** A magnetic point group with the properties that are fixed by its operations (docs/conventions.md, "Properties"). */
|
|
39
|
+
export type PointGroup<K extends PointGroupKey = PointGroupKey> = PointGroupOf<K>;
|
|
40
|
+
/** A point group in a given setting. */
|
|
41
|
+
export type PointGroupInSetting = PointGroupInSettingOf<PointGroupKey>;
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
MAGNETIC_POINT_GROUP_KEYS as POINT_GROUP_KEYS,
|
|
45
|
+
findMagneticPointGroup as findPointGroup,
|
|
46
|
+
generators,
|
|
47
|
+
isMagneticPointGroupKey as isPointGroupKey,
|
|
48
|
+
magneticPointGroups as pointGroups,
|
|
49
|
+
operations,
|
|
50
|
+
pointGroup,
|
|
51
|
+
settings,
|
|
52
|
+
symbol,
|
|
53
|
+
type Convention,
|
|
54
|
+
type PointGroupType,
|
|
55
|
+
type Setting,
|
|
56
|
+
type SettingOptions,
|
|
57
|
+
type SymbolOptions,
|
|
58
|
+
} from './pointGroups/pointGroups.js';
|
|
59
|
+
export { holohedry, isCentrosymmetricOf, isChiralOf } from './pointGroups/properties.js';
|
|
60
|
+
export { LATTICE_SYMMETRY_DIRECTIONS, type Uvw } from './symmetryDirections.js';
|
|
61
|
+
export {
|
|
62
|
+
describeOperations,
|
|
63
|
+
symmetryDirections,
|
|
64
|
+
type Axis,
|
|
65
|
+
type DirectionElements,
|
|
66
|
+
type OperationDescription,
|
|
67
|
+
type OperationKind,
|
|
68
|
+
type SymmetryDirection,
|
|
69
|
+
} from './pointGroups/elements.js';
|
|
70
|
+
export { siteSymmetry, type SiteSymmetry, type SiteSymmetryOptions } from './siteSymmetry.js';
|
|
71
|
+
export {
|
|
72
|
+
rotateTensor,
|
|
73
|
+
tensorForm,
|
|
74
|
+
tensorFormOf,
|
|
75
|
+
type IntrinsicSymmetry,
|
|
76
|
+
type TensorForm,
|
|
77
|
+
type TensorParity,
|
|
78
|
+
type TensorRank,
|
|
79
|
+
type TensorSpec,
|
|
80
|
+
type TimeParity,
|
|
81
|
+
} from './tensors/tensorForm.js';
|
|
82
|
+
export { TENSOR_PROPERTIES, type TensorProperty, type TensorPropertyName } from './tensors/propertyTable.js';
|
|
83
|
+
export {
|
|
84
|
+
allowedProperties,
|
|
85
|
+
allowedPropertiesOf,
|
|
86
|
+
allowsProperty,
|
|
87
|
+
allowsPropertyOf,
|
|
88
|
+
} from './tensors/tensorProperties.js';
|
package/src/operations.ts
CHANGED
|
@@ -4,13 +4,16 @@
|
|
|
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),
|
|
10
11
|
* combined with time reversal if `timeReversal` is true (a primed operation).
|
|
11
12
|
*/
|
|
12
13
|
export interface Operation {
|
|
14
|
+
/** The orthogonal Cartesian 3×3 matrix, rows first. */
|
|
13
15
|
readonly matrix: Mat3;
|
|
16
|
+
/** True if the operation is combined with time reversal (a primed operation). */
|
|
14
17
|
readonly timeReversal: boolean;
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -24,6 +27,34 @@ export function operation(matrix: Mat3): Operation {
|
|
|
24
27
|
return { matrix, timeReversal: false };
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
/** Throws unless `m` is orthogonal (mᵀm = 1 within `EPSILON`): the code assumes Cartesian matrices. */
|
|
31
|
+
export function checkOrthogonal(m: Mat3, what: string): void {
|
|
32
|
+
for (let i = 0; i < 3; i++) {
|
|
33
|
+
for (let j = 0; j < 3; j++) {
|
|
34
|
+
const dot = m[0][i] * m[0][j] + m[1][i] * m[1][j] + m[2][i] * m[2][j];
|
|
35
|
+
// A comparison that is false for NaN, so that a matrix with NaN is refused as well.
|
|
36
|
+
if (!(Math.abs(dot - (i === j ? 1 : 0)) <= EPSILON)) {
|
|
37
|
+
throw new RangeError(`${what} is not an orthogonal (Cartesian) matrix: ${JSON.stringify(m)}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Checks operations that a caller passes in: each must say whether it is combined with time
|
|
45
|
+
* reversal. Without this, an operation that lacks `timeReversal` (as the crystallographic API
|
|
46
|
+
* returns them) would be composed as if it had it in every second product.
|
|
47
|
+
*/
|
|
48
|
+
export function checkTimeReversal(operations: readonly Operation[]): void {
|
|
49
|
+
operations.forEach((op, i) => {
|
|
50
|
+
if (typeof op.timeReversal !== 'boolean') {
|
|
51
|
+
throw new RangeError(
|
|
52
|
+
`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`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
27
58
|
/** The product a·b: first b, then a. */
|
|
28
59
|
export function compose(a: Operation, b: Operation): Operation {
|
|
29
60
|
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
|
|
@@ -46,7 +47,10 @@ export const POINT_GROUP_KEYS = Object.freeze([
|
|
|
46
47
|
'm-3m',
|
|
47
48
|
] as const);
|
|
48
49
|
|
|
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>;
|
|
50
54
|
|
|
51
55
|
/** A symbol in one convention: the short symbol of the setting and the full symbol, positions separated by spaces. */
|
|
52
56
|
interface SymbolForms {
|
|
@@ -77,39 +81,39 @@ export interface PointGroupData {
|
|
|
77
81
|
|
|
78
82
|
// --- Matrices in the stored (Birss) frame ---------------------------------------------------------
|
|
79
83
|
|
|
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 = [
|
|
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 = [
|
|
91
95
|
[-1, 0, 0],
|
|
92
96
|
[0, 1, 0],
|
|
93
97
|
[0, 0, 1],
|
|
94
98
|
];
|
|
95
|
-
const MIRROR_Y: Mat3 = [
|
|
99
|
+
export const MIRROR_Y: Mat3 = [
|
|
96
100
|
[1, 0, 0],
|
|
97
101
|
[0, -1, 0],
|
|
98
102
|
[0, 0, 1],
|
|
99
103
|
];
|
|
100
|
-
const MIRROR_Z: Mat3 = [
|
|
104
|
+
export const MIRROR_Z: Mat3 = [
|
|
101
105
|
[1, 0, 0],
|
|
102
106
|
[0, 1, 0],
|
|
103
107
|
[0, 0, -1],
|
|
104
108
|
];
|
|
105
109
|
/** Mirror with normal [1-10] (swaps x and y). */
|
|
106
|
-
const MIRROR_XY: Mat3 = [
|
|
110
|
+
export const MIRROR_XY: Mat3 = [
|
|
107
111
|
[0, 1, 0],
|
|
108
112
|
[1, 0, 0],
|
|
109
113
|
[0, 0, 1],
|
|
110
114
|
];
|
|
111
115
|
/** Threefold rotation about [111], mapping the vector x to y, y to z, z to x. */
|
|
112
|
-
const ROT3_111: Mat3 = [
|
|
116
|
+
export const ROT3_111: Mat3 = [
|
|
113
117
|
[0, 0, 1],
|
|
114
118
|
[1, 0, 0],
|
|
115
119
|
[0, 1, 0],
|
|
@@ -117,31 +121,38 @@ const ROT3_111: Mat3 = [
|
|
|
117
121
|
|
|
118
122
|
// --- Setting frames -------------------------------------------------------------------------------
|
|
119
123
|
|
|
120
|
-
const SAME: Mat3 = [
|
|
124
|
+
export const SAME: Mat3 = [
|
|
121
125
|
[1, 0, 0],
|
|
122
126
|
[0, 1, 0],
|
|
123
127
|
[0, 0, 1],
|
|
124
128
|
];
|
|
125
129
|
/** Monoclinic, c-unique (stored) → b-unique: z → y. Proper rotation. */
|
|
126
|
-
const MONOCLINIC_B: Mat3 = [
|
|
130
|
+
export const MONOCLINIC_B: Mat3 = [
|
|
127
131
|
[-1, 0, 0],
|
|
128
132
|
[0, 0, 1],
|
|
129
133
|
[0, 1, 0],
|
|
130
134
|
];
|
|
131
135
|
/** Orthorhombic: the axis along z (stored) moves to x (cyclic x → y → z → x). */
|
|
132
|
-
const ORTHO_TO_A: Mat3 = [
|
|
136
|
+
export const ORTHO_TO_A: Mat3 = [
|
|
133
137
|
[0, 0, 1],
|
|
134
138
|
[1, 0, 0],
|
|
135
139
|
[0, 1, 0],
|
|
136
140
|
];
|
|
137
141
|
/** Orthorhombic: the axis along z (stored) moves to y (cyclic x → z → y → x). */
|
|
138
|
-
const ORTHO_TO_B: Mat3 = [
|
|
142
|
+
export const ORTHO_TO_B: Mat3 = [
|
|
139
143
|
[0, 1, 0],
|
|
140
144
|
[0, 0, 1],
|
|
141
145
|
[1, 0, 0],
|
|
142
146
|
];
|
|
143
|
-
|
|
144
|
-
|
|
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);
|
|
145
156
|
|
|
146
157
|
// --- Helpers ---------------------------------------------------------------------------------------
|
|
147
158
|
|
|
@@ -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
|
|
|
@@ -37,6 +37,7 @@ export interface Axis {
|
|
|
37
37
|
|
|
38
38
|
/** One point operation described geometrically. */
|
|
39
39
|
export interface OperationDescription {
|
|
40
|
+
/** What the operation is, without time reversal. */
|
|
40
41
|
readonly kind: OperationKind;
|
|
41
42
|
/**
|
|
42
43
|
* The n of the symbol n or n̄: 1 for the identity and the inversion, 2 for a mirror (m = 2̄),
|
|
@@ -50,12 +51,17 @@ export interface OperationDescription {
|
|
|
50
51
|
* from the tip of `axis` looking towards the origin), `'-'` if by −360°/n.
|
|
51
52
|
*/
|
|
52
53
|
readonly sense?: '+' | '-';
|
|
54
|
+
/** True if the operation is combined with time reversal (a primed operation). */
|
|
53
55
|
readonly timeReversal: boolean;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
/** The symmetry elements along one symmetry direction. */
|
|
57
59
|
export interface DirectionElements extends Axis {
|
|
58
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Highest n of a rotation n about this direction; 1 if there is none. In a magnetic group
|
|
62
|
+
* rotations, rotoinversions and mirrors count with and without time reversal;
|
|
63
|
+
* `describeOperations` tells them apart.
|
|
64
|
+
*/
|
|
59
65
|
readonly rotation: number;
|
|
60
66
|
/** Highest n of a rotoinversion n̄ (n = 3, 4, 6) about this direction; 0 if there is none. */
|
|
61
67
|
readonly rotoinversion: number;
|
|
@@ -67,8 +73,12 @@ export interface DirectionElements extends Axis {
|
|
|
67
73
|
export interface SymmetryDirection {
|
|
68
74
|
/** 1-based position in the full symbol. */
|
|
69
75
|
readonly position: number;
|
|
70
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The symbol at this position of the full symbol, if the full symbol has this position; for a
|
|
78
|
+
* magnetic group with its primes (`4'/m`).
|
|
79
|
+
*/
|
|
71
80
|
readonly symbol?: string;
|
|
81
|
+
/** The symmetry directions of this position (ITA Table 2.1.3.1), each with the elements along it. */
|
|
72
82
|
readonly directions: readonly DirectionElements[];
|
|
73
83
|
}
|
|
74
84
|
|
|
@@ -173,7 +183,7 @@ interface Analysis {
|
|
|
173
183
|
|
|
174
184
|
const cache = new Map<string, Analysis>();
|
|
175
185
|
|
|
176
|
-
function analysis(key:
|
|
186
|
+
function analysis(key: MagneticPointGroupKey, options?: SettingOptions): Analysis {
|
|
177
187
|
const ops = operations(key, options); // checks key, convention and setting
|
|
178
188
|
const c = options?.convention ?? 'itc';
|
|
179
189
|
const setting = options?.setting ?? 0;
|
|
@@ -187,7 +197,13 @@ function analysis(key: PointGroupKey, options?: SettingOptions): Analysis {
|
|
|
187
197
|
const what = `Point group ${key}`;
|
|
188
198
|
const descriptions = Object.freeze(ops.map((op) => describe(op, all, what)));
|
|
189
199
|
|
|
190
|
-
|
|
200
|
+
// The full symbol of a grey group ends in 1', which is no position of the symbol.
|
|
201
|
+
const tokens =
|
|
202
|
+
family === 'triclinic'
|
|
203
|
+
? []
|
|
204
|
+
: symbol(key, { ...options, form: 'full' })
|
|
205
|
+
.split(' ')
|
|
206
|
+
.filter((t) => t !== "1'");
|
|
191
207
|
const directions = Object.freeze(
|
|
192
208
|
positions.map((axes, i) => {
|
|
193
209
|
const elements = axes.map((a) => {
|
|
@@ -247,7 +263,10 @@ function birssSigned(d: OperationDescription): OperationDescription {
|
|
|
247
263
|
* convention with the sign of ITA Table 2.1.3.1, in the Birss convention signed as birss-app signs
|
|
248
264
|
* them (first non-zero Cartesian component positive); the sign fixes what the sense refers to.
|
|
249
265
|
*/
|
|
250
|
-
export function describeOperations(
|
|
266
|
+
export function describeOperations(
|
|
267
|
+
key: MagneticPointGroupKey,
|
|
268
|
+
options?: SettingOptions,
|
|
269
|
+
): readonly OperationDescription[] {
|
|
251
270
|
return analysis(key, options).descriptions;
|
|
252
271
|
}
|
|
253
272
|
|
|
@@ -257,8 +276,8 @@ export function describeOperations(key: PointGroupKey, options?: SettingOptions)
|
|
|
257
276
|
* positions of the crystal family are listed, also those the symbol of the class leaves out (then
|
|
258
277
|
* without `symbol`); the triclinic family has none. The directions keep the sign of Table 2.1.3.1
|
|
259
278
|
* in both conventions; in the Birss convention an axis of `describeOperations` may be reversed, so
|
|
260
|
-
* match it to a direction
|
|
279
|
+
* match it to a direction whose dot product with it is ±1, not by identity.
|
|
261
280
|
*/
|
|
262
|
-
export function symmetryDirections(key:
|
|
281
|
+
export function symmetryDirections(key: MagneticPointGroupKey, options?: SettingOptions): readonly SymmetryDirection[] {
|
|
263
282
|
return analysis(key, options).directions;
|
|
264
283
|
}
|