react-cheminfo 0.134.1 → 0.136.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 (454) 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/cellAtoms.d.ts +43 -0
  7. package/lib/crystal/core/cellAtoms.d.ts.map +1 -0
  8. package/lib/crystal/core/cellAtoms.js +70 -0
  9. package/lib/crystal/core/cellAtoms.js.map +1 -0
  10. package/lib/crystal/core/cellBonds.d.ts +21 -0
  11. package/lib/crystal/core/cellBonds.d.ts.map +1 -0
  12. package/lib/crystal/core/cellBonds.js +100 -0
  13. package/lib/crystal/core/cellBonds.js.map +1 -0
  14. package/lib/crystal/core/cif/element.d.ts +9 -0
  15. package/lib/crystal/core/cif/element.d.ts.map +1 -0
  16. package/lib/crystal/core/cif/element.js +41 -0
  17. package/lib/crystal/core/cif/element.js.map +1 -0
  18. package/lib/crystal/core/cif/index.d.ts +4 -0
  19. package/lib/crystal/core/cif/index.d.ts.map +1 -0
  20. package/lib/crystal/core/cif/index.js +3 -0
  21. package/lib/crystal/core/cif/index.js.map +1 -0
  22. package/lib/crystal/core/cif/number.d.ts +27 -0
  23. package/lib/crystal/core/cif/number.d.ts.map +1 -0
  24. package/lib/crystal/core/cif/number.js +57 -0
  25. package/lib/crystal/core/cif/number.js.map +1 -0
  26. package/lib/crystal/core/cif/read.d.ts +12 -0
  27. package/lib/crystal/core/cif/read.d.ts.map +1 -0
  28. package/lib/crystal/core/cif/read.js +183 -0
  29. package/lib/crystal/core/cif/read.js.map +1 -0
  30. package/lib/crystal/core/cif/readGeometry.d.ts +17 -0
  31. package/lib/crystal/core/cif/readGeometry.d.ts.map +1 -0
  32. package/lib/crystal/core/cif/readGeometry.js +93 -0
  33. package/lib/crystal/core/cif/readGeometry.js.map +1 -0
  34. package/lib/crystal/core/cif/tags.d.ts +62 -0
  35. package/lib/crystal/core/cif/tags.d.ts.map +1 -0
  36. package/lib/crystal/core/cif/tags.js +115 -0
  37. package/lib/crystal/core/cif/tags.js.map +1 -0
  38. package/lib/crystal/core/cif/types.d.ts +158 -0
  39. package/lib/crystal/core/cif/types.d.ts.map +1 -0
  40. package/lib/crystal/core/cif/types.js +2 -0
  41. package/lib/crystal/core/cif/types.js.map +1 -0
  42. package/lib/crystal/core/components.d.ts +56 -0
  43. package/lib/crystal/core/components.d.ts.map +1 -0
  44. package/lib/crystal/core/components.js +132 -0
  45. package/lib/crystal/core/components.js.map +1 -0
  46. package/lib/crystal/core/covalentRadii.d.ts +24 -0
  47. package/lib/crystal/core/covalentRadii.d.ts.map +1 -0
  48. package/lib/crystal/core/covalentRadii.js +55 -0
  49. package/lib/crystal/core/covalentRadii.js.map +1 -0
  50. package/lib/crystal/core/disorder.d.ts +59 -0
  51. package/lib/crystal/core/disorder.d.ts.map +1 -0
  52. package/lib/crystal/core/disorder.js +168 -0
  53. package/lib/crystal/core/disorder.js.map +1 -0
  54. package/lib/crystal/core/expand.d.ts +62 -0
  55. package/lib/crystal/core/expand.d.ts.map +1 -0
  56. package/lib/crystal/core/expand.js +61 -0
  57. package/lib/crystal/core/expand.js.map +1 -0
  58. package/lib/crystal/core/index.d.ts +20 -0
  59. package/lib/crystal/core/index.d.ts.map +1 -0
  60. package/lib/crystal/core/index.js +13 -0
  61. package/lib/crystal/core/index.js.map +1 -0
  62. package/lib/crystal/core/moleculeOf.d.ts +31 -0
  63. package/lib/crystal/core/moleculeOf.d.ts.map +1 -0
  64. package/lib/crystal/core/moleculeOf.js +128 -0
  65. package/lib/crystal/core/moleculeOf.js.map +1 -0
  66. package/lib/crystal/core/moleculeTypes.d.ts +80 -0
  67. package/lib/crystal/core/moleculeTypes.d.ts.map +1 -0
  68. package/lib/crystal/core/moleculeTypes.js +2 -0
  69. package/lib/crystal/core/moleculeTypes.js.map +1 -0
  70. package/lib/crystal/core/molecules.d.ts +39 -0
  71. package/lib/crystal/core/molecules.d.ts.map +1 -0
  72. package/lib/crystal/core/molecules.js +106 -0
  73. package/lib/crystal/core/molecules.js.map +1 -0
  74. package/lib/crystal/core/operations.d.ts +19 -0
  75. package/lib/crystal/core/operations.d.ts.map +1 -0
  76. package/lib/crystal/core/operations.js +68 -0
  77. package/lib/crystal/core/operations.js.map +1 -0
  78. package/lib/crystal/core/packing.d.ts +43 -0
  79. package/lib/crystal/core/packing.d.ts.map +1 -0
  80. package/lib/crystal/core/packing.js +89 -0
  81. package/lib/crystal/core/packing.js.map +1 -0
  82. package/lib/crystal/core/periodicBonds.d.ts +57 -0
  83. package/lib/crystal/core/periodicBonds.d.ts.map +1 -0
  84. package/lib/crystal/core/periodicBonds.js +167 -0
  85. package/lib/crystal/core/periodicBonds.js.map +1 -0
  86. package/lib/crystal/core/resolve.d.ts +61 -0
  87. package/lib/crystal/core/resolve.d.ts.map +1 -0
  88. package/lib/crystal/core/resolve.js +149 -0
  89. package/lib/crystal/core/resolve.js.map +1 -0
  90. package/lib/crystal/core/spaceGroups/index.d.ts +5 -0
  91. package/lib/crystal/core/spaceGroups/index.d.ts.map +1 -0
  92. package/lib/crystal/core/spaceGroups/index.js +4 -0
  93. package/lib/crystal/core/spaceGroups/index.js.map +1 -0
  94. package/lib/crystal/core/spaceGroups/spaceGroupOperations.d.ts +14 -0
  95. package/lib/crystal/core/spaceGroups/spaceGroupOperations.d.ts.map +1 -0
  96. package/lib/crystal/core/spaceGroups/spaceGroupOperations.js +24 -0
  97. package/lib/crystal/core/spaceGroups/spaceGroupOperations.js.map +1 -0
  98. package/lib/crystal/core/spaceGroups/spaceGroupRows.d.ts +3 -0
  99. package/lib/crystal/core/spaceGroups/spaceGroupRows.d.ts.map +1 -0
  100. package/lib/crystal/core/spaceGroups/spaceGroupRows.js +536 -0
  101. package/lib/crystal/core/spaceGroups/spaceGroupRows.js.map +1 -0
  102. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.d.ts +43 -0
  103. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.d.ts.map +1 -0
  104. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.js +169 -0
  105. package/lib/crystal/core/spaceGroups/spaceGroupSymbols.js.map +1 -0
  106. package/lib/crystal/core/spaceGroups/spaceGroups.d.ts +78 -0
  107. package/lib/crystal/core/spaceGroups/spaceGroups.d.ts.map +1 -0
  108. package/lib/crystal/core/spaceGroups/spaceGroups.js +83 -0
  109. package/lib/crystal/core/spaceGroups/spaceGroups.js.map +1 -0
  110. package/lib/crystal/core/symmetry/group.d.ts +15 -0
  111. package/lib/crystal/core/symmetry/group.d.ts.map +1 -0
  112. package/lib/crystal/core/symmetry/group.js +37 -0
  113. package/lib/crystal/core/symmetry/group.js.map +1 -0
  114. package/lib/crystal/core/symmetry/index.d.ts +8 -0
  115. package/lib/crystal/core/symmetry/index.d.ts.map +1 -0
  116. package/lib/crystal/core/symmetry/index.js +6 -0
  117. package/lib/crystal/core/symmetry/index.js.map +1 -0
  118. package/lib/crystal/core/symmetry/integerMatrix.d.ts +45 -0
  119. package/lib/crystal/core/symmetry/integerMatrix.d.ts.map +1 -0
  120. package/lib/crystal/core/symmetry/integerMatrix.js +139 -0
  121. package/lib/crystal/core/symmetry/integerMatrix.js.map +1 -0
  122. package/lib/crystal/core/symmetry/lattice.d.ts +64 -0
  123. package/lib/crystal/core/symmetry/lattice.d.ts.map +1 -0
  124. package/lib/crystal/core/symmetry/lattice.js +113 -0
  125. package/lib/crystal/core/symmetry/lattice.js.map +1 -0
  126. package/lib/crystal/core/symmetry/operation.d.ts +91 -0
  127. package/lib/crystal/core/symmetry/operation.d.ts.map +1 -0
  128. package/lib/crystal/core/symmetry/operation.js +184 -0
  129. package/lib/crystal/core/symmetry/operation.js.map +1 -0
  130. package/lib/crystal/core/symmetry/parseOperation.d.ts +18 -0
  131. package/lib/crystal/core/symmetry/parseOperation.d.ts.map +1 -0
  132. package/lib/crystal/core/symmetry/parseOperation.js +145 -0
  133. package/lib/crystal/core/symmetry/parseOperation.js.map +1 -0
  134. package/lib/crystal/core/symmetry/types.d.ts +29 -0
  135. package/lib/crystal/core/symmetry/types.d.ts.map +1 -0
  136. package/lib/crystal/core/symmetry/types.js +5 -0
  137. package/lib/crystal/core/symmetry/types.js.map +1 -0
  138. package/lib/crystal/core/symmetryClasses.d.ts +28 -0
  139. package/lib/crystal/core/symmetryClasses.d.ts.map +1 -0
  140. package/lib/crystal/core/symmetryClasses.js +93 -0
  141. package/lib/crystal/core/symmetryClasses.js.map +1 -0
  142. package/lib/crystal.d.ts +12 -0
  143. package/lib/crystal.d.ts.map +1 -0
  144. package/lib/crystal.js +12 -0
  145. package/lib/crystal.js.map +1 -0
  146. package/lib/crystal3d/core/cellClip.d.ts +46 -0
  147. package/lib/crystal3d/core/cellClip.d.ts.map +1 -0
  148. package/lib/crystal3d/core/cellClip.js +198 -0
  149. package/lib/crystal3d/core/cellClip.js.map +1 -0
  150. package/lib/crystal3d/core/cellGeometry.d.ts +63 -0
  151. package/lib/crystal3d/core/cellGeometry.d.ts.map +1 -0
  152. package/lib/crystal3d/core/cellGeometry.js +153 -0
  153. package/lib/crystal3d/core/cellGeometry.js.map +1 -0
  154. package/lib/crystal3d/core/cellStack.d.ts +51 -0
  155. package/lib/crystal3d/core/cellStack.d.ts.map +1 -0
  156. package/lib/crystal3d/core/cellStack.js +79 -0
  157. package/lib/crystal3d/core/cellStack.js.map +1 -0
  158. package/lib/crystal3d/core/crystalView.d.ts +71 -0
  159. package/lib/crystal3d/core/crystalView.d.ts.map +1 -0
  160. package/lib/crystal3d/core/crystalView.js +48 -0
  161. package/lib/crystal3d/core/crystalView.js.map +1 -0
  162. package/lib/crystal3d/core/drawingSet.d.ts +31 -0
  163. package/lib/crystal3d/core/drawingSet.d.ts.map +1 -0
  164. package/lib/crystal3d/core/drawingSet.js +63 -0
  165. package/lib/crystal3d/core/drawingSet.js.map +1 -0
  166. package/lib/crystal3d/core/elementDrawing.d.ts +50 -0
  167. package/lib/crystal3d/core/elementDrawing.d.ts.map +1 -0
  168. package/lib/crystal3d/core/elementDrawing.js +100 -0
  169. package/lib/crystal3d/core/elementDrawing.js.map +1 -0
  170. package/lib/crystal3d/core/elementExtent.d.ts +42 -0
  171. package/lib/crystal3d/core/elementExtent.d.ts.map +1 -0
  172. package/lib/crystal3d/core/elementExtent.js +56 -0
  173. package/lib/crystal3d/core/elementExtent.js.map +1 -0
  174. package/lib/crystal3d/core/elementLabels.d.ts +31 -0
  175. package/lib/crystal3d/core/elementLabels.d.ts.map +1 -0
  176. package/lib/crystal3d/core/elementLabels.js +99 -0
  177. package/lib/crystal3d/core/elementLabels.js.map +1 -0
  178. package/lib/crystal3d/core/elementShapes.d.ts +43 -0
  179. package/lib/crystal3d/core/elementShapes.d.ts.map +1 -0
  180. package/lib/crystal3d/core/elementShapes.js +115 -0
  181. package/lib/crystal3d/core/elementShapes.js.map +1 -0
  182. package/lib/crystal3d/core/frame.d.ts +36 -0
  183. package/lib/crystal3d/core/frame.d.ts.map +1 -0
  184. package/lib/crystal3d/core/frame.js +35 -0
  185. package/lib/crystal3d/core/frame.js.map +1 -0
  186. package/lib/crystal3d/core/framing.d.ts +41 -0
  187. package/lib/crystal3d/core/framing.d.ts.map +1 -0
  188. package/lib/crystal3d/core/framing.js +79 -0
  189. package/lib/crystal3d/core/framing.js.map +1 -0
  190. package/lib/crystal3d/core/index.d.ts +42 -0
  191. package/lib/crystal3d/core/index.d.ts.map +1 -0
  192. package/lib/crystal3d/core/index.js +29 -0
  193. package/lib/crystal3d/core/index.js.map +1 -0
  194. package/lib/crystal3d/core/labelText.d.ts +19 -0
  195. package/lib/crystal3d/core/labelText.d.ts.map +1 -0
  196. package/lib/crystal3d/core/labelText.js +42 -0
  197. package/lib/crystal3d/core/labelText.js.map +1 -0
  198. package/lib/crystal3d/core/latticeBasis.d.ts +49 -0
  199. package/lib/crystal3d/core/latticeBasis.d.ts.map +1 -0
  200. package/lib/crystal3d/core/latticeBasis.js +89 -0
  201. package/lib/crystal3d/core/latticeBasis.js.map +1 -0
  202. package/lib/crystal3d/core/mat3.d.ts +68 -0
  203. package/lib/crystal3d/core/mat3.d.ts.map +1 -0
  204. package/lib/crystal3d/core/mat3.js +146 -0
  205. package/lib/crystal3d/core/mat3.js.map +1 -0
  206. package/lib/crystal3d/core/operationMatrix.d.ts +44 -0
  207. package/lib/crystal3d/core/operationMatrix.d.ts.map +1 -0
  208. package/lib/crystal3d/core/operationMatrix.js +172 -0
  209. package/lib/crystal3d/core/operationMatrix.js.map +1 -0
  210. package/lib/crystal3d/core/orientation.d.ts +62 -0
  211. package/lib/crystal3d/core/orientation.d.ts.map +1 -0
  212. package/lib/crystal3d/core/orientation.js +166 -0
  213. package/lib/crystal3d/core/orientation.js.map +1 -0
  214. package/lib/crystal3d/core/palette.d.ts +24 -0
  215. package/lib/crystal3d/core/palette.d.ts.map +1 -0
  216. package/lib/crystal3d/core/palette.js +34 -0
  217. package/lib/crystal3d/core/palette.js.map +1 -0
  218. package/lib/crystal3d/core/primitives.d.ts +133 -0
  219. package/lib/crystal3d/core/primitives.d.ts.map +1 -0
  220. package/lib/crystal3d/core/primitives.js +80 -0
  221. package/lib/crystal3d/core/primitives.js.map +1 -0
  222. package/lib/crystal3d/core/structureText.d.ts +20 -0
  223. package/lib/crystal3d/core/structureText.d.ts.map +1 -0
  224. package/lib/crystal3d/core/structureText.js +37 -0
  225. package/lib/crystal3d/core/structureText.js.map +1 -0
  226. package/lib/crystal3d/core/supercell.d.ts +20 -0
  227. package/lib/crystal3d/core/supercell.d.ts.map +1 -0
  228. package/lib/crystal3d/core/supercell.js +35 -0
  229. package/lib/crystal3d/core/supercell.js.map +1 -0
  230. package/lib/crystal3d/core/types.d.ts +166 -0
  231. package/lib/crystal3d/core/types.d.ts.map +1 -0
  232. package/lib/crystal3d/core/types.js +10 -0
  233. package/lib/crystal3d/core/types.js.map +1 -0
  234. package/lib/crystal3d/core/vec3.d.ts +75 -0
  235. package/lib/crystal3d/core/vec3.d.ts.map +1 -0
  236. package/lib/crystal3d/core/vec3.js +119 -0
  237. package/lib/crystal3d/core/vec3.js.map +1 -0
  238. package/lib/crystal3d/ui/CrystalCanvas3D.d.ts +52 -0
  239. package/lib/crystal3d/ui/CrystalCanvas3D.d.ts.map +1 -0
  240. package/lib/crystal3d/ui/CrystalCanvas3D.js +242 -0
  241. package/lib/crystal3d/ui/CrystalCanvas3D.js.map +1 -0
  242. package/lib/crystal3d/ui/CrystalStructureView.d.ts +17 -0
  243. package/lib/crystal3d/ui/CrystalStructureView.d.ts.map +1 -0
  244. package/lib/crystal3d/ui/CrystalStructureView.js +76 -0
  245. package/lib/crystal3d/ui/CrystalStructureView.js.map +1 -0
  246. package/lib/crystal3d/ui/CrystalStructureViewer.d.ts +22 -0
  247. package/lib/crystal3d/ui/CrystalStructureViewer.d.ts.map +1 -0
  248. package/lib/crystal3d/ui/CrystalStructureViewer.js +29 -0
  249. package/lib/crystal3d/ui/CrystalStructureViewer.js.map +1 -0
  250. package/lib/crystal3d/ui/CrystalViewControls.d.ts +25 -0
  251. package/lib/crystal3d/ui/CrystalViewControls.d.ts.map +1 -0
  252. package/lib/crystal3d/ui/CrystalViewControls.js +22 -0
  253. package/lib/crystal3d/ui/CrystalViewControls.js.map +1 -0
  254. package/lib/crystal3d/ui/CrystalViewer3D.d.ts +72 -0
  255. package/lib/crystal3d/ui/CrystalViewer3D.d.ts.map +1 -0
  256. package/lib/crystal3d/ui/CrystalViewer3D.js +70 -0
  257. package/lib/crystal3d/ui/CrystalViewer3D.js.map +1 -0
  258. package/lib/crystal3d/ui/crystalScene.d.ts +91 -0
  259. package/lib/crystal3d/ui/crystalScene.d.ts.map +1 -0
  260. package/lib/crystal3d/ui/crystalScene.js +10 -0
  261. package/lib/crystal3d/ui/crystalScene.js.map +1 -0
  262. package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts +52 -0
  263. package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts.map +1 -0
  264. package/lib/crystal3d/ui/crystalStructureViewerProps.js +2 -0
  265. package/lib/crystal3d/ui/crystalStructureViewerProps.js.map +1 -0
  266. package/lib/crystal3d/ui/index.d.ts +16 -0
  267. package/lib/crystal3d/ui/index.d.ts.map +1 -0
  268. package/lib/crystal3d/ui/index.js +12 -0
  269. package/lib/crystal3d/ui/index.js.map +1 -0
  270. package/lib/crystal3d/ui/useCrystalCaption.d.ts +14 -0
  271. package/lib/crystal3d/ui/useCrystalCaption.d.ts.map +1 -0
  272. package/lib/crystal3d/ui/useCrystalCaption.js +32 -0
  273. package/lib/crystal3d/ui/useCrystalCaption.js.map +1 -0
  274. package/lib/crystal3d/viewer/animate.d.ts +49 -0
  275. package/lib/crystal3d/viewer/animate.d.ts.map +1 -0
  276. package/lib/crystal3d/viewer/animate.js +83 -0
  277. package/lib/crystal3d/viewer/animate.js.map +1 -0
  278. package/lib/crystal3d/viewer/camera.d.ts +44 -0
  279. package/lib/crystal3d/viewer/camera.d.ts.map +1 -0
  280. package/lib/crystal3d/viewer/camera.js +103 -0
  281. package/lib/crystal3d/viewer/camera.js.map +1 -0
  282. package/lib/crystal3d/viewer/index.d.ts +13 -0
  283. package/lib/crystal3d/viewer/index.d.ts.map +1 -0
  284. package/lib/crystal3d/viewer/index.js +8 -0
  285. package/lib/crystal3d/viewer/index.js.map +1 -0
  286. package/lib/crystal3d/viewer/layerRegistry.d.ts +24 -0
  287. package/lib/crystal3d/viewer/layerRegistry.d.ts.map +1 -0
  288. package/lib/crystal3d/viewer/layerRegistry.js +39 -0
  289. package/lib/crystal3d/viewer/layerRegistry.js.map +1 -0
  290. package/lib/crystal3d/viewer/meshPrimitives.d.ts +13 -0
  291. package/lib/crystal3d/viewer/meshPrimitives.d.ts.map +1 -0
  292. package/lib/crystal3d/viewer/meshPrimitives.js +76 -0
  293. package/lib/crystal3d/viewer/meshPrimitives.js.map +1 -0
  294. package/lib/crystal3d/viewer/plugin.d.ts +133 -0
  295. package/lib/crystal3d/viewer/plugin.d.ts.map +1 -0
  296. package/lib/crystal3d/viewer/plugin.js +181 -0
  297. package/lib/crystal3d/viewer/plugin.js.map +1 -0
  298. package/lib/crystal3d/viewer/renderCell.d.ts +43 -0
  299. package/lib/crystal3d/viewer/renderCell.d.ts.map +1 -0
  300. package/lib/crystal3d/viewer/renderCell.js +53 -0
  301. package/lib/crystal3d/viewer/renderCell.js.map +1 -0
  302. package/lib/crystal3d/viewer/renderElements.d.ts +54 -0
  303. package/lib/crystal3d/viewer/renderElements.d.ts.map +1 -0
  304. package/lib/crystal3d/viewer/renderElements.js +77 -0
  305. package/lib/crystal3d/viewer/renderElements.js.map +1 -0
  306. package/lib/crystal3d/viewer/renderStructure.d.ts +55 -0
  307. package/lib/crystal3d/viewer/renderStructure.d.ts.map +1 -0
  308. package/lib/crystal3d/viewer/renderStructure.js +103 -0
  309. package/lib/crystal3d/viewer/renderStructure.js.map +1 -0
  310. package/lib/crystal3d/viewer/sceneParts.d.ts +32 -0
  311. package/lib/crystal3d/viewer/sceneParts.d.ts.map +1 -0
  312. package/lib/crystal3d/viewer/sceneParts.js +77 -0
  313. package/lib/crystal3d/viewer/sceneParts.js.map +1 -0
  314. package/lib/crystal3d/viewer/shapeLayer.d.ts +41 -0
  315. package/lib/crystal3d/viewer/shapeLayer.d.ts.map +1 -0
  316. package/lib/crystal3d/viewer/shapeLayer.js +57 -0
  317. package/lib/crystal3d/viewer/shapeLayer.js.map +1 -0
  318. package/lib/crystal3d/viewer/textLayer.d.ts +21 -0
  319. package/lib/crystal3d/viewer/textLayer.d.ts.map +1 -0
  320. package/lib/crystal3d/viewer/textLayer.js +59 -0
  321. package/lib/crystal3d/viewer/textLayer.js.map +1 -0
  322. package/lib/crystal3d/viewer/viewer.d.ts +110 -0
  323. package/lib/crystal3d/viewer/viewer.d.ts.map +1 -0
  324. package/lib/crystal3d/viewer/viewer.js +157 -0
  325. package/lib/crystal3d/viewer/viewer.js.map +1 -0
  326. package/lib/crystal3d.d.ts +12 -0
  327. package/lib/crystal3d.d.ts.map +1 -0
  328. package/lib/crystal3d.js +12 -0
  329. package/lib/crystal3d.js.map +1 -0
  330. package/lib/i18n/core/chromeCatalog.d.ts +1 -1
  331. package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
  332. package/lib/locales/de.json +19 -1
  333. package/lib/locales/en.json +19 -1
  334. package/lib/locales/es.json +19 -1
  335. package/lib/locales/fr.json +19 -1
  336. package/lib/locales/it.json +19 -1
  337. package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
  338. package/lib/molecule3d/ui/MoleculeCanvas3D.js +16 -27
  339. package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
  340. package/lib/molstar/bonds/bondRule.d.ts +16 -0
  341. package/lib/molstar/bonds/bondRule.d.ts.map +1 -0
  342. package/lib/molstar/bonds/bondRule.js +23 -0
  343. package/lib/molstar/bonds/bondRule.js.map +1 -0
  344. package/lib/molstar/bonds/index.d.ts +9 -0
  345. package/lib/molstar/bonds/index.d.ts.map +1 -0
  346. package/lib/molstar/bonds/index.js +9 -0
  347. package/lib/molstar/bonds/index.js.map +1 -0
  348. package/lib/molstar/ui/MolstarToolbar.d.ts +47 -0
  349. package/lib/molstar/ui/MolstarToolbar.d.ts.map +1 -0
  350. package/lib/molstar/ui/MolstarToolbar.js +28 -0
  351. package/lib/molstar/ui/MolstarToolbar.js.map +1 -0
  352. package/lib/molstar/ui/index.d.ts +10 -0
  353. package/lib/molstar/ui/index.d.ts.map +1 -0
  354. package/lib/molstar/ui/index.js +8 -0
  355. package/lib/molstar/ui/index.js.map +1 -0
  356. package/lib/molstar/ui/useMolstarTools.d.ts +63 -0
  357. package/lib/molstar/ui/useMolstarTools.d.ts.map +1 -0
  358. package/lib/molstar/ui/useMolstarTools.js +36 -0
  359. package/lib/molstar/ui/useMolstarTools.js.map +1 -0
  360. package/package.json +4 -1
  361. package/src/crystal/core/bondGrid.ts +98 -0
  362. package/src/crystal/core/cellAtoms.ts +106 -0
  363. package/src/crystal/core/cellBonds.ts +121 -0
  364. package/src/crystal/core/cif/element.ts +40 -0
  365. package/src/crystal/core/cif/index.ts +12 -0
  366. package/src/crystal/core/cif/number.ts +62 -0
  367. package/src/crystal/core/cif/read.ts +218 -0
  368. package/src/crystal/core/cif/readGeometry.ts +104 -0
  369. package/src/crystal/core/cif/tags.ts +143 -0
  370. package/src/crystal/core/cif/types.ts +164 -0
  371. package/src/crystal/core/components.ts +183 -0
  372. package/src/crystal/core/covalentRadii.ts +56 -0
  373. package/src/crystal/core/disorder.ts +190 -0
  374. package/src/crystal/core/expand.ts +105 -0
  375. package/src/crystal/core/index.ts +46 -0
  376. package/src/crystal/core/moleculeOf.ts +169 -0
  377. package/src/crystal/core/moleculeTypes.ts +85 -0
  378. package/src/crystal/core/molecules.ts +128 -0
  379. package/src/crystal/core/operations.ts +79 -0
  380. package/src/crystal/core/packing.ts +116 -0
  381. package/src/crystal/core/periodicBonds.ts +234 -0
  382. package/src/crystal/core/resolve.ts +187 -0
  383. package/src/crystal/core/spaceGroups/index.ts +16 -0
  384. package/src/crystal/core/spaceGroups/spaceGroupOperations.ts +32 -0
  385. package/src/crystal/core/spaceGroups/spaceGroupRows.ts +536 -0
  386. package/src/crystal/core/spaceGroups/spaceGroupSymbols.ts +179 -0
  387. package/src/crystal/core/spaceGroups/spaceGroups.ts +154 -0
  388. package/src/crystal/core/symmetry/group.ts +42 -0
  389. package/src/crystal/core/symmetry/index.ts +23 -0
  390. package/src/crystal/core/symmetry/integerMatrix.ts +153 -0
  391. package/src/crystal/core/symmetry/lattice.ts +152 -0
  392. package/src/crystal/core/symmetry/operation.ts +223 -0
  393. package/src/crystal/core/symmetry/parseOperation.ts +180 -0
  394. package/src/crystal/core/symmetry/types.ts +32 -0
  395. package/src/crystal/core/symmetryClasses.ts +105 -0
  396. package/src/crystal.ts +12 -0
  397. package/src/crystal3d/core/cellClip.ts +229 -0
  398. package/src/crystal3d/core/cellGeometry.ts +193 -0
  399. package/src/crystal3d/core/cellStack.ts +87 -0
  400. package/src/crystal3d/core/crystalView.ts +114 -0
  401. package/src/crystal3d/core/drawingSet.ts +71 -0
  402. package/src/crystal3d/core/elementDrawing.ts +147 -0
  403. package/src/crystal3d/core/elementExtent.ts +81 -0
  404. package/src/crystal3d/core/elementLabels.ts +130 -0
  405. package/src/crystal3d/core/elementShapes.ts +141 -0
  406. package/src/crystal3d/core/frame.ts +56 -0
  407. package/src/crystal3d/core/framing.ts +101 -0
  408. package/src/crystal3d/core/index.ts +132 -0
  409. package/src/crystal3d/core/labelText.ts +44 -0
  410. package/src/crystal3d/core/latticeBasis.ts +110 -0
  411. package/src/crystal3d/core/mat3.ts +163 -0
  412. package/src/crystal3d/core/operationMatrix.ts +255 -0
  413. package/src/crystal3d/core/orientation.ts +229 -0
  414. package/src/crystal3d/core/palette.ts +43 -0
  415. package/src/crystal3d/core/primitives.ts +183 -0
  416. package/src/crystal3d/core/structureText.ts +43 -0
  417. package/src/crystal3d/core/supercell.ts +40 -0
  418. package/src/crystal3d/core/types.ts +186 -0
  419. package/src/crystal3d/core/vec3.ts +127 -0
  420. package/src/crystal3d/ui/CrystalCanvas3D.tsx +384 -0
  421. package/src/crystal3d/ui/CrystalStructureView.tsx +148 -0
  422. package/src/crystal3d/ui/CrystalStructureViewer.tsx +39 -0
  423. package/src/crystal3d/ui/CrystalViewControls.tsx +100 -0
  424. package/src/crystal3d/ui/CrystalViewer3D.tsx +183 -0
  425. package/src/crystal3d/ui/crystalScene.ts +100 -0
  426. package/src/crystal3d/ui/crystalStructureViewerProps.ts +54 -0
  427. package/src/crystal3d/ui/index.ts +20 -0
  428. package/src/crystal3d/ui/useCrystalCaption.ts +38 -0
  429. package/src/crystal3d/viewer/animate.ts +113 -0
  430. package/src/crystal3d/viewer/camera.ts +139 -0
  431. package/src/crystal3d/viewer/index.ts +13 -0
  432. package/src/crystal3d/viewer/layerRegistry.ts +47 -0
  433. package/src/crystal3d/viewer/meshPrimitives.ts +102 -0
  434. package/src/crystal3d/viewer/plugin.ts +258 -0
  435. package/src/crystal3d/viewer/renderCell.ts +98 -0
  436. package/src/crystal3d/viewer/renderElements.ts +121 -0
  437. package/src/crystal3d/viewer/renderStructure.ts +144 -0
  438. package/src/crystal3d/viewer/sceneParts.ts +119 -0
  439. package/src/crystal3d/viewer/shapeLayer.ts +108 -0
  440. package/src/crystal3d/viewer/textLayer.ts +85 -0
  441. package/src/crystal3d/viewer/viewer.ts +207 -0
  442. package/src/crystal3d.ts +12 -0
  443. package/src/locales/de.json +19 -1
  444. package/src/locales/en.json +19 -1
  445. package/src/locales/es.json +19 -1
  446. package/src/locales/fr.json +19 -1
  447. package/src/locales/it.json +19 -1
  448. package/src/molecule3d/ui/MoleculeCanvas3D.tsx +45 -71
  449. package/src/molstar/bonds/bondRule.ts +34 -0
  450. package/src/molstar/bonds/index.ts +9 -0
  451. package/src/molstar/ui/MolstarToolbar.tsx +103 -0
  452. package/src/molstar/ui/index.ts +14 -0
  453. package/src/molstar/ui/useMolstarTools.ts +98 -0
  454. package/styles/chrome.css +90 -0
