react-cheminfo 0.134.1 → 0.135.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 (177) hide show
  1. package/README.md +13 -0
  2. package/lib/crystal/core/bondGrid.d.ts +26 -0
  3. package/lib/crystal/core/bondGrid.d.ts.map +1 -0
  4. package/lib/crystal/core/bondGrid.js +76 -0
  5. package/lib/crystal/core/bondGrid.js.map +1 -0
  6. package/lib/crystal/core/cellBonds.d.ts +21 -0
  7. package/lib/crystal/core/cellBonds.d.ts.map +1 -0
  8. package/lib/crystal/core/cellBonds.js +100 -0
  9. package/lib/crystal/core/cellBonds.js.map +1 -0
  10. package/lib/crystal/core/cif/element.d.ts +9 -0
  11. package/lib/crystal/core/cif/element.d.ts.map +1 -0
  12. package/lib/crystal/core/cif/element.js +41 -0
  13. package/lib/crystal/core/cif/element.js.map +1 -0
  14. package/lib/crystal/core/cif/index.d.ts +4 -0
  15. package/lib/crystal/core/cif/index.d.ts.map +1 -0
  16. package/lib/crystal/core/cif/index.js +3 -0
  17. package/lib/crystal/core/cif/index.js.map +1 -0
  18. package/lib/crystal/core/cif/number.d.ts +27 -0
  19. package/lib/crystal/core/cif/number.d.ts.map +1 -0
  20. package/lib/crystal/core/cif/number.js +57 -0
  21. package/lib/crystal/core/cif/number.js.map +1 -0
  22. package/lib/crystal/core/cif/read.d.ts +12 -0
  23. package/lib/crystal/core/cif/read.d.ts.map +1 -0
  24. package/lib/crystal/core/cif/read.js +183 -0
  25. package/lib/crystal/core/cif/read.js.map +1 -0
  26. package/lib/crystal/core/cif/readGeometry.d.ts +17 -0
  27. package/lib/crystal/core/cif/readGeometry.d.ts.map +1 -0
  28. package/lib/crystal/core/cif/readGeometry.js +93 -0
  29. package/lib/crystal/core/cif/readGeometry.js.map +1 -0
  30. package/lib/crystal/core/cif/tags.d.ts +62 -0
  31. package/lib/crystal/core/cif/tags.d.ts.map +1 -0
  32. package/lib/crystal/core/cif/tags.js +115 -0
  33. package/lib/crystal/core/cif/tags.js.map +1 -0
  34. package/lib/crystal/core/cif/types.d.ts +158 -0
  35. package/lib/crystal/core/cif/types.d.ts.map +1 -0
  36. package/lib/crystal/core/cif/types.js +2 -0
  37. package/lib/crystal/core/cif/types.js.map +1 -0
  38. package/lib/crystal/core/components.d.ts +56 -0
  39. package/lib/crystal/core/components.d.ts.map +1 -0
  40. package/lib/crystal/core/components.js +132 -0
  41. package/lib/crystal/core/components.js.map +1 -0
  42. package/lib/crystal/core/covalentRadii.d.ts +24 -0
  43. package/lib/crystal/core/covalentRadii.d.ts.map +1 -0
  44. package/lib/crystal/core/covalentRadii.js +55 -0
  45. package/lib/crystal/core/covalentRadii.js.map +1 -0
  46. package/lib/crystal/core/disorder.d.ts +59 -0
  47. package/lib/crystal/core/disorder.d.ts.map +1 -0
  48. package/lib/crystal/core/disorder.js +168 -0
  49. package/lib/crystal/core/disorder.js.map +1 -0
  50. package/lib/crystal/core/expand.d.ts +62 -0
  51. package/lib/crystal/core/expand.d.ts.map +1 -0
  52. package/lib/crystal/core/expand.js +61 -0
  53. package/lib/crystal/core/expand.js.map +1 -0
  54. package/lib/crystal/core/index.d.ts +18 -0
  55. package/lib/crystal/core/index.d.ts.map +1 -0
  56. package/lib/crystal/core/index.js +12 -0
  57. package/lib/crystal/core/index.js.map +1 -0
  58. package/lib/crystal/core/moleculeOf.d.ts +31 -0
  59. package/lib/crystal/core/moleculeOf.d.ts.map +1 -0
  60. package/lib/crystal/core/moleculeOf.js +128 -0
  61. package/lib/crystal/core/moleculeOf.js.map +1 -0
  62. package/lib/crystal/core/moleculeTypes.d.ts +80 -0
  63. package/lib/crystal/core/moleculeTypes.d.ts.map +1 -0
  64. package/lib/crystal/core/moleculeTypes.js +2 -0
  65. package/lib/crystal/core/moleculeTypes.js.map +1 -0
  66. package/lib/crystal/core/molecules.d.ts +39 -0
  67. package/lib/crystal/core/molecules.d.ts.map +1 -0
  68. package/lib/crystal/core/molecules.js +140 -0
  69. package/lib/crystal/core/molecules.js.map +1 -0
  70. package/lib/crystal/core/operations.d.ts +19 -0
  71. package/lib/crystal/core/operations.d.ts.map +1 -0
  72. package/lib/crystal/core/operations.js +68 -0
  73. package/lib/crystal/core/operations.js.map +1 -0
  74. package/lib/crystal/core/packing.d.ts +43 -0
  75. package/lib/crystal/core/packing.d.ts.map +1 -0
  76. package/lib/crystal/core/packing.js +89 -0
  77. package/lib/crystal/core/packing.js.map +1 -0
  78. package/lib/crystal/core/periodicBonds.d.ts +57 -0
  79. package/lib/crystal/core/periodicBonds.d.ts.map +1 -0
  80. package/lib/crystal/core/periodicBonds.js +167 -0
  81. package/lib/crystal/core/periodicBonds.js.map +1 -0
  82. package/lib/crystal/core/resolve.d.ts +61 -0
  83. package/lib/crystal/core/resolve.d.ts.map +1 -0
  84. package/lib/crystal/core/resolve.js +149 -0
  85. package/lib/crystal/core/resolve.js.map +1 -0
  86. package/lib/crystal/core/spaceGroups/index.d.ts +5 -0
  87. package/lib/crystal/core/spaceGroups/index.d.ts.map +1 -0
  88. package/lib/crystal/core/spaceGroups/index.js +4 -0
  89. package/lib/crystal/core/spaceGroups/index.js.map +1 -0
  90. package/lib/crystal/core/spaceGroups/spaceGroupOperations.d.ts +14 -0
  91. package/lib/crystal/core/spaceGroups/spaceGroupOperations.d.ts.map +1 -0
  92. package/lib/crystal/core/spaceGroups/spaceGroupOperations.js +24 -0
  93. package/lib/crystal/core/spaceGroups/spaceGroupOperations.js.map +1 -0
  94. package/lib/crystal/core/spaceGroups/spaceGroupRows.d.ts +3 -0
  95. package/lib/crystal/core/spaceGroups/spaceGroupRows.d.ts.map +1 -0
  96. package/lib/crystal/core/spaceGroups/spaceGroupRows.js +536 -0
  97. package/lib/crystal/core/spaceGroups/spaceGroupRows.js.map +1 -0
  98. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.d.ts +43 -0
  99. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.d.ts.map +1 -0
  100. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.js +169 -0
  101. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.js.map +1 -0
  102. package/lib/crystal/core/spaceGroups/spaceGroups.d.ts +78 -0
  103. package/lib/crystal/core/spaceGroups/spaceGroups.d.ts.map +1 -0
  104. package/lib/crystal/core/spaceGroups/spaceGroups.js +83 -0
  105. package/lib/crystal/core/spaceGroups/spaceGroups.js.map +1 -0
  106. package/lib/crystal/core/symmetry/group.d.ts +15 -0
  107. package/lib/crystal/core/symmetry/group.d.ts.map +1 -0
  108. package/lib/crystal/core/symmetry/group.js +37 -0
  109. package/lib/crystal/core/symmetry/group.js.map +1 -0
  110. package/lib/crystal/core/symmetry/index.d.ts +8 -0
  111. package/lib/crystal/core/symmetry/index.d.ts.map +1 -0
  112. package/lib/crystal/core/symmetry/index.js +6 -0
  113. package/lib/crystal/core/symmetry/index.js.map +1 -0
  114. package/lib/crystal/core/symmetry/integerMatrix.d.ts +45 -0
  115. package/lib/crystal/core/symmetry/integerMatrix.d.ts.map +1 -0
  116. package/lib/crystal/core/symmetry/integerMatrix.js +139 -0
  117. package/lib/crystal/core/symmetry/integerMatrix.js.map +1 -0
  118. package/lib/crystal/core/symmetry/lattice.d.ts +64 -0
  119. package/lib/crystal/core/symmetry/lattice.d.ts.map +1 -0
  120. package/lib/crystal/core/symmetry/lattice.js +113 -0
  121. package/lib/crystal/core/symmetry/lattice.js.map +1 -0
  122. package/lib/crystal/core/symmetry/operation.d.ts +91 -0
  123. package/lib/crystal/core/symmetry/operation.d.ts.map +1 -0
  124. package/lib/crystal/core/symmetry/operation.js +184 -0
  125. package/lib/crystal/core/symmetry/operation.js.map +1 -0
  126. package/lib/crystal/core/symmetry/parseOperation.d.ts +18 -0
  127. package/lib/crystal/core/symmetry/parseOperation.d.ts.map +1 -0
  128. package/lib/crystal/core/symmetry/parseOperation.js +145 -0
  129. package/lib/crystal/core/symmetry/parseOperation.js.map +1 -0
  130. package/lib/crystal/core/symmetry/types.d.ts +29 -0
  131. package/lib/crystal/core/symmetry/types.d.ts.map +1 -0
  132. package/lib/crystal/core/symmetry/types.js +5 -0
  133. package/lib/crystal/core/symmetry/types.js.map +1 -0
  134. package/lib/crystal/core/symmetryClasses.d.ts +28 -0
  135. package/lib/crystal/core/symmetryClasses.d.ts.map +1 -0
  136. package/lib/crystal/core/symmetryClasses.js +93 -0
  137. package/lib/crystal/core/symmetryClasses.js.map +1 -0
  138. package/lib/crystal.d.ts +12 -0
  139. package/lib/crystal.d.ts.map +1 -0
  140. package/lib/crystal.js +12 -0
  141. package/lib/crystal.js.map +1 -0
  142. package/package.json +3 -1
  143. package/src/crystal/core/bondGrid.ts +98 -0
  144. package/src/crystal/core/cellBonds.ts +121 -0
  145. package/src/crystal/core/cif/element.ts +40 -0
  146. package/src/crystal/core/cif/index.ts +12 -0
  147. package/src/crystal/core/cif/number.ts +62 -0
  148. package/src/crystal/core/cif/read.ts +218 -0
  149. package/src/crystal/core/cif/readGeometry.ts +104 -0
  150. package/src/crystal/core/cif/tags.ts +143 -0
  151. package/src/crystal/core/cif/types.ts +164 -0
  152. package/src/crystal/core/components.ts +183 -0
  153. package/src/crystal/core/covalentRadii.ts +56 -0
  154. package/src/crystal/core/disorder.ts +190 -0
  155. package/src/crystal/core/expand.ts +105 -0
  156. package/src/crystal/core/index.ts +44 -0
  157. package/src/crystal/core/moleculeOf.ts +169 -0
  158. package/src/crystal/core/moleculeTypes.ts +85 -0
  159. package/src/crystal/core/molecules.ts +165 -0
  160. package/src/crystal/core/operations.ts +79 -0
  161. package/src/crystal/core/packing.ts +116 -0
  162. package/src/crystal/core/periodicBonds.ts +234 -0
  163. package/src/crystal/core/resolve.ts +187 -0
  164. package/src/crystal/core/spaceGroups/index.ts +16 -0
  165. package/src/crystal/core/spaceGroups/spaceGroupOperations.ts +32 -0
  166. package/src/crystal/core/spaceGroups/spaceGroupRows.ts +536 -0
  167. package/src/crystal/core/spaceGroups/spaceGroupSymbols.ts +179 -0
  168. package/src/crystal/core/spaceGroups/spaceGroups.ts +154 -0
  169. package/src/crystal/core/symmetry/group.ts +42 -0
  170. package/src/crystal/core/symmetry/index.ts +23 -0
  171. package/src/crystal/core/symmetry/integerMatrix.ts +153 -0
  172. package/src/crystal/core/symmetry/lattice.ts +152 -0
  173. package/src/crystal/core/symmetry/operation.ts +223 -0
  174. package/src/crystal/core/symmetry/parseOperation.ts +180 -0
  175. package/src/crystal/core/symmetry/types.ts +32 -0
  176. package/src/crystal/core/symmetryClasses.ts +105 -0
  177. package/src/crystal.ts +12 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/crystal/core/cif/types.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,MAAM,WAAW,SAAS;IACxB,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,qFAAqF;AACrF,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gFAAgF;IAChF,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,0EAA0E;AAC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types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/crystal/core/cif/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The cell read as the periodic graph it is: which atoms are bonded, across
