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
package/src/crystalClasses.ts
CHANGED
|
@@ -11,38 +11,48 @@
|
|
|
11
11
|
* comes in and leaves time reversal out of what goes back.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import
|
|
14
|
+
import { checkOptions, shown, TOLERANCE_KEYS } from './checks.js';
|
|
15
|
+
import type { CrystalSystem, LatticeSystem } from './lattice.js';
|
|
15
16
|
import type { Mat3, Vec3 } from './linalg.js';
|
|
16
|
-
import type {
|
|
17
|
+
import type { CartesianOperation as MagneticOperation, Operation as MagneticRecord } from './operations.js';
|
|
17
18
|
import * as elements from './pointGroups/elements.js';
|
|
18
19
|
import * as groups from './pointGroups/pointGroups.js';
|
|
19
|
-
import type {
|
|
20
|
+
import type { PointGroupKey, Setting, SettingOptions, SymbolOptions } from './pointGroups/pointGroups.js';
|
|
20
21
|
import * as properties from './pointGroups/properties.js';
|
|
21
22
|
import * as forms from './pointGroups/crystalForms.js';
|
|
22
23
|
import * as identify from './pointGroups/identify.js';
|
|
23
24
|
import * as orbits from './pointGroups/orbits.js';
|
|
24
25
|
import * as wyckoff from './pointGroups/wyckoff.js';
|
|
25
|
-
import type { Hkl } from './pointGroups/wyckoff.js';
|
|
26
26
|
import * as cell from './cell.js';
|
|
27
27
|
import * as site from './siteSymmetry.js';
|
|
28
|
-
import type { Uvw } from './symmetryDirections.js';
|
|
29
28
|
import { TENSOR_PROPERTIES as ALL_TENSOR_PROPERTIES } from './tensors/propertyTable.js';
|
|
30
29
|
import type { TensorPropertyName as MagneticTensorPropertyName } from './tensors/propertyTable.js';
|
|
31
30
|
import * as tensors from './tensors/tensorForm.js';
|
|
32
|
-
import
|
|
31
|
+
import * as voigtNotation from './tensors/voigt.js';
|
|
32
|
+
import type { IntrinsicSymmetry, TensorForm, TensorKind, TensorRank } from './tensors/tensorForm.js';
|
|
33
|
+
import { deepFreeze } from './freeze.js';
|
|
34
|
+
import type { ToleranceOptions } from './tolerances.js';
|
|
33
35
|
|
|
34
36
|
const USE_MAGNETIC =
|
|
35
37
|
"the crystallographic API has no time reversal; use the magnetic API ('symcrys/magnetic', in Python symcrys.magnetic)";
|
|
36
38
|
|
|
37
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* A point operation of a crystal class in a setting: ITA's matrix W in the lattice basis of the
|
|
41
|
+
* setting (`matrix`, integer, acting on the coordinates of a lattice direction [uvw]; the coordinate
|
|
42
|
+
* triplets of ITA's general position are its rows) and the same operation as an orthogonal Cartesian
|
|
43
|
+
* matrix (`cartesian`: rotation, rotoinversion, mirror, inversion; R = B·W·B⁻¹ with the basis B of
|
|
44
|
+
* the setting). docs/conventions.md, "Operations".
|
|
45
|
+
*/
|
|
38
46
|
export interface Operation {
|
|
39
|
-
/**
|
|
47
|
+
/** ITA's matrix W in the lattice basis of the setting, integer, rows first. */
|
|
40
48
|
readonly matrix: Mat3;
|
|
49
|
+
/** The orthogonal Cartesian 3×3 matrix, rows first. */
|
|
50
|
+
readonly cartesian: Mat3;
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
/**
|
|
44
54
|
* A crystal class with the properties that are fixed by its operations. None of them depends on
|
|
45
|
-
* the setting
|
|
55
|
+
* the setting (docs/conventions.md, "Properties").
|
|
46
56
|
*/
|
|
47
57
|
export interface PointGroup {
|
|
48
58
|
/** The key (docs/conventions.md, "Keys"). */
|
|
@@ -55,8 +65,12 @@ export interface PointGroup {
|
|
|
55
65
|
readonly centrosymmetric: boolean;
|
|
56
66
|
/** Polar (pyroelectric class): some direction is left unchanged by every operation. */
|
|
57
67
|
readonly polar: boolean;
|
|
58
|
-
/**
|
|
59
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Enantiomorphic: proper rotations only. ITA § 3.2.2.1.3 (p. 738): "All these terms
|
|
70
|
+
* [enantiomorphism, enantiomerism, chirality, dissymmetry] refer to the same symmetry restriction,
|
|
71
|
+
* the absence of improper rotations (rotoinversions, rotoreflections)".
|
|
72
|
+
*/
|
|
73
|
+
readonly enantiomorphic: boolean;
|
|
60
74
|
/** The Laue class: the centrosymmetric crystal class generated by the class and the inversion. */
|
|
61
75
|
readonly laueClass: PointGroupKey;
|
|
62
76
|
}
|
|
@@ -77,25 +91,35 @@ export interface TensorSpec {
|
|
|
77
91
|
/** Number of indices, 0 to 4. */
|
|
78
92
|
readonly rank: TensorRank;
|
|
79
93
|
/** `'polar'` or `'axial'`: whether an improper operation changes the sign (factor det R). */
|
|
80
|
-
readonly
|
|
94
|
+
readonly kind: TensorKind;
|
|
81
95
|
/** The index symmetry of the tensor. */
|
|
82
96
|
readonly intrinsic: IntrinsicSymmetry;
|
|
83
97
|
}
|
|
84
98
|
|
|
85
99
|
/**
|
|
86
|
-
* An operation as a caller may pass it
|
|
87
|
-
*
|
|
88
|
-
*
|
|
100
|
+
* An operation as a caller may pass it to a function that computes with Cartesian matrices: its
|
|
101
|
+
* Cartesian matrix (`cartesian`; other fields, such as `matrix`, are not read), so that the
|
|
102
|
+
* operations of `operations` can be passed as they are. `timeReversal: false` is accepted, so that
|
|
103
|
+
* an operation of the magnetic API without time reversal can be handed on from plain JavaScript;
|
|
104
|
+
* with `timeReversal: true` it is refused, at compile time and at run time.
|
|
89
105
|
*/
|
|
90
|
-
type OperationArgument =
|
|
106
|
+
type OperationArgument = {
|
|
107
|
+
/** The orthogonal Cartesian 3×3 matrix, rows first. */
|
|
108
|
+
readonly cartesian: Mat3;
|
|
91
109
|
/** Accepted if false; an operation with time reversal belongs to the magnetic API. */
|
|
92
110
|
readonly timeReversal?: false;
|
|
93
111
|
};
|
|
94
112
|
|
|
95
|
-
/**
|
|
113
|
+
/** An operation as a caller may pass it to `residualOperations`: its matrix W in the lattice basis. */
|
|
114
|
+
type CellOperationArgument = cell.CellOperation & {
|
|
115
|
+
/** Accepted if false; an operation with time reversal belongs to the magnetic API. */
|
|
116
|
+
readonly timeReversal?: false;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** A tensor specification as a caller may pass it; `timeParity: 'even'` is accepted, `'odd'` refused. */
|
|
96
120
|
type TensorSpecArgument = TensorSpec & {
|
|
97
|
-
/** Accepted if `'
|
|
98
|
-
readonly timeParity?: '
|
|
121
|
+
/** Accepted if `'even'`; a time-odd tensor belongs to the magnetic API. */
|
|
122
|
+
readonly timeParity?: 'even';
|
|
99
123
|
};
|
|
100
124
|
|
|
101
125
|
/** A named property: the tensor that describes it, what it is and where it is defined. */
|
|
@@ -122,11 +146,11 @@ export type TensorPropertyName = Extract<
|
|
|
122
146
|
export const TENSOR_PROPERTIES = Object.freeze(
|
|
123
147
|
Object.fromEntries(
|
|
124
148
|
Object.entries(ALL_TENSOR_PROPERTIES)
|
|
125
|
-
.filter(([, p]) => p.spec.timeParity === '
|
|
149
|
+
.filter(([, p]) => p.spec.timeParity === 'even')
|
|
126
150
|
.map(([name, { spec, description, source }]) => [
|
|
127
151
|
name,
|
|
128
152
|
Object.freeze({
|
|
129
|
-
spec: Object.freeze({ rank: spec.rank,
|
|
153
|
+
spec: Object.freeze({ rank: spec.rank, kind: spec.kind, intrinsic: spec.intrinsic }),
|
|
130
154
|
description,
|
|
131
155
|
source,
|
|
132
156
|
}),
|
|
@@ -142,9 +166,9 @@ const TENSOR_PROPERTY_NAMES = Object.freeze(Object.keys(TENSOR_PROPERTIES)) as r
|
|
|
142
166
|
function classKey(key: PointGroupKey): PointGroupKey {
|
|
143
167
|
if (groups.isPointGroupKey(key)) return key;
|
|
144
168
|
if (groups.isMagneticPointGroupKey(key)) {
|
|
145
|
-
throw new RangeError(`${
|
|
169
|
+
throw new RangeError(`${shown(key)} is a magnetic point group, not a crystal class: ${USE_MAGNETIC}`);
|
|
146
170
|
}
|
|
147
|
-
throw new RangeError(`Unknown point group key: ${
|
|
171
|
+
throw new RangeError(`Unknown point group key: ${shown(key)}`);
|
|
148
172
|
}
|
|
149
173
|
|
|
150
174
|
/** A name of the table of this API, checked. */
|
|
@@ -152,35 +176,41 @@ function propertyName(name: TensorPropertyName): TensorPropertyName {
|
|
|
152
176
|
if (typeof name === 'string') {
|
|
153
177
|
if (Object.hasOwn(TENSOR_PROPERTIES, name)) return name;
|
|
154
178
|
if (Object.hasOwn(ALL_TENSOR_PROPERTIES, name)) {
|
|
155
|
-
throw new RangeError(`${
|
|
179
|
+
throw new RangeError(`${shown(name)} is the property of a time-odd tensor: ${USE_MAGNETIC}`);
|
|
156
180
|
}
|
|
157
181
|
}
|
|
158
|
-
throw new RangeError(`Unknown tensor property: ${
|
|
182
|
+
throw new RangeError(`Unknown tensor property: ${shown(name)} (known: ${TENSOR_PROPERTY_NAMES.join(', ')})`);
|
|
159
183
|
}
|
|
160
184
|
|
|
161
185
|
/** The time-even tensor of a specification or of a property name, as the shared modules take it. */
|
|
162
186
|
function timeEven(specOrName: TensorSpecArgument | TensorPropertyName): tensors.TensorSpec | TensorPropertyName {
|
|
163
187
|
if (typeof specOrName === 'string') return propertyName(specOrName);
|
|
164
188
|
if (typeof specOrName !== 'object' || specOrName === null) {
|
|
165
|
-
throw new RangeError(`Not a tensor specification: ${
|
|
189
|
+
throw new RangeError(`Not a tensor specification: ${shown(specOrName)}`);
|
|
166
190
|
}
|
|
167
191
|
const timeParity = (specOrName as { readonly timeParity?: unknown }).timeParity;
|
|
168
|
-
if (timeParity === '
|
|
169
|
-
|
|
170
|
-
|
|
192
|
+
if (timeParity === 'odd' || timeParity === 'c') {
|
|
193
|
+
throw new RangeError(`A time-odd tensor (timeParity '${timeParity}'): ${USE_MAGNETIC}`);
|
|
194
|
+
}
|
|
195
|
+
if (timeParity !== undefined && timeParity !== 'even') {
|
|
196
|
+
// The shared check names the values and the names up to 0.10 ('i', 'c').
|
|
197
|
+
return { ...specOrName, timeParity: timeParity as never };
|
|
171
198
|
}
|
|
172
|
-
|
|
199
|
+
// The other fields are passed on as they are, so that the shared check reports a field of 0.10 (parity).
|
|
200
|
+
return { ...specOrName, timeParity: 'even' };
|
|
173
201
|
}
|
|
174
202
|
|
|
175
203
|
/** Checks a list of operations of a caller: an operation with time reversal is an error. */
|
|
176
|
-
function checkUnitary(operations: readonly
|
|
204
|
+
function checkUnitary(operations: readonly { readonly timeReversal?: false }[]): void {
|
|
205
|
+
if (!Array.isArray(operations)) throw new RangeError('The operations must be an array');
|
|
177
206
|
operations.forEach((op, i) => {
|
|
207
|
+
if (typeof op !== 'object' || op === null) throw new RangeError(`Operation ${i} is not an object`);
|
|
178
208
|
const timeReversal = (op as { readonly timeReversal?: unknown }).timeReversal;
|
|
179
209
|
if (timeReversal === true) {
|
|
180
210
|
throw new RangeError(`Operation ${i} is combined with time reversal: ${USE_MAGNETIC}`);
|
|
181
211
|
}
|
|
182
212
|
if (timeReversal !== undefined && timeReversal !== false) {
|
|
183
|
-
throw new RangeError(`Operation ${i}: timeReversal must be false or absent, not ${
|
|
213
|
+
throw new RangeError(`Operation ${i}: timeReversal must be false or absent, not ${shown(timeReversal)}`);
|
|
184
214
|
}
|
|
185
215
|
});
|
|
186
216
|
}
|
|
@@ -188,18 +218,20 @@ function checkUnitary(operations: readonly OperationArgument[]): void {
|
|
|
188
218
|
/** A list of operations as the shared modules take it. */
|
|
189
219
|
function unitary(operations: readonly OperationArgument[]): MagneticOperation[] {
|
|
190
220
|
checkUnitary(operations);
|
|
191
|
-
|
|
221
|
+
// The other fields are kept for the checks of the shared modules (a record with `matrix` only
|
|
222
|
+
// is refused there with a hint).
|
|
223
|
+
return operations.map((op) => ({ ...op, timeReversal: false }));
|
|
192
224
|
}
|
|
193
225
|
|
|
194
226
|
// --- what goes back --------------------------------------------------------------------------------
|
|
195
227
|
|
|
196
|
-
const withoutTimeCache = new WeakMap<readonly
|
|
228
|
+
const withoutTimeCache = new WeakMap<readonly MagneticRecord[], readonly Operation[]>();
|
|
197
229
|
|
|
198
|
-
/** The operations
|
|
199
|
-
function
|
|
230
|
+
/** The operations without time reversal; the shared modules return the same frozen list for the same call. */
|
|
231
|
+
function withoutTime(ops: readonly MagneticRecord[]): readonly Operation[] {
|
|
200
232
|
let result = withoutTimeCache.get(ops);
|
|
201
233
|
if (!result) {
|
|
202
|
-
result = Object.freeze(ops.map((op) => Object.freeze({ matrix: op.matrix })));
|
|
234
|
+
result = Object.freeze(ops.map((op) => Object.freeze({ matrix: op.matrix, cartesian: op.cartesian })));
|
|
203
235
|
withoutTimeCache.set(ops, result);
|
|
204
236
|
}
|
|
205
237
|
return result;
|
|
@@ -222,8 +254,8 @@ const groupCache = new Map<PointGroupKey, PointGroup>();
|
|
|
222
254
|
export function pointGroup(key: PointGroupKey): PointGroup {
|
|
223
255
|
let g = groupCache.get(classKey(key));
|
|
224
256
|
if (!g) {
|
|
225
|
-
const { crystalSystem, order, centrosymmetric, polar,
|
|
226
|
-
g = Object.freeze({ key, crystalSystem, order, centrosymmetric, polar,
|
|
257
|
+
const { crystalSystem, order, centrosymmetric, polar, enantiomorphic, laueClass } = groups.pointGroup(key);
|
|
258
|
+
g = Object.freeze({ key, crystalSystem, order, centrosymmetric, polar, enantiomorphic, laueClass });
|
|
227
259
|
groupCache.set(key, g);
|
|
228
260
|
}
|
|
229
261
|
return g;
|
|
@@ -231,74 +263,99 @@ export function pointGroup(key: PointGroupKey): PointGroup {
|
|
|
231
263
|
|
|
232
264
|
/** All 32 crystal classes, in the order of `POINT_GROUP_KEYS` (by crystal system, as in ITA). */
|
|
233
265
|
export function pointGroups(): readonly PointGroup[] {
|
|
234
|
-
return groups.POINT_GROUP_KEYS.map((key) => pointGroup(key));
|
|
266
|
+
return deepFreeze(groups.POINT_GROUP_KEYS.map((key) => pointGroup(key)));
|
|
235
267
|
}
|
|
236
268
|
|
|
237
269
|
/**
|
|
238
|
-
* Finds a crystal class by a
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* the
|
|
245
|
-
*
|
|
270
|
+
* Finds a crystal class by a symbol, read tolerantly.
|
|
271
|
+
* It reads, spaces ignored (#96; docs/conventions.md, "Reading symbols"): the key; the short or
|
|
272
|
+
* full symbol of a setting (`312`, `1 1 2`); a Schoenflies symbol, ITA's or ITC Vol. D's (`D3`,
|
|
273
|
+
* `C3i`, `S6`); Birss's cubic symbols without the overbar on the 3 (`m3m`). A symbol that names
|
|
274
|
+
* several settings (the key `32`, which is also the symbol of the setting with rhombohedral axes;
|
|
275
|
+
* `2` for unique axis b, c and a; any Schoenflies symbol) gives the standard (ITC default) setting,
|
|
276
|
+
* unless the options `axes` or `uniqueAxis` choose another, as the headlines of ITA name the
|
|
277
|
+
* settings (the option `axes` set to `'rhombohedral'` for the key `32`).
|
|
278
|
+
*
|
|
279
|
+
* Spellings: the overbar as `-`, `−`, a combining overbar or `¯` after the digit (`m3̄m`), `bar3` (also with a backslash and braces, as in LaTeX);
|
|
280
|
+
* Schoenflies subscripts also as Unicode or LaTeX subscripts (`C₃ᵥ`, `C_{3v}`). Returns `undefined` if nothing matches,
|
|
281
|
+
* also for the symbol of a magnetic group with time reversal; a value that is not a string, and a
|
|
282
|
+
* symbol that names several groups, are a RangeError (the latter lists the groups).
|
|
246
283
|
*/
|
|
247
|
-
export function findPointGroup(
|
|
248
|
-
|
|
284
|
+
export function findPointGroup(symbol: string, options?: groups.AxesOptions): PointGroupInSetting | undefined {
|
|
285
|
+
if (arguments.length > 2) groups.rejectConventionArgument(arguments.length);
|
|
286
|
+
return deepFreeze(groups.findPointGroup(symbol, options));
|
|
249
287
|
}
|
|
250
288
|
|
|
251
|
-
/** The settings of a crystal class, with symbols and the
|
|
252
|
-
export function settings(key: PointGroupKey
|
|
253
|
-
|
|
289
|
+
/** The settings of a crystal class, with their symbols and the ITC default. */
|
|
290
|
+
export function settings(key: PointGroupKey): readonly Setting[] {
|
|
291
|
+
groups.rejectConventionArgument(arguments.length);
|
|
292
|
+
return deepFreeze(groups.settings(classKey(key)));
|
|
254
293
|
}
|
|
255
294
|
|
|
256
295
|
/**
|
|
257
|
-
* All operations of the crystal class in the requested setting (default: the
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
296
|
+
* All operations of the crystal class in the requested setting (default: the ITC default setting),
|
|
297
|
+
* in ITA's order: identity first, then as ITA numbers the general position (docs/conventions.md,
|
|
298
|
+
* "Order of the operations"). Each operation is ITA's matrix W in the lattice basis of the setting
|
|
299
|
+
* (`matrix`) with the same operation as a Cartesian matrix (`cartesian`; docs/conventions.md,
|
|
300
|
+
* "Operations").
|
|
261
301
|
*/
|
|
262
302
|
export function operations(key: PointGroupKey, options?: SettingOptions): readonly Operation[] {
|
|
263
|
-
return
|
|
303
|
+
return withoutTime(groups.operations(classKey(key), options));
|
|
264
304
|
}
|
|
265
305
|
|
|
266
306
|
/**
|
|
267
|
-
* Generators of the crystal class in the requested setting (docs/conventions.md, "Generators")
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* the identity, as in birss-app).
|
|
307
|
+
* Generators of the crystal class in the requested setting (docs/conventions.md, "Generators"):
|
|
308
|
+
* ITA's selected generators in printed order, without the identity and ITA's lattice translations,
|
|
309
|
+
* so the list is empty for `1`; for the settings ITA does not print (`mm2` settings 2 and 3, monoclinic unique axis a), those of setting 1
|
|
310
|
+
* carried into their frame.
|
|
272
311
|
*/
|
|
273
312
|
export function generators(key: PointGroupKey, options?: SettingOptions): readonly Operation[] {
|
|
274
|
-
return
|
|
313
|
+
return withoutTime(groups.generators(classKey(key), options));
|
|
275
314
|
}
|
|
276
315
|
|
|
277
|
-
/**
|
|
316
|
+
/**
|
|
317
|
+
* A symbol of the crystal class in the requested setting, as ITA writes it (Tables 3.2.1.2 and
|
|
318
|
+
* 3.2.3.2: `321`, `C3i`; docs/conventions.md, "Symbols").
|
|
319
|
+
*/
|
|
278
320
|
export function symbol(key: PointGroupKey, options?: SymbolOptions): string {
|
|
279
|
-
|
|
321
|
+
const result = groups.symbol(classKey(key), options);
|
|
322
|
+
// The Schoenflies symbol as ITA writes it (`C3i`); the magnetic API follows ITC Vol. D (`S6`).
|
|
323
|
+
return options?.form === 'schoenflies' ? groups.itaSchoenflies(key) : result;
|
|
280
324
|
}
|
|
281
325
|
|
|
282
326
|
// --- properties that follow from operations ---------------------------------------------------------
|
|
283
327
|
|
|
284
328
|
export { holohedry } from './pointGroups/properties.js';
|
|
285
329
|
|
|
330
|
+
/**
|
|
331
|
+
* The lattice systems of a crystal class: those whose lattices it can act on (ITA § 1.3.4.4.2 and
|
|
332
|
+
* Table 1.3.4.1, p. 39). One for every class but the trigonal ones, which belong to the hexagonal
|
|
333
|
+
* (hP) or the rhombohedral (hR) lattice system depending on the basis, so they give both,
|
|
334
|
+
* `['hexagonal', 'rhombohedral']`. The holohedry of each is `holohedry(latticeSystem)`. Throws a
|
|
335
|
+
* RangeError for an unknown key.
|
|
336
|
+
*/
|
|
337
|
+
export function latticeSystems(key: PointGroupKey): readonly LatticeSystem[] {
|
|
338
|
+
return groups.latticeSystems(classKey(key));
|
|
339
|
+
}
|
|
340
|
+
|
|
286
341
|
/**
|
|
287
342
|
* True if the group generated by `operations` contains the inversion, e.g. for the operations of a
|
|
288
|
-
* distorted crystal.
|
|
289
|
-
* `pointGroup(key).centrosymmetric`. Throws a
|
|
343
|
+
* distorted crystal. The list is closed into a group within the tolerance and made exact first, as
|
|
344
|
+
* `tensorFormOf` does. For a crystal class, read `pointGroup(key).centrosymmetric`. Throws a
|
|
345
|
+
* RangeError as `tensorFormOf`.
|
|
290
346
|
*/
|
|
291
|
-
export function isCentrosymmetricOf(operations: readonly OperationArgument[]): boolean {
|
|
292
|
-
return properties.isCentrosymmetricOf(unitary(operations));
|
|
347
|
+
export function isCentrosymmetricOf(operations: readonly OperationArgument[], options?: ToleranceOptions): boolean {
|
|
348
|
+
return properties.isCentrosymmetricOf(unitary(operations), options);
|
|
293
349
|
}
|
|
294
350
|
|
|
295
351
|
/**
|
|
296
|
-
* True if the group generated by `operations` is
|
|
297
|
-
* class, read `pointGroup(key).
|
|
298
|
-
* `allowsPropertyOf(operations, 'pyroelectric')`. Throws a RangeError for
|
|
352
|
+
* True if the group generated by `operations` is enantiomorphic: proper rotations only (ITA
|
|
353
|
+
* § 3.2.2.1.3). For a crystal class, read `pointGroup(key).enantiomorphic`. Polar is the named property `'pyroelectric'`:
|
|
354
|
+
* `allowsPropertyOf(operations, 'pyroelectric')`. Throws a RangeError for an operation without an
|
|
355
|
+
* orthogonal Cartesian matrix (`cartesian`; within the tolerance).
|
|
299
356
|
*/
|
|
300
|
-
export function
|
|
301
|
-
return properties.
|
|
357
|
+
export function isEnantiomorphicOf(operations: readonly OperationArgument[], options?: ToleranceOptions): boolean {
|
|
358
|
+
return properties.isEnantiomorphicOf(unitary(operations), options);
|
|
302
359
|
}
|
|
303
360
|
|
|
304
361
|
// --- the point group of a list of operations -------------------------------------------------------
|
|
@@ -323,14 +380,13 @@ export type CartesianOperationDescription = Omit<identify.CartesianOperationDesc
|
|
|
323
380
|
* (absent if the group is the class in another orientation, e.g. a threefold axis along [111]). The
|
|
324
381
|
* list is closed into a group first, two matrices being equal when no entry differs by `tolerance`
|
|
325
382
|
* (default `EPSILON`) or more. Returns undefined if the operations generate no crystal class (an
|
|
326
|
-
* operation of order 5, a group larger than 48). Throws a RangeError for
|
|
327
|
-
* orthogonal (within `tolerance`, at least `EPSILON`). The classes `1` and `-1` have no
|
|
383
|
+
* operation of order 5, a group larger than 48). Throws a RangeError for an operation without an orthogonal Cartesian matrix (`cartesian`; within `tolerance`, at least `EPSILON`). The classes `1` and `-1` have no
|
|
328
384
|
* orientation, so they always have setting 1. The first call builds a table of the groups (about
|
|
329
385
|
* 0.1 s; docs/conventions.md, "Point group of a list of operations").
|
|
330
386
|
*/
|
|
331
387
|
export function pointGroupOf(
|
|
332
388
|
operations: readonly OperationArgument[],
|
|
333
|
-
options?:
|
|
389
|
+
options?: ToleranceOptions,
|
|
334
390
|
): IdentifiedPointGroup | undefined {
|
|
335
391
|
return identify.pointGroupOf(unitary(operations), options) as IdentifiedPointGroup | undefined;
|
|
336
392
|
}
|
|
@@ -340,13 +396,13 @@ export function pointGroupOf(
|
|
|
340
396
|
* Cartesian axis (rotation or rotoinversion axis, mirror normal) with its first non-zero component,
|
|
341
397
|
* in the order x, y, z, positive, and for n ≥ 3 the sense about that axis. The axes are not named
|
|
342
398
|
* by lattice directions, since the list need not belong to a setting; for a crystal class given by
|
|
343
|
-
* its key, `describeOperations` names them. Throws a RangeError for
|
|
399
|
+
* its key, `describeOperations` names them. Throws a RangeError for an operation without an orthogonal Cartesian matrix (`cartesian`)
|
|
344
400
|
* or not a crystallographic operation (a rotation part by an angle other than 360°/n, n = 1, 2, 3,
|
|
345
401
|
* 4, 6), both within `tolerance` (default `EPSILON`, as for `pointGroupOf`).
|
|
346
402
|
*/
|
|
347
403
|
export function describeOperationsOf(
|
|
348
404
|
operations: readonly OperationArgument[],
|
|
349
|
-
options?:
|
|
405
|
+
options?: ToleranceOptions,
|
|
350
406
|
): readonly CartesianOperationDescription[] {
|
|
351
407
|
return Object.freeze(
|
|
352
408
|
identify.describeOperationsOf(unitary(operations), options).map((d) => {
|
|
@@ -360,17 +416,18 @@ export function describeOperationsOf(
|
|
|
360
416
|
|
|
361
417
|
/**
|
|
362
418
|
* Each operation of the crystal class described geometrically, in the order of `operations` for
|
|
363
|
-
* the same key and options.
|
|
364
|
-
*
|
|
365
|
-
*
|
|
419
|
+
* the same key and options. An axis lies along a symmetry direction and has the sign of the
|
|
420
|
+
* operation's Seitz symbol (ITA 6th ed., Tables 1.4.2.1–1.4.2.3, p. 52), e.g. [1, 1, 0] for 2₁₁₀ in
|
|
421
|
+
* the hexagonal family, where ITA Table 2.1.3.1 lists [1̄, 1̄, 0]; for n ≥ 3 the sign fixes what the
|
|
422
|
+
* sense refers to.
|
|
366
423
|
*/
|
|
367
424
|
export function describeOperations(key: PointGroupKey, options?: SettingOptions): readonly OperationDescription[] {
|
|
368
425
|
const described = elements.describeOperations(classKey(key), options);
|
|
369
426
|
let result = descriptionCache.get(described);
|
|
370
427
|
if (!result) {
|
|
371
428
|
result = Object.freeze(
|
|
372
|
-
described.map(({ kind,
|
|
373
|
-
Object.freeze({ kind,
|
|
429
|
+
described.map(({ kind, n, axis, sense }) =>
|
|
430
|
+
Object.freeze({ kind, n, ...(axis ? { axis } : {}), ...(sense ? { sense } : {}) }),
|
|
374
431
|
),
|
|
375
432
|
);
|
|
376
433
|
descriptionCache.set(described, result);
|
|
@@ -379,12 +436,12 @@ export function describeOperations(key: PointGroupKey, options?: SettingOptions)
|
|
|
379
436
|
}
|
|
380
437
|
|
|
381
438
|
/**
|
|
382
|
-
* The positions of the full Hermann–Mauguin symbol in the requested
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* without `symbol`); the triclinic family has none.
|
|
386
|
-
*
|
|
387
|
-
*
|
|
439
|
+
* The positions of the full Hermann–Mauguin symbol in the requested setting, each with its
|
|
440
|
+
* symmetry directions (ITA Table 2.1.3.1) and the symmetry elements along them. All positions of the
|
|
441
|
+
* crystal family are listed (for rhombohedral axes the two of that row of the table), also those the
|
|
442
|
+
* symbol of the class leaves out (then without `symbol`); the triclinic family has none. A direction
|
|
443
|
+
* has the sign of ITA Table 2.1.3.1, the axis of an operation along it that of its Seitz symbol, so
|
|
444
|
+
* the two are parallel and may be opposite: match them by direction, up to sign.
|
|
388
445
|
*/
|
|
389
446
|
export function symmetryDirections(
|
|
390
447
|
key: PointGroupKey,
|
|
@@ -401,24 +458,37 @@ export function symmetryDirections(
|
|
|
401
458
|
* fixing the direction within the tolerance are closed under the products found in the list and
|
|
402
459
|
* the direction is set onto their fixed space, repeated until stable, so that for a group the
|
|
403
460
|
* result is a subgroup and the set direction lies exactly on its elements. For a list that is not a
|
|
404
|
-
* group, `multiplicity` may not be an integer.
|
|
405
|
-
*
|
|
461
|
+
* group, `multiplicity` may not be an integer. Each operation is read by its Cartesian matrix
|
|
462
|
+
* (`cartesian`). Throws a RangeError for an operation without an orthogonal Cartesian matrix (`cartesian`; within
|
|
406
463
|
* `tolerance`, at least `EPSILON`), for a zero vector, and if the closed operations fix no common
|
|
407
464
|
* direction or do not settle into a group (a tolerance far too large, e.g. 0.5).
|
|
408
465
|
*/
|
|
409
|
-
export function
|
|
466
|
+
export function siteSymmetryOf(
|
|
410
467
|
operations: readonly OperationArgument[],
|
|
411
468
|
direction: Vec3,
|
|
412
|
-
options?:
|
|
469
|
+
options?: ToleranceOptions,
|
|
413
470
|
): site.SiteSymmetry {
|
|
414
471
|
checkUnitary(operations);
|
|
415
472
|
// The shared function reads the matrices only, so the list of the caller is passed on as it is.
|
|
416
|
-
return site.
|
|
473
|
+
return site.siteSymmetryOf(operations as readonly MagneticOperation[], direction, options);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* The site symmetry of a direction (any non-zero Cartesian vector) under a crystal class in a
|
|
478
|
+
* setting: `siteSymmetryOf` applied to `operations(key, options)`, so the indices refer to those
|
|
479
|
+
* operations (#137 C1). Throws a RangeError as `siteSymmetryOf` does.
|
|
480
|
+
*/
|
|
481
|
+
export function siteSymmetry(
|
|
482
|
+
key: PointGroupKey,
|
|
483
|
+
direction: Vec3,
|
|
484
|
+
options?: SettingOptions & ToleranceOptions,
|
|
485
|
+
): site.SiteSymmetry {
|
|
486
|
+
return wyckoff.siteSymmetry(classKey(key), direction, options);
|
|
417
487
|
}
|
|
418
488
|
|
|
419
489
|
/**
|
|
420
490
|
* The Wyckoff positions of a crystal class for directions, as ITA tabulates them (general position
|
|
421
|
-
* first)
|
|
491
|
+
* first) (docs/conventions.md, "Site symmetry and Wyckoff positions").
|
|
422
492
|
*/
|
|
423
493
|
export function wyckoffPositions(key: PointGroupKey, options?: SettingOptions): readonly wyckoff.WyckoffPosition[] {
|
|
424
494
|
return wyckoff.wyckoffPositions(classKey(key), options);
|
|
@@ -427,53 +497,38 @@ export function wyckoffPositions(key: PointGroupKey, options?: SettingOptions):
|
|
|
427
497
|
/**
|
|
428
498
|
* The Wyckoff position of a direction (Cartesian) in a crystal class: the position whose site
|
|
429
499
|
* symmetry is conjugate to that of the direction (ITA's definition). `tolerance` as for
|
|
430
|
-
* `
|
|
500
|
+
* `siteSymmetryOf`.
|
|
431
501
|
*/
|
|
432
|
-
export function
|
|
502
|
+
export function wyckoffPosition(
|
|
433
503
|
key: PointGroupKey,
|
|
434
504
|
direction: Vec3,
|
|
435
|
-
options?:
|
|
505
|
+
options?: SettingOptions & ToleranceOptions,
|
|
436
506
|
): wyckoff.WyckoffPosition {
|
|
437
|
-
return wyckoff.
|
|
507
|
+
return wyckoff.wyckoffPosition(classKey(key), direction, options);
|
|
438
508
|
}
|
|
439
509
|
|
|
440
510
|
// --- lattice basis and orbits ---------------------------------------------------------------------
|
|
441
511
|
|
|
442
512
|
/**
|
|
443
513
|
* The operations of a list that keep the metric of a cell: W with WᵀGW = G, G the metric tensor
|
|
444
|
-
* of `basis`. The operations are integer
|
|
445
|
-
* gives them; the list is taken as it is and the kept operations are the ones of the list, in its
|
|
514
|
+
* of `basis`. The operations are read by `matrix`, the integer matrix W on lattice coordinates, as
|
|
515
|
+
* `operations` gives them; the list is taken as it is and the kept operations are the ones of the list, in its
|
|
446
516
|
* order. The deviation counts relative to the largest entry of G (`tolerance`, default
|
|
447
517
|
* `EPSILON`). An operation combined with time reversal belongs to the magnetic API.
|
|
448
518
|
*/
|
|
449
|
-
export function residualOperations<T extends
|
|
519
|
+
export function residualOperations<T extends CellOperationArgument>(
|
|
450
520
|
operations: readonly T[],
|
|
451
521
|
basis: Mat3,
|
|
452
|
-
options?:
|
|
453
|
-
): T[] {
|
|
522
|
+
options?: ToleranceOptions,
|
|
523
|
+
): readonly T[] {
|
|
454
524
|
checkUnitary(operations);
|
|
455
525
|
return cell.residualOperations(operations, basis, options);
|
|
456
526
|
}
|
|
457
527
|
|
|
458
|
-
/**
|
|
459
|
-
* The operations of the crystal class in the conventional lattice basis (a, b, c; for the trigonal
|
|
460
|
-
* classes the hexagonal axes), in the order of `operations` for the same setting and convention:
|
|
461
|
-
* integer matrices W acting on the coordinates of a lattice direction [uvw], W = B⁻¹·R·B with the
|
|
462
|
-
* basis B of `latticeBasis` and the Cartesian matrix R of `operations`. They do not depend on the
|
|
463
|
-
* cell angles, so they exist for every family; for the monoclinic and triclinic families a, b, c
|
|
464
|
-
* are taken along x, y, z, as for the Wyckoff positions. In the ITC convention they are the
|
|
465
|
-
* matrices of ITA's general position (6th ed., Table 3.2.3.2). Not orthogonal in general: pass
|
|
466
|
-
* them to no function that takes Cartesian operations (docs/conventions.md, "Lattice basis and
|
|
467
|
-
* orbits").
|
|
468
|
-
*/
|
|
469
|
-
export function latticeOperations(key: PointGroupKey, options?: SettingOptions): readonly Operation[] {
|
|
470
|
-
return matricesOnly(orbits.latticeOperations(classKey(key), options));
|
|
471
|
-
}
|
|
472
|
-
|
|
473
528
|
/**
|
|
474
529
|
* The orbit of a face (hkl) or of a lattice direction [uvw] under a crystal class, exactly, in the
|
|
475
530
|
* lattice basis: the distinct faces (directions), in the order in which the operations reach them
|
|
476
|
-
* (so
|
|
531
|
+
* (so the given face first), each with the indices of the operations that map
|
|
477
532
|
* the given one onto it. A face transforms with the inverse transpose of a lattice operation,
|
|
478
533
|
* h' = W⁻ᵀ·h, a direction with the operation itself, u' = W·u. The number of entries is the
|
|
479
534
|
* multiplicity of the face (direction). Throws a RangeError unless exactly one of `hkl` and `uvw` is
|
|
@@ -481,40 +536,40 @@ export function latticeOperations(key: PointGroupKey, options?: SettingOptions):
|
|
|
481
536
|
*/
|
|
482
537
|
export function orbit(
|
|
483
538
|
key: PointGroupKey,
|
|
484
|
-
indices:
|
|
539
|
+
indices: orbits.FaceIndices,
|
|
485
540
|
options?: SettingOptions,
|
|
486
541
|
): readonly orbits.FaceOrbitEntry[];
|
|
487
542
|
export function orbit(
|
|
488
543
|
key: PointGroupKey,
|
|
489
|
-
indices:
|
|
544
|
+
indices: orbits.DirectionIndices,
|
|
490
545
|
options?: SettingOptions,
|
|
491
546
|
): readonly orbits.DirectionOrbitEntry[];
|
|
492
547
|
export function orbit(
|
|
493
548
|
key: PointGroupKey,
|
|
494
|
-
indices:
|
|
549
|
+
indices: orbits.FaceIndices | orbits.DirectionIndices,
|
|
495
550
|
options?: SettingOptions,
|
|
496
551
|
): readonly orbits.FaceOrbitEntry[] | readonly orbits.DirectionOrbitEntry[];
|
|
497
552
|
export function orbit(
|
|
498
553
|
key: PointGroupKey,
|
|
499
|
-
indices:
|
|
554
|
+
indices: orbits.FaceIndices | orbits.DirectionIndices,
|
|
500
555
|
options?: SettingOptions,
|
|
501
556
|
): readonly orbits.FaceOrbitEntry[] | readonly orbits.DirectionOrbitEntry[] {
|
|
502
|
-
return orbits.orbit(classKey(key), indices as
|
|
557
|
+
return orbits.orbit(classKey(key), indices as orbits.FaceIndices, options);
|
|
503
558
|
}
|
|
504
559
|
|
|
505
560
|
/**
|
|
506
561
|
* The orbit of a direction (any non-zero vector, Cartesian, e.g. a face normal) under a list of
|
|
507
562
|
* operations, for instance those of a distorted crystal: the images of its unit vector under each
|
|
508
563
|
* operation, coinciding images merged (closer than `tolerance`, default `EPSILON`, as for
|
|
509
|
-
* `
|
|
564
|
+
* `siteSymmetryOf`), in the order in which the operations reach them, each with the indices of the
|
|
510
565
|
* operations that map the direction there. The list is taken as it is, not closed into a group.
|
|
511
|
-
* Throws a RangeError for a zero vector and for
|
|
566
|
+
* Throws a RangeError for a zero vector and for an operation without an orthogonal Cartesian matrix (`cartesian`; within
|
|
512
567
|
* `tolerance`, at least `EPSILON`).
|
|
513
568
|
*/
|
|
514
569
|
export function orbitOf(
|
|
515
570
|
operations: readonly OperationArgument[],
|
|
516
571
|
direction: Vec3,
|
|
517
|
-
options?:
|
|
572
|
+
options?: ToleranceOptions,
|
|
518
573
|
): readonly orbits.OrbitPole[] {
|
|
519
574
|
checkUnitary(operations);
|
|
520
575
|
return orbits.orbitOf(operations, direction, options);
|
|
@@ -533,8 +588,7 @@ export const CRYSTAL_FORM_TYPES: readonly forms.CrystalFormType[] = forms.CRYSTA
|
|
|
533
588
|
/**
|
|
534
589
|
* The crystal forms of a crystal class, as ITA 6th ed. Table 3.2.3.2 prints them: for each Wyckoff
|
|
535
590
|
* position (general position first) its basic form (two for the cubic faces (hhl) of -43m and
|
|
536
|
-
* m-3m), then its limiting forms.
|
|
537
|
-
* only, like the Wyckoff positions (docs/conventions.md, "Crystal forms").
|
|
591
|
+
* m-3m), then its limiting forms (docs/conventions.md, "Crystal forms").
|
|
538
592
|
*/
|
|
539
593
|
export function crystalForms(key: PointGroupKey, options?: SettingOptions): readonly forms.CrystalForm[] {
|
|
540
594
|
return forms.crystalForms(classKey(key), options);
|
|
@@ -543,11 +597,9 @@ export function crystalForms(key: PointGroupKey, options?: SettingOptions): read
|
|
|
543
597
|
// --- tensors ---------------------------------------------------------------------------------------
|
|
544
598
|
|
|
545
599
|
/**
|
|
546
|
-
* The form of a tensor under a crystal class in the requested setting (default: the default
|
|
547
|
-
* setting
|
|
548
|
-
*
|
|
549
|
-
* through the setting: the same setting index gives the same form in both conventions
|
|
550
|
-
* (docs/conventions.md, "Tensors").
|
|
600
|
+
* The form of a tensor under a crystal class in the requested setting (default: the ITC default
|
|
601
|
+
* setting). The tensor is given by its specification or by the name of a property in
|
|
602
|
+
* `TENSOR_PROPERTIES` (`'piezoelectric'`; docs/conventions.md, "Tensors").
|
|
551
603
|
*/
|
|
552
604
|
export function tensorForm(
|
|
553
605
|
key: PointGroupKey,
|
|
@@ -560,37 +612,82 @@ export function tensorForm(
|
|
|
560
612
|
/**
|
|
561
613
|
* The form of a tensor under the group generated by `operations`, e.g. the site symmetry of a
|
|
562
614
|
* surface normal (`siteSymmetry`) or the operations of a distorted crystal. The tensor is given by
|
|
563
|
-
* its specification or by the name of a property in `TENSOR_PROPERTIES`.
|
|
564
|
-
* Cartesian
|
|
565
|
-
*
|
|
615
|
+
* its specification or by the name of a property in `TENSOR_PROPERTIES`. Each operation is read by
|
|
616
|
+
* its Cartesian matrix (`cartesian`), which must be orthogonal. The list is closed into a group
|
|
617
|
+
* within the tolerance, and that group is made exact before the form is computed, so that matrices
|
|
618
|
+
* with rounding errors (e.g. rounded to 6 decimals) give the form of the exact group, with its
|
|
619
|
+
* number of free parameters (docs/conventions.md, "Tolerances"). Throws a RangeError for an
|
|
620
|
+
* operation without an orthogonal Cartesian matrix (`cartesian`; within the tolerance) and for
|
|
621
|
+
* operations that generate no finite group within the tolerance.
|
|
566
622
|
*/
|
|
567
623
|
export function tensorFormOf(
|
|
568
624
|
operations: readonly OperationArgument[],
|
|
569
625
|
spec: TensorSpecArgument | TensorPropertyName,
|
|
626
|
+
options?: ToleranceOptions,
|
|
570
627
|
): TensorForm {
|
|
571
|
-
return tensors.tensorFormOf(unitary(operations), timeEven(spec));
|
|
628
|
+
return tensors.tensorFormOf(unitary(operations), timeEven(spec), options);
|
|
572
629
|
}
|
|
573
630
|
|
|
574
631
|
/**
|
|
575
|
-
* The
|
|
632
|
+
* The tensor `tensor` in a frame rotated by the orthogonal
|
|
576
633
|
* matrix `rotation`: t′_{i…} = f·Σ R_{ia}…R_{…}·t_{a…}, with f = det(R) for an axial tensor and 1
|
|
577
634
|
* for a polar one. To express a tensor in the frame of a surface, pass the matrix whose rows are
|
|
578
635
|
* the new axes in the old frame. The kind of tensor is given by its specification or by the name
|
|
579
|
-
* of a property in `TENSOR_PROPERTIES`.
|
|
636
|
+
* of a property in `TENSOR_PROPERTIES`. Throws a RangeError for a rotation that is not orthogonal
|
|
637
|
+
* within the tolerance (per matrix entry of RᵀR).
|
|
580
638
|
*/
|
|
581
639
|
export function rotateTensor(
|
|
582
640
|
tensor: readonly number[],
|
|
583
641
|
rotation: Mat3,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
642
|
+
spec: TensorSpecArgument | TensorPropertyName,
|
|
643
|
+
options?: ToleranceOptions,
|
|
644
|
+
): readonly number[] {
|
|
645
|
+
return tensors.rotateTensor(tensor, rotation, timeEven(spec), options);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* A tensor in Voigt's two-index notation (ITC Vol. D (2013) § 1.1.4.10, pp. 24–27): each contracted
|
|
650
|
+
* index pair ij becomes α = 1…6 for 11, 22, 33, 23, 31, 12 (eq. (1.1.4.6)), and a component with
|
|
651
|
+
* α = 4, 5, 6 is the tensor component times the factor of its pair (`factors`). A symmetric tensor of
|
|
652
|
+
* rank 2 gives 6 components, one of rank 3 symmetric in its last pair a 3 × 6 matrix (d_iα), in its
|
|
653
|
+
* first pair a 6 × 3 matrix (e_αk), one of rank 4 a 6 × 6 matrix (s_αβ, c_αβ). Throws a RangeError for a specification
|
|
654
|
+
* without a symmetric index pair, factors that are missing or not one 1 or 2 per pair, and a tensor
|
|
655
|
+
* that lacks the index symmetry of its specification (within the tolerance, relative to its largest
|
|
656
|
+
* component).
|
|
657
|
+
*
|
|
658
|
+
* @remarks The tensor is flat, 3^rank components, as `tensorForm` gives a basis tensor.
|
|
659
|
+
*/
|
|
660
|
+
export function toVoigt(
|
|
661
|
+
tensor: readonly number[],
|
|
662
|
+
spec: TensorSpecArgument | TensorPropertyName,
|
|
663
|
+
options?: voigtNotation.VoigtOptions,
|
|
664
|
+
): readonly number[] | readonly (readonly number[])[] {
|
|
665
|
+
return voigtNotation.toVoigt(tensor, timeEven(spec), options);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* The tensor of a Voigt array (`toVoigt` in reverse): each tensor component is the Voigt component
|
|
670
|
+
* of its index pairs over the factors of the pairs, so that the tensor has the index symmetry of its
|
|
671
|
+
* specification. Throws a RangeError for a Voigt array of
|
|
672
|
+
* the wrong shape, and for one that is no tensor of the specification (for rank 4 with interchangeable
|
|
673
|
+
* pairs a 6 × 6 matrix that is not symmetric, for a totally symmetric tensor one whose
|
|
674
|
+
* components do not agree), within the tolerance relative to its largest component.
|
|
675
|
+
*
|
|
676
|
+
* @remarks The tensor is flat, 3^rank components, as `tensorForm` gives a basis tensor.
|
|
677
|
+
*/
|
|
678
|
+
export function fromVoigt(
|
|
679
|
+
voigt: readonly number[] | readonly (readonly number[])[],
|
|
680
|
+
spec: TensorSpecArgument | TensorPropertyName,
|
|
681
|
+
options?: voigtNotation.VoigtOptions,
|
|
682
|
+
): readonly number[] {
|
|
683
|
+
return voigtNotation.fromVoigt(voigt, timeEven(spec), options);
|
|
587
684
|
}
|
|
588
685
|
|
|
589
686
|
/**
|
|
590
687
|
* True if the crystal class allows the named property, e.g. `allowsProperty('-6m2',
|
|
591
688
|
* 'piezoelectric')`: the tensor that describes it (`TENSOR_PROPERTIES`) has a non-zero form under
|
|
592
689
|
* the class. Symmetry only allows a property; whether a crystal shows it is a question of the
|
|
593
|
-
* material. It does not depend on setting
|
|
690
|
+
* material. It does not depend on the setting. Throws a RangeError for an unknown key or
|
|
594
691
|
* name.
|
|
595
692
|
*/
|
|
596
693
|
export function allowsProperty(key: PointGroupKey, name: TensorPropertyName): boolean {
|
|
@@ -598,21 +695,38 @@ export function allowsProperty(key: PointGroupKey, name: TensorPropertyName): bo
|
|
|
598
695
|
}
|
|
599
696
|
|
|
600
697
|
/** The named properties the crystal class allows, in the order of `TENSOR_PROPERTIES`. */
|
|
601
|
-
export function allowedProperties(key: PointGroupKey): TensorPropertyName[] {
|
|
602
|
-
return TENSOR_PROPERTY_NAMES.filter((name) => allowsProperty(key, name));
|
|
698
|
+
export function allowedProperties(key: PointGroupKey): readonly TensorPropertyName[] {
|
|
699
|
+
return deepFreeze(TENSOR_PROPERTY_NAMES.filter((name) => allowsProperty(key, name)));
|
|
603
700
|
}
|
|
604
701
|
|
|
605
702
|
/**
|
|
606
703
|
* True if the group generated by `operations` allows the named property, e.g. for the site
|
|
607
|
-
* symmetry of a surface normal or the operations of a distorted crystal. The
|
|
608
|
-
*
|
|
704
|
+
* symmetry of a surface normal or the operations of a distorted crystal. The operations are read
|
|
705
|
+
* and closed as `tensorFormOf` reads them, within the tolerance, and it throws a RangeError as
|
|
706
|
+
* `tensorFormOf` does.
|
|
609
707
|
*/
|
|
610
|
-
export function allowsPropertyOf(
|
|
611
|
-
|
|
708
|
+
export function allowsPropertyOf(
|
|
709
|
+
operations: readonly OperationArgument[],
|
|
710
|
+
name: TensorPropertyName,
|
|
711
|
+
options?: ToleranceOptions,
|
|
712
|
+
): boolean {
|
|
713
|
+
checkOptions(options, TOLERANCE_KEYS, 'allowsPropertyOf');
|
|
714
|
+
const checked = propertyName(name);
|
|
715
|
+
const { spec, perms } = tensors.checkedSpec(checked);
|
|
716
|
+
return tensors.formOfGroup(tensors.callerGroup(unitary(operations), options), spec, perms).basis.length > 0;
|
|
612
717
|
}
|
|
613
718
|
|
|
614
|
-
/** The named properties the group generated by `operations` allows.
|
|
615
|
-
export function allowedPropertiesOf(
|
|
616
|
-
|
|
617
|
-
|
|
719
|
+
/** The named properties the group generated by `operations` allows. Reads the operations as `allowsPropertyOf`. */
|
|
720
|
+
export function allowedPropertiesOf(
|
|
721
|
+
operations: readonly OperationArgument[],
|
|
722
|
+
options?: ToleranceOptions,
|
|
723
|
+
): readonly TensorPropertyName[] {
|
|
724
|
+
checkOptions(options, TOLERANCE_KEYS, 'allowedPropertiesOf');
|
|
725
|
+
const group = tensors.callerGroup(unitary(operations), options);
|
|
726
|
+
return deepFreeze(
|
|
727
|
+
TENSOR_PROPERTY_NAMES.filter((name) => {
|
|
728
|
+
const { spec, perms } = tensors.checkedSpec(name);
|
|
729
|
+
return tensors.formOfGroup(group, spec, perms).basis.length > 0;
|
|
730
|
+
}),
|
|
731
|
+
);
|
|
618
732
|
}
|