@@ -1085,5 +1085,23 @@
1085
1085
  "send.label": "Invia a",
1086
1086
  "send.heading": "Invia {what} a",
1087
1087
  "send.none": "Nulla di questa pagina può ancora essere inviato a un altro strumento.",
1088
- "send.blocked": "Il browser ha bloccato la nuova scheda: consenti i pop-up per questo sito, poi invia di nuovo."
1088
+ "send.blocked": "Il browser ha bloccato la nuova scheda: consenti i pop-up per questo sito, poi invia di nuovo.",
1089
+ "crystal3d.draw": "Disegna",
1090
+ "crystal3d.cells": "Celle",
1091
+ "crystal3d.packing.molecules": "Molecole intere",
1092
+ "crystal3d.packing.moleculesHelp": "Ogni molecola intera, nella cella in cui cade il suo centro.",
1093
+ "crystal3d.packing.cell": "Atomi della cella",
1094
+ "crystal3d.packing.cellHelp": "Ogni atomo dentro la cella, tagliato dove lo tagliano le sue pareti.",
1095
+ "crystal3d.unitCell": "Cella elementare",
1096
+ "crystal3d.unitCellHelp": "Il contorno della cella elementare.",
1097
+ "crystal3d.caption.molecules.one": "1 molecola per cella",
1098
+ "crystal3d.caption.molecules.other": "{count} molecole per cella",
1099
+ "crystal3d.caption.atoms.one": "1 atomo per cella",
1100
+ "crystal3d.caption.atoms.other": "{count} atomi per cella",
1101
+ "crystal3d.caption.cells.one": "1×1×1 cella",
1102
+ "crystal3d.caption.cells.other": "{count}×{count}×{count} celle",
1103
+ "crystal3d.caption.cellsCapped": "{count}×{count}×{count} celle, perché {asked}×{asked}×{asked} conterrebbero troppi atomi",
1104
+ "crystal3d.unreadable": "Non è stato possibile leggere quel file",
1105
+ "crystal3d.tooLarge": "Questa cella contiene {count} atomi, più di quanti il visualizzatore ne disegni.",
1106
+ "crystal3d.unsupported": "Niente 3D su questo computer"
1089
1107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MoleculeCanvas3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAmBzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAYxE,yCAAyC;AACzC,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,qBAAqB,EACrB,UAAU,GAAG,mBAAmB,CACjC;IACC,2EAA2E;IAC3E,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAsK3E"}
1
+ {"version":3,"file":"MoleculeCanvas3D.d.ts","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAkBzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAYxE,yCAAyC;AACzC,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,qBAAqB,EACrB,UAAU,GAAG,mBAAmB,CACjC;IACC,2EAA2E;IAC3E,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAyJ3E"}
@@ -2,12 +2,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useEffect, useState } from 'react';
3
3
  import { useChromeT } from "../../i18n/ui/useT.js";
