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
|
@@ -9,42 +9,75 @@
|
|
|
9
9
|
* NumPy array of shape (3,)*n in C order). Moved from birss-app (`tensorForms.ts`,
|
|
10
10
|
* `tensorProjection.ts`, `linalg.ts`, revision 2be5fe3).
|
|
11
11
|
*/
|
|
12
|
+
import { SETTING_KEYS, TOLERANCE_KEYS, checkNumbers, checkOptions, shown } from '../checks.js';
|
|
12
13
|
import { det } from '../linalg.js';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
14
|
+
import { checkCartesianOperations, checkOrthogonalWithin, checkTimeReversal, } from '../operations.js';
|
|
15
|
+
import { idealGroup } from '../closure.js';
|
|
16
|
+
import { operations, settingIndexOf, } from '../pointGroups/pointGroups.js';
|
|
15
17
|
import { specOf } from './propertyTable.js';
|
|
16
|
-
import { EPSILON, SNAP_EPSILON } from '../tolerances.js';
|
|
17
|
-
import {
|
|
18
|
+
import { EPSILON, MAX_PIVOT_THRESHOLD, SNAP_EPSILON, toleranceOf } from '../tolerances.js';
|
|
19
|
+
import { PIVOT_EPSILON, rowEchelonWithPivots } from './rowEchelon.js';
|
|
20
|
+
import { deepFreeze } from '../freeze.js';
|
|
18
21
|
const RANKS = [0, 1, 2, 3, 4];
|
|
19
|
-
/**
|
|
22
|
+
/** The names of the fields and values up to 0.10, with those that replace them (#137 E1, E2). */
|
|
23
|
+
const RENAMED_INTRINSIC = {
|
|
24
|
+
ij: 'symmetric-first-pair',
|
|
25
|
+
jk: 'symmetric-last-pair',
|
|
26
|
+
ij_kl: 'symmetric-pairs',
|
|
27
|
+
voigt: 'symmetric-pairs-exchangeable',
|
|
28
|
+
};
|
|
29
|
+
const RENAMED_TIME_PARITY = { i: 'even', c: 'odd' };
|
|
30
|
+
/** Checks a specification and returns the signed index permutations that generate its intrinsic symmetry. */
|
|
20
31
|
function checkSpec(spec) {
|
|
21
|
-
const { rank,
|
|
32
|
+
const { rank, kind, timeParity, intrinsic } = spec;
|
|
33
|
+
if ('parity' in spec) {
|
|
34
|
+
throw new RangeError(`The field parity of a tensor specification is named kind since symcrys 0.11 ('polar' or 'axial')`);
|
|
35
|
+
}
|
|
22
36
|
if (!RANKS.includes(rank))
|
|
23
|
-
throw new RangeError(`Tensor rank must be 0 to 4, not ${
|
|
24
|
-
if (
|
|
25
|
-
throw new RangeError(`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
throw new RangeError(`Tensor rank must be 0 to 4, not ${shown(rank)}`);
|
|
38
|
+
if (kind !== 'polar' && kind !== 'axial') {
|
|
39
|
+
throw new RangeError(`The kind of a tensor is 'polar' or 'axial', not ${shown(kind)}`);
|
|
40
|
+
}
|
|
41
|
+
if (timeParity !== 'even' && timeParity !== 'odd') {
|
|
42
|
+
const renamed = typeof timeParity === 'string' ? RENAMED_TIME_PARITY[timeParity] : undefined;
|
|
43
|
+
throw new RangeError(`The time parity of a tensor is 'even' or 'odd', not ${shown(timeParity)}` +
|
|
44
|
+
(renamed ? ` ('${timeParity}' up to symcrys 0.10 is '${renamed}')` : ''));
|
|
45
|
+
}
|
|
46
|
+
const swap = (a, b, sign = 1) => {
|
|
47
|
+
const perm = Array.from({ length: rank }, (_, k) => k);
|
|
48
|
+
[perm[a], perm[b]] = [perm[b], perm[a]];
|
|
49
|
+
return { perm, sign };
|
|
50
|
+
};
|
|
51
|
+
const needs = (condition, what) => {
|
|
52
|
+
if (!condition)
|
|
53
|
+
throw new RangeError(`Intrinsic symmetry '${intrinsic}' needs ${what}, not rank ${rank}`);
|
|
32
54
|
};
|
|
33
55
|
switch (intrinsic) {
|
|
34
56
|
case 'none':
|
|
35
57
|
return [];
|
|
36
|
-
case '
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
case '
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
case 'symmetric-first-pair':
|
|
59
|
+
needs(rank >= 2, 'rank 2 or more');
|
|
60
|
+
return [swap(0, 1)];
|
|
61
|
+
case 'symmetric-last-pair':
|
|
62
|
+
needs(rank >= 2, 'rank 2 or more');
|
|
63
|
+
return [swap(rank - 2, rank - 1)];
|
|
64
|
+
case 'symmetric-pairs':
|
|
65
|
+
needs(rank === 4, 'rank 4');
|
|
66
|
+
return [swap(0, 1), swap(2, 3)];
|
|
67
|
+
case 'symmetric-pairs-exchangeable':
|
|
68
|
+
needs(rank === 4, 'rank 4');
|
|
69
|
+
return [swap(0, 1), swap(2, 3), { perm: [2, 3, 0, 1], sign: 1 }];
|
|
70
|
+
case 'antisymmetric':
|
|
71
|
+
needs(rank === 2, 'rank 2');
|
|
72
|
+
return [swap(0, 1, -1)];
|
|
73
|
+
case 'totally-symmetric':
|
|
74
|
+
needs(rank >= 2, 'rank 2 or more');
|
|
75
|
+
return Array.from({ length: rank - 1 }, (_, k) => swap(k, k + 1));
|
|
76
|
+
default: {
|
|
77
|
+
const renamed = typeof intrinsic === 'string' ? RENAMED_INTRINSIC[intrinsic] : undefined;
|
|
78
|
+
throw new RangeError(`Unknown intrinsic symmetry: ${shown(intrinsic)}` +
|
|
79
|
+
(renamed ? ` ('${intrinsic}' up to symcrys 0.10 is '${renamed}')` : ''));
|
|
80
|
+
}
|
|
48
81
|
}
|
|
49
82
|
}
|
|
50
83
|
/** The indices (x, y, z = 0, 1, 2) of every flat index at a rank, first index first. */
|
|
@@ -57,24 +90,34 @@ function digits(rank) {
|
|
|
57
90
|
}
|
|
58
91
|
return table;
|
|
59
92
|
}
|
|
60
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* The flat indices reached from `flat` by the signed index permutations (`out[k] = in[perm[k]]`),
|
|
95
|
+
* each with the product of the signs on the way; undefined if one is reached with both signs (the
|
|
96
|
+
* seed of an antisymmetric tensor with two equal indices, which vanishes).
|
|
97
|
+
*/
|
|
61
98
|
function orbit(flat, rank, perms) {
|
|
62
99
|
const d = digits(rank);
|
|
63
|
-
const seen = new
|
|
100
|
+
const seen = new Map([[flat, 1]]);
|
|
64
101
|
const stack = [flat];
|
|
65
102
|
while (stack.length > 0) {
|
|
66
103
|
const cur = stack.pop();
|
|
67
|
-
|
|
104
|
+
const curSign = seen.get(cur);
|
|
105
|
+
for (const { perm, sign } of perms) {
|
|
68
106
|
let next = 0;
|
|
69
107
|
for (let k = 0; k < rank; k++)
|
|
70
|
-
next = next * 3 + d[cur][
|
|
71
|
-
|
|
72
|
-
|
|
108
|
+
next = next * 3 + d[cur][perm[k]];
|
|
109
|
+
const nextSign = (curSign * sign);
|
|
110
|
+
const known = seen.get(next);
|
|
111
|
+
if (known === undefined) {
|
|
112
|
+
seen.set(next, nextSign);
|
|
73
113
|
stack.push(next);
|
|
74
114
|
}
|
|
115
|
+
else if (known !== nextSign) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
75
118
|
}
|
|
76
119
|
}
|
|
77
|
-
return [...seen];
|
|
120
|
+
return [...seen].map(([f, sign]) => ({ flat: f, sign }));
|
|
78
121
|
}
|
|
79
122
|
function freezeRows(rows) {
|
|
80
123
|
return Object.freeze(rows.map((r) => Object.freeze([...r])));
|
|
@@ -84,18 +127,23 @@ function freezeRows(rows) {
|
|
|
84
127
|
* (a unit tensor on one orbit of the intrinsic symmetry) projects it onto the invariant subspace;
|
|
85
128
|
* the projections span it, and the reduced row echelon form makes the basis minimal and canonical.
|
|
86
129
|
*/
|
|
87
|
-
function project(group, spec, perms) {
|
|
130
|
+
function project(group, spec, perms, deviation = 0) {
|
|
88
131
|
const { rank } = spec;
|
|
89
132
|
const dim = 3 ** rank;
|
|
90
133
|
const d = digits(rank);
|
|
91
134
|
const ops = group.map((op) => ({
|
|
92
|
-
m: op.
|
|
93
|
-
sign: (spec.
|
|
135
|
+
m: op.cartesian.flat(),
|
|
136
|
+
sign: (spec.kind === 'axial' ? Math.sign(det(op.cartesian)) : 1) *
|
|
137
|
+
(spec.timeParity === 'odd' && op.timeReversal ? -1 : 1),
|
|
94
138
|
}));
|
|
95
139
|
const spanning = [];
|
|
140
|
+
// The trace of the group average on the tensors of this index symmetry: the dimension of the
|
|
141
|
+
// invariant subspace, since the average is an orthogonal projector for orthogonal operations. The
|
|
142
|
+
// sums over the orbits of the index symmetry are an orthogonal basis of those tensors.
|
|
143
|
+
let trace = 0;
|
|
96
144
|
for (let seed = 0; seed < dim; seed++) {
|
|
97
145
|
const members = orbit(seed, rank, perms);
|
|
98
|
-
if (seed !== Math.min(...members))
|
|
146
|
+
if (!members || seed !== Math.min(...members.map((m) => m.flat)))
|
|
99
147
|
continue;
|
|
100
148
|
const averaged = new Array(dim).fill(0);
|
|
101
149
|
for (const { m, sign } of ops) {
|
|
@@ -103,8 +151,8 @@ function project(group, spec, perms) {
|
|
|
103
151
|
const o = d[out];
|
|
104
152
|
let acc = 0;
|
|
105
153
|
for (const s of members) {
|
|
106
|
-
const i = d[s];
|
|
107
|
-
let p =
|
|
154
|
+
const i = d[s.flat];
|
|
155
|
+
let p = s.sign;
|
|
108
156
|
for (let r = 0; r < rank; r++)
|
|
109
157
|
p *= m[o[r] * 3 + i[r]];
|
|
110
158
|
acc += p;
|
|
@@ -114,11 +162,13 @@ function project(group, spec, perms) {
|
|
|
114
162
|
}
|
|
115
163
|
for (let k = 0; k < dim; k++)
|
|
116
164
|
averaged[k] /= ops.length;
|
|
165
|
+
trace += members.reduce((sum, s) => sum + s.sign * averaged[s.flat], 0) / members.length;
|
|
117
166
|
if (averaged.some((x) => Math.abs(x) >= EPSILON))
|
|
118
167
|
spanning.push(averaged);
|
|
119
168
|
}
|
|
120
|
-
const
|
|
121
|
-
const
|
|
169
|
+
const reduced = reduce(spanning, dim, deviation, Math.round(trace));
|
|
170
|
+
const basis = reduced.rows.map((row) => row.map(snapEntry));
|
|
171
|
+
const { pivots } = reduced;
|
|
122
172
|
const relations = [];
|
|
123
173
|
for (let c = 0; c < dim; c++) {
|
|
124
174
|
if (pivots.includes(c))
|
|
@@ -138,6 +188,31 @@ function project(group, spec, perms) {
|
|
|
138
188
|
relations: freezeRows(relations),
|
|
139
189
|
});
|
|
140
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* The reduced row echelon form of the projections, with as many pivots as the invariant subspace
|
|
193
|
+
* has dimensions (`rank`, the trace of the group average, exact for an exact group in any frame).
|
|
194
|
+
* For a group made exact from operations of a caller (`idealGroup`), which lies `deviation` from
|
|
195
|
+
* them, a component smaller than about that is not known to be independent: the pivots are first
|
|
196
|
+
* sought at 10 × `deviation` (at least `PIVOT_EPSILON`) and the threshold is lowered tenfold until
|
|
197
|
+
* the pivots reach the rank, so that the free parameters are those of the exact form unless one of
|
|
198
|
+
* its pivots is itself of the order of the deviation (#89). Should the pivots exceed the rank even
|
|
199
|
+
* at `PIVOT_EPSILON` (a component of the order of 10⁻⁷ in a general orientation), the threshold is
|
|
200
|
+
* raised instead until they reach it.
|
|
201
|
+
*/
|
|
202
|
+
function reduce(spanning, dim, deviation, rank) {
|
|
203
|
+
const start = Math.max(10 * deviation, PIVOT_EPSILON);
|
|
204
|
+
for (let threshold = start; threshold >= PIVOT_EPSILON * 0.999; threshold /= 10) {
|
|
205
|
+
const reduced = rowEchelonWithPivots(spanning, dim, threshold);
|
|
206
|
+
if (reduced.pivots.length === rank)
|
|
207
|
+
return reduced;
|
|
208
|
+
}
|
|
209
|
+
for (let threshold = start * 10; threshold <= MAX_PIVOT_THRESHOLD; threshold *= 10) {
|
|
210
|
+
const reduced = rowEchelonWithPivots(spanning, dim, threshold);
|
|
211
|
+
if (reduced.pivots.length === rank)
|
|
212
|
+
return reduced;
|
|
213
|
+
}
|
|
214
|
+
throw new Error(`The projections of a tensor form give no ${rank} independent components`);
|
|
215
|
+
}
|
|
141
216
|
/**
|
|
142
217
|
* An entry within 10⁻⁹ of a multiple of 1/12 is set to it, so that the exact values of the
|
|
143
218
|
* crystallographic forms (0, ±1/2, ±1, ±2 for the 32 classes in all settings) come out exact instead
|
|
@@ -148,21 +223,21 @@ function snapEntry(x) {
|
|
|
148
223
|
return Math.abs(x - r) < SNAP_EPSILON ? r + 0 : x;
|
|
149
224
|
}
|
|
150
225
|
function specKey(spec) {
|
|
151
|
-
return `${spec.rank}:${spec.
|
|
226
|
+
return `${spec.rank}:${spec.kind}:${spec.timeParity}:${spec.intrinsic}`;
|
|
152
227
|
}
|
|
153
228
|
const formCache = new Map();
|
|
154
229
|
/**
|
|
155
230
|
* The form of a tensor under a point group, a crystal class or a magnetic point group, in the
|
|
156
|
-
* requested setting (default: the default setting
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* gives the same form in both conventions (docs/conventions.md, "Tensors").
|
|
231
|
+
* requested setting (default: the ITC default setting). The tensor is given by its specification
|
|
232
|
+
* or by the name of a property in `TENSOR_PROPERTIES` (`'piezoelectric'`; docs/conventions.md,
|
|
233
|
+
* "Tensors").
|
|
160
234
|
*/
|
|
161
235
|
export function tensorForm(key, spec, options) {
|
|
236
|
+
checkOptions(options, SETTING_KEYS, 'tensorForm');
|
|
162
237
|
const resolved = specOf(spec);
|
|
163
238
|
const perms = checkSpec(resolved);
|
|
164
|
-
const ops = operations(key, options); // checks key
|
|
165
|
-
const index =
|
|
239
|
+
const ops = operations(key, options); // checks key and setting
|
|
240
|
+
const index = settingIndexOf(key, options);
|
|
166
241
|
const cacheKey = `${key}#${index}#${specKey(resolved)}`;
|
|
167
242
|
let form = formCache.get(cacheKey);
|
|
168
243
|
if (!form) {
|
|
@@ -174,37 +249,67 @@ export function tensorForm(key, spec, options) {
|
|
|
174
249
|
/**
|
|
175
250
|
* The form of a tensor under the group generated by `operations`, e.g. the site symmetry of a
|
|
176
251
|
* surface normal (`siteSymmetry`) or the operations of a distorted crystal. The tensor is given by
|
|
177
|
-
* its specification or by the name of a property in `TENSOR_PROPERTIES`.
|
|
178
|
-
* Cartesian
|
|
179
|
-
* (`timeReversal`, `true` or `false`)
|
|
180
|
-
*
|
|
181
|
-
*
|
|
252
|
+
* its specification or by the name of a property in `TENSOR_PROPERTIES`. Each operation is read by
|
|
253
|
+
* its Cartesian matrix (`cartesian`), which must be orthogonal, and each says whether it is
|
|
254
|
+
* combined with time reversal (`timeReversal`, `true` or `false`). The list is closed into a group
|
|
255
|
+
* within the tolerance, and that group is made exact before the form is computed, so that matrices
|
|
256
|
+
* with rounding errors (e.g. rounded to 6 decimals) give the form of the exact group, with its
|
|
257
|
+
* number of free parameters (docs/conventions.md, "Tolerances"). Throws a RangeError for an
|
|
258
|
+
* operation without an orthogonal Cartesian matrix (`cartesian`; within the tolerance), for an
|
|
259
|
+
* operation that does not say whether it is combined with time reversal, and for operations that
|
|
260
|
+
* generate no finite group within the tolerance.
|
|
182
261
|
*/
|
|
183
|
-
export function tensorFormOf(operations, spec) {
|
|
262
|
+
export function tensorFormOf(operations, spec, options) {
|
|
263
|
+
checkOptions(options, TOLERANCE_KEYS, 'tensorFormOf');
|
|
184
264
|
const resolved = specOf(spec);
|
|
185
265
|
const perms = checkSpec(resolved);
|
|
186
|
-
|
|
266
|
+
return formOfGroup(callerGroup(operations, options), resolved, perms);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* The operations of a caller, checked (orthogonal within the tolerance, time reversal given),
|
|
270
|
+
* closed within the tolerance and made exact: the group the functions for a list of operations
|
|
271
|
+
* compute with.
|
|
272
|
+
*/
|
|
273
|
+
export function callerGroup(operations, options) {
|
|
274
|
+
const tolerance = toleranceOf(options, 'operations');
|
|
275
|
+
checkCartesianOperations(operations, tolerance);
|
|
187
276
|
checkTimeReversal(operations);
|
|
188
|
-
return
|
|
277
|
+
return idealGroup(operations, tolerance);
|
|
278
|
+
}
|
|
279
|
+
/** The form of a tensor (checked specification and its permutations) under a group made exact. */
|
|
280
|
+
export function formOfGroup(group, spec, perms) {
|
|
281
|
+
return project(group.operations, spec, perms, group.deviation);
|
|
282
|
+
}
|
|
283
|
+
/** The specification of a tensor given by its specification or name, checked, with its permutations. */
|
|
284
|
+
export function checkedSpec(spec) {
|
|
285
|
+
const resolved = specOf(spec);
|
|
286
|
+
return { spec: resolved, perms: checkSpec(resolved) };
|
|
189
287
|
}
|
|
190
288
|
/**
|
|
191
|
-
* The
|
|
289
|
+
* The tensor `tensor` in a frame rotated by the orthogonal
|
|
192
290
|
* matrix `rotation`: t′_{i…} = f·Σ R_{ia}…R_{…}·t_{a…}, with f = det(R) for an axial tensor and 1
|
|
193
291
|
* for a polar one. To express a tensor in the frame of a surface, pass the matrix whose rows are
|
|
194
292
|
* the new axes in the old frame. Time parity plays no part. The kind of tensor is given by its
|
|
195
|
-
* specification or by the name of a property in `TENSOR_PROPERTIES`.
|
|
293
|
+
* specification or by the name of a property in `TENSOR_PROPERTIES`. Throws a RangeError for a
|
|
294
|
+
* rotation that is not orthogonal within the tolerance (per matrix entry of RᵀR).
|
|
196
295
|
*/
|
|
197
|
-
export function rotateTensor(tensor, rotation,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
296
|
+
export function rotateTensor(tensor, rotation, spec, options) {
|
|
297
|
+
checkOptions(options, TOLERANCE_KEYS, 'rotateTensor');
|
|
298
|
+
const resolved = specOf(spec);
|
|
299
|
+
checkSpec(resolved);
|
|
300
|
+
if (!Array.isArray(rotation) || rotation.length !== 3) {
|
|
301
|
+
throw new RangeError(`The rotation must be a 3 × 3 matrix, not ${shown(rotation)}`);
|
|
302
|
+
}
|
|
303
|
+
rotation.forEach((row, i) => checkNumbers(row, 3, `Row ${i} of the rotation`));
|
|
304
|
+
checkOrthogonalWithin(rotation, 'The rotation', toleranceOf(options, 'operations'));
|
|
305
|
+
const { rank } = resolved;
|
|
202
306
|
const dim = 3 ** rank;
|
|
203
|
-
if (tensor.length !== dim)
|
|
204
|
-
throw new RangeError(`A tensor of rank ${rank} has ${dim} components, not ${tensor
|
|
307
|
+
if (!Array.isArray(tensor) || tensor.length !== dim)
|
|
308
|
+
throw new RangeError(`A tensor of rank ${rank} has ${dim} components, not ${shown(tensor)}`);
|
|
309
|
+
checkNumbers(tensor, dim, 'The tensor');
|
|
205
310
|
const d = digits(rank);
|
|
206
311
|
const m = rotation.flat();
|
|
207
|
-
const f =
|
|
312
|
+
const f = resolved.kind === 'axial' ? Math.sign(det(rotation)) : 1;
|
|
208
313
|
const out = new Array(dim).fill(0);
|
|
209
314
|
for (let o = 0; o < dim; o++) {
|
|
210
315
|
let acc = 0;
|
|
@@ -218,6 +323,6 @@ export function rotateTensor(tensor, rotation, specOrName) {
|
|
|
218
323
|
}
|
|
219
324
|
out[o] = f * acc;
|
|
220
325
|
}
|
|
221
|
-
return out;
|
|
326
|
+
return deepFreeze(out);
|
|
222
327
|
}
|
|
223
328
|
//# sourceMappingURL=tensorForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensorForm.js","sourceRoot":"","sources":["../../src/tensors/tensorForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,GAAG,EAAa,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAkB,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAmD,MAAM,+BAA+B,CAAC;AACtH,OAAO,EAAE,MAAM,EAA2B,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA6DpD,MAAM,KAAK,GAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjD,sGAAsG;AACtG,SAAS,SAAS,CAAC,IAAgB;IACjC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACrD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE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AAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC1B,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,MAAM,GAAG,GAAG,IAAI,KAAK,CAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7B,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;gBAAE,SAAS;YAC9B,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE;gBAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7D,GAAG,IAAI,CAAC,CAAC;QACX,CAAC;QACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IACnB,CAAC;IACD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -10,23 +10,24 @@
|
|
|
10
10
|
* The crystallographic API (`crystalClasses.ts`) knows the time-even properties only
|
|
11
11
|
* (docs/conventions.md, "Two entry points").
|
|
12
12
|
*/
|
|
13
|
-
import type {
|
|
13
|
+
import type { CartesianOperation } from '../operations.js';
|
|
14
14
|
import type { MagneticPointGroupKey } from '../pointGroups/pointGroups.js';
|
|
15
15
|
import { type TensorPropertyName } from './propertyTable.js';
|
|
16
|
+
import type { ToleranceOptions } from '../tolerances.js';
|
|
16
17
|
/**
|
|
17
18
|
* True if the point group allows the named property, e.g. `allowsProperty('-6m2', 'piezoelectric')`.
|
|
18
|
-
* It does not depend on setting
|
|
19
|
+
* It does not depend on the setting. Throws a RangeError for an unknown key or name.
|
|
19
20
|
*/
|
|
20
21
|
export declare function allowsProperty(key: MagneticPointGroupKey, name: TensorPropertyName): boolean;
|
|
21
22
|
/** The named properties the point group allows, in the order of `TENSOR_PROPERTIES`. */
|
|
22
|
-
export declare function allowedProperties(key: MagneticPointGroupKey): TensorPropertyName[];
|
|
23
|
+
export declare function allowedProperties(key: MagneticPointGroupKey): readonly TensorPropertyName[];
|
|
23
24
|
/**
|
|
24
25
|
* True if the group generated by `operations` allows the named property, e.g. for the site
|
|
25
|
-
* symmetry of a surface normal or the operations of a distorted crystal. The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* symmetry of a surface normal or the operations of a distorted crystal. The operations are read
|
|
27
|
+
* and closed as `tensorFormOf` reads them, within the tolerance, and it throws a RangeError as
|
|
28
|
+
* `tensorFormOf` does.
|
|
28
29
|
*/
|
|
29
|
-
export declare function allowsPropertyOf(operations: readonly
|
|
30
|
-
/** The named properties the group generated by `operations` allows.
|
|
31
|
-
export declare function allowedPropertiesOf(operations: readonly
|
|
30
|
+
export declare function allowsPropertyOf(operations: readonly CartesianOperation[], name: TensorPropertyName, options?: ToleranceOptions): boolean;
|
|
31
|
+
/** The named properties the group generated by `operations` allows. Reads the operations as `allowsPropertyOf`. */
|
|
32
|
+
export declare function allowedPropertiesOf(operations: readonly CartesianOperation[], options?: ToleranceOptions): readonly TensorPropertyName[];
|
|
32
33
|
//# sourceMappingURL=tensorProperties.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensorProperties.d.ts","sourceRoot":"","sources":["../../src/tensors/tensorProperties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"tensorProperties.d.ts","sourceRoot":"","sources":["../../src/tensors/tensorProperties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE5F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAWzD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,qBAAqB,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAE5F;AAED,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,GAAG,SAAS,kBAAkB,EAAE,CAE3F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,SAAS,kBAAkB,EAAE,EACzC,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAIT;AAED,mHAAmH;AACnH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS,kBAAkB,EAAE,EACzC,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS,kBAAkB,EAAE,CAI/B"}
|
|
@@ -10,37 +10,47 @@
|
|
|
10
10
|
* The crystallographic API (`crystalClasses.ts`) knows the time-even properties only
|
|
11
11
|
* (docs/conventions.md, "Two entry points").
|
|
12
12
|
*/
|
|
13
|
+
import { checkOptions, shown, TOLERANCE_KEYS } from '../checks.js';
|
|
13
14
|
import { TENSOR_PROPERTY_NAMES, specOf } from './propertyTable.js';
|
|
14
|
-
import {
|
|
15
|
+
import { callerGroup, checkedSpec, formOfGroup, tensorForm } from './tensorForm.js';
|
|
16
|
+
import { deepFreeze } from '../freeze.js';
|
|
15
17
|
/** A name of the table; anything else, a specification included, is an error here. */
|
|
16
18
|
function named(name) {
|
|
17
19
|
if (typeof name !== 'string')
|
|
18
|
-
throw new RangeError(`Unknown tensor property: ${
|
|
20
|
+
throw new RangeError(`Unknown tensor property: ${shown(name)}`);
|
|
19
21
|
specOf(name);
|
|
20
22
|
return name;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* True if the point group allows the named property, e.g. `allowsProperty('-6m2', 'piezoelectric')`.
|
|
24
|
-
* It does not depend on setting
|
|
26
|
+
* It does not depend on the setting. Throws a RangeError for an unknown key or name.
|
|
25
27
|
*/
|
|
26
28
|
export function allowsProperty(key, name) {
|
|
27
29
|
return tensorForm(key, named(name), { setting: 1 }).basis.length > 0;
|
|
28
30
|
}
|
|
29
31
|
/** The named properties the point group allows, in the order of `TENSOR_PROPERTIES`. */
|
|
30
32
|
export function allowedProperties(key) {
|
|
31
|
-
return TENSOR_PROPERTY_NAMES.filter((name) => allowsProperty(key, name));
|
|
33
|
+
return deepFreeze(TENSOR_PROPERTY_NAMES.filter((name) => allowsProperty(key, name)));
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
36
|
* True if the group generated by `operations` allows the named property, e.g. for the site
|
|
35
|
-
* symmetry of a surface normal or the operations of a distorted crystal. The
|
|
36
|
-
*
|
|
37
|
-
*
|
|
37
|
+
* symmetry of a surface normal or the operations of a distorted crystal. The operations are read
|
|
38
|
+
* and closed as `tensorFormOf` reads them, within the tolerance, and it throws a RangeError as
|
|
39
|
+
* `tensorFormOf` does.
|
|
38
40
|
*/
|
|
39
|
-
export function allowsPropertyOf(operations, name) {
|
|
40
|
-
|
|
41
|
+
export function allowsPropertyOf(operations, name, options) {
|
|
42
|
+
checkOptions(options, TOLERANCE_KEYS, 'allowsPropertyOf');
|
|
43
|
+
const checked = named(name);
|
|
44
|
+
return allows(callerGroup(operations, options), checked);
|
|
41
45
|
}
|
|
42
|
-
/** The named properties the group generated by `operations` allows.
|
|
43
|
-
export function allowedPropertiesOf(operations) {
|
|
44
|
-
|
|
46
|
+
/** The named properties the group generated by `operations` allows. Reads the operations as `allowsPropertyOf`. */
|
|
47
|
+
export function allowedPropertiesOf(operations, options) {
|
|
48
|
+
checkOptions(options, TOLERANCE_KEYS, 'allowedPropertiesOf');
|
|
49
|
+
const group = callerGroup(operations, options);
|
|
50
|
+
return deepFreeze(TENSOR_PROPERTY_NAMES.filter((name) => allows(group, name)));
|
|
51
|
+
}
|
|
52
|
+
function allows(group, name) {
|
|
53
|
+
const { spec, perms } = checkedSpec(name);
|
|
54
|
+
return formOfGroup(group, spec, perms).basis.length > 0;
|
|
45
55
|
}
|
|
46
56
|
//# sourceMappingURL=tensorProperties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensorProperties.js","sourceRoot":"","sources":["../../src/tensors/tensorProperties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"tensorProperties.js","sourceRoot":"","sources":["../../src/tensors/tensorProperties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAA2B,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGpF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,sFAAsF;AACtF,SAAS,KAAK,CAAC,IAAwB;IACrC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9F,MAAM,CAAC,IAAI,CAAC,CAAC;IACb,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,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AC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/tolerances.d.ts
CHANGED
|
@@ -1,11 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Numeric tolerances, in one place. The values differ on purpose: each gates a different quantity.
|
|
3
|
+
* The tolerance a caller passes is one contract for every function (docs/conventions.md,
|
|
4
|
+
* "Tolerances"): one option, one metric per kind of object, one check.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The default tolerance of every function that compares numbers a caller passes in (operations,
|
|
8
|
+
* directions, points): two numbers closer than this count as equal, in the metric of their kind
|
|
9
|
+
* (docs/conventions.md, "Tolerances").
|
|
3
10
|
*/
|
|
4
|
-
/** Two matrix entries (or vector components) closer than this are equal. */
|
|
5
11
|
export declare const EPSILON = 0.000001;
|
|
6
12
|
/**
|
|
7
13
|
* During group closure, an entry closer than this to one of the exact values in `SNAP_VALUES`
|
|
8
14
|
* (linalg.ts) is replaced by it, so rounding errors cannot accumulate over repeated products.
|
|
9
15
|
*/
|
|
10
16
|
export declare const SNAP_EPSILON = 1e-9;
|
|
17
|
+
/** The tolerance of a function that compares numbers a caller passes in. */
|
|
18
|
+
export interface ToleranceOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Two numbers closer than this count as equal; default `EPSILON` (10⁻⁶). It is measured per
|
|
21
|
+
* matrix entry for operations, as the distance of unit vectors for directions and per coordinate
|
|
22
|
+
* modulo the lattice for points (docs/conventions.md, "Tolerances").
|
|
23
|
+
*/
|
|
24
|
+
readonly tolerance?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The upper bound of the tolerance per kind of object, above which it says nothing: two distinct
|
|
28
|
+
* operations A, B of a crystallographic point group differ in some entry by at least √2/3 ≈ 0.47 in
|
|
29
|
+
* any orthonormal frame (‖A − B‖ = ‖1 − A⁻¹B‖ ≥ √2 in the Frobenius norm, the least for a sixfold
|
|
30
|
+
* rotation), so 0.1 keeps them apart; two unit vectors are at most 2 apart; two points modulo the
|
|
31
|
+
* lattice at most 1/2 per coordinate; a relative deviation of the metric tensor is at most of the
|
|
32
|
+
* order of 1.
|
|
33
|
+
*/
|
|
34
|
+
export declare const TOLERANCE_BOUND: Readonly<{
|
|
35
|
+
operations: 0.1;
|
|
36
|
+
directions: 1;
|
|
37
|
+
points: 0.5;
|
|
38
|
+
metric: 1;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* The tolerance of the options, checked: a finite number above 0 and below the bound of the kind
|
|
42
|
+
* of object it measures; the default `EPSILON`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function toleranceOf(options: ToleranceOptions | undefined, kind: keyof typeof TOLERANCE_BOUND): number;
|
|
45
|
+
/**
|
|
46
|
+
* Making a group of a caller exact (`idealGroup`, closure.ts): a product is matched to the nearest
|
|
47
|
+
* element of the group, which must lie closer than `PRODUCT_MATCH` per entry (distinct operations
|
|
48
|
+
* of a point group differ by at least √2/3 ≈ 0.47 in some entry, so a nearer one is the product);
|
|
49
|
+
* the averaging has settled when no entry changes by `IDEAL_SETTLED` or more in a pass, and fails
|
|
50
|
+
* if after `IDEAL_PASSES` passes an entry still changes by `IDEAL_UNSETTLED` (it settles in one to
|
|
51
|
+
* six passes for every point group, exact or rounded); entries within `IDEAL_SNAP` of an exact value
|
|
52
|
+
* are set to it, which catches the rounding of the last bits but not a group turned by a small
|
|
53
|
+
* angle.
|
|
54
|
+
*/
|
|
55
|
+
export declare const PRODUCT_MATCH = 0.25;
|
|
56
|
+
export declare const IDEAL_SETTLED = 1e-15;
|
|
57
|
+
export declare const IDEAL_UNSETTLED = 1e-12;
|
|
58
|
+
export declare const IDEAL_PASSES = 50;
|
|
59
|
+
export declare const IDEAL_SNAP = 1e-12;
|
|
60
|
+
/**
|
|
61
|
+
* The largest pivot threshold of a tensor form (tensorForm.ts, `reduce`): the threshold is raised
|
|
62
|
+
* up to this only in a general orientation, when components of the order of 10⁻⁷ would otherwise be
|
|
63
|
+
* taken for independent ones; a genuine pivot of a form of a point group is far larger.
|
|
64
|
+
*/
|
|
65
|
+
export declare const MAX_PIVOT_THRESHOLD = 0.01;
|
|
11
66
|
//# sourceMappingURL=tolerances.d.ts.map
|
package/dist/tolerances.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tolerances.d.ts","sourceRoot":"","sources":["../src/tolerances.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tolerances.d.ts","sourceRoot":"","sources":["../src/tolerances.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;GAIG;AACH,eAAO,MAAM,OAAO,WAAO,CAAC;AAE5B;;;GAGG;AACH,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,4EAA4E;AAC5E,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;;EAA4E,CAAC;AAEzG;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,OAAO,eAAe,GAAG,MAAM,CAQ7G;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,UAAU,QAAQ,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC"}
|