react-cheminfo 0.134.0 → 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 (181) 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/lib/server/spaSite.d.ts.map +1 -1
  143. package/lib/server/spaSite.js +9 -0
  144. package/lib/server/spaSite.js.map +1 -1
  145. package/package.json +3 -1
  146. package/src/crystal/core/bondGrid.ts +98 -0
  147. package/src/crystal/core/cellBonds.ts +121 -0
  148. package/src/crystal/core/cif/element.ts +40 -0
  149. package/src/crystal/core/cif/index.ts +12 -0
  150. package/src/crystal/core/cif/number.ts +62 -0
  151. package/src/crystal/core/cif/read.ts +218 -0
  152. package/src/crystal/core/cif/readGeometry.ts +104 -0
  153. package/src/crystal/core/cif/tags.ts +143 -0
  154. package/src/crystal/core/cif/types.ts +164 -0
  155. package/src/crystal/core/components.ts +183 -0
  156. package/src/crystal/core/covalentRadii.ts +56 -0
  157. package/src/crystal/core/disorder.ts +190 -0
  158. package/src/crystal/core/expand.ts +105 -0
  159. package/src/crystal/core/index.ts +44 -0
  160. package/src/crystal/core/moleculeOf.ts +169 -0
  161. package/src/crystal/core/moleculeTypes.ts +85 -0
  162. package/src/crystal/core/molecules.ts +165 -0
  163. package/src/crystal/core/operations.ts +79 -0
  164. package/src/crystal/core/packing.ts +116 -0
  165. package/src/crystal/core/periodicBonds.ts +234 -0
  166. package/src/crystal/core/resolve.ts +187 -0
  167. package/src/crystal/core/spaceGroups/index.ts +16 -0
  168. package/src/crystal/core/spaceGroups/spaceGroupOperations.ts +32 -0
  169. package/src/crystal/core/spaceGroups/spaceGroupRows.ts +536 -0
  170. package/src/crystal/core/spaceGroups/spaceGroupSymbols.ts +179 -0
  171. package/src/crystal/core/spaceGroups/spaceGroups.ts +154 -0
  172. package/src/crystal/core/symmetry/group.ts +42 -0
  173. package/src/crystal/core/symmetry/index.ts +23 -0
  174. package/src/crystal/core/symmetry/integerMatrix.ts +153 -0
  175. package/src/crystal/core/symmetry/lattice.ts +152 -0
  176. package/src/crystal/core/symmetry/operation.ts +223 -0
  177. package/src/crystal/core/symmetry/parseOperation.ts +180 -0
  178. package/src/crystal/core/symmetry/types.ts +32 -0
  179. package/src/crystal/core/symmetryClasses.ts +105 -0
  180. package/src/crystal.ts +12 -0
  181. package/src/server/spaSite.ts +9 -0