4
4
  import { DEFAULT_SPIN_SPEED } from "../../molstar/core/index.js";
5
+ import { MolstarToolbar } from "../../molstar/ui/MolstarToolbar.js";
6
+ import { useMolstarTools } from "../../molstar/ui/useMolstarTools.js";
5
7
  import { DEFAULT_FRAMES_PER_SECOND } from "../core/animatedPng.js";
6
8
  import { normalizeMolecule3DSettings, resolveMolecule3DTools, } from "../core/settings.js";
7
- import { Molecule3DExport } from "./Molecule3DExport.js";
8
9
  import { Molecule3DOptions } from "./Molecule3DOptions.js";
9
10
  import { Molecule3DStage } from "./Molecule3DStage.js";
10
- import { Molecule3DToolbar } from "./Molecule3DToolbar.js";
11
11
  import { highlightColorOf } from "./highlightColor.js";
12
12
  import { moleculeFileAtoms } from "./moleculeFileFormats.js";
13
13
  import { useAtomHover } from "./useAtomHover.js";
@@ -28,9 +28,7 @@ export function MoleculeCanvas3D(props) {
28
28
  const tools = resolveMolecule3DTools(toolsProp);
29
29
  const [initialSettings] = useState(() => normalizeMolecule3DSettings(defaultSettings));
30
30
  const [settings, setSettings] = useControlledState(settingsProp, initialSettings, onSettingsChange);
31
- const [spinning, setSpinning] = useControlledState(spinningProp, defaultSpinning, onSpinningChange);
32
31
  const { measurements, add: addMeasurement, remove: removeMeasurement, clear: clearMeasurements, } = useMeasurementList(measurementsProp, onMeasurementsChange);
33
- const [measureKind, setMeasureKind] = useState(null);
34
32
  const [frameCount, setFrameCount] = useState(0);
35
33
  const polarSurfaceArea = usePolarSurfaceArea(molfile, settings.surfaceColoring === 'polarity');
36
34
  // A callback ref: the element arriving is what creates the viewer, and every
@@ -42,15 +40,16 @@ export function MoleculeCanvas3D(props) {
42
40
  onFrameCountChange: setFrameCount,
43
41
  });
