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