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.
- package/README.md +6 -6
- package/dist/cell.d.ts +19 -16
- package/dist/cell.d.ts.map +1 -1
- package/dist/cell.js +63 -35
- package/dist/cell.js.map +1 -1
- package/dist/checks.d.ts +29 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +79 -0
- package/dist/checks.js.map +1 -0
- package/dist/closure.d.ts +43 -0
- package/dist/closure.d.ts.map +1 -0
- package/dist/closure.js +201 -0
- package/dist/closure.js.map +1 -0
- package/dist/coordinates.d.ts +143 -0
- package/dist/coordinates.d.ts.map +1 -0
- package/dist/coordinates.js +198 -0
- package/dist/coordinates.js.map +1 -0
- package/dist/crystalClasses.d.ts +170 -117
- package/dist/crystalClasses.d.ts.map +1 -1
- package/dist/crystalClasses.js +190 -121
- package/dist/crystalClasses.js.map +1 -1
- package/dist/freeze.d.ts +7 -0
- package/dist/freeze.d.ts.map +1 -0
- package/dist/freeze.js +15 -0
- package/dist/freeze.js.map +1 -0
- package/dist/index.d.ts +13 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/indices.d.ts +30 -20
- package/dist/indices.d.ts.map +1 -1
- package/dist/indices.js +101 -31
- package/dist/indices.js.map +1 -1
- package/dist/lattice.d.ts +15 -1
- package/dist/lattice.d.ts.map +1 -1
- package/dist/lattice.js +30 -1
- package/dist/lattice.js.map +1 -1
- package/dist/linalg.d.ts +2 -2
- package/dist/linalg.d.ts.map +1 -1
- package/dist/linalg.js +3 -3
- package/dist/linalg.js.map +1 -1
- package/dist/magnetic.d.ts +14 -10
- package/dist/magnetic.d.ts.map +1 -1
- package/dist/magnetic.js +10 -6
- package/dist/magnetic.js.map +1 -1
- package/dist/notation.d.ts +16 -0
- package/dist/notation.d.ts.map +1 -0
- package/dist/notation.js +66 -0
- package/dist/notation.js.map +1 -0
- package/dist/operations.d.ts +40 -26
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +48 -60
- package/dist/operations.js.map +1 -1
- package/dist/plane.d.ts +297 -80
- package/dist/plane.d.ts.map +1 -1
- package/dist/plane.js +289 -94
- package/dist/plane.js.map +1 -1
- package/dist/pointGroups/crystalForms.d.ts +6 -21
- package/dist/pointGroups/crystalForms.d.ts.map +1 -1
- package/dist/pointGroups/crystalForms.js +9 -16
- package/dist/pointGroups/crystalForms.js.map +1 -1
- package/dist/pointGroups/crystalFormsData.d.ts +4 -1
- package/dist/pointGroups/crystalFormsData.d.ts.map +1 -1
- package/dist/pointGroups/crystalFormsData.js +64 -1
- package/dist/pointGroups/crystalFormsData.js.map +1 -1
- package/dist/pointGroups/elements.d.ts +19 -17
- package/dist/pointGroups/elements.d.ts.map +1 -1
- package/dist/pointGroups/elements.js +65 -83
- package/dist/pointGroups/elements.js.map +1 -1
- package/dist/pointGroups/identify.d.ts +10 -18
- package/dist/pointGroups/identify.d.ts.map +1 -1
- package/dist/pointGroups/identify.js +27 -79
- package/dist/pointGroups/identify.js.map +1 -1
- package/dist/pointGroups/itaOrder.d.ts +15 -14
- package/dist/pointGroups/itaOrder.d.ts.map +1 -1
- package/dist/pointGroups/itaOrder.js +116 -94
- package/dist/pointGroups/itaOrder.js.map +1 -1
- package/dist/pointGroups/itcData.d.ts +96 -0
- package/dist/pointGroups/itcData.d.ts.map +1 -0
- package/dist/pointGroups/itcData.js +336 -0
- package/dist/pointGroups/itcData.js.map +1 -0
- package/dist/pointGroups/itcMagneticData.d.ts +55 -0
- package/dist/pointGroups/itcMagneticData.d.ts.map +1 -0
- package/dist/pointGroups/itcMagneticData.js +172 -0
- package/dist/pointGroups/itcMagneticData.js.map +1 -0
- package/dist/pointGroups/keys.d.ts +32 -0
- package/dist/pointGroups/keys.d.ts.map +1 -0
- package/dist/pointGroups/keys.js +120 -0
- package/dist/pointGroups/keys.js.map +1 -0
- package/dist/pointGroups/magneticSymbols.d.ts +6 -5
- package/dist/pointGroups/magneticSymbols.d.ts.map +1 -1
- package/dist/pointGroups/magneticSymbols.js +15 -12
- package/dist/pointGroups/magneticSymbols.js.map +1 -1
- package/dist/pointGroups/orbits.d.ts +23 -42
- package/dist/pointGroups/orbits.d.ts.map +1 -1
- package/dist/pointGroups/orbits.js +20 -62
- package/dist/pointGroups/orbits.js.map +1 -1
- package/dist/pointGroups/pointGroups.d.ts +145 -68
- package/dist/pointGroups/pointGroups.d.ts.map +1 -1
- package/dist/pointGroups/pointGroups.js +455 -243
- package/dist/pointGroups/pointGroups.js.map +1 -1
- package/dist/pointGroups/properties.d.ts +21 -22
- package/dist/pointGroups/properties.d.ts.map +1 -1
- package/dist/pointGroups/properties.js +40 -37
- package/dist/pointGroups/properties.js.map +1 -1
- package/dist/pointGroups/seitzData.d.ts +26 -0
- package/dist/pointGroups/seitzData.d.ts.map +1 -0
- package/dist/pointGroups/seitzData.js +130 -0
- package/dist/pointGroups/seitzData.js.map +1 -0
- package/dist/pointGroups/shubnikovData.d.ts +11 -0
- package/dist/pointGroups/shubnikovData.d.ts.map +1 -0
- package/dist/pointGroups/shubnikovData.js +101 -0
- package/dist/pointGroups/shubnikovData.js.map +1 -0
- package/dist/pointGroups/wyckoff.d.ts +70 -40
- package/dist/pointGroups/wyckoff.d.ts.map +1 -1
- package/dist/pointGroups/wyckoff.js +98 -91
- package/dist/pointGroups/wyckoff.js.map +1 -1
- package/dist/pointGroups/wyckoffData.d.ts +7 -4
- package/dist/pointGroups/wyckoffData.d.ts.map +1 -1
- package/dist/pointGroups/wyckoffData.js +789 -168
- package/dist/pointGroups/wyckoffData.js.map +1 -1
- package/dist/siteSymmetry.d.ts +8 -16
- package/dist/siteSymmetry.d.ts.map +1 -1
- package/dist/siteSymmetry.js +34 -24
- package/dist/siteSymmetry.js.map +1 -1
- package/dist/spaceGroups/affine.d.ts.map +1 -1
- package/dist/spaceGroups/affine.js +3 -2
- package/dist/spaceGroups/affine.js.map +1 -1
- package/dist/spaceGroups/cell.d.ts +43 -31
- package/dist/spaceGroups/cell.d.ts.map +1 -1
- package/dist/spaceGroups/cell.js +173 -85
- package/dist/spaceGroups/cell.js.map +1 -1
- package/dist/spaceGroups/describe.d.ts +13 -10
- package/dist/spaceGroups/describe.d.ts.map +1 -1
- package/dist/spaceGroups/describe.js +11 -10
- package/dist/spaceGroups/describe.js.map +1 -1
- package/dist/spaceGroups/planeGroupData.d.ts +3 -1
- package/dist/spaceGroups/planeGroupData.d.ts.map +1 -1
- package/dist/spaceGroups/planeGroupData.js +25 -8
- package/dist/spaceGroups/planeGroupData.js.map +1 -1
- package/dist/spaceGroups/planeGroups.d.ts.map +1 -1
- package/dist/spaceGroups/planeGroups.js +2 -1
- package/dist/spaceGroups/planeGroups.js.map +1 -1
- package/dist/spaceGroups/planeLattice.d.ts +78 -0
- package/dist/spaceGroups/planeLattice.d.ts.map +1 -0
- package/dist/spaceGroups/planeLattice.js +143 -0
- package/dist/spaceGroups/planeLattice.js.map +1 -0
- package/dist/spaceGroups/planePointGroups.d.ts +6 -2
- package/dist/spaceGroups/planePointGroups.d.ts.map +1 -1
- package/dist/spaceGroups/planePointGroups.js +14 -2
- package/dist/spaceGroups/planePointGroups.js.map +1 -1
- package/dist/spaceGroups/positions.d.ts +48 -19
- package/dist/spaceGroups/positions.d.ts.map +1 -1
- package/dist/spaceGroups/positions.js +166 -67
- package/dist/spaceGroups/positions.js.map +1 -1
- package/dist/spaceGroups/rational.d.ts +18 -0
- package/dist/spaceGroups/rational.d.ts.map +1 -1
- package/dist/spaceGroups/rational.js +58 -0
- package/dist/spaceGroups/rational.js.map +1 -1
- package/dist/tensors/propertyTable.d.ts +3 -1
- package/dist/tensors/propertyTable.d.ts.map +1 -1
- package/dist/tensors/propertyTable.js +17 -10
- package/dist/tensors/propertyTable.js.map +1 -1
- package/dist/tensors/rowEchelon.d.ts +3 -3
- package/dist/tensors/rowEchelon.d.ts.map +1 -1
- package/dist/tensors/rowEchelon.js +4 -4
- package/dist/tensors/rowEchelon.js.map +1 -1
- package/dist/tensors/tensorForm.d.ts +75 -34
- package/dist/tensors/tensorForm.d.ts.map +1 -1
- package/dist/tensors/tensorForm.js +171 -67
- package/dist/tensors/tensorForm.js.map +1 -1
- package/dist/tensors/tensorProperties.d.ts +10 -9
- package/dist/tensors/tensorProperties.d.ts.map +1 -1
- package/dist/tensors/tensorProperties.js +22 -12
- package/dist/tensors/tensorProperties.js.map +1 -1
- package/dist/tensors/voigt.d.ts +56 -0
- package/dist/tensors/voigt.d.ts.map +1 -0
- package/dist/tensors/voigt.js +188 -0
- package/dist/tensors/voigt.js.map +1 -0
- package/dist/tolerances.d.ts +56 -1
- package/dist/tolerances.d.ts.map +1 -1
- package/dist/tolerances.js +51 -1
- package/dist/tolerances.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/cell.ts +78 -51
- package/src/checks.ts +84 -0
- package/src/closure.ts +214 -0
- package/src/coordinates.ts +370 -0
- package/src/crystalClasses.ts +271 -157
- package/src/freeze.ts +14 -0
- package/src/index.ts +33 -12
- package/src/indices.ts +102 -42
- package/src/lattice.ts +41 -1
- package/src/linalg.ts +3 -3
- package/src/magnetic.ts +24 -11
- package/src/notation.ts +73 -0
- package/src/operations.ts +78 -71
- package/src/plane.ts +531 -151
- package/src/pointGroups/crystalForms.ts +11 -44
- package/src/pointGroups/crystalFormsData.ts +66 -1
- package/src/pointGroups/elements.ts +82 -92
- package/src/pointGroups/identify.ts +38 -97
- package/src/pointGroups/itaOrder.ts +117 -101
- package/src/pointGroups/itcData.ts +404 -0
- package/src/pointGroups/itcMagneticData.ts +206 -0
- package/src/pointGroups/keys.ts +144 -0
- package/src/pointGroups/magneticSymbols.ts +18 -17
- package/src/pointGroups/orbits.ts +41 -89
- package/src/pointGroups/pointGroups.ts +593 -298
- package/src/pointGroups/properties.ts +44 -40
- package/src/pointGroups/seitzData.ts +147 -0
- package/src/pointGroups/shubnikovData.ts +103 -0
- package/src/pointGroups/wyckoff.ts +137 -112
- package/src/pointGroups/wyckoffData.ts +793 -170
- package/src/siteSymmetry.ts +43 -40
- package/src/spaceGroups/affine.ts +3 -2
- package/src/spaceGroups/cell.ts +227 -116
- package/src/spaceGroups/describe.ts +23 -19
- package/src/spaceGroups/planeGroupData.ts +28 -9
- package/src/spaceGroups/planeGroups.ts +2 -1
- package/src/spaceGroups/planeLattice.ts +208 -0
- package/src/spaceGroups/planePointGroups.ts +23 -3
- package/src/spaceGroups/positions.ts +202 -78
- package/src/spaceGroups/rational.ts +59 -0
- package/src/tensors/propertyTable.ts +26 -14
- package/src/tensors/rowEchelon.ts +4 -3
- package/src/tensors/tensorForm.ts +258 -88
- package/src/tensors/tensorProperties.ts +34 -14
- package/src/tensors/voigt.ts +268 -0
- package/src/tolerances.ts +66 -1
- package/src/version.ts +1 -1
- package/dist/pointGroups/data.d.ts +0 -75
- package/dist/pointGroups/data.d.ts.map +0 -1
- package/dist/pointGroups/data.js +0 -212
- package/dist/pointGroups/data.js.map +0 -1
- package/dist/pointGroups/magneticData.d.ts +0 -66
- package/dist/pointGroups/magneticData.d.ts.map +0 -1
- package/dist/pointGroups/magneticData.js +0 -184
- package/dist/pointGroups/magneticData.js.map +0 -1
- package/dist/spaceGroups/snap.d.ts +0 -20
- package/dist/spaceGroups/snap.d.ts.map +0 -1
- package/dist/spaceGroups/snap.js +0 -103
- package/dist/spaceGroups/snap.js.map +0 -1
- package/src/pointGroups/data.ts +0 -305
- package/src/pointGroups/magneticData.ts +0 -328
- package/src/spaceGroups/snap.ts +0 -121
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keys of the point groups: the 32 crystal classes (type I), the 32 grey groups (type II) and
|
|
3
|
+
* the 58 black-and-white groups (type III), the 122 magnetic point groups (docs/conventions.md,
|
|
4
|
+
* "Keys"). Their data are in itcData.ts and itcMagneticData.ts.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { IDENTITY } from '../linalg.js';
|
|
8
|
+
import type { CartesianOperation } from '../operations.js';
|
|
9
|
+
|
|
10
|
+
/** Keys of the 32 crystal classes: the ITC short symbol of the class (docs/conventions.md, "Keys"). */
|
|
11
|
+
export const POINT_GROUP_KEYS = Object.freeze([
|
|
12
|
+
'1',
|
|
13
|
+
'-1',
|
|
14
|
+
'2',
|
|
15
|
+
'm',
|
|
16
|
+
'2/m',
|
|
17
|
+
'222',
|
|
18
|
+
'mm2',
|
|
19
|
+
'mmm',
|
|
20
|
+
'4',
|
|
21
|
+
'-4',
|
|
22
|
+
'4/m',
|
|
23
|
+
'422',
|
|
24
|
+
'4mm',
|
|
25
|
+
'-42m',
|
|
26
|
+
'4/mmm',
|
|
27
|
+
'3',
|
|
28
|
+
'-3',
|
|
29
|
+
'32',
|
|
30
|
+
'3m',
|
|
31
|
+
'-3m',
|
|
32
|
+
'6',
|
|
33
|
+
'-6',
|
|
34
|
+
'6/m',
|
|
35
|
+
'622',
|
|
36
|
+
'6mm',
|
|
37
|
+
'-6m2',
|
|
38
|
+
'6/mmm',
|
|
39
|
+
'23',
|
|
40
|
+
'm-3',
|
|
41
|
+
'432',
|
|
42
|
+
'-43m',
|
|
43
|
+
'm-3m',
|
|
44
|
+
] as const);
|
|
45
|
+
|
|
46
|
+
/** The key of one of the 32 crystal classes (`POINT_GROUP_KEYS`). */
|
|
47
|
+
// `Extract<…, string>` is the same type; written so, the documentation (TypeDoc) names it instead of
|
|
48
|
+
// listing the 32 keys at every use.
|
|
49
|
+
export type PointGroupKey = Extract<(typeof POINT_GROUP_KEYS)[number], string>;
|
|
50
|
+
|
|
51
|
+
/** Keys of the 32 grey groups: the key of the crystal class followed by `1'`. */
|
|
52
|
+
export type GreyPointGroupKey = `${PointGroupKey}1'`;
|
|
53
|
+
|
|
54
|
+
export const GREY_POINT_GROUP_KEYS: readonly GreyPointGroupKey[] = Object.freeze(
|
|
55
|
+
POINT_GROUP_KEYS.map((key): GreyPointGroupKey => `${key}1'`),
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Keys of the 58 black-and-white groups: the short Hermann–Mauguin symbol of ITC Vol. D
|
|
60
|
+
* Table 1.5.2.3, in the order of the table (docs/conventions.md, "Keys").
|
|
61
|
+
*/
|
|
62
|
+
export const BLACK_WHITE_POINT_GROUP_KEYS = Object.freeze([
|
|
63
|
+
"-1'",
|
|
64
|
+
"2'",
|
|
65
|
+
"m'",
|
|
66
|
+
"2'/m'",
|
|
67
|
+
"2/m'",
|
|
68
|
+
"2'/m",
|
|
69
|
+
"2'2'2",
|
|
70
|
+
"m'm'2",
|
|
71
|
+
"2'm'm",
|
|
72
|
+
"mm'm'",
|
|
73
|
+
"m'm'm'",
|
|
74
|
+
"mmm'",
|
|
75
|
+
"4'",
|
|
76
|
+
"-4'",
|
|
77
|
+
"4'/m",
|
|
78
|
+
"4/m'",
|
|
79
|
+
"4'/m'",
|
|
80
|
+
"4'22'",
|
|
81
|
+
"42'2'",
|
|
82
|
+
"4'mm'",
|
|
83
|
+
"4m'm'",
|
|
84
|
+
"-4'2m'",
|
|
85
|
+
"-4'm2'",
|
|
86
|
+
"-42'm'",
|
|
87
|
+
"4'/mmm'",
|
|
88
|
+
"4/mm'm'",
|
|
89
|
+
"4/m'm'm'",
|
|
90
|
+
"4/m'mm",
|
|
91
|
+
"4'/m'm'm",
|
|
92
|
+
"-3'",
|
|
93
|
+
"32'",
|
|
94
|
+
"3m'",
|
|
95
|
+
"-3m'",
|
|
96
|
+
"-3'm'",
|
|
97
|
+
"-3'm",
|
|
98
|
+
"6'",
|
|
99
|
+
"-6'",
|
|
100
|
+
"6'/m'",
|
|
101
|
+
"6/m'",
|
|
102
|
+
"6'/m",
|
|
103
|
+
"6'22'",
|
|
104
|
+
"62'2'",
|
|
105
|
+
"6'mm'",
|
|
106
|
+
"6m'm'",
|
|
107
|
+
"-6'2m'",
|
|
108
|
+
"-6'm2'",
|
|
109
|
+
"-6m'2'",
|
|
110
|
+
"6'/m'mm'",
|
|
111
|
+
"6/mm'm'",
|
|
112
|
+
"6/m'm'm'",
|
|
113
|
+
"6/m'mm",
|
|
114
|
+
"6'/mmm'",
|
|
115
|
+
"m'-3'",
|
|
116
|
+
"4'32'",
|
|
117
|
+
"-4'3m'",
|
|
118
|
+
"m-3m'",
|
|
119
|
+
"m'-3'm'",
|
|
120
|
+
"m'-3'm",
|
|
121
|
+
] as const);
|
|
122
|
+
|
|
123
|
+
/** The key of one of the 58 black-and-white magnetic point groups. */
|
|
124
|
+
// `Extract<…, string>`: the same type, named by the documentation (see `PointGroupKey`).
|
|
125
|
+
export type BlackWhitePointGroupKey = Extract<(typeof BLACK_WHITE_POINT_GROUP_KEYS)[number], string>;
|
|
126
|
+
|
|
127
|
+
/** Keys of all 122 magnetic point groups: the 32 crystal classes, the 32 grey groups, the 58 black-and-white groups. */
|
|
128
|
+
export type MagneticPointGroupKey = PointGroupKey | GreyPointGroupKey | BlackWhitePointGroupKey;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Keys of the 122 magnetic point groups: the 32 crystal classes (white groups), the 32 grey groups
|
|
132
|
+
* and the 58 black-and-white groups, in this order (docs/conventions.md, "Keys").
|
|
133
|
+
*/
|
|
134
|
+
export const MAGNETIC_POINT_GROUP_KEYS: readonly MagneticPointGroupKey[] = Object.freeze([
|
|
135
|
+
...POINT_GROUP_KEYS,
|
|
136
|
+
...GREY_POINT_GROUP_KEYS,
|
|
137
|
+
...BLACK_WHITE_POINT_GROUP_KEYS,
|
|
138
|
+
]);
|
|
139
|
+
|
|
140
|
+
/** Time reversal alone: the identity combined with time reversal (1'). */
|
|
141
|
+
export const TIME_REVERSAL: CartesianOperation = Object.freeze({ cartesian: IDENTITY, timeReversal: true });
|
|
142
|
+
|
|
143
|
+
/** Schoenflies symbol of a grey group: that of its class with the subscript R (ITC Vol. D, Table 1.5.2.1). */
|
|
144
|
+
export const greySchoenflies = (classSymbol: string): string => `${classSymbol}R`;
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
* Hermann–Mauguin symbols of the black-and-white point groups. The symbol of such a group in a
|
|
3
3
|
* given frame is the symbol of its crystal class in that frame, each position carrying a prime if
|
|
4
4
|
* the operation it names is combined with time reversal (ITC Vol. D, § 1.5.2.1, Table 1.5.2.3).
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* The ITC symbols of these groups are stored (itcMagneticData.ts); this module writes the symbol a
|
|
6
|
+
* group has with given operations, from which the time reversal of the operations is derived
|
|
7
|
+
* (docs/conventions.md, "Symbols").
|
|
7
8
|
*/
|
|
8
9
|
|
|
10
|
+
import { shown } from '../checks.js';
|
|
9
11
|
import { matricesEqual, type Mat3, type Vec3 } from '../linalg.js';
|
|
10
12
|
import { crystalFamily, latticeBasis, type CrystalFamily, type CrystalSystem } from '../lattice.js';
|
|
11
|
-
import type {
|
|
13
|
+
import type { CartesianOperation } from '../operations.js';
|
|
12
14
|
import { LATTICE_SYMMETRY_DIRECTIONS } from '../symmetryDirections.js';
|
|
13
15
|
|
|
14
16
|
/** The Cartesian direction of the first symmetry direction of each position of the full symbol. */
|
|
15
|
-
function positionDirections(family: CrystalFamily
|
|
17
|
+
function positionDirections(family: CrystalFamily): readonly Vec3[] {
|
|
16
18
|
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
19
|
// Monoclinic: a, b, c along x, y, z, exact for the unique axis, the only one with an element.
|
|
22
20
|
const b: Mat3 =
|
|
23
21
|
family === 'monoclinic' || family === 'triclinic'
|
|
@@ -27,7 +25,7 @@ function positionDirections(family: CrystalFamily, convention: 'itc' | 'birss'):
|
|
|
27
25
|
[0, 0, 1],
|
|
28
26
|
]
|
|
29
27
|
: latticeBasis(family);
|
|
30
|
-
return
|
|
28
|
+
return positions.map(([uvw]) => [
|
|
31
29
|
b[0][0] * uvw[0] + b[0][1] * uvw[1] + b[0][2] * uvw[2],
|
|
32
30
|
b[1][0] * uvw[0] + b[1][1] * uvw[1] + b[1][2] * uvw[2],
|
|
33
31
|
b[2][0] * uvw[0] + b[2][1] * uvw[1] + b[2][2] * uvw[2],
|
|
@@ -51,17 +49,17 @@ function rotation(u: Vec3, n: number, sign: 1 | -1): Mat3 {
|
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
/** `'` if the operation with this matrix is combined with time reversal in `ops`, otherwise ``. */
|
|
54
|
-
function prime(ops: readonly
|
|
55
|
-
const op = ops.find((x) => matricesEqual(x.
|
|
52
|
+
function prime(ops: readonly CartesianOperation[], matrix: Mat3, what: string): string {
|
|
53
|
+
const op = ops.find((x) => matricesEqual(x.cartesian, matrix));
|
|
56
54
|
if (!op) throw new Error(`${what}: the group does not contain the operation its symbol names`);
|
|
57
55
|
return op.timeReversal ? "'" : '';
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
/** 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
|
|
59
|
+
function primedToken(token: string, u: Vec3 | undefined, ops: readonly CartesianOperation[], what: string): string {
|
|
62
60
|
if (token === '1') return token;
|
|
63
61
|
const parts = /^(?:(-?)([1-6]))?(\/?m)?$/.exec(token);
|
|
64
|
-
if (!parts || token === '') throw new Error(`${what}: unreadable position ${
|
|
62
|
+
if (!parts || token === '') throw new Error(`${what}: unreadable position ${shown(token)}`);
|
|
65
63
|
const [, bar, n, mirror] = parts;
|
|
66
64
|
let result = '';
|
|
67
65
|
if (n) {
|
|
@@ -88,17 +86,20 @@ function shortTokens(symbol: string): string[] {
|
|
|
88
86
|
|
|
89
87
|
/**
|
|
90
88
|
* 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,
|
|
89
|
+
* crystal class in that frame, with primes taken from `ops`, the
|
|
92
90
|
* operations of the group in that frame.
|
|
93
91
|
*/
|
|
94
92
|
export function primedSymbols(
|
|
95
93
|
classSymbols: { readonly short: string; readonly full: string },
|
|
96
94
|
system: CrystalSystem,
|
|
97
|
-
|
|
98
|
-
ops: readonly Operation[],
|
|
95
|
+
ops: readonly CartesianOperation[],
|
|
99
96
|
): { short: string; full: string } {
|
|
100
97
|
const family = crystalFamily(system);
|
|
101
|
-
|
|
98
|
+
// The positions of the family, also for a setting with rhombohedral axes: their Cartesian
|
|
99
|
+
// directions are those of [111] and [1-10] in the obverse rhombohedral cell, the c and a axes of
|
|
100
|
+
// the hexagonal cell (docs/conventions.md, "Cartesian frame"), and its symbol has only these two
|
|
101
|
+
// positions, so reading it along the first two hexagonal positions gives the same primes.
|
|
102
|
+
const directions = positionDirections(family);
|
|
102
103
|
const what = `Symbol ${classSymbols.short}`;
|
|
103
104
|
const fullTokens = classSymbols.full.split(' ');
|
|
104
105
|
const full = fullTokens.map((t, i) => primedToken(t, directions[i], ops, what)).join(' ');
|
|
@@ -1,80 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Orbits of faces and directions (docs/conventions.md, "Lattice basis and orbits"). Shared by both
|
|
3
|
+
* entry points.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { apply, inverse,
|
|
8
|
-
import {
|
|
6
|
+
import { checkNumbers, checkOptions, SETTING_KEYS, shown, TOLERANCE_KEYS } from '../checks.js';
|
|
7
|
+
import { apply, inverse, type Mat3, type Vec3 } from '../linalg.js';
|
|
8
|
+
import { checkCartesianOperations } from '../operations.js';
|
|
9
9
|
import { siteTolerance } from '../siteSymmetry.js';
|
|
10
|
+
import { TOLERANCE_BOUND } from '../tolerances.js';
|
|
11
|
+
import type { ToleranceOptions } from '../tolerances.js';
|
|
10
12
|
import type { Uvw } from '../symmetryDirections.js';
|
|
11
13
|
import {
|
|
14
|
+
integer,
|
|
12
15
|
operations as groupOperations,
|
|
13
|
-
pointGroup,
|
|
14
16
|
type MagneticPointGroupKey,
|
|
15
17
|
type SettingOptions,
|
|
16
18
|
} from './pointGroups.js';
|
|
17
19
|
import type { Hkl } from './wyckoff.js';
|
|
18
20
|
|
|
19
|
-
const IDENTITY: Mat3 = [
|
|
20
|
-
[1, 0, 0],
|
|
21
|
-
[0, 1, 0],
|
|
22
|
-
[0, 0, 1],
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The conventional basis a, b, c (columns) in the Cartesian frame of a point group: that of
|
|
27
|
-
* `latticeBasis`, and for the monoclinic and triclinic families a, b, c along x, y, z, as for the
|
|
28
|
-
* Wyckoff positions (the integer matrices do not depend on the cell angles).
|
|
29
|
-
*/
|
|
30
|
-
function conventionalBasis(key: MagneticPointGroupKey): Mat3 {
|
|
31
|
-
const family = crystalFamily(pointGroup(key).crystalSystem);
|
|
32
|
-
return family === 'monoclinic' || family === 'triclinic' ? IDENTITY : latticeBasis(family);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** An integer matrix from one that should be one; throws if it is not (a data error). */
|
|
36
|
-
function integer(m: Mat3, what: string): Mat3 {
|
|
37
|
-
const r = m.map((row) => row.map((v) => Math.round(v) + 0)) as unknown as Mat3;
|
|
38
|
-
if (!m.every((row, i) => row.every((v, j) => Math.abs(v - r[i][j]) < 1e-9))) {
|
|
39
|
-
throw new Error(`${what} is not an integer matrix in the lattice basis: ${JSON.stringify(m)}`);
|
|
40
|
-
}
|
|
41
|
-
return r;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
21
|
const deepFreeze = (m: Mat3): Mat3 => Object.freeze(m.map((row) => Object.freeze([...row]))) as unknown as Mat3;
|
|
45
22
|
|
|
46
|
-
const latticeCache = new WeakMap<readonly Operation[], readonly Operation[]>();
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The operations of a point group in the conventional lattice basis (a, b, c; for the trigonal
|
|
50
|
-
* classes the hexagonal axes), in the order and with the time reversal of `operations` for the same
|
|
51
|
-
* setting and convention: integer matrices W acting on the coordinates of a lattice vector [uvw],
|
|
52
|
-
* W = B⁻¹·R·B with the basis B of `latticeBasis` and the Cartesian matrix R. They do not depend on
|
|
53
|
-
* the cell angles, so they exist for every family; for the monoclinic and triclinic families a, b,
|
|
54
|
-
* c are taken along x, y, z, as for the Wyckoff positions. In the ITC convention they are the
|
|
55
|
-
* matrices of ITA's general position (6th ed., Table 3.2.3.2). Not orthogonal in general: pass
|
|
56
|
-
* them to no function that takes Cartesian operations (docs/conventions.md, "Lattice basis and
|
|
57
|
-
* orbits").
|
|
58
|
-
*/
|
|
59
|
-
export function latticeOperations(key: MagneticPointGroupKey, options?: SettingOptions): readonly Operation[] {
|
|
60
|
-
const ops = groupOperations(key, options);
|
|
61
|
-
let result = latticeCache.get(ops);
|
|
62
|
-
if (!result) {
|
|
63
|
-
const b = conventionalBasis(key);
|
|
64
|
-
const bInv = inverse(b);
|
|
65
|
-
result = Object.freeze(
|
|
66
|
-
ops.map((op, i) =>
|
|
67
|
-
Object.freeze({
|
|
68
|
-
matrix: deepFreeze(integer(multiply(multiply(bInv, op.matrix), b), `Operation ${i} of ${key}`)),
|
|
69
|
-
timeReversal: op.timeReversal,
|
|
70
|
-
}),
|
|
71
|
-
),
|
|
72
|
-
);
|
|
73
|
-
latticeCache.set(ops, result);
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
23
|
/** The inverse of an integer matrix of determinant ±1, exactly (the adjugate). */
|
|
79
24
|
function integerInverse(w: Mat3): Mat3 {
|
|
80
25
|
return integer(inverse(w), 'The inverse of a lattice operation');
|
|
@@ -88,7 +33,7 @@ function indicesOf(value: unknown, name: string): readonly [number, number, numb
|
|
|
88
33
|
!value.every((x) => typeof x === 'number' && Number.isSafeInteger(x)) ||
|
|
89
34
|
value.every((x) => x === 0)
|
|
90
35
|
) {
|
|
91
|
-
throw new RangeError(`${name} must be three (safe) integers, not all zero: ${
|
|
36
|
+
throw new RangeError(`${name} must be three (safe) integers, not all zero: ${shown(value)}`);
|
|
92
37
|
}
|
|
93
38
|
return [value[0] + 0, value[1] + 0, value[2] + 0];
|
|
94
39
|
}
|
|
@@ -97,7 +42,7 @@ function indicesOf(value: unknown, name: string): readonly [number, number, numb
|
|
|
97
42
|
export interface FaceOrbitEntry {
|
|
98
43
|
/** Miller indices (hkl) of the face, in the conventional basis (hexagonal axes: without i). */
|
|
99
44
|
readonly hkl: Hkl;
|
|
100
|
-
/** Indices into `operations` (same setting
|
|
45
|
+
/** Indices into `operations` (same setting) of the operations that map the given face onto this one, ascending. */
|
|
101
46
|
readonly operations: readonly number[];
|
|
102
47
|
}
|
|
103
48
|
|
|
@@ -105,14 +50,26 @@ export interface FaceOrbitEntry {
|
|
|
105
50
|
export interface DirectionOrbitEntry {
|
|
106
51
|
/** The lattice direction [uvw] in the conventional basis. */
|
|
107
52
|
readonly uvw: Uvw;
|
|
108
|
-
/** Indices into `operations` (same setting
|
|
53
|
+
/** Indices into `operations` (same setting) of the operations that map the given direction onto this one, ascending. */
|
|
109
54
|
readonly operations: readonly number[];
|
|
110
55
|
}
|
|
111
56
|
|
|
57
|
+
/** A face (hkl) for `orbit`. */
|
|
58
|
+
export interface FaceIndices {
|
|
59
|
+
/** The face (hkl), three integers not all zero (hexagonal axes: three indices, without i). */
|
|
60
|
+
readonly hkl: Hkl;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** A lattice direction [uvw] for `orbit`. */
|
|
64
|
+
export interface DirectionIndices {
|
|
65
|
+
/** The lattice direction [uvw], three integers not all zero. */
|
|
66
|
+
readonly uvw: Uvw;
|
|
67
|
+
}
|
|
68
|
+
|
|
112
69
|
/**
|
|
113
70
|
* The orbit of a face (hkl) or of a lattice direction [uvw] under a point group, exactly, in the
|
|
114
71
|
* lattice basis: the distinct faces (directions), in the order in which the operations reach them
|
|
115
|
-
* (so
|
|
72
|
+
* (so the given face first), each with the indices of the operations that map
|
|
116
73
|
* the given one onto it. A face transforms with the inverse transpose of a lattice operation,
|
|
117
74
|
* h' = W⁻ᵀ·h, a direction with the operation itself, u' = W·u. The number of entries is the
|
|
118
75
|
* multiplicity of the face (direction), and the operations of the first entry, if it is the given
|
|
@@ -122,31 +79,32 @@ export interface DirectionOrbitEntry {
|
|
|
122
79
|
*/
|
|
123
80
|
export function orbit(
|
|
124
81
|
key: MagneticPointGroupKey,
|
|
125
|
-
indices:
|
|
82
|
+
indices: FaceIndices,
|
|
126
83
|
options?: SettingOptions,
|
|
127
84
|
): readonly FaceOrbitEntry[];
|
|
128
85
|
export function orbit(
|
|
129
86
|
key: MagneticPointGroupKey,
|
|
130
|
-
indices:
|
|
87
|
+
indices: DirectionIndices,
|
|
131
88
|
options?: SettingOptions,
|
|
132
89
|
): readonly DirectionOrbitEntry[];
|
|
133
90
|
export function orbit(
|
|
134
91
|
key: MagneticPointGroupKey,
|
|
135
|
-
indices:
|
|
92
|
+
indices: FaceIndices | DirectionIndices,
|
|
136
93
|
options?: SettingOptions,
|
|
137
94
|
): readonly FaceOrbitEntry[] | readonly DirectionOrbitEntry[];
|
|
138
95
|
export function orbit(
|
|
139
96
|
key: MagneticPointGroupKey,
|
|
140
|
-
indices:
|
|
97
|
+
indices: FaceIndices | DirectionIndices,
|
|
141
98
|
options?: SettingOptions,
|
|
142
99
|
): readonly FaceOrbitEntry[] | readonly DirectionOrbitEntry[] {
|
|
100
|
+
checkOptions(options, SETTING_KEYS, 'orbit');
|
|
143
101
|
const given = (indices ?? {}) as { readonly hkl?: unknown; readonly uvw?: unknown };
|
|
144
102
|
const hasHkl = given.hkl !== undefined;
|
|
145
103
|
const hasUvw = given.uvw !== undefined;
|
|
146
104
|
if (hasHkl === hasUvw) throw new RangeError('orbit: give either hkl (a face) or uvw (a lattice direction)');
|
|
147
105
|
const field = hasHkl ? 'hkl' : 'uvw';
|
|
148
106
|
const v = indicesOf(hasHkl ? given.hkl : given.uvw, field);
|
|
149
|
-
const ws =
|
|
107
|
+
const ws = groupOperations(key, options).map((op) => (hasHkl ? integerInverseTranspose(op.matrix) : op.matrix));
|
|
150
108
|
const images: { key: string; value: [number, number, number]; operations: number[] }[] = [];
|
|
151
109
|
ws.forEach((w, i) => {
|
|
152
110
|
const image = apply(w, v as unknown as Vec3).map((x) => x + 0) as [number, number, number];
|
|
@@ -172,15 +130,6 @@ function integerInverseTranspose(w: Mat3): Mat3 {
|
|
|
172
130
|
return r;
|
|
173
131
|
}
|
|
174
132
|
|
|
175
|
-
/** Options of `orbitOf`. */
|
|
176
|
-
export interface OrbitOptions {
|
|
177
|
-
/**
|
|
178
|
-
* Two images count as one pole if their unit vectors are closer than this (Euclidean distance).
|
|
179
|
-
* Default 10⁻⁶; a caller whose directions carry rounding errors passes a larger value.
|
|
180
|
-
*/
|
|
181
|
-
readonly tolerance?: number;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
133
|
/** One pole of the orbit of a direction under a list of operations. */
|
|
185
134
|
export interface OrbitPole {
|
|
186
135
|
/** The image of the given direction as a Cartesian unit vector (the first operation's image where several coincide). */
|
|
@@ -193,24 +142,27 @@ export interface OrbitPole {
|
|
|
193
142
|
* The orbit of a direction (any non-zero vector, Cartesian, e.g. a face normal) under a list of
|
|
194
143
|
* operations, for instance those of a distorted crystal: the images of its unit vector under each
|
|
195
144
|
* operation, coinciding images merged (closer than `tolerance`, default `EPSILON`, as for
|
|
196
|
-
* `
|
|
145
|
+
* `siteSymmetryOf`), in the order in which the operations reach them, each with the indices of the
|
|
197
146
|
* operations that map the direction there. The list is taken as it is, not closed into a group.
|
|
198
|
-
* Time reversal is ignored. Throws a RangeError for a zero vector and for
|
|
199
|
-
* orthogonal (Cartesian, not one of `latticeOperations`; within `tolerance`, at least `EPSILON`).
|
|
147
|
+
* Time reversal is ignored. Throws a RangeError for a zero vector and for an operation without an orthogonal Cartesian matrix (`cartesian`; within `tolerance`, at least `EPSILON`).
|
|
200
148
|
*/
|
|
201
149
|
export function orbitOf(
|
|
202
|
-
operations: readonly { readonly
|
|
150
|
+
operations: readonly { readonly cartesian: Mat3 }[],
|
|
203
151
|
direction: Vec3,
|
|
204
|
-
options?:
|
|
152
|
+
options?: ToleranceOptions,
|
|
205
153
|
): readonly OrbitPole[] {
|
|
154
|
+
checkOptions(options, TOLERANCE_KEYS, 'orbitOf');
|
|
206
155
|
const tolerance = siteTolerance(options);
|
|
207
|
-
|
|
156
|
+
// Operations are checked in their own metric, at most with the bound for operations.
|
|
157
|
+
checkCartesianOperations(operations, Math.min(tolerance, TOLERANCE_BOUND.operations));
|
|
158
|
+
if (operations.length === 0) throw new RangeError('orbitOf takes a list of at least one operation');
|
|
159
|
+
checkNumbers(direction, 3, 'A direction');
|
|
208
160
|
const n = Math.hypot(direction[0], direction[1], direction[2]);
|
|
209
|
-
if (!(n > 0) || !Number.isFinite(n)) throw new RangeError(`Not a direction: ${
|
|
161
|
+
if (!(n > 0) || !Number.isFinite(n)) throw new RangeError(`Not a direction: ${shown(direction)}`);
|
|
210
162
|
const u: Vec3 = [direction[0] / n, direction[1] / n, direction[2] / n];
|
|
211
163
|
const poles: { direction: Vec3; operations: number[] }[] = [];
|
|
212
164
|
operations.forEach((op, i) => {
|
|
213
|
-
const w = apply(op.
|
|
165
|
+
const w = apply(op.cartesian, u);
|
|
214
166
|
const pole = poles.find(
|
|
215
167
|
(p) => Math.hypot(p.direction[0] - w[0], p.direction[1] - w[1], p.direction[2] - w[2]) < tolerance,
|
|
216
168
|
);
|