44
42
  useMeasurementRemoval(container, viewerRef, tools.measure && molfile !== null ? removeMeasurement : undefined);
45
- useEffect(() => {
46
- void viewerRef.current?.setSpin(spinning, spinSpeed);
47
- }, [container, viewerRef, spinning, spinSpeed]);
43
+ const controls = useMolstarTools(viewerRef, container, {
44
+ spinning: spinningProp,
45
+ defaultSpinning,
46
+ onSpinningChange,
47
+ spinSpeed,
48
+ });
49
+ const { spinning } = controls;
48
50
  useEffect(() => {
49
51
  void viewerRef.current?.frames.play(playing, framesPerSecond);
50
52
  }, [container, viewerRef, playing, framesPerSecond]);
51
- useEffect(() => {
52
- void viewerRef.current?.setMeasureKind(measureKind);
53
- }, [container, viewerRef, measureKind]);
54
53
  // Kept out of the scene: a new highlight repaints the model, never redraws it.
55
54
  useEffect(() => {
56
55
  void viewerRef.current?.setHighlights(highlights, highlightColorOf(container));
@@ -67,7 +66,8 @@ export function MoleculeCanvas3D(props) {
67
66
  onFailureChange,
68
67
  camera: props,
69
68
  });
70
- const { canvasSize, exportImage, imageFile, copyImage, capture } = useImageExport(container, viewerRef, fileName, framesPerSecond);
69
+ const imageExport = useImageExport(container, viewerRef, fileName, framesPerSecond);
70
+ const { capture } = imageExport;
71
71
  useEffect(() => {
72
72
  if (onCapture === undefined || container === null)
73
73
  return;
@@ -76,11 +76,11 @@ export function MoleculeCanvas3D(props) {
76
76
  onCapture(null);
77
77
  };
78
78
  }, [onCapture, container, capture]);
79
- return (_jsx(Molecule3DStage, { style: { ...STAGE_STYLE, minHeight }, children: (fullscreen) => (_jsxs(_Fragment, { children: [_jsx("div", { ref: setContainer, style: CANVAS_STYLE, "data-testid": "molecule3d" }), molfile !== null && (_jsx("div", { style: OVERLAY_STYLE, children: _jsx(Molecule3DToolbar, { tools: tools, fullscreen: fullscreen, measureKind: measureKind, onMeasureKindChange: setMeasureKind, measurementCount: measurements.length, onClearMeasurements: clearMeasurements, spinning: spinning, onSpinningChange: setSpinning, showSurface: settings.showSurface, onShowSurfaceChange: (showSurface) => {
80
- setSettings({ ...settings, showSurface });
81
- }, onResetView: resetView, options: _jsx(Molecule3DOptions, { settings: settings, onChange: setSettings, polarSurfaceArea: polarSurfaceArea, defaults: initialSettings }), exportLabel: moleculeFileAtoms(molfile, frameCount) > 0
82
- ? t('molecule3d.exportImageOrMolfile')
83
- : undefined, exportPanel: _jsx(Molecule3DExport, { getSize: canvasSize, onExport: exportImage, onCopy: copyImage, writeFile: imageFile, frameCount: frameCount, molfile: molfile, fileName: fileName }) }) }))] })) }));
79
+ return (_jsx(Molecule3DStage, { style: { ...STAGE_STYLE, minHeight }, children: (fullscreen) => (_jsxs(_Fragment, { children: [_jsx("div", { ref: setContainer, style: CANVAS_STYLE, "data-testid": "molecule3d" }), molfile !== null && (_jsx(MolstarToolbar, { controls: controls, tools: tools, fullscreen: fullscreen, measurementCount: measurements.length, onClearMeasurements: clearMeasurements, showSurface: settings.showSurface, onShowSurfaceChange: (showSurface) => {
80
+ setSettings({ ...settings, showSurface });
81
+ }, onResetView: resetView, options: _jsx(Molecule3DOptions, { settings: settings, onChange: setSettings, polarSurfaceArea: polarSurfaceArea, defaults: initialSettings }), exportLabel: moleculeFileAtoms(molfile, frameCount) > 0
82
+ ? t('molecule3d.exportImageOrMolfile')
83
+ : undefined, imageExport: imageExport, frameCount: frameCount, molfile: molfile, fileName: fileName }))] })) }));
84
84
  }
