symcrys 0.5.0 → 0.6.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/README.md +15 -3
- package/dist/crystalClasses.d.ts +222 -0
- package/dist/crystalClasses.d.ts.map +1 -0
- package/dist/crystalClasses.js +295 -0
- package/dist/crystalClasses.js.map +1 -0
- package/dist/index.d.ts +11 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/lattice.d.ts +5 -1
- package/dist/lattice.d.ts.map +1 -1
- package/dist/lattice.js +3 -1
- package/dist/lattice.js.map +1 -1
- package/dist/magnetic.d.ts +36 -0
- package/dist/magnetic.d.ts.map +1 -0
- package/dist/magnetic.js +22 -0
- package/dist/magnetic.js.map +1 -0
- package/dist/operations.d.ts +10 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +25 -0
- package/dist/operations.js.map +1 -1
- package/dist/pointGroups/data.d.ts +36 -1
- package/dist/pointGroups/data.d.ts.map +1 -1
- package/dist/pointGroups/data.js +29 -21
- package/dist/pointGroups/data.js.map +1 -1
- package/dist/pointGroups/elements.d.ts +16 -6
- package/dist/pointGroups/elements.d.ts.map +1 -1
- package/dist/pointGroups/elements.js +7 -2
- package/dist/pointGroups/elements.js.map +1 -1
- package/dist/pointGroups/magneticData.d.ts +66 -0
- package/dist/pointGroups/magneticData.d.ts.map +1 -0
- package/dist/pointGroups/magneticData.js +184 -0
- package/dist/pointGroups/magneticData.js.map +1 -0
- package/dist/pointGroups/magneticSymbols.d.ts +22 -0
- package/dist/pointGroups/magneticSymbols.d.ts.map +1 -0
- package/dist/pointGroups/magneticSymbols.js +103 -0
- package/dist/pointGroups/magneticSymbols.js.map +1 -0
- package/dist/pointGroups/pointGroups.d.ts +102 -24
- package/dist/pointGroups/pointGroups.d.ts.map +1 -1
- package/dist/pointGroups/pointGroups.js +293 -47
- package/dist/pointGroups/pointGroups.js.map +1 -1
- package/dist/pointGroups/properties.d.ts +25 -16
- package/dist/pointGroups/properties.d.ts.map +1 -1
- package/dist/pointGroups/properties.js +46 -56
- package/dist/pointGroups/properties.js.map +1 -1
- package/dist/pointGroups/wyckoff.d.ts +4 -1
- package/dist/pointGroups/wyckoff.d.ts.map +1 -1
- package/dist/pointGroups/wyckoff.js +6 -2
- package/dist/pointGroups/wyckoff.js.map +1 -1
- package/dist/siteSymmetry.d.ts +2 -1
- package/dist/siteSymmetry.d.ts.map +1 -1
- package/dist/siteSymmetry.js.map +1 -1
- package/dist/tensors/propertyTable.d.ts +45 -0
- package/dist/tensors/propertyTable.d.ts.map +1 -0
- package/dist/tensors/propertyTable.js +41 -0
- package/dist/tensors/propertyTable.js.map +1 -0
- package/dist/tensors/tensorForm.d.ts +21 -10
- package/dist/tensors/tensorForm.d.ts.map +1 -1
- package/dist/tensors/tensorForm.js +23 -24
- package/dist/tensors/tensorForm.js.map +1 -1
- package/dist/tensors/tensorProperties.d.ts +30 -0
- package/dist/tensors/tensorProperties.d.ts.map +1 -0
- package/dist/tensors/tensorProperties.js +44 -0
- package/dist/tensors/tensorProperties.js.map +1 -0
- package/dist/version.d.ts +6 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +6 -2
- package/dist/version.js.map +1 -1
- package/package.json +6 -2
- package/src/crystalClasses.ts +451 -0
- package/src/index.ts +32 -38
- package/src/lattice.ts +5 -1
- package/src/magnetic.ts +88 -0
- package/src/operations.ts +31 -0
- package/src/pointGroups/data.ts +33 -22
- package/src/pointGroups/elements.ts +27 -8
- package/src/pointGroups/magneticData.ts +328 -0
- package/src/pointGroups/magneticSymbols.ts +110 -0
- package/src/pointGroups/pointGroups.ts +388 -65
- package/src/pointGroups/properties.ts +47 -56
- package/src/pointGroups/wyckoff.ts +17 -2
- package/src/siteSymmetry.ts +2 -1
- package/src/tensors/propertyTable.ts +89 -0
- package/src/tensors/tensorForm.ts +39 -28
- package/src/tensors/tensorProperties.ts +50 -0
- package/src/version.ts +6 -2
|
@@ -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,UAAU,EAAkB,MAAM,kBAAkB,CAAC;
|
|
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,MAAM,IAAI,UAAU,CAAC,mCAAmC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3G,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,OAAO;QAC1C,MAAM,IAAI,UAAU,CAAC,0BAA0B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3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,GAAG,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which named tensor properties a point group allows: the property is allowed if the tensor that
|
|
3
|
+
* describes it (`TENSOR_PROPERTIES`) has a non-zero form under the group. Symmetry only allows a
|
|
4
|
+
* property; whether a crystal shows it is a question of the material.
|
|
5
|
+
*
|
|
6
|
+
* These functions serve the magnetic API (`magnetic.ts`), where a key of type `'I'` (`'432'`) is the
|
|
7
|
+
* white group: the symmetry of a magnetically ordered crystal in which time reversal does not occur
|
|
8
|
+
* at all (`'432'` is magnetoelectric). A crystal without magnetic order has the grey group of its
|
|
9
|
+
* class (`"4321'"`), which allows no time-odd property; for the time-even properties the two agree.
|
|
10
|
+
* The crystallographic API (`crystalClasses.ts`) knows the time-even properties only
|
|
11
|
+
* (docs/conventions.md, "Two entry points").
|
|
12
|
+
*/
|
|
13
|
+
import type { Operation } from '../operations.js';
|
|
14
|
+
import type { MagneticPointGroupKey } from '../pointGroups/pointGroups.js';
|
|
15
|
+
import { type TensorPropertyName } from './propertyTable.js';
|
|
16
|
+
/**
|
|
17
|
+
* True if the point group allows the named property, e.g. `allowsProperty('-6m2', 'piezoelectric')`.
|
|
18
|
+
* It does not depend on setting or convention. Throws a RangeError for an unknown key or name.
|
|
19
|
+
*/
|
|
20
|
+
export declare function allowsProperty(key: MagneticPointGroupKey, name: TensorPropertyName): boolean;
|
|
21
|
+
/** The named properties the point group allows, in the order of `TENSOR_PROPERTIES`. */
|
|
22
|
+
export declare function allowedProperties(key: MagneticPointGroupKey): TensorPropertyName[];
|
|
23
|
+
/**
|
|
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.
|
|
26
|
+
*/
|
|
27
|
+
export declare function allowsPropertyOf(operations: readonly Operation[], name: TensorPropertyName): boolean;
|
|
28
|
+
/** The named properties the group generated by `operations` allows. */
|
|
29
|
+
export declare function allowedPropertiesOf(operations: readonly Operation[]): TensorPropertyName[];
|
|
30
|
+
//# sourceMappingURL=tensorProperties.d.ts.map
|
|
@@ -0,0 +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;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAEpG;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,kBAAkB,EAAE,CAE1F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which named tensor properties a point group allows: the property is allowed if the tensor that
|
|
3
|
+
* describes it (`TENSOR_PROPERTIES`) has a non-zero form under the group. Symmetry only allows a
|
|
4
|
+
* property; whether a crystal shows it is a question of the material.
|
|
5
|
+
*
|
|
6
|
+
* These functions serve the magnetic API (`magnetic.ts`), where a key of type `'I'` (`'432'`) is the
|
|
7
|
+
* white group: the symmetry of a magnetically ordered crystal in which time reversal does not occur
|
|
8
|
+
* at all (`'432'` is magnetoelectric). A crystal without magnetic order has the grey group of its
|
|
9
|
+
* class (`"4321'"`), which allows no time-odd property; for the time-even properties the two agree.
|
|
10
|
+
* The crystallographic API (`crystalClasses.ts`) knows the time-even properties only
|
|
11
|
+
* (docs/conventions.md, "Two entry points").
|
|
12
|
+
*/
|
|
13
|
+
import { TENSOR_PROPERTY_NAMES, specOf } from './propertyTable.js';
|
|
14
|
+
import { tensorForm, tensorFormOf } from './tensorForm.js';
|
|
15
|
+
/** A name of the table; anything else, a specification included, is an error here. */
|
|
16
|
+
function named(name) {
|
|
17
|
+
if (typeof name !== 'string')
|
|
18
|
+
throw new RangeError(`Unknown tensor property: ${JSON.stringify(name)}`);
|
|
19
|
+
specOf(name);
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* True if the point group allows the named property, e.g. `allowsProperty('-6m2', 'piezoelectric')`.
|
|
24
|
+
* It does not depend on setting or convention. Throws a RangeError for an unknown key or name.
|
|
25
|
+
*/
|
|
26
|
+
export function allowsProperty(key, name) {
|
|
27
|
+
return tensorForm(key, named(name), { setting: 1 }).basis.length > 0;
|
|
28
|
+
}
|
|
29
|
+
/** The named properties the point group allows, in the order of `TENSOR_PROPERTIES`. */
|
|
30
|
+
export function allowedProperties(key) {
|
|
31
|
+
return TENSOR_PROPERTY_NAMES.filter((name) => allowsProperty(key, name));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
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.
|
|
36
|
+
*/
|
|
37
|
+
export function allowsPropertyOf(operations, name) {
|
|
38
|
+
return tensorFormOf(operations, named(name)).basis.length > 0;
|
|
39
|
+
}
|
|
40
|
+
/** The named properties the group generated by `operations` allows. */
|
|
41
|
+
export function allowedPropertiesOf(operations) {
|
|
42
|
+
return TENSOR_PROPERTY_NAMES.filter((name) => allowsPropertyOf(operations, name));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=tensorProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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AC;AACpF,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The version of symcrys, the same for the TypeScript and the Python package.
|
|
3
|
+
*
|
|
4
|
+
* @remarks Kept equal to `version` in package.json (checked by version.test.ts).
|
|
5
|
+
*/
|
|
6
|
+
export declare const VERSION = "0.6.1";
|
|
3
7
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/dist/version.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The version of symcrys, the same for the TypeScript and the Python package.
|
|
3
|
+
*
|
|
4
|
+
* @remarks Kept equal to `version` in package.json (checked by version.test.ts).
|
|
5
|
+
*/
|
|
6
|
+
export const VERSION = '0.6.1';
|
|
3
7
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "symcrys",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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",
|
|
@@ -17,13 +17,17 @@
|
|
|
17
17
|
"directory": "packages/ts"
|
|
18
18
|
},
|
|
19
19
|
"bugs": "https://github.com/manganite/symcrys/issues",
|
|
20
|
-
"homepage": "https://github.
|
|
20
|
+
"homepage": "https://manganite.github.io/symcrys/",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
25
|
"default": "./dist/index.js"
|
|
26
26
|
},
|
|
27
|
+
"./magnetic": {
|
|
28
|
+
"types": "./dist/magnetic.d.ts",
|
|
29
|
+
"default": "./dist/magnetic.js"
|
|
30
|
+
},
|
|
27
31
|
"./package.json": "./package.json"
|
|
28
32
|
},
|
|
29
33
|
"main": "./dist/index.js",
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The crystallographic API: the 32 crystal classes, without time reversal. It is what `index.ts`
|
|
3
|
+
* exports. Nothing here mentions time reversal: an operation is its matrix, a tensor has no time
|
|
4
|
+
* parity, and the named properties are those of time-even tensors. A question that involves time
|
|
5
|
+
* reversal (a magnetic point group, a time-odd tensor or property, an operation combined with time
|
|
6
|
+
* reversal) is a RangeError that names the magnetic API (`magnetic.ts`, `symcrys/magnetic`), where
|
|
7
|
+
* the key `'32'` is the white group and a crystal without magnetic order has the grey group of its
|
|
8
|
+
* class (`"321'"`; docs/conventions.md, "Two entry points").
|
|
9
|
+
*
|
|
10
|
+
* Everything is computed by the modules that serve both entry points; this module checks what
|
|
11
|
+
* comes in and leaves time reversal out of what goes back.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { CrystalSystem } from './lattice.js';
|
|
15
|
+
import type { Mat3, Vec3 } from './linalg.js';
|
|
16
|
+
import type { Operation as MagneticOperation } from './operations.js';
|
|
17
|
+
import * as elements from './pointGroups/elements.js';
|
|
18
|
+
import * as groups from './pointGroups/pointGroups.js';
|
|
19
|
+
import type { Convention, PointGroupKey, Setting, SettingOptions, SymbolOptions } from './pointGroups/pointGroups.js';
|
|
20
|
+
import * as properties from './pointGroups/properties.js';
|
|
21
|
+
import * as wyckoff from './pointGroups/wyckoff.js';
|
|
22
|
+
import * as site from './siteSymmetry.js';
|
|
23
|
+
import { TENSOR_PROPERTIES as ALL_TENSOR_PROPERTIES } from './tensors/propertyTable.js';
|
|
24
|
+
import type { TensorPropertyName as MagneticTensorPropertyName } from './tensors/propertyTable.js';
|
|
25
|
+
import * as tensors from './tensors/tensorForm.js';
|
|
26
|
+
import type { IntrinsicSymmetry, TensorForm, TensorParity, TensorRank } from './tensors/tensorForm.js';
|
|
27
|
+
|
|
28
|
+
const USE_MAGNETIC =
|
|
29
|
+
"the crystallographic API has no time reversal; use the magnetic API ('symcrys/magnetic', in Python symcrys.magnetic)";
|
|
30
|
+
|
|
31
|
+
/** A point operation: an orthogonal Cartesian matrix (rotation, rotoinversion, mirror, inversion). */
|
|
32
|
+
export interface Operation {
|
|
33
|
+
/** The orthogonal Cartesian 3×3 matrix, rows first. */
|
|
34
|
+
readonly matrix: Mat3;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A crystal class with the properties that are fixed by its operations. None of them depends on
|
|
39
|
+
* the setting or the convention (docs/conventions.md, "Properties").
|
|
40
|
+
*/
|
|
41
|
+
export interface PointGroup {
|
|
42
|
+
/** The key (docs/conventions.md, "Keys"). */
|
|
43
|
+
readonly key: PointGroupKey;
|
|
44
|
+
/** The crystal system. */
|
|
45
|
+
readonly crystalSystem: CrystalSystem;
|
|
46
|
+
/** Number of operations. */
|
|
47
|
+
readonly order: number;
|
|
48
|
+
/** Contains the inversion. */
|
|
49
|
+
readonly centrosymmetric: boolean;
|
|
50
|
+
/** Polar (pyroelectric class): some direction is left unchanged by every operation. */
|
|
51
|
+
readonly polar: boolean;
|
|
52
|
+
/** Chiral (enantiomorphic class): proper rotations only. */
|
|
53
|
+
readonly chiral: boolean;
|
|
54
|
+
/** The Laue class: the centrosymmetric crystal class generated by the class and the inversion. */
|
|
55
|
+
readonly laueClass: PointGroupKey;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A crystal class in a given setting. */
|
|
59
|
+
export interface PointGroupInSetting {
|
|
60
|
+
/** The key of the crystal class. */
|
|
61
|
+
readonly key: PointGroupKey;
|
|
62
|
+
/** The 1-based index of the setting. */
|
|
63
|
+
readonly setting: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** One point operation described geometrically. */
|
|
67
|
+
export type OperationDescription = Omit<elements.OperationDescription, 'timeReversal'>;
|
|
68
|
+
|
|
69
|
+
/** The kind of tensor. */
|
|
70
|
+
export interface TensorSpec {
|
|
71
|
+
/** Number of indices, 0 to 4. */
|
|
72
|
+
readonly rank: TensorRank;
|
|
73
|
+
/** `'polar'` or `'axial'`: whether an improper operation changes the sign (factor det R). */
|
|
74
|
+
readonly parity: TensorParity;
|
|
75
|
+
/** The index symmetry of the tensor. */
|
|
76
|
+
readonly intrinsic: IntrinsicSymmetry;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* An operation as a caller may pass it: its matrix. `timeReversal: false` is accepted, so that an
|
|
81
|
+
* operation of the magnetic API without time reversal can be handed on from plain JavaScript; with
|
|
82
|
+
* `timeReversal: true` it is refused, at compile time and at run time.
|
|
83
|
+
*/
|
|
84
|
+
type OperationArgument = Operation & {
|
|
85
|
+
/** Accepted if false; an operation with time reversal belongs to the magnetic API. */
|
|
86
|
+
readonly timeReversal?: false;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/** A tensor specification as a caller may pass it; `timeParity: 'i'` is accepted, `'c'` refused. */
|
|
90
|
+
type TensorSpecArgument = TensorSpec & {
|
|
91
|
+
/** Accepted if `'i'`; a time-odd tensor belongs to the magnetic API. */
|
|
92
|
+
readonly timeParity?: 'i';
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** A named property: the tensor that describes it, what it is and where it is defined. */
|
|
96
|
+
export interface TensorProperty {
|
|
97
|
+
/** The kind of tensor whose non-zero form means that the property is allowed. */
|
|
98
|
+
readonly spec: TensorSpec;
|
|
99
|
+
/** The physical quantity the tensor relates. */
|
|
100
|
+
readonly description: string;
|
|
101
|
+
/** Print source of the definition, with printed page. */
|
|
102
|
+
readonly source: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Name of a tensor property in `TENSOR_PROPERTIES`. */
|
|
106
|
+
export type TensorPropertyName = Extract<
|
|
107
|
+
MagneticTensorPropertyName,
|
|
108
|
+
'pyroelectric' | 'ferroaxial' | 'piezoelectric' | 'gyrotropic'
|
|
109
|
+
>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The named tensor properties of the crystal classes: those of time-even tensors. `'gyrotropic'`
|
|
113
|
+
* is optical activity. The properties of time-odd tensors (`'ferromagnetic'`, …) are in the
|
|
114
|
+
* magnetic API.
|
|
115
|
+
*/
|
|
116
|
+
export const TENSOR_PROPERTIES = Object.freeze(
|
|
117
|
+
Object.fromEntries(
|
|
118
|
+
Object.entries(ALL_TENSOR_PROPERTIES)
|
|
119
|
+
.filter(([, p]) => p.spec.timeParity === 'i')
|
|
120
|
+
.map(([name, { spec, description, source }]) => [
|
|
121
|
+
name,
|
|
122
|
+
Object.freeze({
|
|
123
|
+
spec: Object.freeze({ rank: spec.rank, parity: spec.parity, intrinsic: spec.intrinsic }),
|
|
124
|
+
description,
|
|
125
|
+
source,
|
|
126
|
+
}),
|
|
127
|
+
]),
|
|
128
|
+
),
|
|
129
|
+
) as Readonly<Record<TensorPropertyName, TensorProperty>>;
|
|
130
|
+
|
|
131
|
+
const TENSOR_PROPERTY_NAMES = Object.freeze(Object.keys(TENSOR_PROPERTIES)) as readonly TensorPropertyName[];
|
|
132
|
+
|
|
133
|
+
// --- what comes in ---------------------------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
/** The key of a crystal class, checked. */
|
|
136
|
+
function classKey(key: PointGroupKey): PointGroupKey {
|
|
137
|
+
if (groups.isPointGroupKey(key)) return key;
|
|
138
|
+
if (groups.isMagneticPointGroupKey(key)) {
|
|
139
|
+
throw new RangeError(`${JSON.stringify(key)} is a magnetic point group, not a crystal class: ${USE_MAGNETIC}`);
|
|
140
|
+
}
|
|
141
|
+
throw new RangeError(`Unknown point group key: ${JSON.stringify(key)}`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** A name of the table of this API, checked. */
|
|
145
|
+
function propertyName(name: TensorPropertyName): TensorPropertyName {
|
|
146
|
+
if (typeof name === 'string') {
|
|
147
|
+
if (Object.hasOwn(TENSOR_PROPERTIES, name)) return name;
|
|
148
|
+
if (Object.hasOwn(ALL_TENSOR_PROPERTIES, name)) {
|
|
149
|
+
throw new RangeError(`${JSON.stringify(name)} is the property of a time-odd tensor: ${USE_MAGNETIC}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
throw new RangeError(`Unknown tensor property: ${JSON.stringify(name)} (known: ${TENSOR_PROPERTY_NAMES.join(', ')})`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** The time-even tensor of a specification or of a property name, as the shared modules take it. */
|
|
156
|
+
function timeEven(specOrName: TensorSpecArgument | TensorPropertyName): tensors.TensorSpec | TensorPropertyName {
|
|
157
|
+
if (typeof specOrName === 'string') return propertyName(specOrName);
|
|
158
|
+
if (typeof specOrName !== 'object' || specOrName === null) {
|
|
159
|
+
throw new RangeError(`Not a tensor specification: ${JSON.stringify(specOrName)}`);
|
|
160
|
+
}
|
|
161
|
+
const timeParity = (specOrName as { readonly timeParity?: unknown }).timeParity;
|
|
162
|
+
if (timeParity === 'c') throw new RangeError(`A time-odd tensor (timeParity 'c'): ${USE_MAGNETIC}`);
|
|
163
|
+
if (timeParity !== undefined && timeParity !== 'i') {
|
|
164
|
+
throw new RangeError(`Unknown time parity: ${JSON.stringify(timeParity)}`);
|
|
165
|
+
}
|
|
166
|
+
return { rank: specOrName.rank, parity: specOrName.parity, timeParity: 'i', intrinsic: specOrName.intrinsic };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Checks a list of operations of a caller: an operation with time reversal is an error. */
|
|
170
|
+
function checkUnitary(operations: readonly OperationArgument[]): void {
|
|
171
|
+
operations.forEach((op, i) => {
|
|
172
|
+
const timeReversal = (op as { readonly timeReversal?: unknown }).timeReversal;
|
|
173
|
+
if (timeReversal === true) {
|
|
174
|
+
throw new RangeError(`Operation ${i} is combined with time reversal: ${USE_MAGNETIC}`);
|
|
175
|
+
}
|
|
176
|
+
if (timeReversal !== undefined && timeReversal !== false) {
|
|
177
|
+
throw new RangeError(`Operation ${i}: timeReversal must be false or absent, not ${JSON.stringify(timeReversal)}`);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** A list of operations as the shared modules take it. */
|
|
183
|
+
function unitary(operations: readonly OperationArgument[]): MagneticOperation[] {
|
|
184
|
+
checkUnitary(operations);
|
|
185
|
+
return operations.map((op) => ({ matrix: op.matrix, timeReversal: false }));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// --- what goes back --------------------------------------------------------------------------------
|
|
189
|
+
|
|
190
|
+
const withoutTimeCache = new WeakMap<readonly MagneticOperation[], readonly Operation[]>();
|
|
191
|
+
|
|
192
|
+
/** The operations as their matrices; the shared modules return the same frozen list for the same call. */
|
|
193
|
+
function matricesOnly(ops: readonly MagneticOperation[]): readonly Operation[] {
|
|
194
|
+
let result = withoutTimeCache.get(ops);
|
|
195
|
+
if (!result) {
|
|
196
|
+
result = Object.freeze(ops.map((op) => Object.freeze({ matrix: op.matrix })));
|
|
197
|
+
withoutTimeCache.set(ops, result);
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const descriptionCache = new WeakMap<readonly elements.OperationDescription[], readonly OperationDescription[]>();
|
|
203
|
+
|
|
204
|
+
// --- point groups ----------------------------------------------------------------------------------
|
|
205
|
+
|
|
206
|
+
export { POINT_GROUP_KEYS } from './pointGroups/pointGroups.js';
|
|
207
|
+
|
|
208
|
+
/** True if `key` is the key of one of the 32 crystal classes. */
|
|
209
|
+
export function isPointGroupKey(key: string): key is PointGroupKey {
|
|
210
|
+
return groups.isPointGroupKey(key);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const groupCache = new Map<PointGroupKey, PointGroup>();
|
|
214
|
+
|
|
215
|
+
/** The crystal class with this key. Throws a RangeError for an unknown key. */
|
|
216
|
+
export function pointGroup(key: PointGroupKey): PointGroup {
|
|
217
|
+
let g = groupCache.get(classKey(key));
|
|
218
|
+
if (!g) {
|
|
219
|
+
const { crystalSystem, order, centrosymmetric, polar, chiral, laueClass } = groups.pointGroup(key);
|
|
220
|
+
g = Object.freeze({ key, crystalSystem, order, centrosymmetric, polar, chiral, laueClass });
|
|
221
|
+
groupCache.set(key, g);
|
|
222
|
+
}
|
|
223
|
+
return g;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** All 32 crystal classes, in the order of `POINT_GROUP_KEYS` (by crystal system, as in ITA). */
|
|
227
|
+
export function pointGroups(): readonly PointGroup[] {
|
|
228
|
+
return groups.POINT_GROUP_KEYS.map((key) => pointGroup(key));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Finds a crystal class by a Hermann–Mauguin symbol in the given convention (default `'itc'`): the
|
|
233
|
+
* short symbol of a setting, a full symbol, or the key (spaces are ignored). A symbol that names
|
|
234
|
+
* one setting gives that setting; the key, and a short symbol that several settings share (the
|
|
235
|
+
* monoclinic ones: `2` for unique axis b and c), give the default setting of the convention.
|
|
236
|
+
* Returns undefined if nothing matches, also for a value that is not a string and for the
|
|
237
|
+
* symbol of a magnetic group with time reversal. Symbols are written as in this library: `-` for
|
|
238
|
+
* the overbar, also in the Birss convention (`m-3m`, where Birss prints `m3m`; docs/conventions.md,
|
|
239
|
+
* "Where ITC and Birss differ").
|
|
240
|
+
*/
|
|
241
|
+
export function findPointGroup(hm: string, conventionName: Convention = 'itc'): PointGroupInSetting | undefined {
|
|
242
|
+
return groups.findPointGroup(hm, conventionName);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** The settings of a crystal class, with symbols and the default of the given convention (default `'itc'`). */
|
|
246
|
+
export function settings(key: PointGroupKey, conventionName: Convention = 'itc'): readonly Setting[] {
|
|
247
|
+
return groups.settings(classKey(key), conventionName);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* All operations of the crystal class in the requested setting (default: the convention's default
|
|
252
|
+
* setting). ITC convention: in ITA's order, identity first, then as ITA numbers the general
|
|
253
|
+
* position. Birss convention: in birss-app's order (docs/conventions.md, "Order of the
|
|
254
|
+
* operations"). The matrices are Cartesian (docs/conventions.md, "Cartesian frame").
|
|
255
|
+
*/
|
|
256
|
+
export function operations(key: PointGroupKey, options?: SettingOptions): readonly Operation[] {
|
|
257
|
+
return matricesOnly(groups.operations(classKey(key), options));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Generators of the crystal class in the requested setting (docs/conventions.md, "Generators"). ITC
|
|
262
|
+
* convention: ITA's selected generators in printed order, without the identity and ITA's lattice
|
|
263
|
+
* translations, so the list is empty for `1`; for `mm2` settings 2 and 3, which ITA does not list,
|
|
264
|
+
* those of setting 1 carried into their frame. Birss convention: birss-app's generators (for `1`
|
|
265
|
+
* the identity, as in birss-app).
|
|
266
|
+
*/
|
|
267
|
+
export function generators(key: PointGroupKey, options?: SettingOptions): readonly Operation[] {
|
|
268
|
+
return matricesOnly(groups.generators(classKey(key), options));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** A symbol of the crystal class in the requested convention and setting. */
|
|
272
|
+
export function symbol(key: PointGroupKey, options?: SymbolOptions): string {
|
|
273
|
+
return groups.symbol(classKey(key), options);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// --- properties that follow from operations ---------------------------------------------------------
|
|
277
|
+
|
|
278
|
+
export { holohedry } from './pointGroups/properties.js';
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* True if the group generated by `operations` contains the inversion, e.g. for the operations of a
|
|
282
|
+
* distorted crystal. A list that is not closed is closed first. For a crystal class, read
|
|
283
|
+
* `pointGroup(key).centrosymmetric`.
|
|
284
|
+
*/
|
|
285
|
+
export function isCentrosymmetricOf(operations: readonly OperationArgument[]): boolean {
|
|
286
|
+
return properties.isCentrosymmetricOf(unitary(operations));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* True if the group generated by `operations` is chiral: proper rotations only. For a crystal
|
|
291
|
+
* class, read `pointGroup(key).chiral`. Polar is the named property `'pyroelectric'`:
|
|
292
|
+
* `allowsPropertyOf(operations, 'pyroelectric')`.
|
|
293
|
+
*/
|
|
294
|
+
export function isChiralOf(operations: readonly OperationArgument[]): boolean {
|
|
295
|
+
return properties.isChiralOf(unitary(operations));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// --- symmetry elements -----------------------------------------------------------------------------
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Each operation of the crystal class described geometrically, in the order of `operations` for
|
|
302
|
+
* the same key and options. Axes are named by the symmetry direction they lie along: in the ITC
|
|
303
|
+
* convention with the sign of ITA Table 2.1.3.1, in the Birss convention signed as birss-app signs
|
|
304
|
+
* them (first non-zero Cartesian component positive); the sign fixes what the sense refers to.
|
|
305
|
+
*/
|
|
306
|
+
export function describeOperations(key: PointGroupKey, options?: SettingOptions): readonly OperationDescription[] {
|
|
307
|
+
const described = elements.describeOperations(classKey(key), options);
|
|
308
|
+
let result = descriptionCache.get(described);
|
|
309
|
+
if (!result) {
|
|
310
|
+
result = Object.freeze(
|
|
311
|
+
described.map(({ kind, order, axis, sense }) =>
|
|
312
|
+
Object.freeze({ kind, order, ...(axis ? { axis } : {}), ...(sense ? { sense } : {}) }),
|
|
313
|
+
),
|
|
314
|
+
);
|
|
315
|
+
descriptionCache.set(described, result);
|
|
316
|
+
}
|
|
317
|
+
return result;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* The positions of the full Hermann–Mauguin symbol in the requested convention and setting, each
|
|
322
|
+
* with its symmetry directions (ITA Table 2.1.3.1) and the symmetry elements along them. All
|
|
323
|
+
* positions of the crystal family are listed, also those the symbol of the class leaves out (then
|
|
324
|
+
* without `symbol`); the triclinic family has none. The directions keep the sign of Table 2.1.3.1
|
|
325
|
+
* in both conventions; in the Birss convention an axis of `describeOperations` may be reversed, so
|
|
326
|
+
* match it to a direction whose dot product with it is ±1, not by identity.
|
|
327
|
+
*/
|
|
328
|
+
export function symmetryDirections(
|
|
329
|
+
key: PointGroupKey,
|
|
330
|
+
options?: SettingOptions,
|
|
331
|
+
): readonly elements.SymmetryDirection[] {
|
|
332
|
+
return elements.symmetryDirections(classKey(key), options);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// --- site symmetry and Wyckoff positions -----------------------------------------------------------
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* The site symmetry of `direction` (any non-zero vector, Cartesian) under `operations`, which may
|
|
339
|
+
* be any list of point operations (for instance those of a distorted crystal). The operations
|
|
340
|
+
* fixing the direction within the tolerance are closed under the products found in the list and
|
|
341
|
+
* the direction is set onto their fixed space, repeated until stable, so that for a group the
|
|
342
|
+
* result is a subgroup and the set direction lies exactly on its elements. For a list that is not a
|
|
343
|
+
* group, `multiplicity` may not be an integer. Throws a RangeError for a zero vector, and if the
|
|
344
|
+
* closed operations fix no common direction (a tolerance far too large, e.g. 0.5).
|
|
345
|
+
*/
|
|
346
|
+
export function siteSymmetry(
|
|
347
|
+
operations: readonly OperationArgument[],
|
|
348
|
+
direction: Vec3,
|
|
349
|
+
options?: site.SiteSymmetryOptions,
|
|
350
|
+
): site.SiteSymmetry {
|
|
351
|
+
checkUnitary(operations);
|
|
352
|
+
// The shared function reads the matrices only, and it keeps the products of a list by the identity
|
|
353
|
+
// of the list, so the list of the caller is passed on as it is.
|
|
354
|
+
return site.siteSymmetry(operations as readonly MagneticOperation[], direction, options);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* The Wyckoff positions of a crystal class for directions, as ITA tabulates them (general position
|
|
359
|
+
* first), in the ITC convention only (docs/conventions.md, "Site symmetry and Wyckoff positions").
|
|
360
|
+
*/
|
|
361
|
+
export function wyckoffPositions(key: PointGroupKey, options?: SettingOptions): readonly wyckoff.WyckoffPosition[] {
|
|
362
|
+
return wyckoff.wyckoffPositions(classKey(key), options);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* The Wyckoff position of a direction (Cartesian) in a crystal class: the position whose site
|
|
367
|
+
* symmetry is conjugate to that of the direction (ITA's definition). `tolerance` as for
|
|
368
|
+
* `siteSymmetry`.
|
|
369
|
+
*/
|
|
370
|
+
export function wyckoffPositionOf(
|
|
371
|
+
key: PointGroupKey,
|
|
372
|
+
direction: Vec3,
|
|
373
|
+
options?: wyckoff.WyckoffOptions,
|
|
374
|
+
): wyckoff.WyckoffPosition {
|
|
375
|
+
return wyckoff.wyckoffPositionOf(classKey(key), direction, options);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// --- tensors ---------------------------------------------------------------------------------------
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* The form of a tensor under a crystal class in the requested setting (default: the default
|
|
382
|
+
* setting of the convention, `'itc'` unless given). The tensor is given by its specification or by
|
|
383
|
+
* the name of a property in `TENSOR_PROPERTIES` (`'piezoelectric'`). The convention matters only
|
|
384
|
+
* through the setting: the same setting index gives the same form in both conventions
|
|
385
|
+
* (docs/conventions.md, "Tensors").
|
|
386
|
+
*/
|
|
387
|
+
export function tensorForm(
|
|
388
|
+
key: PointGroupKey,
|
|
389
|
+
spec: TensorSpecArgument | TensorPropertyName,
|
|
390
|
+
options?: SettingOptions,
|
|
391
|
+
): TensorForm {
|
|
392
|
+
return tensors.tensorForm(classKey(key), timeEven(spec), options);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* The form of a tensor under the group generated by `operations`, e.g. the site symmetry of a
|
|
397
|
+
* surface normal (`siteSymmetry`) or the operations of a distorted crystal. The tensor is given by
|
|
398
|
+
* its specification or by the name of a property in `TENSOR_PROPERTIES`. The operations are
|
|
399
|
+
* Cartesian and orthogonal; a list that is not closed is closed first.
|
|
400
|
+
*/
|
|
401
|
+
export function tensorFormOf(
|
|
402
|
+
operations: readonly OperationArgument[],
|
|
403
|
+
spec: TensorSpecArgument | TensorPropertyName,
|
|
404
|
+
): TensorForm {
|
|
405
|
+
return tensors.tensorFormOf(unitary(operations), timeEven(spec));
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* The components of `tensor` (length 3^rank, flat index) in a frame rotated by the orthogonal
|
|
410
|
+
* matrix `rotation`: t′_{i…} = f·Σ R_{ia}…R_{…}·t_{a…}, with f = det(R) for an axial tensor and 1
|
|
411
|
+
* for a polar one. To express a tensor in the frame of a surface, pass the matrix whose rows are
|
|
412
|
+
* the new axes in the old frame. The kind of tensor is given by its specification or by the name
|
|
413
|
+
* of a property in `TENSOR_PROPERTIES`.
|
|
414
|
+
*/
|
|
415
|
+
export function rotateTensor(
|
|
416
|
+
tensor: readonly number[],
|
|
417
|
+
rotation: Mat3,
|
|
418
|
+
specOrName: TensorSpecArgument | TensorPropertyName,
|
|
419
|
+
): number[] {
|
|
420
|
+
return tensors.rotateTensor(tensor, rotation, timeEven(specOrName));
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* True if the crystal class allows the named property, e.g. `allowsProperty('-6m2',
|
|
425
|
+
* 'piezoelectric')`: the tensor that describes it (`TENSOR_PROPERTIES`) has a non-zero form under
|
|
426
|
+
* the class. Symmetry only allows a property; whether a crystal shows it is a question of the
|
|
427
|
+
* material. It does not depend on setting or convention. Throws a RangeError for an unknown key or
|
|
428
|
+
* name.
|
|
429
|
+
*/
|
|
430
|
+
export function allowsProperty(key: PointGroupKey, name: TensorPropertyName): boolean {
|
|
431
|
+
return tensors.tensorForm(classKey(key), propertyName(name), { setting: 1 }).basis.length > 0;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** The named properties the crystal class allows, in the order of `TENSOR_PROPERTIES`. */
|
|
435
|
+
export function allowedProperties(key: PointGroupKey): TensorPropertyName[] {
|
|
436
|
+
return TENSOR_PROPERTY_NAMES.filter((name) => allowsProperty(key, name));
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* True if the group generated by `operations` allows the named property, e.g. for the site
|
|
441
|
+
* symmetry of a surface normal or the operations of a distorted crystal.
|
|
442
|
+
*/
|
|
443
|
+
export function allowsPropertyOf(operations: readonly OperationArgument[], name: TensorPropertyName): boolean {
|
|
444
|
+
return tensors.tensorFormOf(unitary(operations), propertyName(name)).basis.length > 0;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/** The named properties the group generated by `operations` allows. */
|
|
448
|
+
export function allowedPropertiesOf(operations: readonly OperationArgument[]): TensorPropertyName[] {
|
|
449
|
+
const ops = unitary(operations);
|
|
450
|
+
return TENSOR_PROPERTY_NAMES.filter((name) => tensors.tensorFormOf(ops, name).basis.length > 0);
|
|
451
|
+
}
|