symcrys 0.1.1 → 0.3.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 +28 -5
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/lattice.d.ts +22 -0
- package/dist/lattice.d.ts.map +1 -0
- package/dist/lattice.js +43 -0
- package/dist/lattice.js.map +1 -0
- package/dist/linalg.d.ts +32 -0
- package/dist/linalg.d.ts.map +1 -0
- package/dist/linalg.js +120 -0
- package/dist/linalg.js.map +1 -0
- package/dist/operations.d.ts +30 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +49 -0
- package/dist/operations.js.map +1 -0
- package/dist/pointGroups/data.d.ts +40 -0
- package/dist/pointGroups/data.d.ts.map +1 -0
- package/dist/pointGroups/data.js +204 -0
- package/dist/pointGroups/data.js.map +1 -0
- package/dist/pointGroups/elements.d.ts +75 -0
- package/dist/pointGroups/elements.d.ts.map +1 -0
- package/dist/pointGroups/elements.js +181 -0
- package/dist/pointGroups/elements.js.map +1 -0
- package/dist/pointGroups/itaOrder.d.ts +22 -0
- package/dist/pointGroups/itaOrder.d.ts.map +1 -0
- package/dist/pointGroups/itaOrder.js +675 -0
- package/dist/pointGroups/itaOrder.js.map +1 -0
- package/dist/pointGroups/pointGroups.d.ts +84 -0
- package/dist/pointGroups/pointGroups.d.ts.map +1 -0
- package/dist/pointGroups/pointGroups.js +229 -0
- package/dist/pointGroups/pointGroups.js.map +1 -0
- package/dist/pointGroups/properties.d.ts +18 -0
- package/dist/pointGroups/properties.d.ts.map +1 -0
- package/dist/pointGroups/properties.js +60 -0
- package/dist/pointGroups/properties.js.map +1 -0
- package/dist/pointGroups/wyckoff.d.ts +53 -0
- package/dist/pointGroups/wyckoff.d.ts.map +1 -0
- package/dist/pointGroups/wyckoff.js +189 -0
- package/dist/pointGroups/wyckoff.js.map +1 -0
- package/dist/pointGroups/wyckoffData.d.ts +24 -0
- package/dist/pointGroups/wyckoffData.d.ts.map +1 -0
- package/dist/pointGroups/wyckoffData.js +423 -0
- package/dist/pointGroups/wyckoffData.js.map +1 -0
- package/dist/siteSymmetry.d.ts +40 -0
- package/dist/siteSymmetry.d.ts.map +1 -0
- package/dist/siteSymmetry.js +57 -0
- package/dist/siteSymmetry.js.map +1 -0
- package/dist/symmetryDirections.d.ts +18 -0
- package/dist/symmetryDirections.d.ts.map +1 -0
- package/dist/symmetryDirections.js +65 -0
- package/dist/symmetryDirections.js.map +1 -0
- package/dist/tolerances.d.ts +11 -0
- package/dist/tolerances.d.ts.map +1 -0
- package/dist/tolerances.js +11 -0
- package/dist/tolerances.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -4
- package/src/index.ts +49 -0
- package/src/lattice.ts +59 -0
- package/src/linalg.ts +138 -0
- package/src/operations.ts +63 -0
- package/src/pointGroups/data.ts +294 -0
- package/src/pointGroups/elements.ts +264 -0
- package/src/pointGroups/itaOrder.ts +688 -0
- package/src/pointGroups/pointGroups.ts +304 -0
- package/src/pointGroups/properties.ts +62 -0
- package/src/pointGroups/wyckoff.ts +233 -0
- package/src/pointGroups/wyckoffData.ts +437 -0
- package/src/siteSymmetry.ts +89 -0
- package/src/symmetryDirections.ts +72 -0
- package/src/tolerances.ts +12 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API for the crystallographic point groups: lookup, settings, operations, generators and
|
|
3
|
+
* symbols, in the ITC convention (default) or the Birss convention.
|
|
4
|
+
*/
|
|
5
|
+
import { type Operation } from '../operations.js';
|
|
6
|
+
import type { CrystalSystem } from '../lattice.js';
|
|
7
|
+
import { type PointGroupKey } from './data.js';
|
|
8
|
+
export { POINT_GROUP_KEYS, type PointGroupKey } from './data.js';
|
|
9
|
+
/** `'itc'`: International Tables for Crystallography (default). `'birss'`: Birss, Symmetry and Magnetism (1966). */
|
|
10
|
+
export type Convention = 'itc' | 'birss';
|
|
11
|
+
/** Type I: crystallographic point group without time reversal (the only type so far). */
|
|
12
|
+
export type PointGroupType = 'I';
|
|
13
|
+
export interface PointGroup {
|
|
14
|
+
readonly key: PointGroupKey;
|
|
15
|
+
readonly type: PointGroupType;
|
|
16
|
+
readonly crystalSystem: CrystalSystem;
|
|
17
|
+
/** Number of operations. */
|
|
18
|
+
readonly order: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Setting {
|
|
21
|
+
/** 1-based; the same physical frame in both conventions. */
|
|
22
|
+
readonly index: number;
|
|
23
|
+
/** Short symbol of the setting in the requested convention. */
|
|
24
|
+
readonly symbol: string;
|
|
25
|
+
/** Full symbol, symmetry directions separated by single spaces. */
|
|
26
|
+
readonly fullSymbol: string;
|
|
27
|
+
/** Monoclinic: the unique axis; orthorhombic mm2: the axis of the twofold rotation. */
|
|
28
|
+
readonly uniqueAxis?: 'a' | 'b' | 'c';
|
|
29
|
+
/** True for the default setting of the requested convention. */
|
|
30
|
+
readonly isDefault: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface SettingOptions {
|
|
33
|
+
/** Default `'itc'`. */
|
|
34
|
+
readonly convention?: Convention;
|
|
35
|
+
/** 1-based setting index; default: the default setting of the convention. */
|
|
36
|
+
readonly setting?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SymbolOptions extends SettingOptions {
|
|
39
|
+
/**
|
|
40
|
+
* `'short'` (default): short symbol of the setting, e.g. `321` (ITC) for class `32`.
|
|
41
|
+
* `'full'`: full symbol, positions separated by spaces, e.g. `-3 2/m 1`.
|
|
42
|
+
* `'schoenflies'`: Schoenflies symbol, subscripts written inline (`C3v`, `D2d`, `Oh`).
|
|
43
|
+
*/
|
|
44
|
+
readonly form?: 'short' | 'full' | 'schoenflies';
|
|
45
|
+
}
|
|
46
|
+
/** True if `key` is the key of one of the 32 crystal classes. */
|
|
47
|
+
export declare function isPointGroupKey(key: string): key is PointGroupKey;
|
|
48
|
+
/** The point group with this key. Throws a RangeError for an unknown key. */
|
|
49
|
+
export declare function pointGroup(key: PointGroupKey): PointGroup;
|
|
50
|
+
/** All 32 crystal classes, in the order of `POINT_GROUP_KEYS` (by crystal system, as in ITA). */
|
|
51
|
+
export declare function pointGroups(): readonly PointGroup[];
|
|
52
|
+
/** The settings of a point group, with symbols and the default of the given convention (default `'itc'`). */
|
|
53
|
+
export declare function settings(key: PointGroupKey, conventionName?: Convention): readonly Setting[];
|
|
54
|
+
/**
|
|
55
|
+
* All operations of the point group in the requested setting (default: the convention's default
|
|
56
|
+
* setting). ITC convention: in ITA's order, identity first, then as ITA numbers the general
|
|
57
|
+
* position; Birss convention: in birss-app's order (docs/conventions.md, "Order of the
|
|
58
|
+
* operations"). The matrices are Cartesian (docs/conventions.md, "Cartesian frame").
|
|
59
|
+
*/
|
|
60
|
+
export declare function operations(key: PointGroupKey, options?: SettingOptions): readonly Operation[];
|
|
61
|
+
/**
|
|
62
|
+
* Generators of the point group in the requested setting (docs/conventions.md, "Generators"). ITC
|
|
63
|
+
* convention: ITA's selected generators in printed order, without the identity and ITA's lattice
|
|
64
|
+
* translations, so the list is empty for `1`; for `mm2` settings 2 and 3, which ITA does not list,
|
|
65
|
+
* those of setting 1 carried into their frame. Birss convention: birss-app's generators (for `1`
|
|
66
|
+
* the identity, as in birss-app).
|
|
67
|
+
*/
|
|
68
|
+
export declare function generators(key: PointGroupKey, options?: SettingOptions): readonly Operation[];
|
|
69
|
+
/** A symbol of the point group in the requested convention and setting. */
|
|
70
|
+
export declare function symbol(key: PointGroupKey, options?: SymbolOptions): string;
|
|
71
|
+
/** A point group in a given setting. */
|
|
72
|
+
export interface PointGroupInSetting {
|
|
73
|
+
readonly key: PointGroupKey;
|
|
74
|
+
readonly setting: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Finds a point group by a Hermann–Mauguin symbol in the given convention (default `'itc'`): the
|
|
78
|
+
* key (giving the default setting), the short symbol of a setting, or a full symbol (spaces are
|
|
79
|
+
* ignored). Returns undefined if nothing matches, also for a value that is not a string. Symbols
|
|
80
|
+
* are written as in this library: `-` for the overbar, also in the Birss convention (`m-3m`, where
|
|
81
|
+
* Birss prints `m3m`; docs/conventions.md, "Where ITC and Birss differ").
|
|
82
|
+
*/
|
|
83
|
+
export declare function findPointGroup(hm: string, conventionName?: Convention): PointGroupInSetting | undefined;
|
|
84
|
+
//# sourceMappingURL=pointGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointGroups.d.ts","sourceRoot":"","sources":["../../src/pointGroups/pointGroups.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAA2D,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAExG,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAEjE,oHAAoH;AACpH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,CAAC;AAEzC,yFAAyF;AACzF,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC;AAEjC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,OAAO;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uFAAuF;IACvF,QA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AAE,MAAM,CAAC;CAC1B;AAID;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,GAAE,UAAkB,GAAG,mBAAmB,GAAG,SAAS,CAa9G"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API for the crystallographic point groups: lookup, settings, operations, generators and
|
|
3
|
+
* symbols, in the ITC convention (default) or the Birss convention.
|
|
4
|
+
*/
|
|
5
|
+
import { MAX_GROUP_ORDER, closeGroup, compose, operationsEqual, transformOperation, } from '../operations.js';
|
|
6
|
+
import { inItaOrder, itaGeneratorOperations } from './itaOrder.js';
|
|
7
|
+
import { POINT_GROUP_DATA, POINT_GROUP_KEYS } from './data.js';
|
|
8
|
+
export { POINT_GROUP_KEYS } from './data.js';
|
|
9
|
+
const BY_KEY = new Map(POINT_GROUP_DATA.map((d) => [d.key, d]));
|
|
10
|
+
/** True if `key` is the key of one of the 32 crystal classes. */
|
|
11
|
+
export function isPointGroupKey(key) {
|
|
12
|
+
return BY_KEY.has(key);
|
|
13
|
+
}
|
|
14
|
+
function data(key) {
|
|
15
|
+
const d = BY_KEY.get(key);
|
|
16
|
+
if (!d)
|
|
17
|
+
throw new RangeError(`Unknown point group key: ${JSON.stringify(key)}`);
|
|
18
|
+
return d;
|
|
19
|
+
}
|
|
20
|
+
function convention(options) {
|
|
21
|
+
const c = options?.convention ?? 'itc';
|
|
22
|
+
if (c !== 'itc' && c !== 'birss')
|
|
23
|
+
throw new RangeError(`Unknown convention: ${JSON.stringify(c)}`);
|
|
24
|
+
return c;
|
|
25
|
+
}
|
|
26
|
+
function defaultSetting(d, c) {
|
|
27
|
+
return c === 'itc' ? d.itcDefault : 1;
|
|
28
|
+
}
|
|
29
|
+
/** The requested setting index, checked; the convention's default if none is given. */
|
|
30
|
+
function settingIndex(d, options) {
|
|
31
|
+
const c = convention(options);
|
|
32
|
+
const index = options?.setting ?? defaultSetting(d, c);
|
|
33
|
+
if (!Number.isInteger(index) || index < 1 || index > d.settings.length) {
|
|
34
|
+
throw new RangeError(`Point group ${d.key} has no setting ${String(index)} (settings 1 to ${d.settings.length})`);
|
|
35
|
+
}
|
|
36
|
+
return index;
|
|
37
|
+
}
|
|
38
|
+
function freezeOperation(op) {
|
|
39
|
+
const [r0, r1, r2] = op.matrix;
|
|
40
|
+
return Object.freeze({
|
|
41
|
+
matrix: Object.freeze([Object.freeze([...r0]), Object.freeze([...r1]), Object.freeze([...r2])]),
|
|
42
|
+
timeReversal: op.timeReversal,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const generatorCache = new Map();
|
|
46
|
+
const operationCache = new Map();
|
|
47
|
+
/** The stored generators carried into the frame of a setting: the generators of the Birss convention. */
|
|
48
|
+
function settingGenerators(d, index) {
|
|
49
|
+
const cacheKey = `${d.key}#${index}`;
|
|
50
|
+
let result = generatorCache.get(cacheKey);
|
|
51
|
+
if (!result) {
|
|
52
|
+
const frame = d.settings[index - 1].frame;
|
|
53
|
+
result = Object.freeze(d.generators.map((g) => freezeOperation(transformOperation(g, frame))));
|
|
54
|
+
generatorCache.set(cacheKey, result);
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
const itaGeneratorCache = new Map();
|
|
59
|
+
/** ITA's generators of a setting (see `generators`); throws if setting 1 has none. */
|
|
60
|
+
function settingItaGenerators(d, index) {
|
|
61
|
+
const cacheKey = `${d.key}#${index}`;
|
|
62
|
+
let result = itaGeneratorCache.get(cacheKey);
|
|
63
|
+
if (!result) {
|
|
64
|
+
let gens = itaGeneratorOperations(d.key, index, d.crystalSystem);
|
|
65
|
+
if (!gens) {
|
|
66
|
+
if (index === 1)
|
|
67
|
+
throw new Error(`Point group ${d.key}: no ITA generators for setting 1`);
|
|
68
|
+
gens = settingItaGenerators(d, 1).map((op) => transformOperation(op, d.settings[index - 1].frame));
|
|
69
|
+
}
|
|
70
|
+
result = Object.freeze(gens.map(freezeOperation));
|
|
71
|
+
itaGeneratorCache.set(cacheKey, result);
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
const birssOperationCache = new Map();
|
|
76
|
+
/**
|
|
77
|
+
* The operations of a setting in the Birss convention, in birss-app's order (docs/conventions.md,
|
|
78
|
+
* "Birss convention and birss-app"): the generators of the setting first, then repeated passes
|
|
79
|
+
* that append every new product g·h of two operations found before the pass, in the order of g,
|
|
80
|
+
* then h, until a pass adds nothing.
|
|
81
|
+
*/
|
|
82
|
+
function birssOperations(d, index) {
|
|
83
|
+
const cacheKey = `${d.key}#${index}`;
|
|
84
|
+
let result = birssOperationCache.get(cacheKey);
|
|
85
|
+
if (!result) {
|
|
86
|
+
const group = [...settingGenerators(d, index)];
|
|
87
|
+
for (let changed = true; changed;) {
|
|
88
|
+
changed = false;
|
|
89
|
+
const size = group.length;
|
|
90
|
+
for (let i = 0; i < size; i++) {
|
|
91
|
+
for (let j = 0; j < size; j++) {
|
|
92
|
+
const product = compose(group[i], group[j]);
|
|
93
|
+
if (!group.some((g) => operationsEqual(g, product))) {
|
|
94
|
+
if (group.length >= MAX_GROUP_ORDER)
|
|
95
|
+
throw new Error(`Point group ${d.key}: closure does not terminate`);
|
|
96
|
+
group.push(product);
|
|
97
|
+
changed = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!sameSet(group, settingOperations(d, index))) {
|
|
103
|
+
throw new Error(`Point group ${d.key}, setting ${index}: Birss operations differ from the closure`);
|
|
104
|
+
}
|
|
105
|
+
result = Object.freeze(group.map(freezeOperation));
|
|
106
|
+
birssOperationCache.set(cacheKey, result);
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The operations of a setting in ITA's order (docs/conventions.md, "Order of the operations"): for a
|
|
112
|
+
* setting ITA lists, coset by coset from ITA's generators; for a setting ITA does not list (today
|
|
113
|
+
* `mm2` settings 2 and 3), the order of setting 1, carried into the frame of the setting. Setting 1
|
|
114
|
+
* is always one ITA lists; throws if its generators are missing or do not give the closure.
|
|
115
|
+
*/
|
|
116
|
+
function settingOperations(d, index) {
|
|
117
|
+
const cacheKey = `${d.key}#${index}`;
|
|
118
|
+
let result = operationCache.get(cacheKey);
|
|
119
|
+
if (!result) {
|
|
120
|
+
const closed = closeGroup(settingGenerators(d, index));
|
|
121
|
+
let ordered = inItaOrder(d.key, index, d.crystalSystem, closed);
|
|
122
|
+
if (!ordered) {
|
|
123
|
+
if (index === 1)
|
|
124
|
+
throw new Error(`Point group ${d.key}: no ITA generators for setting 1`);
|
|
125
|
+
ordered = settingOperations(d, 1).map((op) => transformOperation(op, d.settings[index - 1].frame));
|
|
126
|
+
}
|
|
127
|
+
if (!sameSet(ordered, closed)) {
|
|
128
|
+
throw new Error(`Point group ${d.key}, setting ${index}: ordered operations differ from the closure`);
|
|
129
|
+
}
|
|
130
|
+
result = Object.freeze(ordered.map(freezeOperation));
|
|
131
|
+
operationCache.set(cacheKey, result);
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
/** True if `a` is `b` in some order: equal length, no operation twice in `a`, every one of `a` in `b`. */
|
|
136
|
+
function sameSet(a, b) {
|
|
137
|
+
return (a.length === b.length &&
|
|
138
|
+
a.every((op, i) => b.some((x) => operationsEqual(x, op)) && !a.slice(0, i).some((x) => operationsEqual(x, op))));
|
|
139
|
+
}
|
|
140
|
+
const groupCache = new Map();
|
|
141
|
+
/** The point group with this key. Throws a RangeError for an unknown key. */
|
|
142
|
+
export function pointGroup(key) {
|
|
143
|
+
const d = data(key);
|
|
144
|
+
let g = groupCache.get(d.key);
|
|
145
|
+
if (!g) {
|
|
146
|
+
g = Object.freeze({ key: d.key, type: 'I', crystalSystem: d.crystalSystem, order: settingOperations(d, 1).length });
|
|
147
|
+
groupCache.set(d.key, g);
|
|
148
|
+
}
|
|
149
|
+
return g;
|
|
150
|
+
}
|
|
151
|
+
/** All 32 crystal classes, in the order of `POINT_GROUP_KEYS` (by crystal system, as in ITA). */
|
|
152
|
+
export function pointGroups() {
|
|
153
|
+
return POINT_GROUP_KEYS.map(pointGroup);
|
|
154
|
+
}
|
|
155
|
+
/** The settings of a point group, with symbols and the default of the given convention (default `'itc'`). */
|
|
156
|
+
export function settings(key, conventionName = 'itc') {
|
|
157
|
+
const d = data(key);
|
|
158
|
+
const c = convention({ convention: conventionName });
|
|
159
|
+
const def = defaultSetting(d, c);
|
|
160
|
+
return d.settings.map((s, i) => Object.freeze({
|
|
161
|
+
index: i + 1,
|
|
162
|
+
symbol: s[c].short,
|
|
163
|
+
fullSymbol: s[c].full,
|
|
164
|
+
...(s.uniqueAxis ? { uniqueAxis: s.uniqueAxis } : {}),
|
|
165
|
+
isDefault: i + 1 === def,
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* All operations of the point group in the requested setting (default: the convention's default
|
|
170
|
+
* setting). ITC convention: in ITA's order, identity first, then as ITA numbers the general
|
|
171
|
+
* position; Birss convention: in birss-app's order (docs/conventions.md, "Order of the
|
|
172
|
+
* operations"). The matrices are Cartesian (docs/conventions.md, "Cartesian frame").
|
|
173
|
+
*/
|
|
174
|
+
export function operations(key, options) {
|
|
175
|
+
const d = data(key);
|
|
176
|
+
const index = settingIndex(d, options);
|
|
177
|
+
return convention(options) === 'birss' ? birssOperations(d, index) : settingOperations(d, index);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Generators of the point group in the requested setting (docs/conventions.md, "Generators"). ITC
|
|
181
|
+
* convention: ITA's selected generators in printed order, without the identity and ITA's lattice
|
|
182
|
+
* translations, so the list is empty for `1`; for `mm2` settings 2 and 3, which ITA does not list,
|
|
183
|
+
* those of setting 1 carried into their frame. Birss convention: birss-app's generators (for `1`
|
|
184
|
+
* the identity, as in birss-app).
|
|
185
|
+
*/
|
|
186
|
+
export function generators(key, options) {
|
|
187
|
+
const d = data(key);
|
|
188
|
+
const index = settingIndex(d, options);
|
|
189
|
+
return convention(options) === 'birss' ? settingGenerators(d, index) : settingItaGenerators(d, index);
|
|
190
|
+
}
|
|
191
|
+
/** A symbol of the point group in the requested convention and setting. */
|
|
192
|
+
export function symbol(key, options) {
|
|
193
|
+
const d = data(key);
|
|
194
|
+
const form = options?.form ?? 'short';
|
|
195
|
+
const s = d.settings[settingIndex(d, options) - 1][convention(options)];
|
|
196
|
+
if (form === 'schoenflies')
|
|
197
|
+
return d.schoenflies;
|
|
198
|
+
if (form === 'short')
|
|
199
|
+
return s.short;
|
|
200
|
+
if (form === 'full')
|
|
201
|
+
return s.full;
|
|
202
|
+
throw new RangeError(`Unknown symbol form: ${JSON.stringify(form)}`);
|
|
203
|
+
}
|
|
204
|
+
const compact = (s) => s.replace(/\s+/g, '');
|
|
205
|
+
/**
|
|
206
|
+
* Finds a point group by a Hermann–Mauguin symbol in the given convention (default `'itc'`): the
|
|
207
|
+
* key (giving the default setting), the short symbol of a setting, or a full symbol (spaces are
|
|
208
|
+
* ignored). Returns undefined if nothing matches, also for a value that is not a string. Symbols
|
|
209
|
+
* are written as in this library: `-` for the overbar, also in the Birss convention (`m-3m`, where
|
|
210
|
+
* Birss prints `m3m`; docs/conventions.md, "Where ITC and Birss differ").
|
|
211
|
+
*/
|
|
212
|
+
export function findPointGroup(hm, conventionName = 'itc') {
|
|
213
|
+
const c = convention({ convention: conventionName });
|
|
214
|
+
if (typeof hm !== 'string')
|
|
215
|
+
return undefined;
|
|
216
|
+
const target = compact(hm);
|
|
217
|
+
const byKey = BY_KEY.get(target);
|
|
218
|
+
if (byKey)
|
|
219
|
+
return { key: byKey.key, setting: defaultSetting(byKey, c) };
|
|
220
|
+
for (const form of ['short', 'full']) {
|
|
221
|
+
for (const d of POINT_GROUP_DATA) {
|
|
222
|
+
const i = d.settings.findIndex((s) => compact(s[c][form]) === target);
|
|
223
|
+
if (i >= 0)
|
|
224
|
+
return { key: d.key, setting: i + 1 };
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=pointGroups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointGroups.js","sourceRoot":"","sources":["../../src/pointGroups/pointGroups.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,eAAe,EACf,UAAU,EACV,OAAO,EACP,eAAe,EACf,kBAAkB,GAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAA2C,MAAM,WAAW,CAAC;AAExG,OAAO,EAAE,gBAAgB,EAAsB,MAAM,WAAW,CAAC;AA6CjE,MAAM,MAAM,GAAG,IAAI,GAAG,CAAyB,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAExF,iEAAiE;AACjE,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,IAAI,CAAC,GAAW;IACvB,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChF,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,UAAU,CAAC,OAAwB;IAC1C,MAAM,CAAC,GAAG,OAAO,EAAE,UAAU,IAAI,KAAK,CAAC;IACvC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,OAAO;QAAE,MAAM,IAAI,UAAU,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,CAAC,C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AAC,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties of a point group that follow from its operations alone. They do not depend on the
|
|
3
|
+
* setting or the convention. Properties that need tensors (piezoelectric, …) come with the tensor
|
|
4
|
+
* module (CLAUDE.md, decision of 2026-11-08 on #13).
|
|
5
|
+
*/
|
|
6
|
+
import { type PointGroupKey } from './data.js';
|
|
7
|
+
/** Contains the inversion. */
|
|
8
|
+
export declare function isCentrosymmetric(key: PointGroupKey): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Polar (pyroelectric class): some direction is left unchanged by every operation, i.e. the group
|
|
11
|
+
* average of the matrices, which projects onto the invariant vectors, is not zero.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isPolar(key: PointGroupKey): boolean;
|
|
14
|
+
/** Chiral (enantiomorphic class): proper rotations only. */
|
|
15
|
+
export declare function isChiral(key: PointGroupKey): boolean;
|
|
16
|
+
/** The Laue class: the centrosymmetric crystal class generated by the group and the inversion. */
|
|
17
|
+
export declare function laueClass(key: PointGroupKey): PointGroupKey;
|
|
18
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/pointGroups/properties.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAMjE,8BAA8B;AAC9B,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAE7D;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAUnD;AAED,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAEpD;AAQD,kGAAkG;AAClG,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,GAAG,aAAa,CAa3D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties of a point group that follow from its operations alone. They do not depend on the
|
|
3
|
+
* setting or the convention. Properties that need tensors (piezoelectric, …) come with the tensor
|
|
4
|
+
* module (CLAUDE.md, decision of 2026-11-08 on #13).
|
|
5
|
+
*/
|
|
6
|
+
import { INVERSION, det, matricesEqual } from '../linalg.js';
|
|
7
|
+
import { EPSILON } from '../tolerances.js';
|
|
8
|
+
import { compose, operation, operationsEqual } from '../operations.js';
|
|
9
|
+
import { POINT_GROUP_KEYS } from './data.js';
|
|
10
|
+
import { operations } from './pointGroups.js';
|
|
11
|
+
/** Operations in setting 1, the frame all stored data share. */
|
|
12
|
+
const stored = (key) => operations(key, { setting: 1 });
|
|
13
|
+
/** Contains the inversion. */
|
|
14
|
+
export function isCentrosymmetric(key) {
|
|
15
|
+
return stored(key).some((op) => !op.timeReversal && matricesEqual(op.matrix, INVERSION));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Polar (pyroelectric class): some direction is left unchanged by every operation, i.e. the group
|
|
19
|
+
* average of the matrices, which projects onto the invariant vectors, is not zero.
|
|
20
|
+
*/
|
|
21
|
+
export function isPolar(key) {
|
|
22
|
+
const ops = stored(key);
|
|
23
|
+
for (let i = 0; i < 3; i++) {
|
|
24
|
+
for (let j = 0; j < 3; j++) {
|
|
25
|
+
let sum = 0;
|
|
26
|
+
for (const op of ops)
|
|
27
|
+
sum += op.matrix[i][j];
|
|
28
|
+
if (Math.abs(sum / ops.length) > EPSILON)
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
/** Chiral (enantiomorphic class): proper rotations only. */
|
|
35
|
+
export function isChiral(key) {
|
|
36
|
+
return stored(key).every((op) => det(op.matrix) > 0);
|
|
37
|
+
}
|
|
38
|
+
function sameSet(a, b) {
|
|
39
|
+
return a.length === b.length && a.every((x) => b.some((y) => operationsEqual(x, y)));
|
|
40
|
+
}
|
|
41
|
+
const laueCache = new Map();
|
|
42
|
+
/** The Laue class: the centrosymmetric crystal class generated by the group and the inversion. */
|
|
43
|
+
export function laueClass(key) {
|
|
44
|
+
const cached = laueCache.get(key);
|
|
45
|
+
if (cached)
|
|
46
|
+
return cached;
|
|
47
|
+
const ops = stored(key);
|
|
48
|
+
const withInversion = [...ops];
|
|
49
|
+
for (const op of ops) {
|
|
50
|
+
const product = compose(operation(INVERSION), op);
|
|
51
|
+
if (!withInversion.some((x) => operationsEqual(x, product)))
|
|
52
|
+
withInversion.push(product);
|
|
53
|
+
}
|
|
54
|
+
const laue = POINT_GROUP_KEYS.find((k) => isCentrosymmetric(k) && sameSet(withInversion, stored(k)));
|
|
55
|
+
if (!laue)
|
|
56
|
+
throw new Error(`laueClass: no centrosymmetric class matches ${key}`);
|
|
57
|
+
laueCache.set(key, laue);
|
|
58
|
+
return laue;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/pointGroups/properties.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAkB,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAsB,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,gEAAgE;AAChE,MAAM,MAAM,GAAG,CAAC,GAAkB,EAAwB,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,OAAO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+
* ITA's letters, multiplicities and oriented site-symmetry symbols, a representative face, and the
|
|
4
|
+
* Wyckoff position of any direction (docs/conventions.md, "Site symmetry and Wyckoff positions").
|
|
5
|
+
*/
|
|
6
|
+
import { type Vec3 } from '../linalg.js';
|
|
7
|
+
import { type PointGroupKey, type SettingOptions } from './pointGroups.js';
|
|
8
|
+
import { type SiteSymmetryOptions } from '../siteSymmetry.js';
|
|
9
|
+
/** A face (hkl): three Miller indices in the conventional basis (for hexagonal axes without i = −(h + k)). */
|
|
10
|
+
export type Hkl = readonly [number, number, number];
|
|
11
|
+
/** One Wyckoff position of a point group for directions. */
|
|
12
|
+
export interface WyckoffPosition {
|
|
13
|
+
/** ITA's Wyckoff letter. */
|
|
14
|
+
readonly letter: string;
|
|
15
|
+
/** Number of equivalent directions (faces of the form). */
|
|
16
|
+
readonly multiplicity: number;
|
|
17
|
+
/** Oriented site-symmetry symbol as ITA prints it, e.g. `..m`, `4m.m`, `1`. */
|
|
18
|
+
readonly siteSymmetry: string;
|
|
19
|
+
/** ITA's representative point as printed, e.g. `x,x,z` (a leading `-` is an overbar). */
|
|
20
|
+
readonly coordinates: string;
|
|
21
|
+
/**
|
|
22
|
+
* ITA's representative face as printed, components separated by commas, e.g. `h,h,l`, or
|
|
23
|
+
* `h,h,-2h,l` (Bravais–Miller indices) for hexagonal axes.
|
|
24
|
+
*/
|
|
25
|
+
readonly millerIndices: string;
|
|
26
|
+
/** A representative face with numbers: `millerIndices` with h = 3, k = 2, l = 1. */
|
|
27
|
+
readonly representative: {
|
|
28
|
+
readonly hkl: Hkl;
|
|
29
|
+
/**
|
|
30
|
+
* Its face normal, a Cartesian unit vector. Monoclinic and triclinic: the normal for a, b, c along
|
|
31
|
+
* x, y, z (no cell angles), exact for the unique axis only, but with the correct site symmetry.
|
|
32
|
+
*/
|
|
33
|
+
readonly cartesian: Vec3;
|
|
34
|
+
};
|
|
35
|
+
/** Indices into `operations` (same setting, ITC convention) of the site symmetry of the representative. */
|
|
36
|
+
readonly siteSymmetryOperations: readonly number[];
|
|
37
|
+
}
|
|
38
|
+
export type WyckoffOptions = SettingOptions & SiteSymmetryOptions;
|
|
39
|
+
/**
|
|
40
|
+
* The Wyckoff positions of a point group for directions, in ITA's printed order (general position
|
|
41
|
+
* first), in the ITC convention only (throws a RangeError for `'birss'`). The point at the origin
|
|
42
|
+
* (letter o) is not a direction and is left out. For `mm2` settings 2 and 3 (`2mm`, `m2m`), which
|
|
43
|
+
* ITA does not print, the positions of setting 1 carried into their frame.
|
|
44
|
+
*/
|
|
45
|
+
export declare function wyckoffPositions(key: PointGroupKey, options?: SettingOptions): readonly WyckoffPosition[];
|
|
46
|
+
/**
|
|
47
|
+
* The Wyckoff position of a direction (any non-zero Cartesian vector) in a point group, ITC
|
|
48
|
+
* convention only: the position whose representative has a site symmetry conjugate to that of the
|
|
49
|
+
* direction (ITA's definition). `tolerance` as for `siteSymmetry`; throws a RangeError if the
|
|
50
|
+
* operations found within it do not match any position (a tolerance too large).
|
|
51
|
+
*/
|
|
52
|
+
export declare function wyckoffPositionOf(key: PointGroupKey, direction: Vec3, options?: WyckoffOptions): WyckoffPosition;
|
|
53
|
+
//# sourceMappingURL=wyckoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wyckoff.d.ts","sourceRoot":"","sources":["../../src/pointGroups/wyckoff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAwC,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,EAAwB,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAA+B,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG3F,8GAA8G;AAC9G,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B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