symcrys 0.7.0 → 0.8.1
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/dist/cell.d.ts +112 -0
- package/dist/cell.d.ts.map +1 -0
- package/dist/cell.js +193 -0
- package/dist/cell.js.map +1 -0
- package/dist/crystalClasses.d.ts +22 -8
- package/dist/crystalClasses.d.ts.map +1 -1
- package/dist/crystalClasses.js +25 -8
- package/dist/crystalClasses.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/indices.d.ts +42 -0
- package/dist/indices.d.ts.map +1 -0
- package/dist/indices.js +101 -0
- package/dist/indices.js.map +1 -0
- package/dist/linalg.d.ts +7 -1
- package/dist/linalg.d.ts.map +1 -1
- package/dist/linalg.js +20 -3
- package/dist/linalg.js.map +1 -1
- package/dist/magnetic.d.ts +3 -0
- package/dist/magnetic.d.ts.map +1 -1
- package/dist/magnetic.js +3 -0
- package/dist/magnetic.js.map +1 -1
- package/dist/operations.d.ts +6 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +19 -0
- package/dist/operations.js.map +1 -1
- package/dist/pointGroups/identify.d.ts +4 -2
- package/dist/pointGroups/identify.d.ts.map +1 -1
- package/dist/pointGroups/identify.js +5 -18
- package/dist/pointGroups/identify.js.map +1 -1
- package/dist/pointGroups/orbits.d.ts +1 -1
- package/dist/pointGroups/orbits.d.ts.map +1 -1
- package/dist/pointGroups/orbits.js +3 -3
- package/dist/pointGroups/orbits.js.map +1 -1
- package/dist/pointGroups/properties.d.ts +6 -2
- package/dist/pointGroups/properties.d.ts.map +1 -1
- package/dist/pointGroups/properties.js +6 -2
- package/dist/pointGroups/properties.js.map +1 -1
- package/dist/siteSymmetry.d.ts +5 -3
- package/dist/siteSymmetry.d.ts.map +1 -1
- package/dist/siteSymmetry.js +6 -2
- package/dist/siteSymmetry.js.map +1 -1
- package/dist/tensors/tensorForm.d.ts +3 -1
- package/dist/tensors/tensorForm.d.ts.map +1 -1
- package/dist/tensors/tensorForm.js +3 -1
- package/dist/tensors/tensorForm.js.map +1 -1
- package/dist/tensors/tensorProperties.d.ts +4 -2
- package/dist/tensors/tensorProperties.d.ts.map +1 -1
- package/dist/tensors/tensorProperties.js +4 -2
- package/dist/tensors/tensorProperties.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 +272 -0
- package/src/crystalClasses.ts +30 -8
- package/src/index.ts +26 -0
- package/src/indices.ts +117 -0
- package/src/linalg.ts +21 -2
- package/src/magnetic.ts +26 -0
- package/src/operations.ts +20 -0
- package/src/pointGroups/identify.ts +5 -19
- package/src/pointGroups/orbits.ts +3 -3
- package/src/pointGroups/properties.ts +6 -2
- package/src/siteSymmetry.ts +6 -3
- package/src/tensors/tensorForm.ts +3 -1
- package/src/tensors/tensorProperties.ts +4 -2
- package/src/version.ts +1 -1
|
@@ -11,13 +11,17 @@ import type { PointGroupKey } from './data.js';
|
|
|
11
11
|
/**
|
|
12
12
|
* True if the group generated by `operations` contains the inversion, not combined with time
|
|
13
13
|
* reversal: e.g. for the operations of a distorted crystal. A list that is not closed is closed
|
|
14
|
-
* first. For a point group given by its key, read `pointGroup(key).centrosymmetric`.
|
|
14
|
+
* first. For a point group given by its key, read `pointGroup(key).centrosymmetric`. Throws a
|
|
15
|
+
* RangeError for a matrix that is not orthogonal and for an operation that does not say whether it
|
|
16
|
+
* is combined with time reversal.
|
|
15
17
|
*/
|
|
16
18
|
export declare function isCentrosymmetricOf(operations: readonly Operation[]): boolean;
|
|
17
19
|
/**
|
|
18
20
|
* True if the group generated by `operations` is chiral: proper rotations only, with or without
|
|
19
21
|
* time reversal (products of proper rotations are proper, so the list need not be closed). For a
|
|
20
|
-
* point group given by its key, read `pointGroup(key).chiral`.
|
|
22
|
+
* point group given by its key, read `pointGroup(key).chiral`. Throws a RangeError for a matrix that
|
|
23
|
+
* is not orthogonal and for an operation that does not say whether it is combined with time
|
|
24
|
+
* reversal.
|
|
21
25
|
*/
|
|
22
26
|
export declare function isChiralOf(operations: readonly Operation[]): boolean;
|
|
23
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/pointGroups/properties.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAkD,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAW/C
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/pointGroups/properties.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAkD,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAW/C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,CAG7E;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,CAGpE;AAYD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAG9D"}
|
|
@@ -18,7 +18,9 @@ function check(operations) {
|
|
|
18
18
|
/**
|
|
19
19
|
* True if the group generated by `operations` contains the inversion, not combined with time
|
|
20
20
|
* reversal: e.g. for the operations of a distorted crystal. A list that is not closed is closed
|
|
21
|
-
* first. For a point group given by its key, read `pointGroup(key).centrosymmetric`.
|
|
21
|
+
* first. For a point group given by its key, read `pointGroup(key).centrosymmetric`. Throws a
|
|
22
|
+
* RangeError for a matrix that is not orthogonal and for an operation that does not say whether it
|
|
23
|
+
* is combined with time reversal.
|
|
22
24
|
*/
|
|
23
25
|
export function isCentrosymmetricOf(operations) {
|
|
24
26
|
check(operations);
|
|
@@ -27,7 +29,9 @@ export function isCentrosymmetricOf(operations) {
|
|
|
27
29
|
/**
|
|
28
30
|
* True if the group generated by `operations` is chiral: proper rotations only, with or without
|
|
29
31
|
* time reversal (products of proper rotations are proper, so the list need not be closed). For a
|
|
30
|
-
* point group given by its key, read `pointGroup(key).chiral`.
|
|
32
|
+
* point group given by its key, read `pointGroup(key).chiral`. Throws a RangeError for a matrix that
|
|
33
|
+
* is not orthogonal and for an operation that does not say whether it is combined with time
|
|
34
|
+
* reversal.
|
|
31
35
|
*/
|
|
32
36
|
export function isChiralOf(operations) {
|
|
33
37
|
check(operations);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/pointGroups/properties.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAkB,MAAM,kBAAkB,CAAC;AAGlG;;;GAGG;AACH,SAAS,KAAK,CAAC,UAAgC;IAC7C,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5E,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/pointGroups/properties.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE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M,CAAC,EAAE,CAAC,CAAC;IACjH,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
|
package/dist/siteSymmetry.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* fixed (docs/conventions.md, "Site symmetry and Wyckoff positions").
|
|
4
4
|
*/
|
|
5
5
|
import { type Vec3 } from './linalg.js';
|
|
6
|
-
import type
|
|
6
|
+
import { type Operation } from './operations.js';
|
|
7
7
|
/** Options of `siteSymmetry` and `wyckoffPositionOf`. */
|
|
8
8
|
export interface SiteSymmetryOptions {
|
|
9
9
|
/**
|
|
@@ -40,8 +40,10 @@ export declare function siteTolerance(options?: SiteSymmetryOptions): number;
|
|
|
40
40
|
* within the tolerance are closed under the products found in the list and the direction is set onto
|
|
41
41
|
* their fixed space, repeated until stable, so that for a group the result is a subgroup and the
|
|
42
42
|
* set direction lies exactly on its elements. For a list that is not a group, `multiplicity` may
|
|
43
|
-
* not be an integer.
|
|
44
|
-
*
|
|
43
|
+
* not be an integer. The matrices must be Cartesian and orthogonal (not those of
|
|
44
|
+
* `latticeOperations`). Throws a RangeError for a matrix that is not orthogonal (within
|
|
45
|
+
* `tolerance`, at least `EPSILON`), for a zero vector, and if the closed operations fix no common
|
|
46
|
+
* direction (a tolerance far too large, e.g. 0.5).
|
|
45
47
|
*/
|
|
46
48
|
export declare function siteSymmetry(operations: readonly Operation[], direction: Vec3, options?: SiteSymmetryOptions): SiteSymmetry;
|
|
47
49
|
//# sourceMappingURL=siteSymmetry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siteSymmetry.d.ts","sourceRoot":"","sources":["../src/siteSymmetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAkC,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"siteSymmetry.d.ts","sourceRoot":"","sources":["../src/siteSymmetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAkC,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGxE,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wCAAwC;AACxC,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,2GAA2G;IAC3G,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,kGAAkG;IAClG,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAuED,6CAA6C;AAC7C,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAInE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,SAAS,EAAE,IAAI,EACf,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,CAuCd"}
|
package/dist/siteSymmetry.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* fixed (docs/conventions.md, "Site symmetry and Wyckoff positions").
|
|
4
4
|
*/
|
|
5
5
|
import { apply, matricesEqual, multiply } from './linalg.js';
|
|
6
|
+
import { checkOrthogonalWithin } from './operations.js';
|
|
6
7
|
import { EPSILON } from './tolerances.js';
|
|
7
8
|
function unit(v) {
|
|
8
9
|
const n = Math.hypot(v[0], v[1], v[2]);
|
|
@@ -80,11 +81,14 @@ export function siteTolerance(options) {
|
|
|
80
81
|
* within the tolerance are closed under the products found in the list and the direction is set onto
|
|
81
82
|
* their fixed space, repeated until stable, so that for a group the result is a subgroup and the
|
|
82
83
|
* set direction lies exactly on its elements. For a list that is not a group, `multiplicity` may
|
|
83
|
-
* not be an integer.
|
|
84
|
-
*
|
|
84
|
+
* not be an integer. The matrices must be Cartesian and orthogonal (not those of
|
|
85
|
+
* `latticeOperations`). Throws a RangeError for a matrix that is not orthogonal (within
|
|
86
|
+
* `tolerance`, at least `EPSILON`), for a zero vector, and if the closed operations fix no common
|
|
87
|
+
* direction (a tolerance far too large, e.g. 0.5).
|
|
85
88
|
*/
|
|
86
89
|
export function siteSymmetry(operations, direction, options) {
|
|
87
90
|
const tolerance = siteTolerance(options);
|
|
91
|
+
operations.forEach((op, i) => checkOrthogonalWithin(op.matrix, `Operation ${i}`, tolerance));
|
|
88
92
|
const v = unit(direction);
|
|
89
93
|
const fixing = (w) => {
|
|
90
94
|
const out = [];
|
package/dist/siteSymmetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siteSymmetry.js","sourceRoot":"","sources":["../src/siteSymmetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"siteSymmetry.js","sourceRoot":"","sources":["../src/siteSymmetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAkB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AA+B1C,SAAS,IAAI,CAAC,CAAO;IACnB,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,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O,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;KACzD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -79,7 +79,9 @@ export declare function tensorForm(key: MagneticPointGroupKey, spec: TensorSpec
|
|
|
79
79
|
* surface normal (`siteSymmetry`) or the operations of a distorted crystal. The tensor is given by
|
|
80
80
|
* its specification or by the name of a property in `TENSOR_PROPERTIES`. The operations are
|
|
81
81
|
* Cartesian and orthogonal, and each says whether it is combined with time reversal
|
|
82
|
-
* (`timeReversal`, `true` or `false`); a list that is not closed is closed first.
|
|
82
|
+
* (`timeReversal`, `true` or `false`); a list that is not closed is closed first. Throws a
|
|
83
|
+
* RangeError for a matrix that is not orthogonal and for an operation that does not say whether it
|
|
84
|
+
* is combined with time reversal.
|
|
83
85
|
*/
|
|
84
86
|
export declare function tensorFormOf(operations: readonly Operation[], spec: TensorSpec | TensorPropertyName): TensorForm;
|
|
85
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensorForm.d.ts","sourceRoot":"","sources":["../../src/tensors/tensorForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAO,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAkD,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAwB,KAAK,qBAAqB,EAAE,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,EAAU,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIrE,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE3C,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,CAAC;AAE7C,wFAAwF;AACxF,MAAM,M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AG,kBAAkB,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAYZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,kBAAkB,GAAG,UAAU,CAMhH;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,QAAQ,EAAE,IAAI,EACd,UAAU,EAAE,UAAU,GAAG,kBAAkB,GAC1C,MAAM,EAAE,CAuBV"}
|
|
@@ -176,7 +176,9 @@ export function tensorForm(key, spec, options) {
|
|
|
176
176
|
* surface normal (`siteSymmetry`) or the operations of a distorted crystal. The tensor is given by
|
|
177
177
|
* its specification or by the name of a property in `TENSOR_PROPERTIES`. The operations are
|
|
178
178
|
* Cartesian and orthogonal, and each says whether it is combined with time reversal
|
|
179
|
-
* (`timeReversal`, `true` or `false`); a list that is not closed is closed first.
|
|
179
|
+
* (`timeReversal`, `true` or `false`); a list that is not closed is closed first. Throws a
|
|
180
|
+
* RangeError for a matrix that is not orthogonal and for an operation that does not say whether it
|
|
181
|
+
* is combined with time reversal.
|
|
180
182
|
*/
|
|
181
183
|
export function tensorFormOf(operations, spec) {
|
|
182
184
|
const resolved = specOf(spec);
|
|
@@ -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,MA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I,EAAE,CAAC;IAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,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,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -22,9 +22,11 @@ export declare function allowsProperty(key: MagneticPointGroupKey, name: TensorP
|
|
|
22
22
|
export declare function allowedProperties(key: MagneticPointGroupKey): TensorPropertyName[];
|
|
23
23
|
/**
|
|
24
24
|
* 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.
|
|
25
|
+
* symmetry of a surface normal or the operations of a distorted crystal. The matrices must be
|
|
26
|
+
* Cartesian and orthogonal; a list that is not closed is closed first. Throws a RangeError for a matrix that is not
|
|
27
|
+
* orthogonal and for an operation that does not say whether it is combined with time reversal.
|
|
26
28
|
*/
|
|
27
29
|
export declare function allowsPropertyOf(operations: readonly Operation[], name: TensorPropertyName): boolean;
|
|
28
|
-
/** The named properties the group generated by `operations` allows. */
|
|
30
|
+
/** The named properties the group generated by `operations` allows. Checks the operations as `allowsPropertyOf`. */
|
|
29
31
|
export declare function allowedPropertiesOf(operations: readonly Operation[]): TensorPropertyName[];
|
|
30
32
|
//# sourceMappingURL=tensorProperties.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensorProperties.d.ts","sourceRoot":"","sources":["../../src/tensors/tensorProperties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAU5F;;;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,kBAAkB,EAAE,CAElF;AAED
|
|
1
|
+
{"version":3,"file":"tensorProperties.d.ts","sourceRoot":"","sources":["../../src/tensors/tensorProperties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAiC,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAU5F;;;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,kBAAkB,EAAE,CAElF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAEpG;AAED,oHAAoH;AACpH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,kBAAkB,EAAE,CAE1F"}
|
|
@@ -32,12 +32,14 @@ export function allowedProperties(key) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* 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.
|
|
35
|
+
* symmetry of a surface normal or the operations of a distorted crystal. The matrices must be
|
|
36
|
+
* Cartesian and orthogonal; a list that is not closed is closed first. Throws a RangeError for a matrix that is not
|
|
37
|
+
* orthogonal and for an operation that does not say whether it is combined with time reversal.
|
|
36
38
|
*/
|
|
37
39
|
export function allowsPropertyOf(operations, name) {
|
|
38
40
|
return tensorFormOf(operations, named(name)).basis.length > 0;
|
|
39
41
|
}
|
|
40
|
-
/** The named properties the group generated by `operations` allows. */
|
|
42
|
+
/** The named properties the group generated by `operations` allows. Checks the operations as `allowsPropertyOf`. */
|
|
41
43
|
export function allowedPropertiesOf(operations) {
|
|
42
44
|
return TENSOR_PROPERTY_NAMES.filter((name) => allowsPropertyOf(operations, name));
|
|
43
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tensorProperties.js","sourceRoot":"","sources":["../../src/tensors/tensorProperties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAA2B,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,UAA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EAAE,IAAwB;IACjF,OAAO,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACvE,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,iBAAiB,CAAC,GAA0B;IAC1D,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAgC,EAAE,IAAwB;IACzF,OAAO,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAChE,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,mBAAmB,CAAC,UAAgC;IAClE,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;AACpF,CAAC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "symcrys",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Crystallographic symmetry calculations: point groups (crystallographic and magnetic), their settings, symbols and properties, and property tensors. TypeScript library without dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"crystallography",
|
package/src/cell.ts
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit cell, metric and angles, for any cell (docs/conventions.md, "Cell, metric and indices").
|
|
3
|
+
* Plain data in and out: a basis is a 3×3 matrix whose columns are a, b, c in Cartesian
|
|
4
|
+
* coordinates, as `latticeBasis` gives it; lengths in any unit, angles in degrees.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { apply, inverse, isSingular, multiply, transpose, type Mat3, type Vec3 } from './linalg.js';
|
|
8
|
+
import { checkTimeReversal, type Operation as MagneticOperation } from './operations.js';
|
|
9
|
+
import { EPSILON } from './tolerances.js';
|
|
10
|
+
|
|
11
|
+
/** The lattice parameters of a cell: edge lengths and angles in degrees (α between b and c, β between a and c, γ between a and b). */
|
|
12
|
+
export interface LatticeParameters {
|
|
13
|
+
/** Edge length a. */
|
|
14
|
+
readonly a: number;
|
|
15
|
+
/** Edge length b. */
|
|
16
|
+
readonly b: number;
|
|
17
|
+
/** Edge length c. */
|
|
18
|
+
readonly c: number;
|
|
19
|
+
/** Angle α between b and c, in degrees. */
|
|
20
|
+
readonly alpha: number;
|
|
21
|
+
/** Angle β between a and c, in degrees. */
|
|
22
|
+
readonly beta: number;
|
|
23
|
+
/** Angle γ between a and b, in degrees. */
|
|
24
|
+
readonly gamma: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The three cell angles in degrees. */
|
|
28
|
+
export interface CellAngles {
|
|
29
|
+
/** Angle α between b and c, in degrees. */
|
|
30
|
+
readonly alpha: number;
|
|
31
|
+
/** Angle β between a and c, in degrees. */
|
|
32
|
+
readonly beta: number;
|
|
33
|
+
/** Angle γ between a and b, in degrees. */
|
|
34
|
+
readonly gamma: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** An operation of a list given to `residualOperations`: at least its matrix; other fields are kept. */
|
|
38
|
+
export interface CellOperation {
|
|
39
|
+
/** The 3×3 matrix W acting on lattice coordinates. */
|
|
40
|
+
readonly matrix: Mat3;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Options of `isValidCell`. */
|
|
44
|
+
export interface IsValidCellOptions {
|
|
45
|
+
/**
|
|
46
|
+
* The smallest accepted ratio V/(abc) of the cell volume to the volume of the box of its edge
|
|
47
|
+
* lengths, from 0 to 1 (1 only for orthogonal axes); default 0, which accepts every cell that
|
|
48
|
+
* `isValidCell` otherwise accepts. A ratio near 0 is a nearly flat cell.
|
|
49
|
+
*/
|
|
50
|
+
readonly minVolumeRatio?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Options of `residualOperations`. */
|
|
54
|
+
export interface ResidualOperationsOptions {
|
|
55
|
+
/** The largest accepted deviation of WᵀGW from G, relative to the largest entry of G; default `EPSILON`. */
|
|
56
|
+
readonly tolerance?: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const DEG = Math.PI / 180;
|
|
60
|
+
|
|
61
|
+
/** Cosine of an angle in degrees, exact at the multiples of 30° that cells use (90°, 60°, 120°, 180°). */
|
|
62
|
+
function cosDeg(x: number): number {
|
|
63
|
+
const r = x % 360;
|
|
64
|
+
const exact: Record<number, number> = { 0: 1, 60: 0.5, 90: 0, 120: -0.5, 180: -1, 240: -0.5, 270: 0, 300: 0.5 };
|
|
65
|
+
const k = r < 0 ? r + 360 : r;
|
|
66
|
+
return k in exact ? exact[k] : Math.cos(x * DEG);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The radicand of the volume, 1 − cos²α − cos²β − cos²γ + 2 cos α cos β cos γ. */
|
|
70
|
+
function radicand({ alpha, beta, gamma }: CellAngles): number {
|
|
71
|
+
const [ca, cb, cg] = [alpha, beta, gamma].map(cosDeg);
|
|
72
|
+
return 1 - ca * ca - cb * cb - cg * cg + 2 * ca * cb * cg;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function anglesOk({ alpha, beta, gamma }: CellAngles): boolean {
|
|
76
|
+
return [alpha, beta, gamma].every((x) => typeof x === 'number' && Number.isFinite(x) && x > 0 && x < 180);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether three angles (degrees) belong to a cell: each between 0° and 180°, and the three axes not
|
|
81
|
+
* in one plane (the volume radicand 1 − cos²α − cos²β − cos²γ + 2 cos α cos β cos γ exceeds 10⁻¹², i.e.
|
|
82
|
+
* V/(abc) > 10⁻⁶: a cell that is flat within rounding is refused). With
|
|
83
|
+
* `minVolumeRatio` (from 0 to 1, default 0) also refuses nearly flat cells, whose ratio V/(abc), the
|
|
84
|
+
* square root of the radicand, is smaller. Throws a RangeError for a `minVolumeRatio` that is not a
|
|
85
|
+
* number from 0 to 1.
|
|
86
|
+
*/
|
|
87
|
+
export function isValidCell(angles: CellAngles, options?: IsValidCellOptions): boolean {
|
|
88
|
+
if (!anglesOk(angles)) return false;
|
|
89
|
+
const min = options?.minVolumeRatio ?? 0;
|
|
90
|
+
if (!(typeof min === 'number' && min >= 0 && min <= 1))
|
|
91
|
+
throw new RangeError(`isValidCell: minVolumeRatio must be a number from 0 to 1, not ${String(min)}`);
|
|
92
|
+
const r = radicand(angles);
|
|
93
|
+
if (!(r > 1e-12)) return false;
|
|
94
|
+
return Math.sqrt(r) >= min;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function checkEdges({ a, b, c }: LatticeParameters): void {
|
|
98
|
+
for (const [name, x] of [
|
|
99
|
+
['a', a],
|
|
100
|
+
['b', b],
|
|
101
|
+
['c', c],
|
|
102
|
+
] as const) {
|
|
103
|
+
if (typeof x !== 'number' || !Number.isFinite(x) || x <= 0) {
|
|
104
|
+
throw new RangeError(`latticeFromParameters: edge ${name} must be a positive number, not ${JSON.stringify(x)}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The Cartesian basis of a cell as the columns of a 3×3 matrix, in the frame of this library for a
|
|
111
|
+
* general cell: a along x, b in the xy plane (y > 0 for γ < 180°), c towards +z. It is the frame of
|
|
112
|
+
* `latticeBasis` where that exists (hexagonal axes: x ∥ a, z ∥ c), so a cell with the angles of a
|
|
113
|
+
* family has that family's basis scaled by the edge lengths. For the monoclinic family with unique
|
|
114
|
+
* axis b, b lies along y (docs/conventions.md, "Cell, metric and indices"). The basis is
|
|
115
|
+
* right-handed. Throws a RangeError for an edge that is not positive and for angles that give no cell.
|
|
116
|
+
*/
|
|
117
|
+
export function latticeFromParameters(p: LatticeParameters): Mat3 {
|
|
118
|
+
checkEdges(p);
|
|
119
|
+
if (!isValidCell(p)) {
|
|
120
|
+
throw new RangeError(`latticeFromParameters: angles ${p.alpha}°, ${p.beta}°, ${p.gamma}° give no cell`);
|
|
121
|
+
}
|
|
122
|
+
const ca = cosDeg(p.alpha);
|
|
123
|
+
const cb = cosDeg(p.beta);
|
|
124
|
+
const cg = cosDeg(p.gamma);
|
|
125
|
+
const sg = Math.sqrt(1 - cg * cg);
|
|
126
|
+
const volumeRatio = Math.sqrt(radicand(p));
|
|
127
|
+
// columns: a = (a, 0, 0), b = (b cos γ, b sin γ, 0), c = (c cos β, c (cos α − cos β cos γ)/sin γ, c V/(abc sin γ))
|
|
128
|
+
const cy = (p.c * (ca - cb * cg)) / sg;
|
|
129
|
+
const cz = (p.c * volumeRatio) / sg;
|
|
130
|
+
return [
|
|
131
|
+
[p.a + 0, p.b * cg + 0, p.c * cb + 0],
|
|
132
|
+
[0, p.b * sg + 0, cy + 0],
|
|
133
|
+
[0, 0, cz + 0],
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function columns(basis: Mat3): [Vec3, Vec3, Vec3] {
|
|
138
|
+
return [0, 1, 2].map((j) => [basis[0][j], basis[1][j], basis[2][j]] as const) as [Vec3, Vec3, Vec3];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const norm = (v: Vec3): number => Math.hypot(v[0], v[1], v[2]);
|
|
142
|
+
const dot = (u: Vec3, v: Vec3): number => u[0] * v[0] + u[1] * v[1] + u[2] * v[2];
|
|
143
|
+
|
|
144
|
+
function checkBasis(basis: Mat3, who: string): void {
|
|
145
|
+
const ok =
|
|
146
|
+
Array.isArray(basis) &&
|
|
147
|
+
basis.length === 3 &&
|
|
148
|
+
basis.every(
|
|
149
|
+
(r) => Array.isArray(r) && r.length === 3 && r.every((x) => typeof x === 'number' && Number.isFinite(x)),
|
|
150
|
+
);
|
|
151
|
+
if (!ok) throw new RangeError(`${who}: the basis must be a 3×3 matrix of finite numbers`);
|
|
152
|
+
if (isSingular(basis)) throw new RangeError(`${who}: singular basis`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The lattice parameters of a basis given as the columns of a Cartesian matrix: the edge lengths and
|
|
157
|
+
* the angles in degrees. Independent of the orientation of the basis in the Cartesian frame (and
|
|
158
|
+
* of its handedness). Throws a RangeError for a singular matrix.
|
|
159
|
+
*/
|
|
160
|
+
export function latticeParameters(basis: Mat3): LatticeParameters {
|
|
161
|
+
checkBasis(basis, 'latticeParameters');
|
|
162
|
+
const [a, b, c] = columns(basis);
|
|
163
|
+
const angle = (u: Vec3, v: Vec3): number => {
|
|
164
|
+
const cross: Vec3 = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];
|
|
165
|
+
return Math.atan2(norm(cross), dot(u, v)) / DEG + 0;
|
|
166
|
+
};
|
|
167
|
+
return { a: norm(a), b: norm(b), c: norm(c), alpha: angle(b, c), beta: angle(a, c), gamma: angle(a, b) };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** 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. */
|
|
171
|
+
export function metricTensor(basis: Mat3): Mat3 {
|
|
172
|
+
checkBasis(basis, 'metricTensor');
|
|
173
|
+
return multiply(transpose(basis), basis);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The reciprocal basis B = A⁻ᵀ of a basis A (columns a, b, c) as the columns a*, b*, c*, with
|
|
178
|
+
* a_i · a*_j = δ_ij (no factor 2π), in the inverse unit of the edge lengths.
|
|
179
|
+
*/
|
|
180
|
+
export function reciprocalBasis(basis: Mat3): Mat3 {
|
|
181
|
+
checkBasis(basis, 'reciprocalBasis');
|
|
182
|
+
return transpose(inverse(basis));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function vector(v: Vec3, name: string): Vec3 {
|
|
186
|
+
if (!Array.isArray(v) || v.length !== 3 || !v.every((x) => typeof x === 'number' && Number.isFinite(x))) {
|
|
187
|
+
throw new RangeError(`${name} must be three finite numbers`);
|
|
188
|
+
}
|
|
189
|
+
if (v.every((x) => x === 0)) throw new RangeError(`${name} must not be the zero vector`);
|
|
190
|
+
return v;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function angleOf(u: Vec3, v: Vec3): number {
|
|
194
|
+
const cross: Vec3 = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];
|
|
195
|
+
return Math.atan2(norm(cross), dot(u, v)) / DEG + 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** 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. */
|
|
199
|
+
export function angleBetweenDirections(basis: Mat3, u: Vec3, v: Vec3): number {
|
|
200
|
+
checkBasis(basis, 'angleBetweenDirections');
|
|
201
|
+
return angleOf(apply(basis, vector(u, 'u')), apply(basis, vector(v, 'v')));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The angle in degrees between the normals of two planes (hkl), 0° to 180°: the angle between the
|
|
206
|
+
* reciprocal vectors h·a* + k·b* + l·c*. For two faces this is 180° minus the interior dihedral
|
|
207
|
+
* angle. Throws a RangeError for a zero vector.
|
|
208
|
+
*/
|
|
209
|
+
export function angleBetweenPlanes(basis: Mat3, h: Vec3, k: Vec3): number {
|
|
210
|
+
checkBasis(basis, 'angleBetweenPlanes');
|
|
211
|
+
const b = reciprocalBasis(basis);
|
|
212
|
+
return angleOf(apply(b, vector(h, 'h')), apply(b, vector(k, 'k')));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The operations that leave the metric of a cell unchanged: those W (integer matrices on the
|
|
217
|
+
* coordinates of a lattice direction, as `latticeOperations` gives them) with WᵀGW = G, G the metric
|
|
218
|
+
* tensor of `basis`. It is the point symmetry of a distorted lattice among the operations of a group;
|
|
219
|
+
* the list is taken as it is, not closed into a group, and the kept operations are the ones of the
|
|
220
|
+
* list, in its order. The deviation counts relative to the largest entry of G (`tolerance`, default
|
|
221
|
+
* `EPSILON`), so the result does not depend on the unit of the edge lengths.
|
|
222
|
+
*/
|
|
223
|
+
export function residualOperations<T extends CellOperation>(
|
|
224
|
+
operations: readonly T[],
|
|
225
|
+
basis: Mat3,
|
|
226
|
+
options?: ResidualOperationsOptions,
|
|
227
|
+
): T[] {
|
|
228
|
+
const g = metricTensor(basis);
|
|
229
|
+
const tolerance = options?.tolerance ?? EPSILON;
|
|
230
|
+
if (typeof tolerance !== 'number' || !Number.isFinite(tolerance) || tolerance < 0) {
|
|
231
|
+
throw new RangeError(
|
|
232
|
+
`residualOperations: tolerance must be a non-negative number, not ${JSON.stringify(tolerance)}`,
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
if (!Array.isArray(operations)) throw new RangeError('residualOperations: operations must be a list');
|
|
236
|
+
operations.forEach((op, i) => {
|
|
237
|
+
const m = (op as { readonly matrix?: unknown } | null)?.matrix;
|
|
238
|
+
const ok =
|
|
239
|
+
Array.isArray(m) &&
|
|
240
|
+
m.length === 3 &&
|
|
241
|
+
m.every((r) => Array.isArray(r) && r.length === 3 && r.every((x) => typeof x === 'number' && Number.isFinite(x)));
|
|
242
|
+
if (!ok) throw new RangeError(`residualOperations: operation ${i} has no 3×3 matrix of finite numbers`);
|
|
243
|
+
});
|
|
244
|
+
const scale = Math.max(...g.flat().map(Math.abs));
|
|
245
|
+
return operations.filter((op) => {
|
|
246
|
+
const m = multiply(multiply(transpose(op.matrix), g), op.matrix);
|
|
247
|
+
return m.every((row, i) => row.every((x, j) => Math.abs(x - g[i][j]) <= tolerance * scale));
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** An operation of the magnetic API passed to `residualOperations`: its matrix and whether it is combined with time reversal. */
|
|
252
|
+
export interface MagneticCellOperation extends CellOperation {
|
|
253
|
+
/** Whether the operation is combined with time reversal. */
|
|
254
|
+
readonly timeReversal: boolean;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* The operations of a list that keep the metric of a cell: W with WᵀGW = G, G the metric tensor
|
|
259
|
+
* of `basis`. The operations are integer matrices on lattice coordinates, as `latticeOperations`
|
|
260
|
+
* gives them; the list is taken as it is and the kept operations are the ones of the list, in its
|
|
261
|
+
* order. The deviation counts relative to the largest entry of G (`tolerance`, default `EPSILON`).
|
|
262
|
+
* Every operation must say whether it is combined with time reversal (`timeReversal`), which is
|
|
263
|
+
* kept; one that does not (an operation of the crystallographic API) is a RangeError.
|
|
264
|
+
*/
|
|
265
|
+
export function residualMagneticOperations<T extends MagneticCellOperation>(
|
|
266
|
+
operations: readonly T[],
|
|
267
|
+
basis: Mat3,
|
|
268
|
+
options?: ResidualOperationsOptions,
|
|
269
|
+
): T[] {
|
|
270
|
+
if (Array.isArray(operations)) checkTimeReversal(operations as unknown as readonly MagneticOperation[]);
|
|
271
|
+
return residualOperations(operations, basis, options);
|
|
272
|
+
}
|