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
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Wyckoff positions of the crystal classes for directions (face normals),
|
|
3
|
-
* ITA's letters, multiplicities
|
|
2
|
+
* Wyckoff positions of the crystal classes for directions (face normals), as ITA gives them:
|
|
3
|
+
* ITA's letters, multiplicities, oriented site-symmetry symbols, coordinates and faces as printed, and the
|
|
4
4
|
* Wyckoff position of any direction (docs/conventions.md, "Site symmetry and Wyckoff positions").
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { checkOptions, pick, SETTING_KEYS, shown, TOLERANCE_KEYS } from '../checks.js';
|
|
7
8
|
import { apply, inverse, transpose, type Mat3, type Vec3 } from '../linalg.js';
|
|
8
|
-
import { crystalFamily
|
|
9
|
-
import {
|
|
9
|
+
import { crystalFamily } from '../lattice.js';
|
|
10
|
+
import { substituteMillerIndices } from '../indices.js';
|
|
11
|
+
import { itcBasis, itcClass, itcSetting as itcClassSetting } from './itcData.js';
|
|
10
12
|
import {
|
|
13
|
+
settingIndexOf,
|
|
11
14
|
isMagneticPointGroupKey,
|
|
12
15
|
isPointGroupKey,
|
|
13
16
|
operations,
|
|
14
17
|
settings,
|
|
18
|
+
type MagneticPointGroupKey,
|
|
15
19
|
type PointGroupKey,
|
|
16
20
|
type SettingOptions,
|
|
17
21
|
} from './pointGroups.js';
|
|
18
|
-
import {
|
|
22
|
+
import { siteSymmetryOf, siteTolerance, type SiteSymmetry } from '../siteSymmetry.js';
|
|
23
|
+
import type { ToleranceOptions } from '../tolerances.js';
|
|
19
24
|
import { ITA_WYCKOFF, type WyckoffRow } from './wyckoffData.js';
|
|
20
25
|
|
|
21
26
|
/** A face (hkl): three Miller indices in the conventional basis (for hexagonal axes without i = −(h + k)). */
|
|
@@ -29,50 +34,45 @@ export interface WyckoffPosition {
|
|
|
29
34
|
readonly multiplicity: number;
|
|
30
35
|
/** Oriented site-symmetry symbol as ITA prints it, e.g. `..m`, `4m.m`, `1`. */
|
|
31
36
|
readonly siteSymmetry: string;
|
|
32
|
-
/**
|
|
33
|
-
|
|
37
|
+
/**
|
|
38
|
+
* ITA's coordinate triplets of the position as printed, in printed order, the first being the
|
|
39
|
+
* representative point, e.g. `['x,x,z', '-x,-x,z', …]` (a leading `-` is an overbar); one per
|
|
40
|
+
* equivalent direction, as in `symcrys/plane`.
|
|
41
|
+
*/
|
|
42
|
+
readonly coordinates: readonly string[];
|
|
34
43
|
/**
|
|
35
44
|
* ITA's representative face as printed, components separated by commas, e.g. `h,h,l`, or
|
|
36
|
-
* `h,h,-2h,l` (Bravais–Miller indices) for hexagonal axes.
|
|
45
|
+
* `h,h,-2h,l` (Bravais–Miller indices) for hexagonal axes. `millerIndices(printed, { h, k, l })` gives
|
|
46
|
+
* a face with numbers, `faceNormal(basis, hkl)` its normal in a cell.
|
|
37
47
|
*/
|
|
38
48
|
readonly millerIndices: string;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Its face normal, a Cartesian unit vector. Monoclinic and triclinic: the normal for a, b, c along
|
|
45
|
-
* x, y, z (no cell angles), exact for the unique axis only, but with the correct site symmetry.
|
|
46
|
-
*/
|
|
47
|
-
readonly cartesian: Vec3;
|
|
48
|
-
};
|
|
49
|
-
/** Indices into `operations` (same setting, ITC convention) of the site symmetry of the representative. */
|
|
49
|
+
/**
|
|
50
|
+
* Indices into `operations` (same setting) of the site symmetry of the position: of the operations
|
|
51
|
+
* that fix its first printed face for values of h, k, l that keep the face in the position.
|
|
52
|
+
*/
|
|
50
53
|
readonly siteSymmetryOperations: readonly number[];
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
/** Convention and setting (`SettingOptions`) and the tolerance of `siteSymmetry` (`SiteSymmetryOptions`). */
|
|
54
|
-
export type WyckoffOptions = SettingOptions & SiteSymmetryOptions;
|
|
55
|
-
|
|
56
56
|
/** The values substituted into ITA's Miller indices for the numeric representative. */
|
|
57
57
|
export const REPRESENTATIVE_VALUES: Readonly<Record<'h' | 'k' | 'l', number>> = { h: 3, k: 2, l: 1 };
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
/**
|
|
60
|
+
* The values for rhombohedral axes: h = 5, k = 2, l = 1. With 3, 2, 1 the face (h,k,l) would lie on
|
|
61
|
+
* the limiting form (h,k,2k-h) that ITA prints there (Table 3.2.3.2, 32, 3m and -3m with rhombohedral
|
|
62
|
+
* axes, pp. 755–759): (321) is (116) in hexagonal axes. (521), (318) in hexagonal axes, lies on no
|
|
63
|
+
* printed limiting form, and every printed face with these values is in lowest terms ((5,2,-7),
|
|
64
|
+
* (5,2,-1), (5,5,1)); h = 4 would give (4,2,-6) and (4,2,0).
|
|
65
|
+
*/
|
|
66
|
+
export const RHOMBOHEDRAL_VALUES: Readonly<Record<'h' | 'k' | 'l', number>> = { h: 5, k: 2, l: 1 };
|
|
67
|
+
|
|
68
|
+
/** The values of h, k, l for the representative faces of a setting. */
|
|
69
|
+
export function representativeValues(key: PointGroupKey, setting: number): Readonly<Record<'h' | 'k' | 'l', number>> {
|
|
70
|
+
return itcClassSetting(key, setting).axes === 'rhombohedral' ? RHOMBOHEDRAL_VALUES : REPRESENTATIVE_VALUES;
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
/** Printed Miller indices (three, or four for hexagonal axes) as three numbers, with the given values of h, k, l. */
|
|
71
74
|
export function numericHkl(miller: string, values = REPRESENTATIVE_VALUES): Hkl {
|
|
72
|
-
|
|
73
|
-
if (parts.length === 3) return [parts[0], parts[1], parts[2]];
|
|
74
|
-
if (parts.length === 4 && parts[2] === -(parts[0] + parts[1])) return [parts[0], parts[1], parts[3]];
|
|
75
|
-
throw new Error(`Unreadable Miller indices: ${miller}`);
|
|
75
|
+
return substituteMillerIndices(miller, values, (m) => new Error(m));
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export const IDENTITY: Mat3 = [
|
|
@@ -121,45 +121,44 @@ function permuteSymbol(symbolText: string, r: Mat3): string {
|
|
|
121
121
|
return [0, 1, 2].map((i) => symbolText[[0, 1, 2].find((k) => Math.abs(r[i][k]) === 1) ?? -1]).join('');
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
function isSignedPermutation(r: Mat3): boolean {
|
|
125
|
-
return r.every(
|
|
126
|
-
(row) => row.filter((v) => Math.abs(v) > 1e-9).length === 1 && row.some((v) => Math.abs(Math.abs(v) - 1) < 1e-9),
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
124
|
/**
|
|
131
|
-
* The
|
|
132
|
-
*
|
|
133
|
-
* the
|
|
125
|
+
* The permutation r that carries setting 1 of a class into `setting` (new axis i = r[i][j] × old
|
|
126
|
+
* axis j), for the settings ITA does not print (`mm2` settings 2 and 3, monoclinic unique axis a):
|
|
127
|
+
* the transpose of the change
|
|
128
|
+
* of basis P of the ITC class data ((a′, b′, c′) = (a, b, c)·P, itcData.ts). Coordinates (P⁻¹·x)
|
|
129
|
+
* and Miller indices (h·P) are carried by the same r only because P is a signed permutation
|
|
130
|
+
* (P⁻¹ = Pᵀ); throws for a setting that is not carried from setting 1 by one.
|
|
134
131
|
*/
|
|
135
132
|
export function permutationFromSetting1(key: PointGroupKey, setting: number): Mat3 {
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)
|
|
146
|
-
throw new Error(`Point group ${key}, setting ${setting}:
|
|
147
|
-
|
|
148
|
-
return r;
|
|
133
|
+
const from = itcClassSetting(key, setting).from;
|
|
134
|
+
if (from?.index !== 1) throw new Error(`Point group ${key}, setting ${setting}: not carried from setting 1`);
|
|
135
|
+
const p = from.basis;
|
|
136
|
+
const signedPermutation = [0, 1, 2].every(
|
|
137
|
+
(i) =>
|
|
138
|
+
p[i].filter((v) => v !== 0).length === 1 &&
|
|
139
|
+
p[i].every((v) => v === 0 || Math.abs(v) === 1) &&
|
|
140
|
+
p.filter((row) => row[i] !== 0).length === 1,
|
|
141
|
+
);
|
|
142
|
+
if (!signedPermutation)
|
|
143
|
+
throw new Error(`Point group ${key}, setting ${setting}: not a signed permutation of setting 1`);
|
|
144
|
+
return [0, 1, 2].map((i) => [0, 1, 2].map((j) => p[j][i])) as unknown as Mat3;
|
|
149
145
|
}
|
|
150
146
|
|
|
151
147
|
/**
|
|
152
148
|
* The entry of a table printed per setting (Wyckoff positions, face forms) for a setting of a class:
|
|
153
|
-
* the one with the ITC short symbol (and unique axis) of the setting, or undefined if ITA does not
|
|
149
|
+
* the one with the ITC short symbol (and unique axis or axes) of the setting, or undefined if ITA does not
|
|
154
150
|
* print the setting.
|
|
155
151
|
*/
|
|
156
|
-
export function printedEntry<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
setting
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
export function printedEntry<
|
|
153
|
+
E extends { readonly symbol: string; readonly uniqueAxis?: 'b' | 'c'; readonly axes?: 'rhombohedral' },
|
|
154
|
+
>(table: readonly E[], key: PointGroupKey, setting: number): E | undefined {
|
|
155
|
+
const s = settings(key)[setting - 1];
|
|
156
|
+
return table.find(
|
|
157
|
+
(e) =>
|
|
158
|
+
e.symbol === s.symbol &&
|
|
159
|
+
(e.uniqueAxis === undefined || e.uniqueAxis === s.uniqueAxis) &&
|
|
160
|
+
(e.axes === 'rhombohedral') === (s.axes === 'rhombohedral'),
|
|
161
|
+
);
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
/** The printed rows of a setting; for a setting ITA does not print, those of setting 1 carried into its frame. */
|
|
@@ -168,69 +167,80 @@ function printedRows(key: PointGroupKey, setting: number): readonly WyckoffRow[]
|
|
|
168
167
|
if (entry) return entry.rows;
|
|
169
168
|
if (setting === 1) throw new Error(`Point group ${key}: no printed Wyckoff positions for setting 1`);
|
|
170
169
|
const r = permutationFromSetting1(key, setting);
|
|
170
|
+
// A monoclinic site symmetry (`2`, `m`, `2/m`) names the element on the unique axis, not a position.
|
|
171
|
+
const oriented = crystalFamily(itcClass(key).crystalSystem) !== 'monoclinic';
|
|
171
172
|
return printedRows(key, 1).map(([letter, mult, site, coords, miller]) => [
|
|
172
173
|
letter,
|
|
173
174
|
mult,
|
|
174
|
-
permuteSymbol(site, r),
|
|
175
|
-
permutePattern(
|
|
175
|
+
oriented ? permuteSymbol(site, r) : site,
|
|
176
|
+
coords.map((c) => permutePattern(c, r, XYZ)),
|
|
176
177
|
miller === '' ? '' : permutePattern(miller, r, HKL),
|
|
177
178
|
]);
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
/**
|
|
181
|
-
* The lattice basis in which the Cartesian normals of the representatives are computed
|
|
182
|
-
* and triclinic
|
|
182
|
+
* The lattice basis in which the Cartesian normals of the representatives are computed, that of the
|
|
183
|
+
* setting (itcData.ts, `itcBasis`): monoclinic and triclinic a, b, c along x, y, z; rhombohedral
|
|
184
|
+
* axes in the hexagonal cell of `latticeBasis` (docs/conventions.md, "Site symmetry and Wyckoff
|
|
185
|
+
* positions").
|
|
186
|
+
*/
|
|
187
|
+
export function faceBasis(key: PointGroupKey, setting: number): Mat3 {
|
|
188
|
+
return itcBasis(key, setting);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** h, k, l of a representative face under the printed condition |h| < |l| (cubic forms (hhl)). */
|
|
192
|
+
export const SMALL_H: Readonly<Record<'h' | 'k' | 'l', number>> = Object.freeze({ h: 1, k: 2, l: 3 });
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* A face of a position or form with numbers, internal (#137 G3: the API gives the printed indices
|
|
196
|
+
* only): h, k, l = 3, 2, 1 (rhombohedral axes: 5, 2, 1; 1, 2, 3 under the condition |h| < |l|), and
|
|
197
|
+
* its normal in the basis of the setting (`faceBasis`; monoclinic and triclinic a, b, c along x, y,
|
|
198
|
+
* z, which gives the correct site symmetry but not the pole of a real cell, #137 G4).
|
|
183
199
|
*/
|
|
184
|
-
export function
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
200
|
+
export function representativeFace(
|
|
201
|
+
key: PointGroupKey,
|
|
202
|
+
setting: number,
|
|
203
|
+
miller: string,
|
|
204
|
+
condition?: string,
|
|
205
|
+
): { readonly hkl: Hkl; readonly cartesian: Vec3 } {
|
|
206
|
+
const hkl = numericHkl(miller, condition === '|h|<|l|' ? SMALL_H : representativeValues(key, setting));
|
|
207
|
+
return { hkl, cartesian: normal(faceBasis(key, setting), hkl) };
|
|
189
208
|
}
|
|
190
209
|
|
|
191
210
|
const cache = new Map<string, readonly WyckoffPosition[]>();
|
|
192
211
|
|
|
193
212
|
/**
|
|
194
|
-
* The setting index for a table that exists for the crystal classes
|
|
195
|
-
*
|
|
196
|
-
* with time reversal and for another convention.
|
|
213
|
+
* The setting index for a table that exists for the crystal classes only (`what`: 'Wyckoff
|
|
214
|
+
* positions', 'Crystal forms'); throws a RangeError for a magnetic point group with time reversal.
|
|
197
215
|
*/
|
|
198
|
-
export function
|
|
216
|
+
export function tableSetting(key: PointGroupKey, options?: SettingOptions, what = 'Wyckoff positions'): number {
|
|
199
217
|
if (isMagneticPointGroupKey(key) && !isPointGroupKey(key)) {
|
|
200
|
-
throw new RangeError(
|
|
201
|
-
`${what} are given for the 32 crystal classes only; ${JSON.stringify(key)} is a magnetic point group`,
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
if ((options?.convention ?? 'itc') !== 'itc') {
|
|
205
|
-
throw new RangeError(`${what} exist in the ITC convention only (convention 'itc')`);
|
|
218
|
+
throw new RangeError(`${what} are given for the 32 crystal classes only; ${shown(key)} is a magnetic point group`);
|
|
206
219
|
}
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
operations(key, { convention: 'itc', setting: index }); // validates the setting index
|
|
220
|
+
const index = settingIndexOf(key, options);
|
|
221
|
+
operations(key, pick(options, SETTING_KEYS)); // validates the setting index
|
|
210
222
|
return index;
|
|
211
223
|
}
|
|
212
224
|
|
|
213
225
|
/**
|
|
214
226
|
* The Wyckoff positions of a point group for directions, in ITA's printed order (general position
|
|
215
|
-
* first), for the 32 crystal classes
|
|
216
|
-
*
|
|
217
|
-
* (letter o) is not a direction and is left out. For `mm2` settings 2 and 3
|
|
218
|
-
*
|
|
227
|
+
* first), for the 32 crystal classes only (throws a RangeError for a magnetic point group with
|
|
228
|
+
* time reversal). The point at the origin
|
|
229
|
+
* (letter o) is not a direction and is left out. For the settings ITA does not print (`mm2` settings 2 and 3, monoclinic unique axis a), the positions
|
|
230
|
+
* of setting 1 carried into their frame.
|
|
219
231
|
*/
|
|
220
232
|
export function wyckoffPositions(key: PointGroupKey, options?: SettingOptions): readonly WyckoffPosition[] {
|
|
221
|
-
|
|
233
|
+
checkOptions(options, SETTING_KEYS, 'wyckoffPositions');
|
|
234
|
+
const setting = tableSetting(key, options);
|
|
222
235
|
const cacheKey = `${key}#${setting}`;
|
|
223
236
|
let result = cache.get(cacheKey);
|
|
224
237
|
if (!result) {
|
|
225
|
-
const ops = operations(key, {
|
|
226
|
-
const basis = faceBasis(key);
|
|
238
|
+
const ops = operations(key, { setting });
|
|
227
239
|
result = Object.freeze(
|
|
228
240
|
printedRows(key, setting)
|
|
229
241
|
.filter(([letter]) => letter !== 'o')
|
|
230
242
|
.map(([letter, multiplicity, site, coordinates, millerIndices]) => {
|
|
231
|
-
const
|
|
232
|
-
const cartesian = normal(basis, hkl);
|
|
233
|
-
const stab = siteSymmetry(ops, cartesian);
|
|
243
|
+
const stab = siteSymmetryOf(ops, representativeFace(key, setting, millerIndices).cartesian);
|
|
234
244
|
if (stab.multiplicity !== multiplicity) {
|
|
235
245
|
throw new Error(
|
|
236
246
|
`Point group ${key}, setting ${setting}, position ${letter}: multiplicity differs from print`,
|
|
@@ -240,12 +250,8 @@ export function wyckoffPositions(key: PointGroupKey, options?: SettingOptions):
|
|
|
240
250
|
letter,
|
|
241
251
|
multiplicity,
|
|
242
252
|
siteSymmetry: site,
|
|
243
|
-
coordinates,
|
|
253
|
+
coordinates: Object.freeze([...coordinates]),
|
|
244
254
|
millerIndices,
|
|
245
|
-
representative: Object.freeze({
|
|
246
|
-
hkl: Object.freeze(hkl) as Hkl,
|
|
247
|
-
cartesian: Object.freeze(cartesian) as Vec3,
|
|
248
|
-
}),
|
|
249
255
|
siteSymmetryOperations: stab.operations,
|
|
250
256
|
});
|
|
251
257
|
}),
|
|
@@ -255,27 +261,46 @@ export function wyckoffPositions(key: PointGroupKey, options?: SettingOptions):
|
|
|
255
261
|
return result;
|
|
256
262
|
}
|
|
257
263
|
|
|
264
|
+
/**
|
|
265
|
+
* The site symmetry of a direction (any non-zero Cartesian vector) under a point group in a
|
|
266
|
+
* setting: `siteSymmetryOf` applied to `operations(key, options)`, so the indices refer to those
|
|
267
|
+
* operations (#137 C1). Time reversal is ignored. Throws a RangeError as `siteSymmetryOf` does.
|
|
268
|
+
*/
|
|
269
|
+
export function siteSymmetry(
|
|
270
|
+
key: MagneticPointGroupKey,
|
|
271
|
+
direction: Vec3,
|
|
272
|
+
options?: SettingOptions & ToleranceOptions,
|
|
273
|
+
): SiteSymmetry {
|
|
274
|
+
checkOptions(options, [...SETTING_KEYS, ...TOLERANCE_KEYS], 'siteSymmetry');
|
|
275
|
+
return siteSymmetryOf(operations(key, pick(options, SETTING_KEYS)), direction, pick(options, TOLERANCE_KEYS));
|
|
276
|
+
}
|
|
277
|
+
|
|
258
278
|
const sortedKey = (list: readonly number[]): string => [...list].sort((a, b) => a - b).join(',');
|
|
259
279
|
|
|
260
280
|
/**
|
|
261
|
-
* The Wyckoff position of a direction (any non-zero Cartesian vector) in a
|
|
262
|
-
*
|
|
263
|
-
* direction (ITA's definition). `tolerance` as for `
|
|
281
|
+
* The Wyckoff position of a direction (any non-zero Cartesian vector) in a crystal class: the
|
|
282
|
+
* position whose printed face has a site symmetry conjugate to that of the
|
|
283
|
+
* direction (ITA's definition). `tolerance` as for `siteSymmetryOf`; throws a RangeError if the
|
|
264
284
|
* operations found within it do not match any position (a tolerance too large).
|
|
265
285
|
*/
|
|
266
|
-
export function
|
|
286
|
+
export function wyckoffPosition(
|
|
287
|
+
key: PointGroupKey,
|
|
288
|
+
direction: Vec3,
|
|
289
|
+
options?: SettingOptions & ToleranceOptions,
|
|
290
|
+
): WyckoffPosition {
|
|
291
|
+
checkOptions(options, [...SETTING_KEYS, ...TOLERANCE_KEYS], 'wyckoffPosition');
|
|
267
292
|
const tolerance = siteTolerance(options);
|
|
268
|
-
const setting =
|
|
269
|
-
const ops = operations(key, {
|
|
270
|
-
const rows = wyckoffPositions(key, {
|
|
271
|
-
const site =
|
|
293
|
+
const setting = tableSetting(key, options);
|
|
294
|
+
const ops = operations(key, { setting });
|
|
295
|
+
const rows = wyckoffPositions(key, { setting });
|
|
296
|
+
const site = siteSymmetryOf(ops, direction, { tolerance });
|
|
272
297
|
const candidates = rows.filter((r) => r.siteSymmetryOperations.length === site.operations.length);
|
|
273
298
|
for (const g of ops) {
|
|
274
|
-
const k = sortedKey(
|
|
299
|
+
const k = sortedKey(siteSymmetryOf(ops, apply(g.cartesian, site.direction), { tolerance }).operations);
|
|
275
300
|
const row = candidates.find((r) => sortedKey(r.siteSymmetryOperations) === k);
|
|
276
301
|
if (row) return row;
|
|
277
302
|
}
|
|
278
303
|
throw new RangeError(
|
|
279
|
-
`Point group ${key}, setting ${setting}: no Wyckoff position for ${
|
|
304
|
+
`Point group ${key}, setting ${setting}: no Wyckoff position for ${shown(direction)} (tolerance too large?)`,
|
|
280
305
|
);
|
|
281
306
|
}
|