symcrys 0.8.0 → 0.9.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 +11 -2
- package/dist/cell.d.ts +5 -2
- package/dist/cell.d.ts.map +1 -1
- package/dist/cell.js +7 -7
- package/dist/cell.js.map +1 -1
- package/dist/crystalClasses.d.ts +13 -8
- package/dist/crystalClasses.d.ts.map +1 -1
- package/dist/crystalClasses.js +13 -8
- package/dist/crystalClasses.js.map +1 -1
- package/dist/indices.d.ts +3 -1
- package/dist/indices.d.ts.map +1 -1
- package/dist/indices.js +6 -2
- package/dist/indices.js.map +1 -1
- 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/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/plane.d.ts +225 -0
- package/dist/plane.d.ts.map +1 -0
- package/dist/plane.js +219 -0
- package/dist/plane.js.map +1 -0
- 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/spaceGroups/affine.d.ts +81 -0
- package/dist/spaceGroups/affine.d.ts.map +1 -0
- package/dist/spaceGroups/affine.js +245 -0
- package/dist/spaceGroups/affine.js.map +1 -0
- package/dist/spaceGroups/cell.d.ts +58 -0
- package/dist/spaceGroups/cell.d.ts.map +1 -0
- package/dist/spaceGroups/cell.js +297 -0
- package/dist/spaceGroups/cell.js.map +1 -0
- package/dist/spaceGroups/describe.d.ts +44 -0
- package/dist/spaceGroups/describe.d.ts.map +1 -0
- package/dist/spaceGroups/describe.js +92 -0
- package/dist/spaceGroups/describe.js.map +1 -0
- package/dist/spaceGroups/planeGroupData.d.ts +44 -0
- package/dist/spaceGroups/planeGroupData.d.ts.map +1 -0
- package/dist/spaceGroups/planeGroupData.js +371 -0
- package/dist/spaceGroups/planeGroupData.js.map +1 -0
- package/dist/spaceGroups/planeGroups.d.ts +28 -0
- package/dist/spaceGroups/planeGroups.d.ts.map +1 -0
- package/dist/spaceGroups/planeGroups.js +61 -0
- package/dist/spaceGroups/planeGroups.js.map +1 -0
- package/dist/spaceGroups/planePointGroups.d.ts +31 -0
- package/dist/spaceGroups/planePointGroups.d.ts.map +1 -0
- package/dist/spaceGroups/planePointGroups.js +77 -0
- package/dist/spaceGroups/planePointGroups.js.map +1 -0
- package/dist/spaceGroups/positions.d.ts +65 -0
- package/dist/spaceGroups/positions.d.ts.map +1 -0
- package/dist/spaceGroups/positions.js +183 -0
- package/dist/spaceGroups/positions.js.map +1 -0
- package/dist/spaceGroups/rational.d.ts +43 -0
- package/dist/spaceGroups/rational.d.ts.map +1 -0
- package/dist/spaceGroups/rational.js +95 -0
- package/dist/spaceGroups/rational.js.map +1 -0
- 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 +7 -2
- package/src/cell.ts +9 -8
- package/src/crystalClasses.ts +13 -8
- package/src/indices.ts +5 -2
- package/src/linalg.ts +21 -2
- package/src/operations.ts +20 -0
- package/src/plane.ts +455 -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/spaceGroups/affine.ts +315 -0
- package/src/spaceGroups/cell.ts +371 -0
- package/src/spaceGroups/describe.ts +133 -0
- package/src/spaceGroups/planeGroupData.ts +407 -0
- package/src/spaceGroups/planeGroups.ts +75 -0
- package/src/spaceGroups/planePointGroups.ts +90 -0
- package/src/spaceGroups/positions.ts +237 -0
- package/src/spaceGroups/rational.ts +115 -0
- package/src/tensors/tensorForm.ts +3 -1
- package/src/tensors/tensorProperties.ts +4 -2
- package/src/version.ts +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { crystalFamily, latticeBasis } from '../lattice.js';
|
|
6
6
|
import { apply, inverse, multiply } from '../linalg.js';
|
|
7
|
-
import {
|
|
7
|
+
import { checkOrthogonalWithin } from '../operations.js';
|
|
8
8
|
import { siteTolerance } from '../siteSymmetry.js';
|
|
9
9
|
import { operations as groupOperations, pointGroup, } from './pointGroups.js';
|
|
10
10
|
const IDENTITY = [
|
|
@@ -108,11 +108,11 @@ function integerInverseTranspose(w) {
|
|
|
108
108
|
* `siteSymmetry`), in the order in which the operations reach them, each with the indices of the
|
|
109
109
|
* operations that map the direction there. The list is taken as it is, not closed into a group.
|
|
110
110
|
* Time reversal is ignored. Throws a RangeError for a zero vector and for a matrix that is not
|
|
111
|
-
* orthogonal (Cartesian
|
|
111
|
+
* orthogonal (Cartesian, not one of `latticeOperations`; within `tolerance`, at least `EPSILON`).
|
|
112
112
|
*/
|
|
113
113
|
export function orbitOf(operations, direction, options) {
|
|
114
114
|
const tolerance = siteTolerance(options);
|
|
115
|
-
operations.forEach((op, i) =>
|
|
115
|
+
operations.forEach((op, i) => checkOrthogonalWithin(op.matrix, `Operation ${i}`, tolerance));
|
|
116
116
|
const n = Math.hypot(direction[0], direction[1], direction[2]);
|
|
117
117
|
if (!(n > 0) || !Number.isFinite(n))
|
|
118
118
|
throw new RangeError(`Not a direction: ${JSON.stringify(direction)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orbits.js","sourceRoot":"","sources":["../../src/pointGroups/orbits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAwB,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"orbits.js","sourceRoot":"","sources":["../../src/pointGroups/orbits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAwB,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,UAAU,IAAI,eAAe,EAC7B,UAAU,GAGX,MAAM,kBAAkB,CAAC;AAG1B,MAAM,QAAQ,GAAS;IACrB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CACV,CAAC;AAEF;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,GAA0B;IACnD,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC;IAC5D,OAAO,MAAM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AAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CACnG,CAAC;QACF,IAAI,IAAI;YAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YAC7B,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAClB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACd,MAAM,CAAC,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAoB;QACxD,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC;KACxC,CAAC,CACH,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -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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M,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,MAAM,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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AAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM;QACzF,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;KACzD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact affine operations of plane and space groups, x' = W·x + w in the lattice basis (ITA
|
|
3
|
+
* notation (W, w)): the matrix W with integer entries and determinant ±1, the translation w with
|
|
4
|
+
* rational components. Written for any dimension d from 1 to 3 (2 for the plane groups, 3 for the
|
|
5
|
+
* space groups). CLAUDE.md, "Plane groups (and later space groups)".
|
|
6
|
+
*/
|
|
7
|
+
import { type Rational } from './rational.js';
|
|
8
|
+
/** An integer matrix of size d × d, rows first. */
|
|
9
|
+
export type IntMatrix = readonly (readonly number[])[];
|
|
10
|
+
/** An exact operation (W, w): x' = W·x + w, in the lattice basis. */
|
|
11
|
+
export interface ExactOperation {
|
|
12
|
+
/** The linear part W: integer entries; an operation of a group has determinant ±1. */
|
|
13
|
+
readonly matrix: IntMatrix;
|
|
14
|
+
/** The translation part w, one rational per axis. */
|
|
15
|
+
readonly translation: readonly Rational[];
|
|
16
|
+
}
|
|
17
|
+
/** The plain form of an operation at the API: integer matrix, translation as the nearest doubles. */
|
|
18
|
+
export interface PlainOperation {
|
|
19
|
+
/** The linear part W, integer entries, rows first. */
|
|
20
|
+
readonly matrix: number[][];
|
|
21
|
+
/** The translation part w as doubles (1/3 as the nearest double). */
|
|
22
|
+
readonly translation: number[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The default bound on the cosets of a closure: no plane group has more than 12 cosets of the
|
|
26
|
+
* integer translations, no space group in its conventional cell more than 192 (Fm-3m: 48 × 4). A
|
|
27
|
+
* closure in a larger cell (a supercell, a subgroup of index k) passes a larger bound.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MAX_COSETS = 192;
|
|
30
|
+
/** The dimension d of an operation; throws unless it is consistent (d = 1 to 3, integer matrix). */
|
|
31
|
+
export declare function dimensionOf(op: ExactOperation): number;
|
|
32
|
+
/** The identity of dimension d. */
|
|
33
|
+
export declare function identity(d: number): ExactOperation;
|
|
34
|
+
/** The pure translation by t, an operation (I, t). */
|
|
35
|
+
export declare function translationOperation(t: readonly Rational[]): ExactOperation;
|
|
36
|
+
/** The determinant of an integer matrix of size 1 to 3. */
|
|
37
|
+
export declare function determinant(m: IntMatrix): number;
|
|
38
|
+
/** The trace of an integer matrix. */
|
|
39
|
+
export declare function trace(m: IntMatrix): number;
|
|
40
|
+
/** Throws unless det W = ±1, as for every operation of a crystallographic group. */
|
|
41
|
+
export declare function checkUnimodular(op: ExactOperation): void;
|
|
42
|
+
/** The image of the point x (rational coordinates) under the operation, W·x + w. */
|
|
43
|
+
export declare function applyToPoint(op: ExactOperation, x: readonly Rational[]): Rational[];
|
|
44
|
+
/** The product a·b: first b, then a; (W_a, w_a)(W_b, w_b) = (W_a W_b, W_a w_b + w_a). */
|
|
45
|
+
export declare function compose(a: ExactOperation, b: ExactOperation): ExactOperation;
|
|
46
|
+
/** The inverse (W⁻¹, −W⁻¹w); throws unless det W = ±1, so that W⁻¹ is an integer matrix. */
|
|
47
|
+
export declare function inverse(op: ExactOperation): ExactOperation;
|
|
48
|
+
/** The operation with its translation reduced modulo 1 into [0, 1): the representative of its coset. */
|
|
49
|
+
export declare function reduceModLattice(op: ExactOperation): ExactOperation;
|
|
50
|
+
/** True if a and b are the same operation, translation included. */
|
|
51
|
+
export declare function operationsEqual(a: ExactOperation, b: ExactOperation): boolean;
|
|
52
|
+
/** True if a and b differ by an integer lattice translation: the same coset of the integer translations. */
|
|
53
|
+
export declare function equalModLattice(a: ExactOperation, b: ExactOperation): boolean;
|
|
54
|
+
/** Options of `closure`. */
|
|
55
|
+
export interface ClosureOptions {
|
|
56
|
+
/** The dimension; needed only for an empty list of generators. */
|
|
57
|
+
readonly dimension?: number;
|
|
58
|
+
/** The largest number of cosets allowed, `MAX_COSETS` by default. */
|
|
59
|
+
readonly maxCosets?: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The group generated by `generators` together with the integer translations, as one operation per
|
|
63
|
+
* coset of the integer translations (translations in [0, 1)). The identity comes first, the others
|
|
64
|
+
* in the order in which the closure finds them (breadth first, each found operation multiplied by
|
|
65
|
+
* the generators from the left); this order has no meaning of its own. A centring translation is
|
|
66
|
+
* passed as a generator. Throws if a generator has a determinant other than ±1 or the closure
|
|
67
|
+
* exceeds `maxCosets`, which no crystallographic group in its conventional cell does.
|
|
68
|
+
*/
|
|
69
|
+
export declare function closure(generators: readonly ExactOperation[], options?: ClosureOptions): ExactOperation[];
|
|
70
|
+
/**
|
|
71
|
+
* Reads an operation from its coordinate triplet as ITA prints it in the general position, e.g.
|
|
72
|
+
* `-x+1/2,y` (plane) or `-y,x-y,z+1/3` (space), with `-x` for x̄. The dimension is the number of
|
|
73
|
+
* coordinates. Integer coefficients other than ±1 (as in `2x,x` of a Wyckoff position) are read; a
|
|
74
|
+
* group operation is checked for det ±1 where it is used (`closure`, `inverse`).
|
|
75
|
+
*/
|
|
76
|
+
export declare function parseOperation(text: string): ExactOperation;
|
|
77
|
+
/** Writes an operation as ITA prints its coordinate triplet, e.g. `-x+1/2,y`, `x-y,x,z+5/6`. */
|
|
78
|
+
export declare function formatOperation(op: ExactOperation): string;
|
|
79
|
+
/** The operation as plain data for the API: integer matrix, translation as the nearest doubles. */
|
|
80
|
+
export declare function toPlain(op: ExactOperation): PlainOperation;
|
|
81
|
+
//# sourceMappingURL=affine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine.d.ts","sourceRoot":"","sources":["../../src/spaceGroups/affine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAeL,KAAK,QAAQ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AAED,4FAA4F;AAC5F,wBAAgB,OAAO,CAAC,EAAE,EAAE,cAAc,GAAG,cAAc,CAyB1D;AAED,wGAAwG;AACxG,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,cAAc,GAAG,cAAc,CAEnE;AAMD,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAM7E;AAED,4GAA4G;AAC5G,wBAAgB,eAAe,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAM7E;AAED,4BAA4B;AAC5B,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,EAAE,OAAO,GAAE,cAAmB,GAAG,cAAc,EAAE,CAwB7G;AAyCD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAQ3D;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,EAAE,EAAE,cAAc,GAAG,MAAM,CAmB1D;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,EAAE,EAAE,cAAc,GAAG,cAAc,CAE1D"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact affine operations of plane and space groups, x' = W·x + w in the lattice basis (ITA
|
|
3
|
+
* notation (W, w)): the matrix W with integer entries and determinant ±1, the translation w with
|
|
4
|
+
* rational components. Written for any dimension d from 1 to 3 (2 for the plane groups, 3 for the
|
|
5
|
+
* space groups). CLAUDE.md, "Plane groups (and later space groups)".
|
|
6
|
+
*/
|
|
7
|
+
import { ZERO, add, checkSafeInteger, formatRational, isInteger, mod1, negate, parseRational, rationalsEqual, safeProduct, safeSum, scale, subtract, toNumber, } from './rational.js';
|
|
8
|
+
/**
|
|
9
|
+
* The default bound on the cosets of a closure: no plane group has more than 12 cosets of the
|
|
10
|
+
* integer translations, no space group in its conventional cell more than 192 (Fm-3m: 48 × 4). A
|
|
11
|
+
* closure in a larger cell (a supercell, a subgroup of index k) passes a larger bound.
|
|
12
|
+
*/
|
|
13
|
+
export const MAX_COSETS = 192;
|
|
14
|
+
/** The coordinate names in ITA's coordinate triplets. */
|
|
15
|
+
const COORDINATES = ['x', 'y', 'z'];
|
|
16
|
+
function checkDimension(d) {
|
|
17
|
+
if (!Number.isInteger(d) || d < 1 || d > 3) {
|
|
18
|
+
throw new RangeError(`The dimension must be 1, 2 or 3, not ${String(d)}`);
|
|
19
|
+
}
|
|
20
|
+
return d;
|
|
21
|
+
}
|
|
22
|
+
/** The dimension d of an operation; throws unless it is consistent (d = 1 to 3, integer matrix). */
|
|
23
|
+
export function dimensionOf(op) {
|
|
24
|
+
const d = op.matrix.length;
|
|
25
|
+
if (d < 1 || d > 3 || op.translation.length !== d || op.matrix.some((row) => row.length !== d)) {
|
|
26
|
+
throw new RangeError(`Not an operation of dimension 1 to 3: ${JSON.stringify(op)}`);
|
|
27
|
+
}
|
|
28
|
+
for (const row of op.matrix) {
|
|
29
|
+
for (const v of row) {
|
|
30
|
+
checkSafeInteger(v, 'A matrix entry');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return d;
|
|
34
|
+
}
|
|
35
|
+
/** The identity of dimension d. */
|
|
36
|
+
export function identity(d) {
|
|
37
|
+
checkDimension(d);
|
|
38
|
+
return {
|
|
39
|
+
matrix: Array.from({ length: d }, (_, i) => Array.from({ length: d }, (_, j) => (i === j ? 1 : 0))),
|
|
40
|
+
translation: Array.from({ length: d }, () => ZERO),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** The pure translation by t, an operation (I, t). */
|
|
44
|
+
export function translationOperation(t) {
|
|
45
|
+
return { matrix: identity(t.length).matrix, translation: [...t] };
|
|
46
|
+
}
|
|
47
|
+
function applyMatrix(m, v) {
|
|
48
|
+
return m.map((row) => row.reduce((sum, mij, j) => add(sum, scale(mij, v[j])), ZERO));
|
|
49
|
+
}
|
|
50
|
+
function multiplyMatrices(a, b) {
|
|
51
|
+
return a.map((row) => b[0].map((_, j) => row.reduce((sum, aik, k) => safeSum(sum, safeProduct(aik, b[k][j])), 0) + 0));
|
|
52
|
+
}
|
|
53
|
+
/** The determinant of an integer matrix of size 1 to 3. */
|
|
54
|
+
export function determinant(m) {
|
|
55
|
+
checkDimension(m.length);
|
|
56
|
+
const p = safeProduct;
|
|
57
|
+
if (m.length === 1)
|
|
58
|
+
return m[0][0];
|
|
59
|
+
if (m.length === 2)
|
|
60
|
+
return safeSum(p(m[0][0], m[1][1]), -p(m[0][1], m[1][0]));
|
|
61
|
+
const minor = (i, j, k, l) => safeSum(p(m[1][i], m[2][j]), -p(m[1][k], m[2][l]));
|
|
62
|
+
return safeSum(safeSum(p(m[0][0], minor(1, 2, 2, 1)), -p(m[0][1], minor(0, 2, 2, 0))), p(m[0][2], minor(0, 1, 1, 0)));
|
|
63
|
+
}
|
|
64
|
+
/** The trace of an integer matrix. */
|
|
65
|
+
export function trace(m) {
|
|
66
|
+
return m.reduce((sum, row, i) => safeSum(sum, row[i]), 0);
|
|
67
|
+
}
|
|
68
|
+
/** Throws unless det W = ±1, as for every operation of a crystallographic group. */
|
|
69
|
+
export function checkUnimodular(op) {
|
|
70
|
+
dimensionOf(op);
|
|
71
|
+
const det = determinant(op.matrix);
|
|
72
|
+
if (det !== 1 && det !== -1) {
|
|
73
|
+
throw new RangeError(`Determinant ${det} is not ±1: ${JSON.stringify(op.matrix)}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** The image of the point x (rational coordinates) under the operation, W·x + w. */
|
|
77
|
+
export function applyToPoint(op, x) {
|
|
78
|
+
return applyMatrix(op.matrix, x).map((v, i) => add(v, op.translation[i]));
|
|
79
|
+
}
|
|
80
|
+
/** The product a·b: first b, then a; (W_a, w_a)(W_b, w_b) = (W_a W_b, W_a w_b + w_a). */
|
|
81
|
+
export function compose(a, b) {
|
|
82
|
+
return {
|
|
83
|
+
matrix: multiplyMatrices(a.matrix, b.matrix),
|
|
84
|
+
translation: applyMatrix(a.matrix, b.translation).map((v, i) => add(v, a.translation[i])),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** The inverse (W⁻¹, −W⁻¹w); throws unless det W = ±1, so that W⁻¹ is an integer matrix. */
|
|
88
|
+
export function inverse(op) {
|
|
89
|
+
checkUnimodular(op);
|
|
90
|
+
const d = op.matrix.length;
|
|
91
|
+
const m = op.matrix;
|
|
92
|
+
const det = determinant(m);
|
|
93
|
+
let inv;
|
|
94
|
+
if (d === 1) {
|
|
95
|
+
inv = [[det]];
|
|
96
|
+
}
|
|
97
|
+
else if (d === 2) {
|
|
98
|
+
inv = [
|
|
99
|
+
[m[1][1] * det, -m[0][1] * det],
|
|
100
|
+
[-m[1][0] * det, m[0][0] * det],
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// The adjugate divided by det, i.e. multiplied by det = ±1: inv[i][j] = cofactor(j, i).
|
|
105
|
+
const cofactor = (i, j) => {
|
|
106
|
+
const r = [0, 1, 2].filter((k) => k !== i);
|
|
107
|
+
const s = [0, 1, 2].filter((k) => k !== j);
|
|
108
|
+
const minor = safeSum(safeProduct(m[r[0]][s[0]], m[r[1]][s[1]]), -safeProduct(m[r[0]][s[1]], m[r[1]][s[0]]));
|
|
109
|
+
return ((i + j) % 2 === 0 ? minor : -minor) * det;
|
|
110
|
+
};
|
|
111
|
+
inv = [0, 1, 2].map((i) => [0, 1, 2].map((j) => cofactor(j, i)));
|
|
112
|
+
}
|
|
113
|
+
inv = inv.map((row) => row.map((v) => v + 0));
|
|
114
|
+
return { matrix: inv, translation: applyMatrix(inv, op.translation).map(negate) };
|
|
115
|
+
}
|
|
116
|
+
/** The operation with its translation reduced modulo 1 into [0, 1): the representative of its coset. */
|
|
117
|
+
export function reduceModLattice(op) {
|
|
118
|
+
return { matrix: op.matrix, translation: op.translation.map(mod1) };
|
|
119
|
+
}
|
|
120
|
+
function matricesEqual(a, b) {
|
|
121
|
+
return a.length === b.length && a.every((row, i) => row.length === b[i].length && row.every((v, j) => v === b[i][j]));
|
|
122
|
+
}
|
|
123
|
+
/** True if a and b are the same operation, translation included. */
|
|
124
|
+
export function operationsEqual(a, b) {
|
|
125
|
+
return (matricesEqual(a.matrix, b.matrix) &&
|
|
126
|
+
a.translation.length === b.translation.length &&
|
|
127
|
+
a.translation.every((t, i) => rationalsEqual(t, b.translation[i])));
|
|
128
|
+
}
|
|
129
|
+
/** True if a and b differ by an integer lattice translation: the same coset of the integer translations. */
|
|
130
|
+
export function equalModLattice(a, b) {
|
|
131
|
+
return (matricesEqual(a.matrix, b.matrix) &&
|
|
132
|
+
a.translation.length === b.translation.length &&
|
|
133
|
+
a.translation.every((t, i) => isInteger(subtract(t, b.translation[i]))));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The group generated by `generators` together with the integer translations, as one operation per
|
|
137
|
+
* coset of the integer translations (translations in [0, 1)). The identity comes first, the others
|
|
138
|
+
* in the order in which the closure finds them (breadth first, each found operation multiplied by
|
|
139
|
+
* the generators from the left); this order has no meaning of its own. A centring translation is
|
|
140
|
+
* passed as a generator. Throws if a generator has a determinant other than ±1 or the closure
|
|
141
|
+
* exceeds `maxCosets`, which no crystallographic group in its conventional cell does.
|
|
142
|
+
*/
|
|
143
|
+
export function closure(generators, options = {}) {
|
|
144
|
+
const d = checkDimension(options.dimension ?? (generators.length > 0 ? dimensionOf(generators[0]) : 0));
|
|
145
|
+
const maxCosets = options.maxCosets ?? MAX_COSETS;
|
|
146
|
+
for (const g of generators) {
|
|
147
|
+
if (dimensionOf(g) !== d) {
|
|
148
|
+
throw new RangeError(`Generators of different dimension: ${d} and ${dimensionOf(g)}`);
|
|
149
|
+
}
|
|
150
|
+
checkUnimodular(g);
|
|
151
|
+
}
|
|
152
|
+
const result = [identity(d)];
|
|
153
|
+
for (let i = 0; i < result.length; i++) {
|
|
154
|
+
for (const g of generators) {
|
|
155
|
+
const product = reduceModLattice(compose(g, result[i]));
|
|
156
|
+
if (!result.some((op) => equalModLattice(op, product))) {
|
|
157
|
+
if (result.length >= maxCosets) {
|
|
158
|
+
throw new RangeError(`The closure exceeds ${maxCosets} cosets: the generators form no crystallographic group`);
|
|
159
|
+
}
|
|
160
|
+
result.push(product);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The terms of one coordinate of a triplet. A term is a sign followed by an integer coefficient and
|
|
168
|
+
* a coordinate, or by a rational; only the first term may omit its sign. The terms must cover the
|
|
169
|
+
* whole text, so that a stray sign (`--x`, `x+`) is an error rather than skipped.
|
|
170
|
+
*/
|
|
171
|
+
const TERM = /([+-]?)(?:(\d*)([xyz])|(\d+(?:\/\d+)?))/y;
|
|
172
|
+
/** One row of a coordinate triplet, e.g. `-x+y+1/3`: integer coefficients and a rational constant. */
|
|
173
|
+
function parseRow(text, d, whole) {
|
|
174
|
+
const coefficients = Array.from({ length: d }, () => 0);
|
|
175
|
+
let constant = ZERO;
|
|
176
|
+
const s = text.replace(/\s/g, '');
|
|
177
|
+
if (s === '') {
|
|
178
|
+
throw new RangeError(`Empty coordinate in "${whole}"`);
|
|
179
|
+
}
|
|
180
|
+
TERM.lastIndex = 0;
|
|
181
|
+
let first = true;
|
|
182
|
+
while (TERM.lastIndex < s.length) {
|
|
183
|
+
const start = TERM.lastIndex;
|
|
184
|
+
const m = TERM.exec(s);
|
|
185
|
+
if (!m || m.index !== start || (!first && m[1] === '')) {
|
|
186
|
+
throw new RangeError(`Cannot read "${s.slice(start)}" in "${whole}"`);
|
|
187
|
+
}
|
|
188
|
+
first = false;
|
|
189
|
+
const sign = m[1] === '-' ? -1 : 1;
|
|
190
|
+
if (m[3] !== undefined) {
|
|
191
|
+
const k = COORDINATES.indexOf(m[3]);
|
|
192
|
+
if (k >= d) {
|
|
193
|
+
throw new RangeError(`Coordinate ${m[3]} in a ${d}-dimensional triplet "${whole}"`);
|
|
194
|
+
}
|
|
195
|
+
const c = m[2] === '' ? 1 : checkSafeInteger(Number(m[2]), 'A coefficient');
|
|
196
|
+
coefficients[k] = safeSum(coefficients[k], sign * c);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
constant = add(constant, scale(sign, parseRational(m[4])));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return { coefficients, constant };
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Reads an operation from its coordinate triplet as ITA prints it in the general position, e.g.
|
|
206
|
+
* `-x+1/2,y` (plane) or `-y,x-y,z+1/3` (space), with `-x` for x̄. The dimension is the number of
|
|
207
|
+
* coordinates. Integer coefficients other than ±1 (as in `2x,x` of a Wyckoff position) are read; a
|
|
208
|
+
* group operation is checked for det ±1 where it is used (`closure`, `inverse`).
|
|
209
|
+
*/
|
|
210
|
+
export function parseOperation(text) {
|
|
211
|
+
const parts = text.split(',');
|
|
212
|
+
const d = parts.length;
|
|
213
|
+
if (d > 3) {
|
|
214
|
+
throw new RangeError(`Not a coordinate triplet: "${text}"`);
|
|
215
|
+
}
|
|
216
|
+
const rows = parts.map((p) => parseRow(p, d, text));
|
|
217
|
+
return { matrix: rows.map((r) => r.coefficients), translation: rows.map((r) => r.constant) };
|
|
218
|
+
}
|
|
219
|
+
/** Writes an operation as ITA prints its coordinate triplet, e.g. `-x+1/2,y`, `x-y,x,z+5/6`. */
|
|
220
|
+
export function formatOperation(op) {
|
|
221
|
+
dimensionOf(op);
|
|
222
|
+
return op.matrix
|
|
223
|
+
.map((row, i) => {
|
|
224
|
+
let s = '';
|
|
225
|
+
row.forEach((c, j) => {
|
|
226
|
+
if (c === 0)
|
|
227
|
+
return;
|
|
228
|
+
const name = COORDINATES[j];
|
|
229
|
+
const magnitude = Math.abs(c) === 1 ? name : `${Math.abs(c)}${name}`;
|
|
230
|
+
s += c < 0 ? `-${magnitude}` : s === '' ? magnitude : `+${magnitude}`;
|
|
231
|
+
});
|
|
232
|
+
const t = op.translation[i];
|
|
233
|
+
if (t[0] !== 0) {
|
|
234
|
+
const f = formatRational(t);
|
|
235
|
+
s += t[0] < 0 || s === '' ? f : `+${f}`;
|
|
236
|
+
}
|
|
237
|
+
return s === '' ? '0' : s;
|
|
238
|
+
})
|
|
239
|
+
.join(',');
|
|
240
|
+
}
|
|
241
|
+
/** The operation as plain data for the API: integer matrix, translation as the nearest doubles. */
|
|
242
|
+
export function toPlain(op) {
|
|
243
|
+
return { matrix: op.matrix.map((row) => [...row]), translation: op.translation.map(toNumber) };
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=affine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine.js","sourceRoot":"","sources":["../../src/spaceGroups/affine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,IAAI,EACJ,GAAG,EACH,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,IAAI,EACJ,MAAM,EACN,aAAa,EACb,cAAc,EACd,WAAW,EACX,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,GAET,MAAM,eAAe,CAAC;AAqBvB;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC;AAE9B,yDAAyD;AACzD,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAE7C,SAAS,cAAc,CAAC,CAAS;IAC/B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,UAAU,CAAC,wCAAwC,MAAM,CAAC,CA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K,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,OAAO,CAAC,EAAkB;IACxC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The asymmetric unit of a plane group and its symmetry elements in the conventional cell, as numbers
|
|
3
|
+
* (CLAUDE.md, "The API of `symcrys/plane`"): the asymmetric unit as inequalities with its vertices,
|
|
4
|
+
* the elements as rotation centres with their order and as mirror and glide lines with the segment
|
|
5
|
+
* that lies in the cell [0, 1]². Exact, in the lattice basis; drawing them stays with the
|
|
6
|
+
* applications. Internal for now.
|
|
7
|
+
*/
|
|
8
|
+
import { type Rational } from './rational.js';
|
|
9
|
+
/** An inequality a·x + b·y ≤ c with integer coefficients without a common factor. */
|
|
10
|
+
export type Inequality = readonly [a: number, b: number, c: number];
|
|
11
|
+
/** The asymmetric unit of a plane group, a convex polygon in the lattice basis. */
|
|
12
|
+
export interface AsymmetricUnit {
|
|
13
|
+
/** Its vertices, counter-clockwise in the lattice basis (a towards b), starting at the vertex with the smallest y, then x. */
|
|
14
|
+
readonly vertices: readonly (readonly Rational[])[];
|
|
15
|
+
/** Its edges as inequalities: inequality i holds the edge from vertex i to vertex i + 1. */
|
|
16
|
+
readonly inequalities: readonly Inequality[];
|
|
17
|
+
}
|
|
18
|
+
/** A rotation centre in the cell. */
|
|
19
|
+
export interface RotationCentre {
|
|
20
|
+
/** The highest order of a rotation about it. */
|
|
21
|
+
readonly order: number;
|
|
22
|
+
/** Its position in [0, 1]². */
|
|
23
|
+
readonly point: readonly Rational[];
|
|
24
|
+
}
|
|
25
|
+
/** A mirror or glide line, the part of it in the cell. */
|
|
26
|
+
export interface SymmetryLine {
|
|
27
|
+
/** `'mirror'` or `'glide'`. */
|
|
28
|
+
readonly kind: 'mirror' | 'glide';
|
|
29
|
+
/** The direction of the line, the shortest integer vector, first non-zero component positive. */
|
|
30
|
+
readonly direction: readonly [number, number];
|
|
31
|
+
/** For a glide line: its glide vector s·direction with 0 < s < 1; for a mirror line (0, 0). */
|
|
32
|
+
readonly glide: readonly Rational[];
|
|
33
|
+
/** The ends of the segment of the line in the cell [0, 1]², in the order of `direction`. */
|
|
34
|
+
readonly segment: readonly [readonly Rational[], readonly Rational[]];
|
|
35
|
+
}
|
|
36
|
+
/** The symmetry elements of a plane group in the cell [0, 1]². */
|
|
37
|
+
export interface CellElements {
|
|
38
|
+
/** The rotation centres, by descending order, then by y and x. */
|
|
39
|
+
readonly rotations: readonly RotationCentre[];
|
|
40
|
+
/** The mirror and glide lines with a segment of non-zero length in the cell, by direction, then by the start of the segment (y, then x). */
|
|
41
|
+
readonly lines: readonly SymmetryLine[];
|
|
42
|
+
}
|
|
43
|
+
/** Reads the printed block "Asymmetric unit", e.g. `0 <= x <= 1/2; y <= min(1 - x, (1 + x)/2)`. */
|
|
44
|
+
export declare function parseAsymmetricUnit(text: string): Inequality[];
|
|
45
|
+
/**
|
|
46
|
+
* The asymmetric unit of a plane group as ITA prints it, a convex polygon: its vertices and, for each
|
|
47
|
+
* edge, the inequality a·x + b·y ≤ c that holds it. Printed inequalities that hold no edge are
|
|
48
|
+
* left out. Frozen.
|
|
49
|
+
*/
|
|
50
|
+
export declare function planeAsymmetricUnit(key: string | number): AsymmetricUnit;
|
|
51
|
+
/**
|
|
52
|
+
* The symmetry elements of a plane group in its conventional cell [0, 1]², boundary included: every
|
|
53
|
+
* rotation centre with the highest order of a rotation about it, and every mirror and glide line
|
|
54
|
+
* that crosses the cell, with the segment inside it. A line that carries a glide is a glide line
|
|
55
|
+
* with its shortest glide vector along the line (between 0 and the lattice vector). Frozen.
|
|
56
|
+
*/
|
|
57
|
+
export declare function planeCellElements(key: string | number): CellElements;
|
|
58
|
+
//# sourceMappingURL=cell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../../src/spaceGroups/cell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAaL,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AAEvB,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAEpE,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC7B,8HAA8H;IAC9H,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,CAAC;IACpD,4FAA4F;IAC5F,QAAQ,CAAC,YAAY,EAAE,SAAS,UAAU,EAAE,CAAC;CAC9C;AAED,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CACrC;AAED,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,4FAA4F;IAC5F,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,QAAQ,EAAE,EAA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