symcrys 0.1.0 → 0.2.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.
Files changed (60) hide show
  1. package/README.md +35 -12
  2. package/dist/index.d.ts +7 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +5 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/lattice.d.ts +22 -0
  7. package/dist/lattice.d.ts.map +1 -0
  8. package/dist/lattice.js +43 -0
  9. package/dist/lattice.js.map +1 -0
  10. package/dist/linalg.d.ts +32 -0
  11. package/dist/linalg.d.ts.map +1 -0
  12. package/dist/linalg.js +120 -0
  13. package/dist/linalg.js.map +1 -0
  14. package/dist/operations.d.ts +30 -0
  15. package/dist/operations.d.ts.map +1 -0
  16. package/dist/operations.js +49 -0
  17. package/dist/operations.js.map +1 -0
  18. package/dist/pointGroups/data.d.ts +40 -0
  19. package/dist/pointGroups/data.d.ts.map +1 -0
  20. package/dist/pointGroups/data.js +204 -0
  21. package/dist/pointGroups/data.js.map +1 -0
  22. package/dist/pointGroups/elements.d.ts +75 -0
  23. package/dist/pointGroups/elements.d.ts.map +1 -0
  24. package/dist/pointGroups/elements.js +181 -0
  25. package/dist/pointGroups/elements.js.map +1 -0
  26. package/dist/pointGroups/itaOrder.d.ts +22 -0
  27. package/dist/pointGroups/itaOrder.d.ts.map +1 -0
  28. package/dist/pointGroups/itaOrder.js +675 -0
  29. package/dist/pointGroups/itaOrder.js.map +1 -0
  30. package/dist/pointGroups/pointGroups.d.ts +84 -0
  31. package/dist/pointGroups/pointGroups.d.ts.map +1 -0
  32. package/dist/pointGroups/pointGroups.js +229 -0
  33. package/dist/pointGroups/pointGroups.js.map +1 -0
  34. package/dist/pointGroups/properties.d.ts +18 -0
  35. package/dist/pointGroups/properties.d.ts.map +1 -0
  36. package/dist/pointGroups/properties.js +60 -0
  37. package/dist/pointGroups/properties.js.map +1 -0
  38. package/dist/symmetryDirections.d.ts +18 -0
  39. package/dist/symmetryDirections.d.ts.map +1 -0
  40. package/dist/symmetryDirections.js +65 -0
  41. package/dist/symmetryDirections.js.map +1 -0
  42. package/dist/tolerances.d.ts +11 -0
  43. package/dist/tolerances.d.ts.map +1 -0
  44. package/dist/tolerances.js +11 -0
  45. package/dist/tolerances.js.map +1 -0
  46. package/dist/version.d.ts +1 -1
  47. package/dist/version.js +1 -1
  48. package/package.json +5 -4
  49. package/src/index.ts +41 -0
  50. package/src/lattice.ts +59 -0
  51. package/src/linalg.ts +138 -0
  52. package/src/operations.ts +63 -0
  53. package/src/pointGroups/data.ts +294 -0
  54. package/src/pointGroups/elements.ts +264 -0
  55. package/src/pointGroups/itaOrder.ts +688 -0
  56. package/src/pointGroups/pointGroups.ts +304 -0
  57. package/src/pointGroups/properties.ts +62 -0
  58. package/src/symmetryDirections.ts +72 -0
  59. package/src/tolerances.ts +12 -0
  60. 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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,aAAa,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,SAAS,EAAE,CAI7F;AAED,2EAA2E;AAC3E,wBAAgB,MAAM,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAQ1E;AAED,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,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":["../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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":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MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,GAAG,EAAE,CAAC,CAAC;IACjF,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACzB,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The symmetry directions of the crystal families: the lattice directions along which the