85
85
  const NO_HIGHLIGHTS = [];
86
86
  const STAGE_STYLE = {
@@ -92,15 +92,4 @@ const STAGE_STYLE = {
92
92
  };
93
93
  /** molstar inserts its canvas here, which therefore has a size of its own. */
94
94
  const CANVAS_STYLE = { position: 'absolute', inset: 0 };
95
- const OVERLAY_STYLE = {
96
- position: 'absolute',
97
- top: 8,
98
- bottom: 8,
99
- left: 8,
100
- zIndex: 2,
101
- display: 'flex',
102
- alignItems: 'flex-start',
103
- gap: 8,
104
- pointerEvents: 'none',
105
- };
106
95
  //# sourceMappingURL=MoleculeCanvas3D.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MoleculeCanvas3D.js","sourceRoot":"","sources":["../../../src/molecule3d/ui/MoleculeCanvas3D.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,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AW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,GAClB,CACH,IACA,CACJ,GACe,CACnB,CAAC;AACJ,CAAC;AAED,MAAM,aAAa,GAAmC,EAAE,CAAC;AAEzD,MAAM,WAAW,GAAkB;IACjC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,MAAM;IACb,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,YAAY,GAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The longest bond molstar draws between two elements.
3
+ *
4
+ * Molecules are completed across the cell walls by this rule, so what the
5
+ * viewer draws as one molecule is exactly what the packing kept together. It
6
+ * is one molstar module with no imports of its own, so a page reading it pays
7
+ * for a table of thresholds, not for the 2.8 MB viewer.
8
+ */
9
+ /**
10
+ * The longest distance at which molstar bonds two atoms.
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 it never bonds (H–H).
14
+ */
15
+ export declare function bondLimit(a: string, b: string): number;
16
+ //# sourceMappingURL=bondRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bondRule.d.ts","sourceRoot":"","sources":["../../../src/molstar/bonds/bondRule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAUtD"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The longest bond molstar draws between two elements.
3
+ *
4
+ * Molecules are completed across the cell walls by this rule, so what the
5
+ * viewer draws as one molecule is exactly what the packing kept together. It
6
+ * is one molstar module with no imports of its own, so a page reading it pays
7
+ * for a table of thresholds, not for the 2.8 MB viewer.
8
+ */
9
+ import { getElementIdx, getElementThreshold, getPairingThreshold, isHydrogen, } from 'molstar/lib/mol-model/structure/structure/unit/bonds/common.js';
10
+ /**
11
+ * The longest distance at which molstar bonds two atoms.
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 it never bonds (H–H).
15
+ */
16
+ export function bondLimit(a, b) {
17
+ const first = getElementIdx(a);
18
+ const second = getElementIdx(b);
19
+ if (isHydrogen(first) && isHydrogen(second))
20
+ return 0;
21
+ return getPairingThreshold(first, second, getElementThreshold(first), getElementThreshold(second));
22
+ }
23
+ //# sourceMappingURL=bondRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bondRule.js","sourceRoot":"","sources":["../../../src/molstar/bonds/bondRule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,GACX,MAAM,gEAAgE,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,CAAS;IAC5C,MAAM,KAAK,GAAG,aAAa,CAAC,CAAkB,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,aAAa,CAAC,CAAkB,CAAC,CAAC;IACjD,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,CAAC;IACtD,OAAO,mBAAmB,CACxB,KAAK,EACL,MAAM,EACN,mBAAmB,CAAC,KAAK,CAAC,EAC1B,mBAAmB,CAAC,MAAM,CAAC,CAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The longest bond molstar draws between two elements.
3
+ *
4
+ * Its own path because it is one small molstar module: a page that fills a
5
+ * crystal's cell before the viewer has loaded completes its molecules by the
6
+ * rule the viewer will join them by, without downloading the viewer.
7
+ */
8
+ export { bondLimit } from './bondRule.ts';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molstar/bonds/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The longest bond molstar draws between two elements.
3
+ *
4
+ * Its own path because it is one small molstar module: a page that fills a
5
+ * crystal's cell before the viewer has loaded completes its molecules by the
6
+ * rule the viewer will join them by, without downloading the viewer.
7
+ */
8
+ export { bondLimit } from "./bondRule.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molstar/bonds/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The toolbars every 3D view of the family floats over its canvas: reset,
3
+ * spin, export, full screen and help, then the measuring tools.
4
+ *
5
+ * It is `Molecule3DToolbar` placed in the top-left corner of the stage and fed
6
+ * from `useMolstarTools` and `useImageExport`, so a site drawing its own
7
+ * scene — orbitals, a crystal — gets the controls `<MoleculeViewer3D>` has
8
+ * without wiring them a second time.
9
+ */
10
+ import type { ReactElement } from 'react';
11
+ import type { Molecule3DFile } from '../../molecule3d/core/file.ts';
12
+ import type { Molecule3DToolbarProps } from '../../molecule3d/ui/Molecule3DToolbar.tsx';
13
+ import type { ImageExport } from '../../molecule3d/ui/useImageExport.ts';
14
+ import type { MolstarTools } from './useMolstarTools.ts';
15
+ /** Props of {@link MolstarToolbar}. */
16
+ export interface MolstarToolbarProps extends Omit<Molecule3DToolbarProps, 'measureKind' | 'onMeasureKindChange' | 'spinning' | 'onSpinningChange' | 'exportPanel'> {
17
+ /** The state `useMolstarTools` keeps. */
18
+ controls: MolstarTools;
19
+ /**
20
+ * The pictures the export tool saves and copies; the tool is left out
21
+ * without them.
22
+ * @default undefined
23
+ */
24
+ imageExport?: ImageExport;
25
+ /**
26
+ * Base name of what the export tool saves, extension excluded.
27
+ * @default 'molecule'
28
+ */
29
+ fileName?: string;
30
+ /**
31
+ * The file on screen, offered beside the pictures; say so in `exportLabel`.
32
+ * @default undefined — only pictures are offered
33
+ */
34
+ molfile?: Molecule3DFile | null;
35
+ /**
36
+ * How many frames the scene holds. Above one, a PNG may hold them all.
37
+ * @default 1
38
+ */
39
+ frameCount?: number;
40
+ }
41
+ /**
42
+ * The toolbars, in the top-left corner of a positioned stage.
43
+ * @param props - See {@link MolstarToolbarProps}.
44
+ * @returns The toolbars.
45
+ */
46
+ export declare function MolstarToolbar(props: MolstarToolbarProps): ReactElement;
47
+ //# sourceMappingURL=MolstarToolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MolstarToolbar.d.ts","sourceRoot":"","sources":["../../../src/molstar/ui/MolstarToolbar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAExF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,uCAAuC;AACvC,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,sBAAsB,EACpB,aAAa,GACb,qBAAqB,GACrB,UAAU,GACV,kBAAkB,GAClB,aAAa,CAChB;IACC,yCAAyC;IACzC,QAAQ,EAAE,YAAY,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CA2BvE"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Molecule3DExport } from "../../molecule3d/ui/Molecule3DExport.js";
3
+ import { Molecule3DToolbar } from "../../molecule3d/ui/Molecule3DToolbar.js";
4
+ /**
5
+ * The toolbars, in the top-left corner of a positioned stage.
6
+ * @param props - See {@link MolstarToolbarProps}.
7
+ * @returns The toolbars.
8
+ */
9
+ export function MolstarToolbar(props) {
10
+ const { controls, imageExport, fileName, molfile, frameCount, ...toolbar } = props;
11
+ return (_jsx("div", { style: OVERLAY_STYLE, children: _jsx(Molecule3DToolbar, { ...toolbar, measureKind: controls.measureKind, onMeasureKindChange: controls.setMeasureKind, spinning: controls.spinning, onSpinningChange: controls.setSpinning, exportPanel: imageExport === undefined ? undefined : (_jsx(Molecule3DExport, { getSize: imageExport.canvasSize, onExport: imageExport.exportImage, onCopy: imageExport.copyImage, writeFile: imageExport.imageFile, frameCount: frameCount, molfile: molfile, fileName: fileName })) }) }));
12
+ }
13
+ /**
14
+ * `pointerEvents` is off here and back on inside the toolbars, so the empty
15
+ * column beside them does not swallow a drag of the scene.
16
+ */
17
+ const OVERLAY_STYLE = {
18
+ position: 'absolute',
19
+ top: 8,
20
+ bottom: 8,
21
+ left: 8,
22
+ zIndex: 2,
23
+ display: 'flex',
24
+ alignItems: 'flex-start',
25
+ gap: 8,
26
+ pointerEvents: 'none',
27
+ };
28
+ //# sourceMappingURL=MolstarToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MolstarToolbar.js","sourceRoot":"","sources":["../../../src/molstar/ui/MolstarToolbar.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAA0C,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA2C,CAAC;AAuC9E;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,GACxE,KAAK,CAAC;IACR,OAAO,CACL,cAAK,KAAK,EAAE,aAAa,YACvB,KAAC,iBAAiB,OACZ,OAAO,EACX,WAAW,EAAE,QAAQ,CAAC,WAAW,EACjC,mBAAmB,EAAE,QAAQ,CAAC,cAAc,EAC5C,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAC3B,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EACtC,WAAW,EACT,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CACtC,KAAC,gBAAgB,IACf,OAAO,EAAE,WAAW,CAAC,UAAU,EAC/B,QAAQ,EAAE,WAAW,CAAC,WAAW,EACjC,MAAM,EAAE,WAAW,CAAC,SAAS,EAC7B,SAAS,EAAE,WAAW,CAAC,SAAS,EAChC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,GAClB,CACH,GAEH,GACE,CACP,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,aAAa,GAAkB;IACnC,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,YAAY;IACxB,GAAG,EAAE,CAAC;IACN,aAAa,EAAE,MAAM;CACtB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The controls of a molstar canvas, for a site drawing a scene of its own:
3
+ * the toolbars `<MoleculeViewer3D>` floats over its canvas, and the state they
4
+ * keep on the viewer.
5
+ */
6
+ export type { MolstarToolbarProps } from './MolstarToolbar.tsx';
7
+ export { MolstarToolbar } from './MolstarToolbar.tsx';
8
+ export type { MolstarTools, MolstarToolsOptions, MolstarToolsViewer, } from './useMolstarTools.ts';
9
+ export { useMolstarTools } from './useMolstarTools.ts';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molstar/ui/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The controls of a molstar canvas, for a site drawing a scene of its own:
3
+ * the toolbars `<MoleculeViewer3D>` floats over its canvas, and the state they
4
+ * keep on the viewer.
5
+ */
6
+ export { MolstarToolbar } from "./MolstarToolbar.js";
7
+ export { useMolstarTools } from "./useMolstarTools.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molstar/ui/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAC;AAMtD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * What the toolbar over a molstar canvas changes on the viewer: whether the
3
+ * scene turns, and what a click on an atom measures.
4
+ *
5
+ * Every 3D view of the family keeps its own viewer class — a molecule, its
6
+ * orbitals, a crystal — but all of them turn and measure the same way, so the
7
+ * state and the two effects that hand it to the viewer are written once here.
8
+ */
9
+ import type { RefObject } from 'react';
10
+ import type { MeasurementKind } from '../../molecule3d/core/measurement.ts';
11
+ /** What a viewer offers the toolbar; each method resolves once it is done. */
12
+ export interface MolstarToolsViewer {
13
+ /** Turn the automatic spin on or off, at `speed`. */
14
+ setSpin: (spinning: boolean, speed?: number) => Promise<void>;
15
+ /** Make clicks on atoms build this measurement, or give them back. */
16
+ setMeasureKind: (kind: MeasurementKind | null) => Promise<void>;
17
+ }
18
+ /** Options of {@link useMolstarTools}. */
19
+ export interface MolstarToolsOptions {
20
+ /**
21
+ * Whether the scene turns, when the parent owns it.
22
+ * @default undefined
23
+ */
24
+ spinning?: boolean;
25
+ /**
26
+ * Whether the scene turns at first, when the toolbar owns it.
27
+ * @default false
28
+ */
29
+ defaultSpinning?: boolean;
30
+ /**
31
+ * Called with every change of the spin.
32
+ * @default undefined
33
+ */
34
+ onSpinningChange?: (spinning: boolean) => void;
35
+ /**
36
+ * Turn rate, in molstar's own spin unit.
37
+ * @default DEFAULT_SPIN_SPEED
38
+ */
39
+ spinSpeed?: number;
40
+ }
41
+ /** The toolbar's state, and its setters. */
42
+ export interface MolstarTools {
43
+ /** The measurement a click on an atom builds, or `null`. */
44
+ measureKind: MeasurementKind | null;
45
+ setMeasureKind: (kind: MeasurementKind | null) => void;
46
+ /** Whether the scene turns. */
47
+ spinning: boolean;
48
+ setSpinning: (spinning: boolean) => void;
49
+ }
50
+ /**
51
+ * Keep the viewer turning and measuring as the toolbar says.
52
+ *
53
+ * Call it after the viewer is created, in the same component: effects run in
54
+ * the order they are declared, so a viewer created by an earlier effect is
55
+ * there when these run.
56
+ * @param viewerRef - The viewer, `null` while there is none.
57
+ * @param container - The element the viewer draws in; a new one is a new
58
+ * viewer, which is handed the state again.
59
+ * @param options - See {@link MolstarToolsOptions}.
60
+ * @returns See {@link MolstarTools}.
61
+ */
62
+ export declare function useMolstarTools(viewerRef: RefObject<MolstarToolsViewer | null>, container: HTMLElement | null, options?: MolstarToolsOptions): MolstarTools;
63
+ //# sourceMappingURL=useMolstarTools.d.ts.map
@@ -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AE,mBAAwB,GAChC,YAAY,CAuBd"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * What the toolbar over a molstar canvas changes on the viewer: whether the
3
+ * scene turns, and what a click on an atom measures.
4
+ *
5
+ * Every 3D view of the family keeps its own viewer class — a molecule, its
6
+ * orbitals, a crystal — but all of them turn and measure the same way, so the
7
+ * state and the two effects that hand it to the viewer are written once here.
8
+ */
9
+ import { useEffect, useState } from 'react';
10
+ import { useControlledState } from "../../molecule3d/ui/useControlledState.js";
11
+ import { DEFAULT_SPIN_SPEED } from "../core/camera.js";
12
+ /**
13
+ * Keep the viewer turning and measuring as the toolbar says.
14
+ *
15
+ * Call it after the viewer is created, in the same component: effects run in
16
+ * the order they are declared, so a viewer created by an earlier effect is
17
+ * there when these run.
18
+ * @param viewerRef - The viewer, `null` while there is none.
19
+ * @param container - The element the viewer draws in; a new one is a new
20
+ * viewer, which is handed the state again.
21
+ * @param options - See {@link MolstarToolsOptions}.
22
+ * @returns See {@link MolstarTools}.
23
+ */
24
+ export function useMolstarTools(viewerRef, container, options = {}) {
25
+ const { spinning: spinningProp, defaultSpinning = false, onSpinningChange, spinSpeed = DEFAULT_SPIN_SPEED, } = options;
26
+ const [measureKind, setMeasureKind] = useState(null);
27
+ const [spinning, setSpinning] = useControlledState(spinningProp, defaultSpinning, onSpinningChange);
28
+ useEffect(() => {
29
+ void viewerRef.current?.setSpin(spinning, spinSpeed);
30
+ }, [viewerRef, container, spinning, spinSpeed]);
31
+ useEffect(() => {
32
+ void viewerRef.current?.setMeasureKind(measureKind);
33
+ }, [viewerRef, container, measureKind]);
34
+ return { measureKind, setMeasureKind, spinning, setSpinning };
35
+ }
36
+ //# sourceMappingURL=useMolstarTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMolstarTools.js","sourceRoot":"","sources":["../../../src/molstar/ui/useMolstarTools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA4CvD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAC7B,SAA+C,EAC/C,SAA6B,EAC7B,UAA+B,EAAE;IAEjC,MAAM,EACJ,QAAQ,EAAE,YAAY,EACtB,eAAe,GAAG,KAAK,EACvB,gBAAgB,EAChB,SAAS,GAAG,kBAAkB,GAC/B,GAAG,OAAO,CAAC;IACZ,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAyB,IAAI,CAAC,CAAC;IAC7E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,kBAAkB,CAChD,YAAY,EACZ,eAAe,EACf,gBAAgB,CACjB,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,SAAS,CAAC,OAAO,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACtD,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IAExC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cheminfo",
3
- "version": "0.134.1",
3
+ "version": "0.136.0",
4
4
  "license": "MIT",
5
5
  "description": "React components, hooks and framework-free helpers shared by the cheminfo sites: site chrome, citations, sharing, routing, pedagogy, charts, and the structure, orbital and 3D molecule viewers",
6
6
  "author": "Luc Patiny",
@@ -20,6 +20,8 @@
20
20
  "./card": "./lib/card.js",
21
21
  "./conformers": "./lib/conformers.js",
22
22
  "./core": "./lib/core.js",
23
+ "./crystal": "./lib/crystal.js",
24
+ "./crystal3d": "./lib/crystal3d.js",
23
25
  "./demo": "./lib/demo.js",
24
26
  "./drawing": "./lib/drawing.js",
25
27
  "./formula": "./lib/formula.js",
@@ -87,6 +89,7 @@
87
89
  "bezier-js": "^6.1.4",
88
90
  "cheminfo-font": "^1.28.0",
89
91
  "cheminfo-types": "^1.16.0",
92
+ "cif-to-json": "^2.1.0",
90
93
  "convert-to-jcamp": "^7.0.3",
91
94
  "countries-and-timezones": "^3.11.0",
92
95
  "crc-32": "^1.2.2",
@@ -0,0 +1,98 @@
1
+ import type { PackedAtom } from './periodicBonds.ts';
2
+ import type { Lattice } from './symmetry/lattice.ts';
3
+
4
+ /** The atoms of each bin, and the bin each atom falls in. */
5
+ export interface Grid {
6
+ /** Bins along a, b and c. */
7
+ readonly counts: readonly [number, number, number];
8
+ /** How many bins away along each axis a bond can reach. */
9
+ readonly reaches: readonly [number, number, number];
10
+ /** `start[bin]` to `start[bin + 1]` index the atoms of a bin in `members`. */
11
+ readonly start: Int32Array;
12
+ readonly members: Int32Array;
13
+ /** The bin of each atom, three indices per atom. */
14
+ readonly cells: Int32Array;
15
+ }
16
+
17
+ /**
18
+ * Bin the atoms of a cell on a grid of the cell itself.
19
+ *
20
+ * A bin holds about one atom and is never thinner than a bond, so a dense cell
21
+ * is not compared pair by pair and a sparse one is not cut into empty bins.
22
+ * @param atoms - The atoms, fractional, wrapped into [0, 1).
23
+ * @param lattice - The cell.
24
+ * @param reach - The longest bond searched for, Å.
25
+ * @returns The bins, and how many of them a bond can reach along each axis.
26
+ */
27
+ export function createGrid(
28
+ atoms: readonly PackedAtom[],
29
+ lattice: Lattice,
30
+ reach: number,
31
+ ): Grid {
32
+ const count = atoms.length;
33
+ const spacing = Math.max(reach, Math.cbrt(lattice.volume / count));
34
+ const widths = planeSpacings(lattice);
35
+ const counts: [number, number, number] = [1, 1, 1];
36
+ const reaches: [number, number, number] = [1, 1, 1];
37
+ for (let axis = 0; axis < 3; axis++) {
38
+ const width = widths[axis] ?? 1;
39
+ const bins = Math.max(1, Math.floor(width / spacing));
40
+ counts[axis] = bins;
41
+ reaches[axis] = Math.max(1, Math.ceil((reach * bins) / width - 1e-9));
42
+ }
43
+ const [na, nb, nc] = counts;
44
+ const cells = new Int32Array(count * 3);
45
+ const binOf = new Int32Array(count);
46
+ const start = new Int32Array(na * nb * nc + 1);
47
+ for (let index = 0; index < count; index++) {
48
+ const position = (atoms[index] as PackedAtom).position;
49
+ for (let axis = 0; axis < 3; axis++) {
50
+ const bins = counts[axis] ?? 1;
51
+ const value = Math.floor((position[axis] ?? 0) * bins);
52
+ cells[index * 3 + axis] = Math.min(bins - 1, Math.max(0, value));
53
+ }
54
+ const bin =
55
+ ((cells[index * 3] ?? 0) * nb + (cells[index * 3 + 1] ?? 0)) * nc +
56
+ (cells[index * 3 + 2] ?? 0);
57
+ binOf[index] = bin;
58
+ start[bin + 1] = (start[bin + 1] ?? 0) + 1;
59
+ }
60
+ for (let bin = 0; bin < na * nb * nc; bin++) {
61
+ start[bin + 1] = (start[bin + 1] ?? 0) + (start[bin] ?? 0);
62
+ }
63
+ const cursor = start.slice(0, -1);
64
+ const members = new Int32Array(count);
65
+ for (let index = 0; index < count; index++) {
66
+ const bin = binOf[index] ?? 0;
67
+ members[cursor[bin] ?? 0] = index;
68
+ cursor[bin] = (cursor[bin] ?? 0) + 1;
69
+ }
70
+ return { counts, reaches, start, members, cells };
71
+ }
72
+
73
+ /**
74
+ * The distance between consecutive lattice planes normal to each axis, Å.
75
+ * @param lattice - The cell.
76
+ * @returns The spacings normal to a, b and c.
77
+ */
78
+ function planeSpacings(lattice: Lattice): [number, number, number] {
79
+ const m = lattice.cartesian;
80
+ const column = (index: number): [number, number, number] => [
81
+ m[0]?.[index] ?? 0,
82
+ m[1]?.[index] ?? 0,
83
+ m[2]?.[index] ?? 0,
84
+ ];
85
+ const [a, b, c] = [column(0), column(1), column(2)];
86
+ return [
87
+ lattice.volume / crossLength(b, c),
88
+ lattice.volume / crossLength(c, a),
89
+ lattice.volume / crossLength(a, b),
90
+ ];
91
+ }
92
+
93
+ function crossLength(u: readonly number[], v: readonly number[]): number {
94
+ const x = (u[1] ?? 0) * (v[2] ?? 0) - (u[2] ?? 0) * (v[1] ?? 0);
95
+ const y = (u[2] ?? 0) * (v[0] ?? 0) - (u[0] ?? 0) * (v[2] ?? 0);
96
+ const z = (u[0] ?? 0) * (v[1] ?? 0) - (u[1] ?? 0) * (v[0] ?? 0);
97
+ return Math.hypot(x, y, z);
98
+ }