3
+ * which face, and which sets of them reach their own translate.
4
+ */
5
+ import type { PeriodicPairs } from './periodicBonds.ts';
6
+ /** Every bond of a cell from each atom's side, listed contiguously per atom. */
7
+ export interface BondGraph {
8
+ /** `offsets[i]` to `offsets[i + 1]` index the bonds of atom `i`. */
9
+ readonly offsets: Int32Array;
10
+ /** The atom each bond reaches. */
11
+ readonly targets: Int32Array;
12
+ /** The cell it is reached in, three integers per bond. */
13
+ readonly shifts: Int32Array;
14
+ /** The bond length, Å. */
15
+ readonly lengths: Float64Array;
16
+ }
17
+ /** One connected set of atoms. */
18
+ export interface PeriodicComponent {
19
+ /** Its atoms, in the order the walk reached them. */
20
+ readonly atoms: readonly number[];
21
+ /**
22
+ * How many independent directions it repeats along: 0 for a molecule, 1 for
23
+ * a chain, 2 for a layer, 3 for a framework.
24
+ */
25
+ readonly periodicity: 0 | 1 | 2 | 3;
26
+ }
27
+ /** The connected sets of a cell, and the cell each atom was reached in. */
28
+ export interface ComponentWalk {
29
+ readonly components: readonly PeriodicComponent[];
30
+ /**
31
+ * The cell each atom was reached in, three integers per atom: an atom's
32
+ * position plus its shift puts a molecule back together.
33
+ */
34
+ readonly shifts: Int32Array;
35
+ }
36
+ /**
37
+ * Turn a list of pairs into each atom's bonds.
38
+ * @param atomCount - How many atoms the cell holds.
39
+ * @param pairs - What `findPeriodicBonds` returned.
40
+ * @param keep - One flag per pair, 0 to leave it out.
41
+ * @default every pair kept
42
+ * @returns The bonds of each atom, both directions of every pair listed.
43
+ */
44
+ export declare function bondGraph(atomCount: number, pairs: PeriodicPairs, keep?: Uint8Array): BondGraph;
45
+ /**
46
+ * Walk every connected set of atoms, noting which cell each atom is reached
47
+ * in. Reaching an atom a second time in another cell means the set is bonded
48
+ * to its own translate, and the independent translations met that way say
49
+ * along how many directions it extends.
50
+ * @param graph - The bonds of each atom.
51
+ * @param skip - One flag per atom, 1 for an atom that belongs to no set.
52
+ * @default no atom skipped
53
+ * @returns The sets, in the order of their lowest atom, and each atom's cell.
54
+ */
55
+ export declare function walkComponents(graph: BondGraph, skip?: Uint8Array): ComponentWalk;
56
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/components.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,0BAA0B;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;CAChC;AAED,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACrC;AAED,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,aAAa,EACpB,IAAI,CAAC,EAAE,UAAU,GAChB,SAAS,CAmCX;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,EAChB,IAAI,CAAC,EAAE,UAAU,GAChB,aAAa,CAUf"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * The cell read as the periodic graph it is: which atoms are bonded, across
3
+ * which face, and which sets of them reach their own translate.
4
+ */
5
+ /**
6
+ * Turn a list of pairs into each atom's bonds.
7
+ * @param atomCount - How many atoms the cell holds.
8
+ * @param pairs - What `findPeriodicBonds` returned.
9
+ * @param keep - One flag per pair, 0 to leave it out.
10
+ * @default every pair kept
11
+ * @returns The bonds of each atom, both directions of every pair listed.
12
+ */
13
+ export function bondGraph(atomCount, pairs, keep) {
14
+ const offsets = new Int32Array(atomCount + 1);
15
+ for (let pair = 0; pair < pairs.count; pair++) {
16
+ if (keep?.[pair] === 0)
17
+ continue;
18
+ const from = pairs.from[pair] ?? 0;
19
+ const to = pairs.to[pair] ?? 0;
20
+ offsets[from + 1] = (offsets[from + 1] ?? 0) + 1;
21
+ offsets[to + 1] = (offsets[to + 1] ?? 0) + 1;
22
+ }
23
+ for (let atom = 0; atom < atomCount; atom++) {
24
+ offsets[atom + 1] = (offsets[atom + 1] ?? 0) + (offsets[atom] ?? 0);
25
+ }
26
+ const total = offsets[atomCount] ?? 0;
27
+ const targets = new Int32Array(total);
28
+ const shifts = new Int32Array(total * 3);
29
+ const lengths = new Float64Array(total);
30
+ const cursor = offsets.slice(0, atomCount);
31
+ for (let pair = 0; pair < pairs.count; pair++) {
32
+ if (keep?.[pair] === 0)
33
+ continue;
34
+ const from = pairs.from[pair] ?? 0;
35
+ const to = pairs.to[pair] ?? 0;
36
+ const length = pairs.lengths[pair] ?? 0;
37
+ for (let side = 0; side < 2; side++) {
38
+ const atom = side === 0 ? from : to;
39
+ const slot = cursor[atom] ?? 0;
40
+ cursor[atom] = slot + 1;
41
+ targets[slot] = side === 0 ? to : from;
42
+ lengths[slot] = length;
43
+ const sign = side === 0 ? 1 : -1;
44
+ for (let axis = 0; axis < 3; axis++) {
45
+ shifts[slot * 3 + axis] = sign * (pairs.shifts[pair * 3 + axis] ?? 0);
46
+ }
47
+ }
48
+ }
49
+ return { offsets, targets, shifts, lengths };
50
+ }
51
+ /**
52
+ * Walk every connected set of atoms, noting which cell each atom is reached
53
+ * in. Reaching an atom a second time in another cell means the set is bonded
54
+ * to its own translate, and the independent translations met that way say
55
+ * along how many directions it extends.
56
+ * @param graph - The bonds of each atom.
57
+ * @param skip - One flag per atom, 1 for an atom that belongs to no set.
58
+ * @default no atom skipped
59
+ * @returns The sets, in the order of their lowest atom, and each atom's cell.
60
+ */
61
+ export function walkComponents(graph, skip) {
62
+ const count = graph.offsets.length - 1;
63
+ const seen = new Uint8Array(count);
64
+ const shifts = new Int32Array(count * 3);
65
+ const components = [];
66
+ for (let start = 0; start < count; start++) {
67
+ if (seen[start] === 1 || skip?.[start] === 1)
68
+ continue;
69
+ components.push(walkOne(start, graph, seen, shifts));
70
+ }
71
+ return { components, shifts };
72
+ }
73
+ function walkOne(start, graph, seen, shifts) {
74
+ const atoms = [start];
75
+ const basis = [];
76
+ seen[start] = 1;
77
+ for (let head = 0; head < atoms.length; head++) {
78
+ const from = atoms[head] ?? 0;
79
+ const last = graph.offsets[from + 1] ?? 0;
80
+ for (let bond = graph.offsets[from] ?? 0; bond < last; bond++) {
81
+ const to = graph.targets[bond] ?? 0;
82
+ const a = (shifts[from * 3] ?? 0) + (graph.shifts[bond * 3] ?? 0);
83
+ const b = (shifts[from * 3 + 1] ?? 0) + (graph.shifts[bond * 3 + 1] ?? 0);
84
+ const c = (shifts[from * 3 + 2] ?? 0) + (graph.shifts[bond * 3 + 2] ?? 0);
85
+ if (seen[to] === 1) {
86
+ if (basis.length < 3) {
87
+ addTranslation(basis, a - (shifts[to * 3] ?? 0), b - (shifts[to * 3 + 1] ?? 0), c - (shifts[to * 3 + 2] ?? 0));
88
+ }
89
+ continue;
90
+ }
91
+ seen[to] = 1;
92
+ shifts[to * 3] = a;
93
+ shifts[to * 3 + 1] = b;
94
+ shifts[to * 3 + 2] = c;
95
+ atoms.push(to);
96
+ }
97
+ }
98
+ return { atoms, periodicity: basis.length };
99
+ }
100
+ /**
101
+ * Keep a lattice translation when it is independent of those already kept.
102
+ * @param basis - The independent translations kept so far.
103
+ * @param a - The translation along a, in cells.
104
+ * @param b - The translation along b, in cells.
105
+ * @param c - The translation along c, in cells.
106
+ */
107
+ function addTranslation(basis, a, b, c) {
108
+ if (a === 0 && b === 0 && c === 0)
109
+ return;
110
+ const [first, second] = basis;
111
+ if (first === undefined) {
112
+ basis.push([a, b, c]);
113
+ return;
114
+ }
115
+ const cross = [
116
+ (first[1] ?? 0) * c - (first[2] ?? 0) * b,
117
+ (first[2] ?? 0) * a - (first[0] ?? 0) * c,
118
+ (first[0] ?? 0) * b - (first[1] ?? 0) * a,
119
+ ];
120
+ if (second === undefined) {
121
+ if (cross[0] !== 0 || cross[1] !== 0 || cross[2] !== 0) {
122
+ basis.push([a, b, c]);
123
+ }
124
+ return;
125
+ }
126
+ const volume = (second[0] ?? 0) * (cross[0] ?? 0) +
127
+ (second[1] ?? 0) * (cross[1] ?? 0) +
128
+ (second[2] ?? 0) * (cross[2] ?? 0);
129
+ if (volume !== 0)
130
+ basis.push([a, b, c]);
131
+ }
132
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../../src/crystal/core/components.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqCH;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACvB,SAAiB,EACjB,KAAoB,EACpB,IAAiB;IAEjB,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAC9C,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;QAC9C,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,SAAS;QACjC,MAAM,IAA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AAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;QACD,OAAO;IACT,CAAC;IACD,MAAM,MAAM,GACV,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,IAAI,MAAM,KAAK,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,24 @@
1
+ /** What is added to the sum of two covalent radii before two atoms are bonded, Å. */
2
+ export declare const BOND_TOLERANCE = 0.45;
3
+ /**
4
+ * The longest bond between two elements: the sum of their covalent radii plus
5
+ * {@link BOND_TOLERANCE}, and never one between two hydrogens.
6
+ *
7
+ * It is the rule openchemlib's `BondsCalculator` builds bonds from 3D
8
+ * coordinates with, on the same radii — except that openchemlib bonds only
9
+ * organic atoms, and this rule bonds every element, metals included, so a
10
+ * metal complex comes out whole and a salt or a metal as a network.
11
+ * @param a - One element symbol, e.g. `C`.
12
+ * @param b - The other.
13
+ * @returns The distance in ångström, or 0 for a pair never bonded: H–H, or an
14
+ * element the periodic table does not hold.
15
+ */
16
+ export declare function covalentBondLimit(a: string, b: string): number;
17
+ /**
18
+ * The single-bond covalent radius of an element.
19
+ * @param symbol - The element symbol, e.g. `Fe`.
20
+ * @returns The radius in ångström, or `undefined` for a symbol that names no
21
+ * element.
22
+ */
23
+ export declare function covalentRadius(symbol: string): number | undefined;
24
+ //# sourceMappingURL=covalentRadii.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"covalentRadii.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/covalentRadii.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAM9D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKjE"}
@@ -0,0 +1,55 @@
1
+ import { elementBySymbol } from "../../periodic/core/elements.js";
2
+ /** What is added to the sum of two covalent radii before two atoms are bonded, Å. */
3
+ export const BOND_TOLERANCE = 0.45;
4
+ /**
5
+ * The longest bond between two elements: the sum of their covalent radii plus
6
+ * {@link BOND_TOLERANCE}, and never one between two hydrogens.
7
+ *
8
+ * It is the rule openchemlib's `BondsCalculator` builds bonds from 3D
9
+ * coordinates with, on the same radii — except that openchemlib bonds only
10
+ * organic atoms, and this rule bonds every element, metals included, so a
11
+ * metal complex comes out whole and a salt or a metal as a network.
12
+ * @param a - One element symbol, e.g. `C`.
13
+ * @param b - The other.
14
+ * @returns The distance in ångström, or 0 for a pair never bonded: H–H, or an
15
+ * element the periodic table does not hold.
16
+ */
17
+ export function covalentBondLimit(a, b) {
18
+ if (a === 'H' && b === 'H')
19
+ return 0;
20
+ const first = covalentRadius(a);
21
+ const second = covalentRadius(b);
22
+ if (first === undefined || second === undefined)
23
+ return 0;
24
+ return first + second + BOND_TOLERANCE;
25
+ }
26
+ /**
27
+ * The single-bond covalent radius of an element.
28
+ * @param symbol - The element symbol, e.g. `Fe`.
29
+ * @returns The radius in ångström, or `undefined` for a symbol that names no
30
+ * element.
31
+ */
32
+ export function covalentRadius(symbol) {
33
+ const element = elementBySymbol(symbol);
34
+ return element === undefined
35
+ ? undefined
36
+ : COVALENT_RADII[element.atomicNumber];
37
+ }
38
+ /**
39
+ * Single-bond covalent radii in ångström, by atomic number, as openchemlib
40
+ * carries them (`VDWRadii.COVALENT_RADIUS`); they follow Pyykkö and Atsumi's
41
+ * single-bond radii (Chem. Eur. J. 2009, 15, 186). Index 0 is unused.
42
+ */
43
+ const COVALENT_RADII = [
44
+ 0.25, 0.32, 0.46, 1.33, 1.02, 0.85, 0.75, 0.71, 0.63, 0.64, 0.96, 1.6, 1.39,
45
+ 1.26, 1.16, 1.11, 1.03, 0.99, 1.07, 1.96, 1.71, 1.48, 1.36, 1.34, 1.22, 1.19,
46
+ 1.16, 1.11, 1.1, 1.2, 1.2, 1.24, 1.21, 1.21, 1.16, 1.14, 1.21, 2.1, 1.85,
47
+ 1.63, 1.54, 1.47, 1.38, 1.28, 1.25, 1.25, 1.2, 1.39, 1.44, 1.46, 1.4, 1.4,
48
+ 1.36, 1.33, 1.35, 2.32, 1.96, 1.8, 1.63, 1.76, 1.74, 1.73, 1.72, 1.68, 1.69,
49
+ 1.68, 1.67, 1.66, 1.65, 1.64, 1.7, 1.62, 1.52, 1.46, 1.37, 1.31, 1.29, 1.22,
50
+ 1.23, 1.24, 1.42, 1.5, 1.44, 1.51, 1.45, 1.47, 1.45, 2.23, 2.01, 1.86, 1.75,
51
+ 1.69, 1.7, 1.71, 1.72, 1.66, 1.66, 1.68, 1.68, 1.65, 1.67, 1.73, 1.76, 1.61,
52
+ 1.57, 1.49, 1.43, 1.41, 1.34, 1.29, 1.28, 1.21, 1.37, 1.36, 1.43, 1.62, 1.75,
53
+ 1.65, 1.57,
54
+ ];
55
+ //# sourceMappingURL=covalentRadii.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"covalentRadii.js","sourceRoot":"","sources":["../../../src/crystal/core/covalentRadii.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,qFAAqF;AACrF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC;;;;;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AE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG;IACzE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC3E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC3E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC3E,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC3E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC5E,IAAI,EAAE,IAAI;CACX,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { CrystalSite, CrystalStructure } from './cif/types.ts';
2
+ import type { ExpandedAtom } from './expand.ts';
3
+ import type { Lattice } from './symmetry/lattice.ts';
4
+ /**
5
+ * Two atoms of different disorder groups closer than this, in ångström, are
6
+ * alternatives: the two groups are never kept together.
7
+ */
8
+ export declare const DISORDER_OVERLAP = 1.1;
9
+ /**
10
+ * The same, for two groups of one disorder assembly, which the file already
11
+ * says are alternatives where they meet: a CF₃ group turned by 60° puts its
12
+ * fluorines 1.3 Å from where they were.
13
+ */
14
+ export declare const ASSEMBLY_OVERLAP = 2;
15
+ /**
16
+ * Which atoms of the asymmetric unit a molecule is built from, as
17
+ * {@link chooseDisorder} decides it.
18
+ * @param structure - What `readCif` returned.
19
+ * @returns One flag per site, 1 to keep it.
20
+ * @throws {Error} When the file names no space group and lists no operation.
21
+ */
22
+ export declare function keptSites(structure: CrystalStructure): Uint8Array;
23
+ /**
24
+ * Which atoms of the asymmetric unit a molecule is built from: one model of
25
+ * the crystal, never two disordered parts on top of each other.
26
+ *
27
+ * - A dummy atom (`_atom_site_calc_flag` `dum`) is never kept.
28
+ * - An atom in no disorder group — `.` or `0`, as SHELX writes it — is always
29
+ * kept.
30
+ * - The disorder groups, each named by its assembly and its group, are kept
31
+ * by decreasing mean occupancy, the one written first on a tie, and a group
32
+ * is left out when one of its atoms lies within {@link ASSEMBLY_OVERLAP} of
33
+ * an atom of another group of the same assembly already kept, or within
34
+ * {@link DISORDER_OVERLAP} of one of another assembly and another group
35
+ * number, symmetry copies included. Groups sharing a number — SHELX's
36
+ * `PART 1` in two assemblies — are never alternatives.
37
+ *
38
+ * So a 70:30 disorder keeps its major part, a 50:50 one the part written
39
+ * first, and several disorders of one structure each keep one part, however
40
+ * the file spreads them over assemblies.
41
+ * @param sites - The asymmetric unit, in file order.
42
+ * @param atoms - The atoms of one cell the sites that are not dummies make.
43
+ * @param lattice - The cell.
44
+ * @returns One flag per site, 1 to keep it.
45
+ */
46
+ export declare function chooseDisorder(sites: readonly CrystalSite[], atoms: readonly ExpandedAtom[], lattice: Lattice): Uint8Array;
47
+ /**
48
+ * The disorder group a site belongs to.
49
+ * @param site - One atom of the asymmetric unit.
50
+ * @returns The group as the file writes it, or `null` for an atom in none.
51
+ */
52
+ export declare function disorderGroupOf(site: CrystalSite): string | null;
53
+ /**
54
+ * Whether a site is a dummy atom, which stands for no atom at all.
55
+ * @param site - One atom of the asymmetric unit.
56
+ * @returns Whether its calc flag is `dum`.
57
+ */
58
+ export declare function isDummy(site: CrystalSite): boolean;
59
+ //# sourceMappingURL=disorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disorder.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/disorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,gBAAgB,GAAG,UAAU,CAYjE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,OAAO,EAAE,OAAO,GACf,UAAU,CAmDZ;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAElD"}
@@ -0,0 +1,168 @@
1
+ import { expandSite } from "./expand.js";
2
+ import { structureOperations } from "./operations.js";
3
+ import { findPeriodicBonds } from "./periodicBonds.js";
4
+ import { createLattice } from "./symmetry/lattice.js";
5
+ /**
6
+ * Two atoms of different disorder groups closer than this, in ångström, are
7
+ * alternatives: the two groups are never kept together.
8
+ */
9
+ export const DISORDER_OVERLAP = 1.1;
10
+ /**
11
+ * The same, for two groups of one disorder assembly, which the file already
12
+ * says are alternatives where they meet: a CF₃ group turned by 60° puts its
13
+ * fluorines 1.3 Å from where they were.
14
+ */
15
+ export const ASSEMBLY_OVERLAP = 2;
16
+ /**
17
+ * Which atoms of the asymmetric unit a molecule is built from, as
18
+ * {@link chooseDisorder} decides it.
19
+ * @param structure - What `readCif` returned.
20
+ * @returns One flag per site, 1 to keep it.
21
+ * @throws {Error} When the file names no space group and lists no operation.
22
+ */
23
+ export function keptSites(structure) {
24
+ const operations = structureOperations(structure);
25
+ const atoms = [];
26
+ for (let index = 0; index < structure.sites.length; index++) {
27
+ const site = structure.sites[index];
28
+ if (isDummy(site))
29
+ continue;
30
+ const images = expandSite(site, index, operations);
31
+ for (let image = 0; image < images.length; image++) {
32
+ atoms.push(images[image]);
33
+ }
34
+ }
35
+ return chooseDisorder(structure.sites, atoms, createLattice(structure.cell));
36
+ }
37
+ /**
38
+ * Which atoms of the asymmetric unit a molecule is built from: one model of
39
+ * the crystal, never two disordered parts on top of each other.
40
+ *
41
+ * - A dummy atom (`_atom_site_calc_flag` `dum`) is never kept.
42
+ * - An atom in no disorder group — `.` or `0`, as SHELX writes it — is always
43
+ * kept.
44
+ * - The disorder groups, each named by its assembly and its group, are kept
45
+ * by decreasing mean occupancy, the one written first on a tie, and a group
46
+ * is left out when one of its atoms lies within {@link ASSEMBLY_OVERLAP} of
47
+ * an atom of another group of the same assembly already kept, or within
48
+ * {@link DISORDER_OVERLAP} of one of another assembly and another group
49
+ * number, symmetry copies included. Groups sharing a number — SHELX's
50
+ * `PART 1` in two assemblies — are never alternatives.
51
+ *
52
+ * So a 70:30 disorder keeps its major part, a 50:50 one the part written
53
+ * first, and several disorders of one structure each keep one part, however
54
+ * the file spreads them over assemblies.
55
+ * @param sites - The asymmetric unit, in file order.
56
+ * @param atoms - The atoms of one cell the sites that are not dummies make.
57
+ * @param lattice - The cell.
58
+ * @returns One flag per site, 1 to keep it.
59
+ */
60
+ export function chooseDisorder(sites, atoms, lattice) {
61
+ const kept = new Uint8Array(sites.length);
62
+ const unitOf = new Int32Array(sites.length).fill(-1);
63
+ const units = [];
64
+ const unitIndex = new Map();
65
+ for (let index = 0; index < sites.length; index++) {
66
+ const site = sites[index];
67
+ if (isDummy(site))
68
+ continue;
69
+ const group = disorderGroupOf(site);
70
+ if (group === null) {
71
+ kept[index] = 1;
72
+ continue;
73
+ }
74
+ const key = `${site.disorderAssembly ?? ''}\n${group}`;
75
+ let unit = unitIndex.get(key);
76
+ if (unit === undefined) {
77
+ unit = units.length;
78
+ unitIndex.set(key, unit);
79
+ units.push({
80
+ assembly: site.disorderAssembly ?? '',
81
+ group,
82
+ occupancy: 0,
83
+ count: 0,
84
+ first: index,
85
+ conflicts: [],
86
+ });
87
+ }
88
+ const tally = units[unit];
89
+ tally.occupancy += site.occupancy;
90
+ tally.count += 1;
91
+ unitOf[index] = unit;
92
+ }
93
+ if (units.length === 0)
94
+ return kept;
95
+ findConflicts(units, unitOf, atoms, lattice);
96
+ const order = units.toSorted((a, b) => {
97
+ const difference = b.occupancy / b.count - a.occupancy / a.count;
98
+ return Math.abs(difference) > 1e-6 ? difference : a.first - b.first;
99
+ });
100
+ const chosen = new Set();
101
+ for (const unit of order) {
102
+ let free = true;
103
+ for (const other of unit.conflicts) {
104
+ if (chosen.has(units[other]))
105
+ free = false;
106
+ }
107
+ if (free)
108
+ chosen.add(unit);
109
+ }
110
+ for (let index = 0; index < sites.length; index++) {
111
+ const unit = unitOf[index] ?? -1;
112
+ if (unit !== -1 && chosen.has(units[unit]))
113
+ kept[index] = 1;
114
+ }
115
+ return kept;
116
+ }
117
+ /**
118
+ * The disorder group a site belongs to.
119
+ * @param site - One atom of the asymmetric unit.
120
+ * @returns The group as the file writes it, or `null` for an atom in none.
121
+ */
122
+ export function disorderGroupOf(site) {
123
+ const group = site.disorderGroup;
124
+ return group === undefined || group === '0' ? null : group;
125
+ }
126
+ /**
127
+ * Whether a site is a dummy atom, which stands for no atom at all.
128
+ * @param site - One atom of the asymmetric unit.
129
+ * @returns Whether its calc flag is `dum`.
130
+ */
131
+ export function isDummy(site) {
132
+ return site.calcFlag?.toLowerCase() === 'dum';
133
+ }
134
+ /**
135
+ * Note which disorder groups put atoms on top of each other.
136
+ * @param units - The disorder groups; their conflicts are filled in.
137
+ * @param unitOf - The group of each site, -1 for none.
138
+ * @param atoms - The atoms of one cell.
139
+ * @param lattice - The cell.
140
+ */
141
+ function findConflicts(units, unitOf, atoms, lattice) {
142
+ const disordered = [];
143
+ for (let index = 0; index < atoms.length; index++) {
144
+ const atom = atoms[index];
145
+ if ((unitOf[atom.siteIndex] ?? -1) !== -1)
146
+ disordered.push(atom);
147
+ }
148
+ const close = findPeriodicBonds(disordered, lattice, () => ASSEMBLY_OVERLAP, {
149
+ samePlace: 0,
150
+ });
151
+ for (let pair = 0; pair < close.count; pair++) {
152
+ const first = disordered[close.from[pair] ?? 0];
153
+ const second = disordered[close.to[pair] ?? 0];
154
+ const a = unitOf[first.siteIndex] ?? -1;
155
+ const b = unitOf[second.siteIndex] ?? -1;
156
+ const unitA = units[a];
157
+ const unitB = units[b];
158
+ if (unitA.group === unitB.group)
159
+ continue;
160
+ if (unitA.assembly !== unitB.assembly &&
161
+ (close.lengths[pair] ?? 0) >= DISORDER_OVERLAP) {
162
+ continue;
163
+ }
164
+ units[a].conflicts.push(b);
165
+ units[b].conflicts.push(a);
166
+ }
167
+ }
168
+ //# sourceMappingURL=disorder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disorder.js","sourceRoot":"","sources":["../../../src/crystal/core/disorder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,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;QACvC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAiB,CAAC;QACvC,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK;YAAE,SAAS;QAC1C,IACE,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;YACjC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,gBAAgB,EAC9C,CAAC;YACD,SAAS;QACX,CAAC;QACA,KAAK,CAAC,CAAC,CAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5C,KAAK,CAAC,CAAC,CAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The asymmetric unit becomes the cell.
3
+ *
4
+ * Every atom the space group generates comes from `orbit()`, which walks the
5
+ * coset list in exact integer arithmetic, so a special position is deduplicated
6
+ * rather than drawn four times on top of itself. Each atom remembers the site it
7
+ * came from and the operation that put it there, which is what lets the page say
8
+ * this chlorine is the one the c glide made*.
9
+ */
10
+ import type { CrystalOperation, Dimension } from './symmetry/types.ts';
11
+ /** One line of the asymmetric unit, as a CIF or the atom table gives it. */
12
+ export interface AsymmetricSite {
13
+ /** `Na1` — the label the file uses, unique within the structure. */
14
+ readonly label: string;
15
+ /** Chemical symbol, `Na`. */
16
+ readonly element: string;
17
+ /** Fractional coordinate along **a**. */
18
+ readonly x: number;
19
+ /** Fractional coordinate along **b**. */
20
+ readonly y: number;
21
+ /** Fractional coordinate along **c**. */
22
+ readonly z: number;
23
+ /**
24
+ * How much of the site this atom occupies.
25
+ * @default 1
26
+ */
27
+ readonly occupancy?: number;
28
+ }
29
+ /** One atom of the filled cell, and where it came from. */
30
+ export interface ExpandedAtom {
31
+ /** The label of the site it came from. */
32
+ readonly label: string;
33
+ readonly element: string;
34
+ /** Fractional position, wrapped into [0, 1). */
35
+ readonly position: readonly [number, number, number];
36
+ /** Index into the asymmetric unit it was generated from. */
37
+ readonly siteIndex: number;
38
+ /** Index into the operation list of the operation that generated it. */
39
+ readonly operationIndex: number;
40
+ readonly occupancy: number;
41
+ }
42
+ /**
43
+ * Every atom of one cell, in fractional coordinates.
44
+ * @param sites - The asymmetric unit, in the order the file lists it.
45
+ * @param operations - The full coset list of the setting, centring included.
46
+ * @param tolerance - Fractional distance below which two images are one atom.
47
+ * @default 1e-4
48
+ * @returns The atoms, grouped by the site they came from, each carrying the
49
+ * index of the operation that generated it.
50
+ */
51
+ export declare function expandStructure(sites: readonly AsymmetricSite[], operations: ReadonlyArray<CrystalOperation<Dimension>>, tolerance?: number): ExpandedAtom[];
52
+ /**
53
+ * The orbit of one site.
54
+ * @param site - The line of the asymmetric unit.
55
+ * @param siteIndex - Where it sits in that list, carried onto every atom.
56
+ * @param operations - The full coset list.
57
+ * @param tolerance - As {@link expandStructure}.
58
+ * @default 1e-4
59
+ * @returns One atom per distinct image, the site's own position first.
60
+ */
61
+ export declare function expandSite(site: AsymmetricSite, siteIndex: number, operations: ReadonlyArray<CrystalOperation<Dimension>>, tolerance?: number): ExpandedAtom[];
62
+ //# sourceMappingURL=expand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEvE,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;I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