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/README.md
CHANGED
|
@@ -12,8 +12,8 @@ npm install symcrys
|
|
|
12
12
|
import { operations, symbol, tensorForm } from 'symcrys';
|
|
13
13
|
|
|
14
14
|
symbol('32'); // '321': ITC short symbol of the default setting
|
|
15
|
-
operations('-3m'); // 12 operations
|
|
16
|
-
tensorForm('mm2', { rank: 3,
|
|
15
|
+
operations('-3m'); // 12 operations: W in the lattice basis (matrix) and Cartesian (cartesian); x ∥ a, z ∥ c
|
|
16
|
+
tensorForm('mm2', { rank: 3, kind: 'polar', intrinsic: 'symmetric-last-pair' }).parameters;
|
|
17
17
|
// [[0,0,2], [1,1,2], [2,0,0], [2,1,1], [2,2,2]]: xxz, yyz, zxx, zyy, zzz
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -25,16 +25,16 @@ white group, and a crystal without magnetic order has the grey group of its clas
|
|
|
25
25
|
import { allowedProperties } from 'symcrys/magnetic';
|
|
26
26
|
|
|
27
27
|
allowedProperties("321'"); // ['piezoelectric', 'gyrotropic']: quartz
|
|
28
|
-
allowedProperties("m'm'2"); // six of the
|
|
28
|
+
allowedProperties("m'm'2"); // six of the eight names, 'ferromagnetic' among them
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
The 17 plane groups and the 10 plane point groups are in `symcrys/plane`, in the lattice basis:
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
|
-
import { symmetryElements,
|
|
34
|
+
import { symmetryElements, wyckoffPosition } from 'symcrys/plane';
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
symmetryElements('p4gm').
|
|
36
|
+
wyckoffPosition('p6mm', [1 / 3, 2 / 3]).letter; // 'b'
|
|
37
|
+
symmetryElements('p4gm').rotationPoints; // the 4- and 2-fold rotation points, each once modulo the lattice
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
Documentation (getting started, conventions, tensors, examples, reference):
|
package/dist/cell.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* coordinates, as `latticeBasis` gives it; lengths in any unit, angles in degrees.
|
|
5
5
|
*/
|
|
6
6
|
import { type Mat3, type Vec3 } from './linalg.js';
|
|
7
|
+
import { type ToleranceOptions } from './tolerances.js';
|
|
7
8
|
/** The lattice parameters of a cell: edge lengths and angles in degrees (α between b and c, β between a and c, γ between a and b). */
|
|
8
9
|
export interface LatticeParameters {
|
|
9
10
|
/** Edge length a. */
|
|
@@ -28,9 +29,9 @@ export interface CellAngles {
|
|
|
28
29
|
/** Angle γ between a and b, in degrees. */
|
|
29
30
|
readonly gamma: number;
|
|
30
31
|
}
|
|
31
|
-
/** An operation of a list given to `residualOperations`: at least its matrix; other fields are kept. */
|
|
32
|
+
/** An operation of a list given to `residualOperations`: at least its matrix W; other fields are kept. */
|
|
32
33
|
export interface CellOperation {
|
|
33
|
-
/** The 3×3 matrix W acting on lattice coordinates. */
|
|
34
|
+
/** The integer 3×3 matrix W acting on lattice coordinates (the `matrix` of an operation). */
|
|
34
35
|
readonly matrix: Mat3;
|
|
35
36
|
}
|
|
36
37
|
/** Options of `isValidCell`. */
|
|
@@ -42,11 +43,6 @@ export interface IsValidCellOptions {
|
|
|
42
43
|
*/
|
|
43
44
|
readonly minVolumeRatio?: number;
|
|
44
45
|
}
|
|
45
|
-
/** Options of `residualOperations`. */
|
|
46
|
-
export interface ResidualOperationsOptions {
|
|
47
|
-
/** The largest accepted deviation of WᵀGW from G, relative to the largest entry of G; default `EPSILON`. */
|
|
48
|
-
readonly tolerance?: number;
|
|
49
|
-
}
|
|
50
46
|
/**
|
|
51
47
|
* Whether three angles (degrees) belong to a cell: each between 0° and 180°, and the three axes not
|
|
52
48
|
* in one plane (the volume radicand 1 − cos²α − cos²β − cos²γ + 2 cos α cos β cos γ exceeds 10⁻¹², i.e.
|
|
@@ -64,7 +60,7 @@ export declare function isValidCell(angles: CellAngles, options?: IsValidCellOpt
|
|
|
64
60
|
* axis b, b lies along y (docs/conventions.md, "Cell, metric and indices"). The basis is
|
|
65
61
|
* right-handed. Throws a RangeError for an edge that is not positive and for angles that give no cell.
|
|
66
62
|
*/
|
|
67
|
-
export declare function latticeFromParameters(
|
|
63
|
+
export declare function latticeFromParameters(parameters: LatticeParameters): Mat3;
|
|
68
64
|
/**
|
|
69
65
|
* The lattice parameters of a basis given as the columns of a Cartesian matrix: the edge lengths and
|
|
70
66
|
* the angles in degrees. Independent of the orientation of the basis in the Cartesian frame (and
|
|
@@ -79,22 +75,29 @@ export declare function metricTensor(basis: Mat3): Mat3;
|
|
|
79
75
|
*/
|
|
80
76
|
export declare function reciprocalBasis(basis: Mat3): Mat3;
|
|
81
77
|
/** The angle in degrees between two lattice directions [uvw] (coordinates in the basis, columns a, b, c), 0° to 180°. Throws a RangeError for a zero vector. */
|
|
82
|
-
export declare function angleBetweenDirections(basis: Mat3,
|
|
78
|
+
export declare function angleBetweenDirections(basis: Mat3, direction1: Vec3, direction2: Vec3): number;
|
|
83
79
|
/**
|
|
84
80
|
* The angle in degrees between the normals of two planes (hkl), 0° to 180°: the angle between the
|
|
85
81
|
* reciprocal vectors h·a* + k·b* + l·c*. For two faces this is 180° minus the interior dihedral
|
|
86
82
|
* angle. Throws a RangeError for a zero vector.
|
|
87
83
|
*/
|
|
88
|
-
export declare function angleBetweenPlanes(basis: Mat3,
|
|
84
|
+
export declare function angleBetweenPlanes(basis: Mat3, plane1: Vec3, plane2: Vec3): number;
|
|
85
|
+
/**
|
|
86
|
+
* The unit normal of a plane (hkl) in a cell, a Cartesian vector: h·a* + k·b* + l·c* normalised, the
|
|
87
|
+
* pole of the face (#137 G4). With `latticeBasis(family)` for a family with fixed cell angles, or
|
|
88
|
+
* `latticeFromParameters` for a real cell; Miller indices of hexagonal axes are three, without i.
|
|
89
|
+
* Throws a RangeError for a basis that is not a regular 3 × 3 matrix and for a zero vector.
|
|
90
|
+
*/
|
|
91
|
+
export declare function faceNormal(basis: Mat3, hkl: Vec3): Vec3;
|
|
89
92
|
/**
|
|
90
|
-
* The operations that leave the metric of a cell unchanged: those W (integer matrices
|
|
91
|
-
* coordinates of a lattice direction, as `
|
|
93
|
+
* The operations that leave the metric of a cell unchanged: those W (`matrix`, the integer matrices
|
|
94
|
+
* on the coordinates of a lattice direction, as `operations` gives them) with WᵀGW = G, G the metric
|
|
92
95
|
* tensor of `basis`. It is the point symmetry of a distorted lattice among the operations of a group;
|
|
93
96
|
* the list is taken as it is, not closed into a group, and the kept operations are the ones of the
|
|
94
97
|
* list, in its order. The deviation counts relative to the largest entry of G (`tolerance`, default
|
|
95
98
|
* `EPSILON`), so the result does not depend on the unit of the edge lengths.
|
|
96
99
|
*/
|
|
97
|
-
export declare function residualOperations<T extends CellOperation>(operations: readonly T[], basis: Mat3, options?:
|
|
100
|
+
export declare function residualOperations<T extends CellOperation>(operations: readonly T[], basis: Mat3, options?: ToleranceOptions): readonly T[];
|
|
98
101
|
/** An operation of the magnetic API passed to `residualOperations`: its matrix and whether it is combined with time reversal. */
|
|
99
102
|
export interface MagneticCellOperation extends CellOperation {
|
|
100
103
|
/** Whether the operation is combined with time reversal. */
|
|
@@ -102,11 +105,11 @@ export interface MagneticCellOperation extends CellOperation {
|
|
|
102
105
|
}
|
|
103
106
|
/**
|
|
104
107
|
* The operations of a list that keep the metric of a cell: W with WᵀGW = G, G the metric tensor
|
|
105
|
-
* of `basis`. The operations are integer
|
|
106
|
-
* gives them; the list is taken as it is and the kept operations are the ones of the list, in its
|
|
108
|
+
* of `basis`. The operations are read by `matrix`, the integer matrix W on lattice coordinates, as
|
|
109
|
+
* `operations` gives them; the list is taken as it is and the kept operations are the ones of the list, in its
|
|
107
110
|
* order. The deviation counts relative to the largest entry of G (`tolerance`, default `EPSILON`).
|
|
108
111
|
* Every operation must say whether it is combined with time reversal (`timeReversal`), which is
|
|
109
112
|
* kept; one that does not (an operation of the crystallographic API) is a RangeError.
|
|
110
113
|
*/
|
|
111
|
-
export declare function residualMagneticOperations<T extends MagneticCellOperation>(operations: readonly T[], basis: Mat3, options?:
|
|
114
|
+
export declare function residualMagneticOperations<T extends MagneticCellOperation>(operations: readonly T[], basis: Mat3, options?: ToleranceOptions): readonly T[];
|
|
112
115
|
//# sourceMappingURL=cell.d.ts.map
|
package/dist/cell.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"cell.d.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AAoBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,iBAAiB,CAQhE;AAED,2HAA2H;AAC3H,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAG9C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAGjD;AAeD,gKAAgK;AAChK,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,MAAM,CAG9F;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,CAIlF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,CAKvD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,aAAa,EACxD,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,KAAK,EAAE,IAAI,EACX,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS,CAAC,EAAE,CA2Bd;AAED,iIAAiI;AACjI,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,qBAAqB,EACxE,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,KAAK,EAAE,IAAI,EACX,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS,CAAC,EAAE,CAGd"}
|
package/dist/cell.js
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* Plain data in and out: a basis is a 3×3 matrix whose columns are a, b, c in Cartesian
|
|
4
4
|
* coordinates, as `latticeBasis` gives it; lengths in any unit, angles in degrees.
|
|
5
5
|
*/
|
|
6
|
+
import { checkObject, checkOptions, shown, TOLERANCE_KEYS } from './checks.js';
|
|
6
7
|
import { apply, inverse, isSingular, multiply, transpose } from './linalg.js';
|
|
7
8
|
import { checkTimeReversal } from './operations.js';
|
|
8
|
-
import {
|
|
9
|
+
import { toleranceOf } from './tolerances.js';
|
|
10
|
+
import { deepFreeze } from './freeze.js';
|
|
9
11
|
const DEG = Math.PI / 180;
|
|
10
12
|
/** Cosine of an angle in degrees, exact at the multiples of 30° that cells use (90°, 60°, 120°, 180°). */
|
|
11
13
|
function cosDeg(x) {
|
|
@@ -31,6 +33,15 @@ function anglesOk({ alpha, beta, gamma }) {
|
|
|
31
33
|
* number from 0 to 1.
|
|
32
34
|
*/
|
|
33
35
|
export function isValidCell(angles, options) {
|
|
36
|
+
checkOptions(options, ['minVolumeRatio'], 'isValidCell');
|
|
37
|
+
checkObject(angles, 'isValidCell takes the angles { alpha, beta, gamma }');
|
|
38
|
+
// Numbers out of range are no cell (false); anything else is wrong input.
|
|
39
|
+
for (const name of ['alpha', 'beta', 'gamma']) {
|
|
40
|
+
const x = angles[name];
|
|
41
|
+
if (!(typeof x === 'number' && Number.isFinite(x))) {
|
|
42
|
+
throw new RangeError(`The angle ${name} must be a finite number of degrees, not ${shown(x)}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
34
45
|
if (!anglesOk(angles))
|
|
35
46
|
return false;
|
|
36
47
|
const min = options?.minVolumeRatio ?? 0;
|
|
@@ -41,14 +52,16 @@ export function isValidCell(angles, options) {
|
|
|
41
52
|
return false;
|
|
42
53
|
return Math.sqrt(r) >= min;
|
|
43
54
|
}
|
|
44
|
-
function checkEdges(
|
|
55
|
+
function checkEdges(p) {
|
|
56
|
+
checkObject(p, 'latticeFromParameters takes the parameters { a, b, c, alpha, beta, gamma }');
|
|
57
|
+
const { a, b, c } = p;
|
|
45
58
|
for (const [name, x] of [
|
|
46
59
|
['a', a],
|
|
47
60
|
['b', b],
|
|
48
61
|
['c', c],
|
|
49
62
|
]) {
|
|
50
63
|
if (typeof x !== 'number' || !Number.isFinite(x) || x <= 0) {
|
|
51
|
-
throw new RangeError(`latticeFromParameters: edge ${name} must be a positive number, not ${
|
|
64
|
+
throw new RangeError(`latticeFromParameters: edge ${name} must be a positive number, not ${shown(x)}`);
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
67
|
}
|
|
@@ -60,24 +73,24 @@ function checkEdges({ a, b, c }) {
|
|
|
60
73
|
* axis b, b lies along y (docs/conventions.md, "Cell, metric and indices"). The basis is
|
|
61
74
|
* right-handed. Throws a RangeError for an edge that is not positive and for angles that give no cell.
|
|
62
75
|
*/
|
|
63
|
-
export function latticeFromParameters(
|
|
64
|
-
checkEdges(
|
|
65
|
-
if (!isValidCell(
|
|
66
|
-
throw new RangeError(`latticeFromParameters: angles ${
|
|
76
|
+
export function latticeFromParameters(parameters) {
|
|
77
|
+
checkEdges(parameters);
|
|
78
|
+
if (!isValidCell(parameters)) {
|
|
79
|
+
throw new RangeError(`latticeFromParameters: angles ${parameters.alpha}°, ${parameters.beta}°, ${parameters.gamma}° give no cell`);
|
|
67
80
|
}
|
|
68
|
-
const ca = cosDeg(
|
|
69
|
-
const cb = cosDeg(
|
|
70
|
-
const cg = cosDeg(
|
|
81
|
+
const ca = cosDeg(parameters.alpha);
|
|
82
|
+
const cb = cosDeg(parameters.beta);
|
|
83
|
+
const cg = cosDeg(parameters.gamma);
|
|
71
84
|
const sg = Math.sqrt(1 - cg * cg);
|
|
72
|
-
const volumeRatio = Math.sqrt(radicand(
|
|
85
|
+
const volumeRatio = Math.sqrt(radicand(parameters));
|
|
73
86
|
// columns: a = (a, 0, 0), b = (b cos γ, b sin γ, 0), c = (c cos β, c (cos α − cos β cos γ)/sin γ, c V/(abc sin γ))
|
|
74
|
-
const cy = (
|
|
75
|
-
const cz = (
|
|
76
|
-
return [
|
|
77
|
-
[
|
|
78
|
-
[0,
|
|
87
|
+
const cy = (parameters.c * (ca - cb * cg)) / sg;
|
|
88
|
+
const cz = (parameters.c * volumeRatio) / sg;
|
|
89
|
+
return deepFreeze([
|
|
90
|
+
[parameters.a + 0, parameters.b * cg + 0, parameters.c * cb + 0],
|
|
91
|
+
[0, parameters.b * sg + 0, cy + 0],
|
|
79
92
|
[0, 0, cz + 0],
|
|
80
|
-
];
|
|
93
|
+
]);
|
|
81
94
|
}
|
|
82
95
|
function columns(basis) {
|
|
83
96
|
return [0, 1, 2].map((j) => [basis[0][j], basis[1][j], basis[2][j]]);
|
|
@@ -105,12 +118,12 @@ export function latticeParameters(basis) {
|
|
|
105
118
|
const cross = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];
|
|
106
119
|
return Math.atan2(norm(cross), dot(u, v)) / DEG + 0;
|
|
107
120
|
};
|
|
108
|
-
return { a: norm(a), b: norm(b), c: norm(c), alpha: angle(b, c), beta: angle(a, c), gamma: angle(a, b) };
|
|
121
|
+
return deepFreeze({ a: norm(a), b: norm(b), c: norm(c), alpha: angle(b, c), beta: angle(a, c), gamma: angle(a, b) });
|
|
109
122
|
}
|
|
110
123
|
/** The metric tensor G = AᵀA of a basis A (columns a, b, c): g_ij = a_i · a_j, in the unit of the edge lengths squared. */
|
|
111
124
|
export function metricTensor(basis) {
|
|
112
125
|
checkBasis(basis, 'metricTensor');
|
|
113
|
-
return multiply(transpose(basis), basis);
|
|
126
|
+
return deepFreeze(multiply(transpose(basis), basis));
|
|
114
127
|
}
|
|
115
128
|
/**
|
|
116
129
|
* The reciprocal basis B = A⁻ᵀ of a basis A (columns a, b, c) as the columns a*, b*, c*, with
|
|
@@ -118,7 +131,7 @@ export function metricTensor(basis) {
|
|
|
118
131
|
*/
|
|
119
132
|
export function reciprocalBasis(basis) {
|
|
120
133
|
checkBasis(basis, 'reciprocalBasis');
|
|
121
|
-
return transpose(inverse(basis));
|
|
134
|
+
return deepFreeze(transpose(inverse(basis)));
|
|
122
135
|
}
|
|
123
136
|
function vector(v, name) {
|
|
124
137
|
if (!Array.isArray(v) || v.length !== 3 || !v.every((x) => typeof x === 'number' && Number.isFinite(x))) {
|
|
@@ -133,34 +146,44 @@ function angleOf(u, v) {
|
|
|
133
146
|
return Math.atan2(norm(cross), dot(u, v)) / DEG + 0;
|
|
134
147
|
}
|
|
135
148
|
/** The angle in degrees between two lattice directions [uvw] (coordinates in the basis, columns a, b, c), 0° to 180°. Throws a RangeError for a zero vector. */
|
|
136
|
-
export function angleBetweenDirections(basis,
|
|
149
|
+
export function angleBetweenDirections(basis, direction1, direction2) {
|
|
137
150
|
checkBasis(basis, 'angleBetweenDirections');
|
|
138
|
-
return angleOf(apply(basis, vector(
|
|
151
|
+
return angleOf(apply(basis, vector(direction1, 'direction1')), apply(basis, vector(direction2, 'direction2')));
|
|
139
152
|
}
|
|
140
153
|
/**
|
|
141
154
|
* The angle in degrees between the normals of two planes (hkl), 0° to 180°: the angle between the
|
|
142
155
|
* reciprocal vectors h·a* + k·b* + l·c*. For two faces this is 180° minus the interior dihedral
|
|
143
156
|
* angle. Throws a RangeError for a zero vector.
|
|
144
157
|
*/
|
|
145
|
-
export function angleBetweenPlanes(basis,
|
|
158
|
+
export function angleBetweenPlanes(basis, plane1, plane2) {
|
|
146
159
|
checkBasis(basis, 'angleBetweenPlanes');
|
|
147
160
|
const b = reciprocalBasis(basis);
|
|
148
|
-
return angleOf(apply(b, vector(
|
|
161
|
+
return angleOf(apply(b, vector(plane1, 'plane1')), apply(b, vector(plane2, 'plane2')));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The unit normal of a plane (hkl) in a cell, a Cartesian vector: h·a* + k·b* + l·c* normalised, the
|
|
165
|
+
* pole of the face (#137 G4). With `latticeBasis(family)` for a family with fixed cell angles, or
|
|
166
|
+
* `latticeFromParameters` for a real cell; Miller indices of hexagonal axes are three, without i.
|
|
167
|
+
* Throws a RangeError for a basis that is not a regular 3 × 3 matrix and for a zero vector.
|
|
168
|
+
*/
|
|
169
|
+
export function faceNormal(basis, hkl) {
|
|
170
|
+
checkBasis(basis, 'faceNormal');
|
|
171
|
+
const v = apply(reciprocalBasis(basis), vector(hkl, 'hkl'));
|
|
172
|
+
const n = norm(v);
|
|
173
|
+
return Object.freeze(v.map((x) => x / n + 0));
|
|
149
174
|
}
|
|
150
175
|
/**
|
|
151
|
-
* The operations that leave the metric of a cell unchanged: those W (integer matrices
|
|
152
|
-
* coordinates of a lattice direction, as `
|
|
176
|
+
* The operations that leave the metric of a cell unchanged: those W (`matrix`, the integer matrices
|
|
177
|
+
* on the coordinates of a lattice direction, as `operations` gives them) with WᵀGW = G, G the metric
|
|
153
178
|
* tensor of `basis`. It is the point symmetry of a distorted lattice among the operations of a group;
|
|
154
179
|
* the list is taken as it is, not closed into a group, and the kept operations are the ones of the
|
|
155
180
|
* list, in its order. The deviation counts relative to the largest entry of G (`tolerance`, default
|
|
156
181
|
* `EPSILON`), so the result does not depend on the unit of the edge lengths.
|
|
157
182
|
*/
|
|
158
183
|
export function residualOperations(operations, basis, options) {
|
|
184
|
+
checkOptions(options, TOLERANCE_KEYS, 'residualOperations');
|
|
159
185
|
const g = metricTensor(basis);
|
|
160
|
-
const tolerance = options
|
|
161
|
-
if (typeof tolerance !== 'number' || !Number.isFinite(tolerance) || tolerance < 0) {
|
|
162
|
-
throw new RangeError(`residualOperations: tolerance must be a non-negative number, not ${JSON.stringify(tolerance)}`);
|
|
163
|
-
}
|
|
186
|
+
const tolerance = toleranceOf(options, 'metric');
|
|
164
187
|
if (!Array.isArray(operations))
|
|
165
188
|
throw new RangeError('residualOperations: operations must be a list');
|
|
166
189
|
operations.forEach((op, i) => {
|
|
@@ -170,17 +193,22 @@ export function residualOperations(operations, basis, options) {
|
|
|
170
193
|
m.every((r) => Array.isArray(r) && r.length === 3 && r.every((x) => typeof x === 'number' && Number.isFinite(x)));
|
|
171
194
|
if (!ok)
|
|
172
195
|
throw new RangeError(`residualOperations: operation ${i} has no 3×3 matrix of finite numbers`);
|
|
196
|
+
// W is an integer matrix; a Cartesian matrix (±√3/2) passed as `matrix` would give a wrong answer.
|
|
197
|
+
if (!m.every((r) => r.every((x) => Math.abs(x - Math.round(x)) <= 1e-9))) {
|
|
198
|
+
throw new RangeError(`residualOperations: the matrix of operation ${i} is not an integer matrix in the lattice basis (the field matrix of an operation, not cartesian): ${shown(m)}`);
|
|
199
|
+
}
|
|
173
200
|
});
|
|
174
201
|
const scale = Math.max(...g.flat().map(Math.abs));
|
|
175
|
-
|
|
202
|
+
// The list is frozen, not the operations in it, which are the caller's.
|
|
203
|
+
return Object.freeze(operations.filter((op) => {
|
|
176
204
|
const m = multiply(multiply(transpose(op.matrix), g), op.matrix);
|
|
177
|
-
return m.every((row, i) => row.every((x, j) => Math.abs(x - g[i][j])
|
|
178
|
-
});
|
|
205
|
+
return m.every((row, i) => row.every((x, j) => Math.abs(x - g[i][j]) < tolerance * scale));
|
|
206
|
+
}));
|
|
179
207
|
}
|
|
180
208
|
/**
|
|
181
209
|
* The operations of a list that keep the metric of a cell: W with WᵀGW = G, G the metric tensor
|
|
182
|
-
* of `basis`. The operations are integer
|
|
183
|
-
* gives them; the list is taken as it is and the kept operations are the ones of the list, in its
|
|
210
|
+
* of `basis`. The operations are read by `matrix`, the integer matrix W on lattice coordinates, as
|
|
211
|
+
* `operations` gives them; the list is taken as it is and the kept operations are the ones of the list, in its
|
|
184
212
|
* order. The deviation counts relative to the largest entry of G (`tolerance`, default `EPSILON`).
|
|
185
213
|
* Every operation must say whether it is combined with time reversal (`timeReversal`), which is
|
|
186
214
|
* kept; one that does not (an operation of the crystallographic API) is a RangeError.
|
package/dist/cell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAwB,MAAM,aAA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C,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAQD;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CACxC,UAAwB,EACxB,KAAW,EACX,OAA0B;IAE1B,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QAAE,iBAAiB,CAAC,UAAqD,CAAC,CAAC;IACxG,OAAO,kBAAkB,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/checks.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks of what a caller passes in, shared by the entry points (#137 D2): wrong input is a
|
|
3
|
+
* RangeError that names what is wrong, never a TypeError from deep inside the library.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A value for an error message; never throws: numbers as written (NaN, Infinity), BigInt with its
|
|
7
|
+
* `n`, a function or symbol by its kind, and a value with a cycle as such.
|
|
8
|
+
*/
|
|
9
|
+
export declare function shown(value: unknown): string;
|
|
10
|
+
/** The keys of the options of the functions that choose a setting of a point group. */
|
|
11
|
+
export declare const SETTING_KEYS: readonly ["setting", "axes", "uniqueAxis"];
|
|
12
|
+
/** The key of the options of the functions that compare numbers of a caller. */
|
|
13
|
+
export declare const TOLERANCE_KEYS: readonly ["tolerance"];
|
|
14
|
+
/**
|
|
15
|
+
* Throws unless `options` is undefined or a plain object whose keys are all among `keys`: an
|
|
16
|
+
* options argument of the wrong type and a key the function does not know (a misspelling such as
|
|
17
|
+
* `uniqueaxis`, which would otherwise be ignored) are RangeErrors. The option `convention`, removed
|
|
18
|
+
* in 0.11.0, gets a message of its own.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkOptions(options: unknown, keys: readonly string[], what: string): void;
|
|
21
|
+
/** The options restricted to `keys`, for a function that passes part of its options on. */
|
|
22
|
+
export declare function pick<T extends object>(options: T | undefined, keys: readonly string[]): Partial<T> | undefined;
|
|
23
|
+
/** Throws unless `v` is an array of `length` finite numbers. */
|
|
24
|
+
export declare function checkNumbers(v: unknown, length: number, what: string): asserts v is readonly number[];
|
|
25
|
+
/** True for a plain object: `{ … }` or one without a prototype, not an array, a Map or a Date. */
|
|
26
|
+
export declare function isPlainObject(v: unknown): v is Record<string, unknown>;
|
|
27
|
+
/** Throws unless `v` is a plain object. */
|
|
28
|
+
export declare function checkObject(v: unknown, what: string): asserts v is object;
|
|
29
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAoB5C;AAED,uFAAuF;AACvF,eAAO,MAAM,YAAY,4CAA6C,CAAC;AACvE,gFAAgF;AAChF,eAAO,MAAM,cAAc,wBAAyB,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAgB1F;AAED,2FAA2F;AAC3F,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,CAG9G;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,IAAI,SAAS,MAAM,EAAE,CAIrG;AAED,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAItE;AAED,2CAA2C;AAC3C,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,IAAI,MAAM,CAEzE"}
|
package/dist/checks.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks of what a caller passes in, shared by the entry points (#137 D2): wrong input is a
|
|
3
|
+
* RangeError that names what is wrong, never a TypeError from deep inside the library.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A value for an error message; never throws: numbers as written (NaN, Infinity), BigInt with its
|
|
7
|
+
* `n`, a function or symbol by its kind, and a value with a cycle as such.
|
|
8
|
+
*/
|
|
9
|
+
export function shown(value) {
|
|
10
|
+
if (typeof value === 'number')
|
|
11
|
+
return String(value);
|
|
12
|
+
if (typeof value === 'bigint')
|
|
13
|
+
return `${value}n`;
|
|
14
|
+
if (typeof value === 'function')
|
|
15
|
+
return 'a function';
|
|
16
|
+
if (typeof value === 'symbol')
|
|
17
|
+
return 'a symbol';
|
|
18
|
+
try {
|
|
19
|
+
return (JSON.stringify(value, (_, v) => typeof v === 'bigint'
|
|
20
|
+
? `${v}n`
|
|
21
|
+
: typeof v === 'symbol'
|
|
22
|
+
? 'a symbol'
|
|
23
|
+
: typeof v === 'number' && !Number.isFinite(v)
|
|
24
|
+
? String(v)
|
|
25
|
+
: v) ?? String(value));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return 'a value that contains itself';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** The keys of the options of the functions that choose a setting of a point group. */
|
|
32
|
+
export const SETTING_KEYS = ['setting', 'axes', 'uniqueAxis'];
|
|
33
|
+
/** The key of the options of the functions that compare numbers of a caller. */
|
|
34
|
+
export const TOLERANCE_KEYS = ['tolerance'];
|
|
35
|
+
/**
|
|
36
|
+
* Throws unless `options` is undefined or a plain object whose keys are all among `keys`: an
|
|
37
|
+
* options argument of the wrong type and a key the function does not know (a misspelling such as
|
|
38
|
+
* `uniqueaxis`, which would otherwise be ignored) are RangeErrors. The option `convention`, removed
|
|
39
|
+
* in 0.11.0, gets a message of its own.
|
|
40
|
+
*/
|
|
41
|
+
export function checkOptions(options, keys, what) {
|
|
42
|
+
if (options === undefined)
|
|
43
|
+
return;
|
|
44
|
+
if (!isPlainObject(options)) {
|
|
45
|
+
throw new RangeError(`${what} takes its options as an object { ${keys.join(', ')} }, not ${shown(options)}`);
|
|
46
|
+
}
|
|
47
|
+
const unknown = Object.keys(options).filter((k) => !keys.includes(k));
|
|
48
|
+
if (unknown.includes('convention')) {
|
|
49
|
+
throw new RangeError('The option convention was removed in symcrys 0.11.0: symcrys follows ITC only (CHANGELOG.md, 0.11.0)');
|
|
50
|
+
}
|
|
51
|
+
if (unknown.length > 0) {
|
|
52
|
+
throw new RangeError(`${what} takes the options ${keys.join(', ')}, not ${unknown.map((k) => JSON.stringify(k)).join(', ')}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** The options restricted to `keys`, for a function that passes part of its options on. */
|
|
56
|
+
export function pick(options, keys) {
|
|
57
|
+
if (options === undefined)
|
|
58
|
+
return undefined;
|
|
59
|
+
return Object.fromEntries(Object.entries(options).filter(([k]) => keys.includes(k)));
|
|
60
|
+
}
|
|
61
|
+
/** Throws unless `v` is an array of `length` finite numbers. */
|
|
62
|
+
export function checkNumbers(v, length, what) {
|
|
63
|
+
if (!Array.isArray(v) || v.length !== length || !v.every((x) => typeof x === 'number' && Number.isFinite(x))) {
|
|
64
|
+
throw new RangeError(`${what} must be ${length} finite numbers, not ${shown(v)}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** True for a plain object: `{ … }` or one without a prototype, not an array, a Map or a Date. */
|
|
68
|
+
export function isPlainObject(v) {
|
|
69
|
+
if (typeof v !== 'object' || v === null)
|
|
70
|
+
return false;
|
|
71
|
+
const proto = Object.getPrototypeOf(v);
|
|
72
|
+
return proto === Object.prototype || proto === null;
|
|
73
|
+
}
|
|
74
|
+
/** Throws unless `v` is a plain object. */
|
|
75
|
+
export function checkObject(v, what) {
|
|
76
|
+
if (!isPlainObject(v))
|
|
77
|
+
throw new RangeError(`${what}, not ${shown(v)}`);
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,GAAG,KAAK,GAAG,CAAC;IAClD,IAAI,OAAO,KAAK,KAAK,UAAU;QAAE,OAAO,YAAY,CAAC;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC;IACjD,IAAI,CAAC;QACH,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAU,EAAE,EAAE,CACtC,OAAO,CAAC,KAAK,QAAQ;YACnB,CAAC,CAAC,GAAG,CAAC,GAAG;YACT,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ;gBACrB,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC5C,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;oBACX,CAAC,CAAC,CAAC,CACV,IAAI,MAAM,CAAC,KAAK,CAAC,CACnB,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,8BAA8B,CAAC;IACxC,CAAC;AACH,CAAC;AAED,uFAAuF;AACvF,MAA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AM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAe,CAAC;AACrG,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAAC,CAAU,EAAE,MAAc,EAAE,IAAY;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7G,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,YAAY,MAAM,wBAAwB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC;AACH,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAY,CAAC;IAClD,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACtD,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,WAAW,CAAC,CAAU,EAAE,IAAY;IAClD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The group generated by operations a caller passes in, within a tolerance, and that group made
|
|
3
|
+
* exact (docs/conventions.md, "Tolerances"). Operations read from a file or computed elsewhere carry
|
|
4
|
+
* rounding errors (√3/2 written as 0.866025); compared within the tolerance they still generate the
|
|
5
|
+
* right group, but its matrices are not exactly a group, and a tensor form computed from them has
|
|
6
|
+
* the wrong number of free parameters (#89). `idealGroup` therefore replaces them by the exact group
|
|
7
|
+
* nearest to them before anything is computed from them.
|
|
8
|
+
*/
|
|
9
|
+
import type { CartesianOperation } from './operations.js';
|
|
10
|
+
/** No finite group of Cartesian operations that symcrys computes with has more elements (m-3m1' has 96). */
|
|
11
|
+
export declare const MAX_GROUP_ORDER = 200;
|
|
12
|
+
/** True if the two operations agree in time reversal and in every matrix entry within `tolerance`. */
|
|
13
|
+
export declare function sameWithin(a: CartesianOperation, b: CartesianOperation, tolerance: number): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The group the operations generate within `tolerance` (two operations equal when they agree in
|
|
16
|
+
* time reversal and in every matrix entry within it), the identity first, then the operations of
|
|
17
|
+
* the list that are new, then products in the order they are found; or undefined if it has more
|
|
18
|
+
* than `maxOrder` elements. A new operation is compared only with the operations of its kind.
|
|
19
|
+
*/
|
|
20
|
+
export declare function closeWithin(operations: readonly CartesianOperation[], tolerance: number, maxOrder?: number): CartesianOperation[] | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The group the operations generate within `tolerance` (`closeWithin`); throws a RangeError if it
|
|
23
|
+
* has more than `MAX_GROUP_ORDER` elements.
|
|
24
|
+
*/
|
|
25
|
+
export declare function closedGroup(operations: readonly CartesianOperation[], tolerance: number): CartesianOperation[];
|
|
26
|
+
/** A group made exact: its operations, and how far they lie from the operations it was made from. */
|
|
27
|
+
export interface IdealGroup {
|
|
28
|
+
readonly operations: readonly CartesianOperation[];
|
|
29
|
+
/** The largest difference of a matrix entry from the closed operations of the caller. */
|
|
30
|
+
readonly deviation: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The group generated by `operations` within `tolerance` (`closeWithin`, at most `MAX_GROUP_ORDER`
|
|
34
|
+
* elements), made exact: each matrix f(x) is replaced by the mean of f(xy)·f(y)⁻¹ over the group,
|
|
35
|
+
* repeated until nothing changes. For an exact group this is f(x) itself; for matrices that are a
|
|
36
|
+
* group only within a small error the passes settle on an exact representation nearby (tested in
|
|
37
|
+
* closure.test.ts and tensors/tolerance.test.ts), and the invariant metric of the result makes it
|
|
38
|
+
* orthogonal. Entries within 10⁻¹² of 0, ±1/2, ±√2/2, ±√3/2, ±1 are then set to them, so that exact
|
|
39
|
+
* input stays exact. Throws a RangeError if the operations generate more than `MAX_GROUP_ORDER`
|
|
40
|
+
* elements or do not settle into a group (a tolerance too large or too small for their errors).
|
|
41
|
+
*/
|
|
42
|
+
export declare function idealGroup(operations: readonly CartesianOperation[], tolerance: number): IdealGroup;
|
|
43
|
+
//# sourceMappingURL=closure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closure.d.ts","sourceRoot":"","sources":["../src/closure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAY1D,4GAA4G;AAC5G,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,sGAAsG;AACtG,wBAAgB,UAAU,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAKnG;AAMD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,SAAS,kBAAkB,EAAE,EACzC,SAAS,EAAE,MAAM,EACjB,QAAQ,SAAkB,GACzB,kBAAkB,EAAE,GAAG,SAAS,CA+BlC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAQ9G;AA+BD,qGAAqG;AACrG,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACnD,yFAAyF;IACzF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,CAyEnG"}
|