@@ -0,0 +1,61 @@
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 { orbit } from "./symmetry/operation.js";
11
+ /**
12
+ * Every atom of one cell, in fractional coordinates.
13
+ * @param sites - The asymmetric unit, in the order the file lists it.
14
+ * @param operations - The full coset list of the setting, centring included.
15
+ * @param tolerance - Fractional distance below which two images are one atom.
16
+ * @default 1e-4
17
+ * @returns The atoms, grouped by the site they came from, each carrying the
18
+ * index of the operation that generated it.
19
+ */
20
+ export function expandStructure(sites, operations, tolerance) {
21
+ const atoms = [];
22
+ for (let index = 0; index < sites.length; index++) {
23
+ const site = sites[index];
24
+ if (site === undefined)
25
+ continue;
26
+ const images = expandSite(site, index, operations, tolerance);
27
+ for (let image = 0; image < images.length; image++) {
28
+ atoms.push(images[image]);
29
+ }
30
+ }
31
+ return atoms;
32
+ }
33
+ /**
34
+ * The orbit of one site.
35
+ * @param site - The line of the asymmetric unit.
36
+ * @param siteIndex - Where it sits in that list, carried onto every atom.
37
+ * @param operations - The full coset list.
38
+ * @param tolerance - As {@link expandStructure}.
39
+ * @default 1e-4
40
+ * @returns One atom per distinct image, the site's own position first.
41
+ */
42
+ export function expandSite(site, siteIndex, operations, tolerance) {
43
+ const images = orbit([site.x, site.y, site.z], operations, tolerance);
44
+ const atoms = [];
45
+ for (const image of images) {
46
+ atoms.push({
47
+ label: site.label,
48
+ element: site.element,
49
+ position: [
50
+ image.position[0] ?? 0,
51
+ image.position[1] ?? 0,
52
+ image.position[2] ?? 0,
53
+ ],
54
+ siteIndex,
55
+ operationIndex: image.operationIndex,
56
+ occupancy: site.occupancy ?? 1,
57
+ });
58
+ }
59
+ return atoms;
60
+ }
61
+ //# sourceMappingURL=expand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/crystal/core/expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAoChD;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAgC,EAChC,UAAsD,EACtD,SAAkB;IAElB,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,IAAI,KAAK,SAAS;YAAE,SAAS;QACjC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAC9D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAiB,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,IAAoB,EACpB,SAAiB,EACjB,UAAsD,EACtD,SAAkB;IAElB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACtE,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC;YACT,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE;gBACR,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;gBACtB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;gBACtB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;aACvB;YACD,SAAS;YACT,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,18 @@
1
+ export * from './cif/index.ts';
2
+ export type { BondGraph, PeriodicComponent } from './components.ts';
3
+ export { BOND_TOLERANCE, covalentBondLimit, covalentRadius, } from './covalentRadii.ts';
4
+ export { ASSEMBLY_OVERLAP, DISORDER_OVERLAP, chooseDisorder, disorderGroupOf, isDummy, keptSites, } from './disorder.ts';
5
+ export type { AsymmetricSite, ExpandedAtom } from './expand.ts';
6
+ export { expandSite, expandStructure } from './expand.ts';
7
+ export type { CrystalMolecule, CrystalMoleculeAtom, CrystalMoleculeBond, CrystalMolecules, CrystalMoleculesOptions, CrystalNetwork, } from './moleculeTypes.ts';
8
+ export { SAME_ATOM_DISTANCE, crystalMolecules } from './molecules.ts';
9
+ export { structureOperations } from './operations.ts';
10
+ export type { PackingResult } from './packing.ts';
11
+ export { MAX_PACKED_ATOMS, packMolecules } from './packing.ts';
12
+ export type { BondLimit, PackedAtom, PeriodicBondOptions, PeriodicPairs, } from './periodicBonds.ts';
13
+ export { findPeriodicBonds } from './periodicBonds.ts';
14
+ export type { ResolvedSetting } from './resolve.ts';
15
+ export { operationsBelong, resolveStructureSetting, settingOfOperations, } from './resolve.ts';
16
+ export * from './spaceGroups/index.ts';
17
+ export * from './symmetry/index.ts';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,OAAO,EACP,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,YAAY,EACV,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export * from "./cif/index.js";
2
+ export { BOND_TOLERANCE, covalentBondLimit, covalentRadius, } from "./covalentRadii.js";
3
+ export { ASSEMBLY_OVERLAP, DISORDER_OVERLAP, chooseDisorder, disorderGroupOf, isDummy, keptSites, } from "./disorder.js";
4
+ export { expandSite, expandStructure } from "./expand.js";
5
+ export { SAME_ATOM_DISTANCE, crystalMolecules } from "./molecules.js";
6
+ export { structureOperations } from "./operations.js";
7
+ export { MAX_PACKED_ATOMS, packMolecules } from "./packing.js";
8
+ export { findPeriodicBonds } from "./periodicBonds.js";
9
+ export { operationsBelong, resolveStructureSetting, settingOfOperations, } from "./resolve.js";
10
+ export * from "./spaceGroups/index.js";
11
+ export * from "./symmetry/index.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/crystal/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,OAAO,EACP,SAAS,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAS1D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { CrystalSite } from './cif/types.ts';
2
+ import type { BondGraph } from './components.ts';
3
+ import type { ExpandedAtom } from './expand.ts';
4
+ import type { CrystalMolecule } from './moleculeTypes.ts';
5
+ import type { Lattice } from './symmetry/lattice.ts';
6
+ /** What a molecule is read from: the cell, its bonds, and the walk over them. */
7
+ export interface MoleculeContext {
8
+ readonly atoms: readonly ExpandedAtom[];
9
+ readonly sites: readonly CrystalSite[];
10
+ readonly graph: BondGraph;
11
+ /** The cell each atom was reached in, three integers per atom. */
12
+ readonly shifts: Int32Array;
13
+ readonly lattice: Lattice;
14
+ /** Index of the identity in the operation list, -1 when it is absent. */
15
+ readonly identityIndex: number;
16
+ /** One slot per atom of the cell, -1 everywhere between two calls. */
17
+ readonly localOf: Int32Array;
18
+ }
19
+ /**
20
+ * One molecule, whole, placed where the file wrote it.
21
+ *
22
+ * The molecule is moved by a whole number of cells so the first atom the
23
+ * file's own position generates sits at the coordinates the file gives it.
24
+ * A molecule with no such atom is moved to the cell its centre falls in.
25
+ * @param members - Its atoms, as indices into the cell.
26
+ * @param copies - How many copies of it one cell holds.
27
+ * @param context - The cell it is read from.
28
+ * @returns The molecule.
29
+ */
30
+ export declare function buildMolecule(members: readonly number[], copies: number, context: MoleculeContext): CrystalMolecule;
31
+ //# sourceMappingURL=moleculeOf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moleculeOf.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/moleculeOf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAKrD,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;CAC9B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,GACvB,eAAe,CAsCjB"}
@@ -0,0 +1,128 @@
1
+ import { disorderGroupOf } from "./disorder.js";
2
+ /** Slack on a centroid sitting on a cell face, so it lands in one cell only. */
3
+ const CENTRE_TOLERANCE = 1e-6;
4
+ /**
5
+ * One molecule, whole, placed where the file wrote it.
6
+ *
7
+ * The molecule is moved by a whole number of cells so the first atom the
8
+ * file's own position generates sits at the coordinates the file gives it.
9
+ * A molecule with no such atom is moved to the cell its centre falls in.
10
+ * @param members - Its atoms, as indices into the cell.
11
+ * @param copies - How many copies of it one cell holds.
12
+ * @param context - The cell it is read from.
13
+ * @returns The molecule.
14
+ */
15
+ export function buildMolecule(members, copies, context) {
16
+ const { atoms, sites, shifts, lattice, localOf } = context;
17
+ const order = moleculeOrder(members, context);
18
+ const move = placement(order, context);
19
+ const m = lattice.cartesian;
20
+ const placed = [];
21
+ for (let local = 0; local < order.length; local++) {
22
+ const index = order[local] ?? 0;
23
+ localOf[index] = local;
24
+ const atom = atoms[index];
25
+ const site = sites[atom.siteIndex];
26
+ const fractional = [0, 0, 0];
27
+ for (let axis = 0; axis < 3; axis++) {
28
+ fractional[axis] =
29
+ (atom.position[axis] ?? 0) +
30
+ (shifts[index * 3 + axis] ?? 0) +
31
+ (move[axis] ?? 0);
32
+ }
33
+ const [x = 0, y = 0, z = 0] = fractional;
34
+ placed.push({
35
+ element: atom.element,
36
+ label: atom.label,
37
+ siteIndex: atom.siteIndex,
38
+ operationIndex: atom.operationIndex,
39
+ position: [
40
+ (m[0]?.[0] ?? 0) * x + (m[0]?.[1] ?? 0) * y + (m[0]?.[2] ?? 0) * z,
41
+ (m[1]?.[0] ?? 0) * x + (m[1]?.[1] ?? 0) * y + (m[1]?.[2] ?? 0) * z,
42
+ (m[2]?.[0] ?? 0) * x + (m[2]?.[1] ?? 0) * y + (m[2]?.[2] ?? 0) * z,
43
+ ],
44
+ occupancy: atom.occupancy,
45
+ disorderGroup: disorderGroupOf(site),
46
+ });
47
+ }
48
+ const bonds = moleculeBonds(order, context);
49
+ for (let local = 0; local < order.length; local++) {
50
+ localOf[order[local] ?? 0] = -1;
51
+ }
52
+ return { atoms: placed, bonds, copies };
53
+ }
54
+ /**
55
+ * The atoms the identity generates first, in site order, then the others by
56
+ * operation and site.
57
+ * @param members - The atoms of the molecule, as indices into the cell.
58
+ * @param context - The cell they are read from.
59
+ * @returns The atoms, as indices into the cell, in molecule order.
60
+ */
61
+ function moleculeOrder(members, context) {
62
+ const { atoms, sites, identityIndex } = context;
63
+ const total = atoms.length;
64
+ const keys = new Float64Array(members.length);
65
+ for (let index = 0; index < members.length; index++) {
66
+ const member = members[index] ?? 0;
67
+ const atom = atoms[member];
68
+ const rank = atom.operationIndex === identityIndex ? 0 : atom.operationIndex + 1;
69
+ keys[index] = (rank * sites.length + atom.siteIndex) * total + member;
70
+ }
71
+ const sorted = keys.toSorted();
72
+ const order = new Int32Array(members.length);
73
+ for (let index = 0; index < sorted.length; index++) {
74
+ order[index] = (sorted[index] ?? 0) % total;
75
+ }
76
+ return order;
77
+ }
78
+ /**
79
+ * The whole cells that put the molecule where the file wrote it.
80
+ * @param order - The atoms of the molecule, in molecule order.
81
+ * @param context - The cell they are read from.
82
+ * @returns The cell translation, in whole cells.
83
+ */
84
+ function placement(order, context) {
85
+ const { atoms, sites, shifts, identityIndex } = context;
86
+ const first = order[0] ?? 0;
87
+ const anchor = atoms[first];
88
+ if (anchor.operationIndex === identityIndex) {
89
+ const site = sites[anchor.siteIndex];
90
+ return [
91
+ Math.round(site.x - (anchor.position[0] + (shifts[first * 3] ?? 0))),
92
+ Math.round(site.y - (anchor.position[1] + (shifts[first * 3 + 1] ?? 0))),
93
+ Math.round(site.z - (anchor.position[2] + (shifts[first * 3 + 2] ?? 0))),
94
+ ];
95
+ }
96
+ const centre = [0, 0, 0];
97
+ for (let local = 0; local < order.length; local++) {
98
+ const index = order[local] ?? 0;
99
+ const position = atoms[index].position;
100
+ for (let axis = 0; axis < 3; axis++) {
101
+ centre[axis] =
102
+ (centre[axis] ?? 0) +
103
+ (position[axis] ?? 0) +
104
+ (shifts[index * 3 + axis] ?? 0);
105
+ }
106
+ }
107
+ return [
108
+ -Math.floor((centre[0] ?? 0) / order.length + CENTRE_TOLERANCE),
109
+ -Math.floor((centre[1] ?? 0) / order.length + CENTRE_TOLERANCE),
110
+ -Math.floor((centre[2] ?? 0) / order.length + CENTRE_TOLERANCE),
111
+ ];
112
+ }
113
+ function moleculeBonds(order, context) {
114
+ const { graph, localOf } = context;
115
+ const bonds = [];
116
+ for (let from = 0; from < order.length; from++) {
117
+ const index = order[from] ?? 0;
118
+ const last = graph.offsets[index + 1] ?? 0;
119
+ for (let bond = graph.offsets[index] ?? 0; bond < last; bond++) {
120
+ const to = localOf[graph.targets[bond] ?? 0] ?? -1;
121
+ if (to > from) {
122
+ bonds.push({ from, to, length: graph.lengths[bond] ?? 0 });
123
+ }
124
+ }
125
+ }
126
+ return bonds.toSorted((a, b) => a.from - b.from || a.to - b.to);
127
+ }
128
+ //# sourceMappingURL=moleculeOf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moleculeOf.js","sourceRoot":"","sources":["../../../src/crystal/core/moleculeOf.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAShD,gFAAgF;AAChF,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAgB9B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAC3B,OAA0B,EAC1B,MAAc,EACd,OAAwB;IAExB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC3D,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAC5B,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QACvB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAiB,CAAC;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAgB,CAAC;QAClD,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,E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CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { BondLimit } from './periodicBonds.ts';
2
+ /** Options of `crystalMolecules`. */
3
+ export interface CrystalMoleculesOptions {
4
+ /**
5
+ * When two atoms are bonded.
6
+ * @default covalentBondLimit
7
+ */
8
+ readonly bondLimit?: BondLimit;
9
+ /**
10
+ * The most atoms one cell may hold. A larger cell is not searched, and the
11
+ * result says so with `tooLarge`.
12
+ * @default 100000
13
+ */
14
+ readonly maxAtoms?: number;
15
+ }
16
+ /** One atom of a molecule. */
17
+ export interface CrystalMoleculeAtom {
18
+ /** Chemical symbol, e.g. `C`. */
19
+ readonly element: string;
20
+ /** The label of the site it is a copy of, e.g. `C12`. */
21
+ readonly label: string;
22
+ /** Index into `structure.sites` of that site. */
23
+ readonly siteIndex: number;
24
+ /** Index into the operation list of the operation that put it here. */
25
+ readonly operationIndex: number;
26
+ /** Cartesian coordinates, in ångström, in the cell's Cartesian frame. */
27
+ readonly position: readonly [number, number, number];
28
+ /** How much of the site the atom occupies, 1 when the file gives none. */
29
+ readonly occupancy: number;
30
+ /** The disorder group of its site, or `null` when it is in none. */
31
+ readonly disorderGroup: string | null;
32
+ }
33
+ /** One bond of a molecule. */
34
+ export interface CrystalMoleculeBond {
35
+ /** Index into the molecule's atoms. */
36
+ readonly from: number;
37
+ /** Index into the molecule's atoms, always above `from`. */
38
+ readonly to: number;
39
+ /** In ångström. */
40
+ readonly length: number;
41
+ }
42
+ /** One crystallographically independent molecule, whole. */
43
+ export interface CrystalMolecule {
44
+ /**
45
+ * Its atoms: the copies the file's own position generates first, in the
46
+ * order the file lists their sites, then those its symmetry completes.
47
+ */
48
+ readonly atoms: readonly CrystalMoleculeAtom[];
49
+ /** Its bonds, ordered on `from` then `to`. */
50
+ readonly bonds: readonly CrystalMoleculeBond[];
51
+ /** How many copies of it one cell holds. */
52
+ readonly copies: number;
53
+ }
54
+ /** A set of atoms bonded to its own translate: a chain, a layer or a framework. */
55
+ export interface CrystalNetwork {
56
+ /** The sites of the asymmetric unit it is built from, ascending. */
57
+ readonly siteIndices: readonly number[];
58
+ /** How many atoms of one cell belong to it, every symmetry copy included. */
59
+ readonly cellAtoms: number;
60
+ /** How many independent directions it extends along: 1, 2 or 3. */
61
+ readonly periodicity: 1 | 2 | 3;
62
+ }
63
+ /** What `crystalMolecules` found. */
64
+ export interface CrystalMolecules {
65
+ /**
66
+ * One per crystallographically independent molecule — a lone ion or atom
67
+ * included — ordered on the first site of the file each holds.
68
+ */
69
+ readonly molecules: readonly CrystalMolecule[];
70
+ /** One per independent network, ordered the same way. */
71
+ readonly networks: readonly CrystalNetwork[];
72
+ /**
73
+ * How many atoms one cell holds, once the disorder left out and the atoms
74
+ * written twice are removed.
75
+ */
76
+ readonly cellAtoms: number;
77
+ /** Whether the cell held more than `maxAtoms` atoms, so nothing was searched. */
78
+ readonly tooLarge: boolean;
79
+ }
80
+ //# sourceMappingURL=moleculeTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moleculeTypes.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/moleculeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,qCAAqC;AACrC,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,8BAA8B;AAC9B,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,yEAAyE;IACzE,QAA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AO,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=moleculeTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moleculeTypes.js","sourceRoot":"","sources":["../../../src/crystal/core/moleculeTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import type { CrystalStructure } from './cif/types.ts';
2
+ import type { CrystalMolecules, CrystalMoleculesOptions } from './moleculeTypes.ts';
3
+ /**
4
+ * Two atoms closer than this, in ångström, are one atom written twice: no
5
+ * bond is that short.
6
+ */
7
+ export declare const SAME_ATOM_DISTANCE = 0.5;
8
+ /**
9
+ * The molecules of a crystal, each whole and once.
10
+ *
11
+ * The asymmetric unit is expanded into the cell, the cell is bonded across its
12
+ * faces by `bondLimit`, and every connected set of atoms is walked. Copies the
13
+ * space group makes of one molecule share the sites they are built from, so
14
+ * they are told apart from an independent molecule by that alone: Z′ = 2 gives
15
+ * two molecules, the four images of a molecule in P2₁/c give one, and a
16
+ * molecule sitting on a special position comes out whole, both halves of it.
17
+ *
18
+ * - **Networks** — a set of atoms bonded to its own translate: a salt, a
19
+ * mineral, a metal, a coordination polymer — are reported in `networks` and
20
+ * never returned as molecules.
21
+ * - **Disorder**: the atoms in no disorder group are kept, and the disorder
22
+ * groups by decreasing mean occupancy, each unless it overlaps one already
23
+ * kept — the major part of each disorder (see `chooseDisorder`). An atom of
24
+ * a negative group, as SHELX writes disorder about a special position, is
25
+ * not bonded to a symmetry copy of an atom in a disorder group, as SHELX
26
+ * itself does.
27
+ * - **Hydrogen** holds one bond, to its nearest neighbour.
28
+ * - **Atoms written twice** — two sites, or two images of one site, closer than
29
+ * {@link SAME_ATOM_DISTANCE} — are one atom: the higher occupancy is kept,
30
+ * the one written first on a tie.
31
+ * @param structure - What `readCif` returned.
32
+ * @param options - Options.
33
+ * @returns The independent molecules, in Cartesian coordinates, and the
34
+ * networks.
35
+ * @throws {Error} When the file names no space group and lists no operation, or its
36
+ * cell has angles no cell can have.
37
+ */
38
+ export declare function crystalMolecules(structure: CrystalStructure, options?: CrystalMoleculesOptions): CrystalMolecules;
39
+ //# sourceMappingURL=molecules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"molecules.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/molecules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAQpE,OAAO,KAAK,EAEV,gBAAgB,EAChB,uBAAuB,EAExB,MAAM,oBAAoB,CAAC;AAY5B;;;GAGG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,gBAAgB,EAC3B,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CA+DlB"}
@@ -0,0 +1,140 @@
1
+ import { keptPairs, writtenTwice } from "./cellBonds.js";
2
+ import { bondGraph, walkComponents } from "./components.js";
3
+ import { covalentBondLimit } from "./covalentRadii.js";
4
+ import { chooseDisorder, isDummy } from "./disorder.js";
5
+ import { expandSite } from "./expand.js";
6
+ import { buildMolecule } from "./moleculeOf.js";
7
+ import { structureOperations } from "./operations.js";
8
+ import { findPeriodicBonds } from "./periodicBonds.js";
9
+ import { createLattice } from "./symmetry/lattice.js";
10
+ import { isIdentity } from "./symmetry/operation.js";
11
+ import { representative, siteIndicesOf, symmetryClasses, } from "./symmetryClasses.js";
12
+ /**
13
+ * Two atoms closer than this, in ångström, are one atom written twice: no
14
+ * bond is that short.
15
+ */
16
+ export const SAME_ATOM_DISTANCE = 0.5;
17
+ /**
18
+ * The molecules of a crystal, each whole and once.
19
+ *
20
+ * The asymmetric unit is expanded into the cell, the cell is bonded across its
21
+ * faces by `bondLimit`, and every connected set of atoms is walked. Copies the
22
+ * space group makes of one molecule share the sites they are built from, so
23
+ * they are told apart from an independent molecule by that alone: Z′ = 2 gives
24
+ * two molecules, the four images of a molecule in P2₁/c give one, and a
25
+ * molecule sitting on a special position comes out whole, both halves of it.
26
+ *
27
+ * - **Networks** — a set of atoms bonded to its own translate: a salt, a
28
+ * mineral, a metal, a coordination polymer — are reported in `networks` and
29
+ * never returned as molecules.
30
+ * - **Disorder**: the atoms in no disorder group are kept, and the disorder
31
+ * groups by decreasing mean occupancy, each unless it overlaps one already
32
+ * kept — the major part of each disorder (see `chooseDisorder`). An atom of
33
+ * a negative group, as SHELX writes disorder about a special position, is
34
+ * not bonded to a symmetry copy of an atom in a disorder group, as SHELX
35
+ * itself does.
36
+ * - **Hydrogen** holds one bond, to its nearest neighbour.
37
+ * - **Atoms written twice** — two sites, or two images of one site, closer than
38
+ * {@link SAME_ATOM_DISTANCE} — are one atom: the higher occupancy is kept,
39
+ * the one written first on a tie.
40
+ * @param structure - What `readCif` returned.
41
+ * @param options - Options.
42
+ * @returns The independent molecules, in Cartesian coordinates, and the
43
+ * networks.
44
+ * @throws {Error} When the file names no space group and lists no operation, or its
45
+ * cell has angles no cell can have.
46
+ */
47
+ export function crystalMolecules(structure, options = {}) {
48
+ const { bondLimit = covalentBondLimit, maxAtoms = 100_000 } = options;
49
+ const operations = structureOperations(structure);
50
+ const lattice = createLattice(structure.cell);
51
+ const { sites } = structure;
52
+ const expanded = expandSites(sites, operations, maxAtoms);
53
+ if (expanded.count > maxAtoms) {
54
+ return {
55
+ molecules: [],
56
+ networks: [],
57
+ cellAtoms: expanded.count,
58
+ tooLarge: true,
59
+ };
60
+ }
61
+ const kept = chooseDisorder(sites, expanded.atoms, lattice);
62
+ const atoms = [];
63
+ for (const atom of expanded.atoms) {
64
+ if (kept[atom.siteIndex] === 1)
65
+ atoms.push(atom);
66
+ }
67
+ const pairs = findPeriodicBonds(atoms, lattice, bondLimit, {
68
+ samePlace: SAME_ATOM_DISTANCE,
69
+ });
70
+ const removed = writtenTwice(atoms, pairs.coincident);
71
+ const graph = bondGraph(atoms.length, pairs, keptPairs(pairs, atoms, sites, removed));
72
+ const { components, shifts } = walkComponents(graph, removed);
73
+ const context = {
74
+ atoms,
75
+ sites,
76
+ graph,
77
+ shifts,
78
+ lattice,
79
+ identityIndex: identityIndexOf(operations),
80
+ localOf: new Int32Array(atoms.length).fill(-1),
81
+ };
82
+ const molecules = [];
83
+ const networks = [];
84
+ for (const members of symmetryClasses(components, atoms, sites.length)) {
85
+ let periodicity = 0;
86
+ let cellAtoms = 0;
87
+ for (const component of members) {
88
+ periodicity = Math.max(periodicity, component.periodicity);
89
+ cellAtoms += component.atoms.length;
90
+ }
91
+ if (periodicity > 0) {
92
+ networks.push({
93
+ siteIndices: siteIndicesOf(members, atoms),
94
+ cellAtoms,
95
+ periodicity: periodicity,
96
+ });
97
+ }
98
+ else {
99
+ const chosen = representative(members, atoms, context.identityIndex);
100
+ molecules.push(buildMolecule(chosen.atoms, members.length, context));
101
+ }
102
+ }
103
+ let cellAtoms = atoms.length;
104
+ for (let index = 0; index < removed.length; index++) {
105
+ cellAtoms -= removed[index] ?? 0;
106
+ }
107
+ return { molecules, networks, cellAtoms, tooLarge: false };
108
+ }
109
+ /**
110
+ * Every atom of the cell the sites that are not dummies make, counted past the cap.
111
+ * @param sites - The asymmetric unit.
112
+ * @param operations - The full coset list.
113
+ * @param maxAtoms - The most atoms kept.
114
+ * @returns The atoms, and how many the cell holds.
115
+ */
116
+ function expandSites(sites, operations, maxAtoms) {
117
+ const atoms = [];
118
+ let count = 0;
119
+ for (let index = 0; index < sites.length; index++) {
120
+ const site = sites[index];
121
+ if (isDummy(site))
122
+ continue;
123
+ const images = expandSite(site, index, operations);
124
+ count += images.length;
125
+ if (count > maxAtoms)
126
+ continue;
127
+ for (let image = 0; image < images.length; image++) {
128
+ atoms.push(images[image]);
129
+ }
130
+ }
131
+ return { atoms, count };
132
+ }
133
+ function identityIndexOf(operations) {
134
+ for (let index = 0; index < operations.length; index++) {
135
+ if (isIdentity(operations[index]))
136
+ return index;
137
+ }
138
+ return -1;
139
+ }
140
+ //# sourceMappingURL=molec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B,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAgB,CAAC;QACzC,IAAI,OAAO,CAAC,IAAI,CAAC;YAAE,SAAS;QAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;QACnD,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;QACvB,IAAI,KAAK,GAAG,QAAQ;YAAE,SAAS;QAC/B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAiB,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,eAAe,CACtB,UAA8C;IAE9C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACvD,IAAI,UAAU,CAAC,UAAU,CAAC,KAAK,CAAwB,CAAC;YAAE,OAAO,KAAK,CAAC;IACzE,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { CrystalStructure } from './cif/types.ts';
2
+ import type { CrystalOperation } from './symmetry/types.ts';
3
+ /**
4
+ * The full coset list a structure's asymmetric unit is expanded with.
5
+ *
6
+ * The file's own operations come first, in file order, so an atom's
7
+ * `operationIndex` points at the line of the file that made it. A file that
8
+ * lists only part of the group — one coset of a centred group, or a few
9
+ * generators — is completed: from the setting its symbol names when every
10
+ * listed operation belongs to it, else by composing the listed ones. A file
11
+ * that lists none, or one that cannot be read, is expanded with the setting its
12
+ * Hall symbol, Hermann–Mauguin symbol or number names.
13
+ * @param structure - What `readCif` returned.
14
+ * @returns The operations, the identity among them.
15
+ * @throws {Error} When no listed operation can be used and the file names no space
16
+ * group the catalogue knows.
17
+ */
18
+ export declare function structureOperations(structure: CrystalStructure): ReadonlyArray<CrystalOperation<3>>;
19
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,gBAAgB,GAC1B,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CA0BpC"}