3
+ * symmetry elements of a crystallographic point group lie, grouped by their position in the full
4
+ * Hermann–Mauguin symbol. Data from ITA Table 2.1.3.1 (docs/conventions.md, "Symmetry
5
+ * directions and elements"); `symmetryDirections.reference.test.ts` re-reads the transcription and requires the
6
+ * same directions, in the same order and with the same signs.
7
+ */
8
+ import type { CrystalFamily } from './lattice.js';
9
+ /** A lattice direction [uvw]: integer coordinates in the conventional basis a, b, c. */
10
+ export type Uvw = readonly [number, number, number];
11
+ /**
12
+ * The directions of each position of the full symbol, per family, as printed in ITA Table 2.1.3.1
13
+ * (hexagonal family: the row "Hexagonal", which also serves the trigonal classes with hexagonal
14
+ * axes). Monoclinic: the full symbol reads along a, b, c (ITA 6th ed. § 2.1.3.15, p. 171), the
15
+ * orthorhombic row. Triclinic: no symmetry direction.
16
+ */
17
+ export declare const LATTICE_SYMMETRY_DIRECTIONS: Readonly<Record<CrystalFamily, readonly (readonly Uvw[])[]>>;
18
+ //# sourceMappingURL=symmetryDirections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symmetryDirections.d.ts","sourceRoot":"","sources":["../src/symmetryDirections.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,wFAAwF;AACxF,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAKpD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC,CAiDnG,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The symmetry directions of the crystal families: the lattice directions along which the
3
+ * symmetry elements of a crystallographic point group lie, grouped by their position in the full
4
+ * Hermann–Mauguin symbol. Data from ITA Table 2.1.3.1 (docs/conventions.md, "Symmetry
5
+ * directions and elements"); `symmetryDirections.reference.test.ts` re-reads the transcription and requires the
6
+ * same directions, in the same order and with the same signs.
7
+ */
8
+ const frozen = (rows) => Object.freeze(rows.map((dirs) => Object.freeze(dirs.map((d) => Object.freeze(d)))));
9
+ /**
10
+ * The directions of each position of the full symbol, per family, as printed in ITA Table 2.1.3.1
11
+ * (hexagonal family: the row "Hexagonal", which also serves the trigonal classes with hexagonal
12
+ * axes). Monoclinic: the full symbol reads along a, b, c (ITA 6th ed. § 2.1.3.15, p. 171), the
13
+ * orthorhombic row. Triclinic: no symmetry direction.
14
+ */
15
+ export const LATTICE_SYMMETRY_DIRECTIONS = Object.freeze({
16
+ triclinic: frozen([]),
17
+ monoclinic: frozen([[[1, 0, 0]], [[0, 1, 0]], [[0, 0, 1]]]),
18
+ orthorhombic: frozen([[[1, 0, 0]], [[0, 1, 0]], [[0, 0, 1]]]),
19
+ tetragonal: frozen([
20
+ [[0, 0, 1]],
21
+ [
22
+ [1, 0, 0],
23
+ [0, 1, 0],
24
+ ],
25
+ [
26
+ [1, -1, 0],
27
+ [1, 1, 0],
28
+ ],
29
+ ]),
30
+ hexagonal: frozen([
31
+ [[0, 0, 1]],
32
+ [
33
+ [1, 0, 0],
34
+ [0, 1, 0],
35
+ [-1, -1, 0],
36
+ ],
37
+ [
38
+ [1, -1, 0],
39
+ [1, 2, 0],
40
+ [-2, -1, 0],
41
+ ],
42
+ ]),
43
+ cubic: frozen([
44
+ [
45
+ [1, 0, 0],
46
+ [0, 1, 0],
47
+ [0, 0, 1],
48
+ ],
49
+ [
50
+ [1, 1, 1],
51
+ [1, -1, -1],
52
+ [-1, 1, -1],
53
+ [-1, -1, 1],
54
+ ],
55
+ [
56
+ [1, -1, 0],
57
+ [1, 1, 0],
58
+ [0, 1, -1],
59
+ [0, 1, 1],
60
+ [-1, 0, 1],
61
+ [1, 0, 1],
62
+ ],
63
+ ]),
64
+ });
65
+ //# sourceMappingURL=symmetryDirections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symmetryDirections.js","sourceRoot":"","sources":["../src/symmetryDirections.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,MAAM,GAAG,CAAC,IAAkC,EAA+B,EAAE,CACjF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAExG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAiE,MAAM,CAAC,MAAM,CAAC;IACrH,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,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AC,EAAE,CAAC,CAAC;SACZ;QACD;YACE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACV,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACV,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACT,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACV,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SACV;KACF,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Numeric tolerances, in one place. The values differ on purpose: each gates a different quantity.
3
+ */
4
+ /** Two matrix entries (or vector components) closer than this are equal. */
5
+ export declare const EPSILON = 0.000001;
6
+ /**
7
+ * During group closure, an entry closer than this to one of the exact values in `SNAP_VALUES`
8
+ * (linalg.ts) is replaced by it, so rounding errors cannot accumulate over repeated products.
9
+ */
10
+ export declare const SNAP_EPSILON = 1e-9;
11
+ //# sourceMappingURL=tolerances.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tolerances.d.ts","sourceRoot":"","sources":["../src/tolerances.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,OAAO,WAAO,CAAC;AAE5B;;;GAGG;AACH,eAAO,MAAM,YAAY,OAAO,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Numeric tolerances, in one place. The values differ on purpose: each gates a different quantity.
3
+ */
4
+ /** Two matrix entries (or vector components) closer than this are equal. */
5
+ export const EPSILON = 1e-6;
6
+ /**
7
+ * During group closure, an entry closer than this to one of the exact values in `SNAP_VALUES`
8
+ * (linalg.ts) is replaced by it, so rounding errors cannot accumulate over repeated products.
9
+ */
10
+ export const SNAP_EPSILON = 1e-9;
11
+ //# sourceMappingURL=tolerances.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tolerances.js","sourceRoot":"","sources":["../src/tolerances.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC;AAE5B;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Version of symcrys. Kept equal to `version` in package.json (checked by version.test.ts). */
2
- export declare const VERSION = "0.1.0";
2
+ export declare const VERSION = "0.2.0";
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Version of symcrys. Kept equal to `version` in package.json (checked by version.test.ts). */
2
- export const VERSION = '0.1.0';
2
+ export const VERSION = '0.2.0';
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "symcrys",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
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",
@@ -47,16 +47,17 @@
47
47
  "build": "node node_modules/typescript/bin/tsc -p tsconfig.build.json",
48
48
  "check:dist": "node scripts/check-dist.mjs",
49
49
  "prepack": "npm run build",
50
- "audit:point-groups": "vitest run --config audit/point-groups/vitest.config.ts"
50
+ "audit:point-groups": "vitest run --config audit/point-groups/vitest.config.ts",
51
+ "audit:birss-app": "vitest run --config audit/birss-app/vitest.config.ts && prettier --write src/pointGroups/birssApp.pins.fixtures.ts"
51
52
  },
52
53
  "devDependencies": {
53
54
  "@eslint/js": "10.0.1",
54
55
  "@types/node": "22.20.5",
55
- "eslint": "10.14.0",
56
+ "eslint": "10.15.0",
56
57
  "globals": "17.14.0",
57
58
  "prettier": "3.9.10",
58
59
  "typescript": "6.0.3",
59
- "typescript-eslint": "8.72.1",
60
+ "typescript-eslint": "8.73.0",
60
61
  "typescript7": "npm:typescript@7.0.2",
61
62
  "vitest": "5.1.0"
62
63
  }
package/src/index.ts CHANGED
@@ -3,3 +3,44 @@
3
3
  * everything else is internal.
4
4
  */
5
5
  export { VERSION } from './version.js';
6
+
7
+ export type { Mat3, Vec3 } from './linalg.js';
8
+ export type { Operation } from './operations.js';
9
+ export {
10
+ crystalFamily,
11
+ latticeBasis,
12
+ type CrystalFamily,
13
+ type CrystalSystem,
14
+ type FixedAngleFamily,
15
+ } from './lattice.js';
16
+
17
+ export {
18
+ POINT_GROUP_KEYS,
19
+ findPointGroup,
20
+ generators,
21
+ isPointGroupKey,
22
+ operations,
23
+ pointGroup,
24
+ pointGroups,
25
+ settings,
26
+ symbol,
27
+ type Convention,
28
+ type PointGroup,
29
+ type PointGroupInSetting,
30
+ type PointGroupKey,
31
+ type PointGroupType,
32
+ type Setting,
33
+ type SettingOptions,
34
+ type SymbolOptions,
35
+ } from './pointGroups/pointGroups.js';
36
+ export { isCentrosymmetric, isChiral, isPolar, laueClass } from './pointGroups/properties.js';
37
+ export { LATTICE_SYMMETRY_DIRECTIONS, type Uvw } from './symmetryDirections.js';
38
+ export {
39
+ describeOperations,
40
+ symmetryDirections,
41
+ type Axis,
42
+ type DirectionElements,
43
+ type OperationDescription,
44
+ type OperationKind,
45
+ type SymmetryDirection,
46
+ } from './pointGroups/elements.js';