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.
- package/README.md +13 -0
- package/lib/crystal/core/bondGrid.d.ts +26 -0
- package/lib/crystal/core/bondGrid.d.ts.map +1 -0
- package/lib/crystal/core/bondGrid.js +76 -0
- package/lib/crystal/core/bondGrid.js.map +1 -0
- package/lib/crystal/core/cellAtoms.d.ts +43 -0
- package/lib/crystal/core/cellAtoms.d.ts.map +1 -0
- package/lib/crystal/core/cellAtoms.js +70 -0
- package/lib/crystal/core/cellAtoms.js.map +1 -0
- package/lib/crystal/core/cellBonds.d.ts +21 -0
- package/lib/crystal/core/cellBonds.d.ts.map +1 -0
- package/lib/crystal/core/cellBonds.js +100 -0
- package/lib/crystal/core/cellBonds.js.map +1 -0
- package/lib/crystal/core/cif/element.d.ts +9 -0
- package/lib/crystal/core/cif/element.d.ts.map +1 -0
- package/lib/crystal/core/cif/element.js +41 -0
- package/lib/crystal/core/cif/element.js.map +1 -0
- package/lib/crystal/core/cif/index.d.ts +4 -0
- package/lib/crystal/core/cif/index.d.ts.map +1 -0
- package/lib/crystal/core/cif/index.js +3 -0
- package/lib/crystal/core/cif/index.js.map +1 -0
- package/lib/crystal/core/cif/number.d.ts +27 -0
- package/lib/crystal/core/cif/number.d.ts.map +1 -0
- package/lib/crystal/core/cif/number.js +57 -0
- package/lib/crystal/core/cif/number.js.map +1 -0
- package/lib/crystal/core/cif/read.d.ts +12 -0
- package/lib/crystal/core/cif/read.d.ts.map +1 -0
- package/lib/crystal/core/cif/read.js +183 -0
- package/lib/crystal/core/cif/read.js.map +1 -0
- package/lib/crystal/core/cif/readGeometry.d.ts +17 -0
- package/lib/crystal/core/cif/readGeometry.d.ts.map +1 -0
- package/lib/crystal/core/cif/readGeometry.js +93 -0
- package/lib/crystal/core/cif/readGeometry.js.map +1 -0
- package/lib/crystal/core/cif/tags.d.ts +62 -0
- package/lib/crystal/core/cif/tags.d.ts.map +1 -0
- package/lib/crystal/core/cif/tags.js +115 -0
- package/lib/crystal/core/cif/tags.js.map +1 -0
- package/lib/crystal/core/cif/types.d.ts +158 -0
- package/lib/crystal/core/cif/types.d.ts.map +1 -0
- package/lib/crystal/core/cif/types.js +2 -0
- package/lib/crystal/core/cif/types.js.map +1 -0
- package/lib/crystal/core/components.d.ts +56 -0
- package/lib/crystal/core/components.d.ts.map +1 -0
- package/lib/crystal/core/components.js +132 -0
- package/lib/crystal/core/components.js.map +1 -0
- package/lib/crystal/core/covalentRadii.d.ts +24 -0
- package/lib/crystal/core/covalentRadii.d.ts.map +1 -0
- package/lib/crystal/core/covalentRadii.js +55 -0
- package/lib/crystal/core/covalentRadii.js.map +1 -0
- package/lib/crystal/core/disorder.d.ts +59 -0
- package/lib/crystal/core/disorder.d.ts.map +1 -0
- package/lib/crystal/core/disorder.js +168 -0
- package/lib/crystal/core/disorder.js.map +1 -0
- package/lib/crystal/core/expand.d.ts +62 -0
- package/lib/crystal/core/expand.d.ts.map +1 -0
- package/lib/crystal/core/expand.js +61 -0
- package/lib/crystal/core/expand.js.map +1 -0
- package/lib/crystal/core/index.d.ts +20 -0
- package/lib/crystal/core/index.d.ts.map +1 -0
- package/lib/crystal/core/index.js +13 -0
- package/lib/crystal/core/index.js.map +1 -0
- package/lib/crystal/core/moleculeOf.d.ts +31 -0
- package/lib/crystal/core/moleculeOf.d.ts.map +1 -0
- package/lib/crystal/core/moleculeOf.js +128 -0
- package/lib/crystal/core/moleculeOf.js.map +1 -0
- package/lib/crystal/core/moleculeTypes.d.ts +80 -0
- package/lib/crystal/core/moleculeTypes.d.ts.map +1 -0
- package/lib/crystal/core/moleculeTypes.js +2 -0
- package/lib/crystal/core/moleculeTypes.js.map +1 -0
- package/lib/crystal/core/molecules.d.ts +39 -0
- package/lib/crystal/core/molecules.d.ts.map +1 -0
- package/lib/crystal/core/molecules.js +106 -0
- package/lib/crystal/core/molecules.js.map +1 -0
- package/lib/crystal/core/operations.d.ts +19 -0
- package/lib/crystal/core/operations.d.ts.map +1 -0
- package/lib/crystal/core/operations.js +68 -0
- package/lib/crystal/core/operations.js.map +1 -0
- package/lib/crystal/core/packing.d.ts +43 -0
- package/lib/crystal/core/packing.d.ts.map +1 -0
- package/lib/crystal/core/packing.js +89 -0
- package/lib/crystal/core/packing.js.map +1 -0
- package/lib/crystal/core/periodicBonds.d.ts +57 -0
- package/lib/crystal/core/periodicBonds.d.ts.map +1 -0
- package/lib/crystal/core/periodicBonds.js +167 -0
- package/lib/crystal/core/periodicBonds.js.map +1 -0
- package/lib/crystal/core/resolve.d.ts +61 -0
- package/lib/crystal/core/resolve.d.ts.map +1 -0
- package/lib/crystal/core/resolve.js +149 -0
- package/lib/crystal/core/resolve.js.map +1 -0
- package/lib/crystal/core/spaceGroups/index.d.ts +5 -0
- package/lib/crystal/core/spaceGroups/index.d.ts.map +1 -0
- package/lib/crystal/core/spaceGroups/index.js +4 -0
- package/lib/crystal/core/spaceGroups/index.js.map +1 -0
- package/lib/crystal/core/spaceGroups/spaceGroupOperations.d.ts +14 -0
- package/lib/crystal/core/spaceGroups/spaceGroupOperations.d.ts.map +1 -0
- package/lib/crystal/core/spaceGroups/spaceGroupOperations.js +24 -0
- package/lib/crystal/core/spaceGroups/spaceGroupOperations.js.map +1 -0
- package/lib/crystal/core/spaceGroups/spaceGroupRows.d.ts +3 -0
- package/lib/crystal/core/spaceGroups/spaceGroupRows.d.ts.map +1 -0
- package/lib/crystal/core/spaceGroups/spaceGroupRows.js +536 -0
- package/lib/crystal/core/spaceGroups/spaceGroupRows.js.map +1 -0
- package/lib/crystal/core/spaceGroups/spaceGroupSymbols.d.ts +43 -0
- package/lib/crystal/core/spaceGroups/spaceGroupSymbols.d.ts.map +1 -0
- package/lib/crystal/core/spaceGroups/spaceGroupSymbols.js +169 -0
- package/lib/crystal/core/spaceGroups/spaceGroupSymbols.js.map +1 -0
- package/lib/crystal/core/spaceGroups/spaceGroups.d.ts +78 -0
- package/lib/crystal/core/spaceGroups/spaceGroups.d.ts.map +1 -0
- package/lib/crystal/core/spaceGroups/spaceGroups.js +83 -0
- package/lib/crystal/core/spaceGroups/spaceGroups.js.map +1 -0
- package/lib/crystal/core/symmetry/group.d.ts +15 -0
- package/lib/crystal/core/symmetry/group.d.ts.map +1 -0
- package/lib/crystal/core/symmetry/group.js +37 -0
- package/lib/crystal/core/symmetry/group.js.map +1 -0
- package/lib/crystal/core/symmetry/index.d.ts +8 -0
- package/lib/crystal/core/symmetry/index.d.ts.map +1 -0
- package/lib/crystal/core/symmetry/index.js +6 -0
- package/lib/crystal/core/symmetry/index.js.map +1 -0
- package/lib/crystal/core/symmetry/integerMatrix.d.ts +45 -0
- package/lib/crystal/core/symmetry/integerMatrix.d.ts.map +1 -0
- package/lib/crystal/core/symmetry/integerMatrix.js +139 -0
- package/lib/crystal/core/symmetry/integerMatrix.js.map +1 -0
- package/lib/crystal/core/symmetry/lattice.d.ts +64 -0
- package/lib/crystal/core/symmetry/lattice.d.ts.map +1 -0
- package/lib/crystal/core/symmetry/lattice.js +113 -0
- package/lib/crystal/core/symmetry/lattice.js.map +1 -0
- package/lib/crystal/core/symmetry/operation.d.ts +91 -0
- package/lib/crystal/core/symmetry/operation.d.ts.map +1 -0
- package/lib/crystal/core/symmetry/operation.js +184 -0
- package/lib/crystal/core/symmetry/operation.js.map +1 -0
- package/lib/crystal/core/symmetry/parseOperation.d.ts +18 -0
- package/lib/crystal/core/symmetry/parseOperation.d.ts.map +1 -0
- package/lib/crystal/core/symmetry/parseOperation.js +145 -0
- package/lib/crystal/core/symmetry/parseOperation.js.map +1 -0
- package/lib/crystal/core/symmetry/types.d.ts +29 -0
- package/lib/crystal/core/symmetry/types.d.ts.map +1 -0
- package/lib/crystal/core/symmetry/types.js +5 -0
- package/lib/crystal/core/symmetry/types.js.map +1 -0
- package/lib/crystal/core/symmetryClasses.d.ts +28 -0
- package/lib/crystal/core/symmetryClasses.d.ts.map +1 -0
- package/lib/crystal/core/symmetryClasses.js +93 -0
- package/lib/crystal/core/symmetryClasses.js.map +1 -0
- package/lib/crystal.d.ts +12 -0
- package/lib/crystal.d.ts.map +1 -0
- package/lib/crystal.js +12 -0
- package/lib/crystal.js.map +1 -0
- package/lib/crystal3d/core/cellClip.d.ts +46 -0
- package/lib/crystal3d/core/cellClip.d.ts.map +1 -0
- package/lib/crystal3d/core/cellClip.js +198 -0
- package/lib/crystal3d/core/cellClip.js.map +1 -0
- package/lib/crystal3d/core/cellGeometry.d.ts +63 -0
- package/lib/crystal3d/core/cellGeometry.d.ts.map +1 -0
- package/lib/crystal3d/core/cellGeometry.js +153 -0
- package/lib/crystal3d/core/cellGeometry.js.map +1 -0
- package/lib/crystal3d/core/cellStack.d.ts +51 -0
- package/lib/crystal3d/core/cellStack.d.ts.map +1 -0
- package/lib/crystal3d/core/cellStack.js +79 -0
- package/lib/crystal3d/core/cellStack.js.map +1 -0
- package/lib/crystal3d/core/crystalView.d.ts +71 -0
- package/lib/crystal3d/core/crystalView.d.ts.map +1 -0
- package/lib/crystal3d/core/crystalView.js +48 -0
- package/lib/crystal3d/core/crystalView.js.map +1 -0
- package/lib/crystal3d/core/drawingSet.d.ts +31 -0
- package/lib/crystal3d/core/drawingSet.d.ts.map +1 -0
- package/lib/crystal3d/core/drawingSet.js +63 -0
- package/lib/crystal3d/core/drawingSet.js.map +1 -0
- package/lib/crystal3d/core/elementDrawing.d.ts +50 -0
- package/lib/crystal3d/core/elementDrawing.d.ts.map +1 -0
- package/lib/crystal3d/core/elementDrawing.js +100 -0
- package/lib/crystal3d/core/elementDrawing.js.map +1 -0
- package/lib/crystal3d/core/elementExtent.d.ts +42 -0
- package/lib/crystal3d/core/elementExtent.d.ts.map +1 -0
- package/lib/crystal3d/core/elementExtent.js +56 -0
- package/lib/crystal3d/core/elementExtent.js.map +1 -0
- package/lib/crystal3d/core/elementLabels.d.ts +31 -0
- package/lib/crystal3d/core/elementLabels.d.ts.map +1 -0
- package/lib/crystal3d/core/elementLabels.js +99 -0
- package/lib/crystal3d/core/elementLabels.js.map +1 -0
- package/lib/crystal3d/core/elementShapes.d.ts +43 -0
- package/lib/crystal3d/core/elementShapes.d.ts.map +1 -0
- package/lib/crystal3d/core/elementShapes.js +115 -0
- package/lib/crystal3d/core/elementShapes.js.map +1 -0
- package/lib/crystal3d/core/frame.d.ts +36 -0
- package/lib/crystal3d/core/frame.d.ts.map +1 -0
- package/lib/crystal3d/core/frame.js +35 -0
- package/lib/crystal3d/core/frame.js.map +1 -0
- package/lib/crystal3d/core/framing.d.ts +41 -0
- package/lib/crystal3d/core/framing.d.ts.map +1 -0
- package/lib/crystal3d/core/framing.js +79 -0
- package/lib/crystal3d/core/framing.js.map +1 -0
- package/lib/crystal3d/core/index.d.ts +42 -0
- package/lib/crystal3d/core/index.d.ts.map +1 -0
- package/lib/crystal3d/core/index.js +29 -0
- package/lib/crystal3d/core/index.js.map +1 -0
- package/lib/crystal3d/core/labelText.d.ts +19 -0
- package/lib/crystal3d/core/labelText.d.ts.map +1 -0
- package/lib/crystal3d/core/labelText.js +42 -0
- package/lib/crystal3d/core/labelText.js.map +1 -0
- package/lib/crystal3d/core/latticeBasis.d.ts +49 -0
- package/lib/crystal3d/core/latticeBasis.d.ts.map +1 -0
- package/lib/crystal3d/core/latticeBasis.js +89 -0
- package/lib/crystal3d/core/latticeBasis.js.map +1 -0
- package/lib/crystal3d/core/mat3.d.ts +68 -0
- package/lib/crystal3d/core/mat3.d.ts.map +1 -0
- package/lib/crystal3d/core/mat3.js +146 -0
- package/lib/crystal3d/core/mat3.js.map +1 -0
- package/lib/crystal3d/core/operationMatrix.d.ts +44 -0
- package/lib/crystal3d/core/operationMatrix.d.ts.map +1 -0
- package/lib/crystal3d/core/operationMatrix.js +172 -0
- package/lib/crystal3d/core/operationMatrix.js.map +1 -0
- package/lib/crystal3d/core/orientation.d.ts +62 -0
- package/lib/crystal3d/core/orientation.d.ts.map +1 -0
- package/lib/crystal3d/core/orientation.js +166 -0
- package/lib/crystal3d/core/orientation.js.map +1 -0
- package/lib/crystal3d/core/palette.d.ts +24 -0
- package/lib/crystal3d/core/palette.d.ts.map +1 -0
- package/lib/crystal3d/core/palette.js +34 -0
- package/lib/crystal3d/core/palette.js.map +1 -0
- package/lib/crystal3d/core/primitives.d.ts +133 -0
- package/lib/crystal3d/core/primitives.d.ts.map +1 -0
- package/lib/crystal3d/core/primitives.js +80 -0
- package/lib/crystal3d/core/primitives.js.map +1 -0
- package/lib/crystal3d/core/structureText.d.ts +20 -0
- package/lib/crystal3d/core/structureText.d.ts.map +1 -0
- package/lib/crystal3d/core/structureText.js +37 -0
- package/lib/crystal3d/core/structureText.js.map +1 -0
- package/lib/crystal3d/core/supercell.d.ts +20 -0
- package/lib/crystal3d/core/supercell.d.ts.map +1 -0
- package/lib/crystal3d/core/supercell.js +35 -0
- package/lib/crystal3d/core/supercell.js.map +1 -0
- package/lib/crystal3d/core/types.d.ts +166 -0
- package/lib/crystal3d/core/types.d.ts.map +1 -0
- package/lib/crystal3d/core/types.js +10 -0
- package/lib/crystal3d/core/types.js.map +1 -0
- package/lib/crystal3d/core/vec3.d.ts +75 -0
- package/lib/crystal3d/core/vec3.d.ts.map +1 -0
- package/lib/crystal3d/core/vec3.js +119 -0
- package/lib/crystal3d/core/vec3.js.map +1 -0
- package/lib/crystal3d/ui/CrystalCanvas3D.d.ts +52 -0
- package/lib/crystal3d/ui/CrystalCanvas3D.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalCanvas3D.js +242 -0
- package/lib/crystal3d/ui/CrystalCanvas3D.js.map +1 -0
- package/lib/crystal3d/ui/CrystalStructureView.d.ts +17 -0
- package/lib/crystal3d/ui/CrystalStructureView.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalStructureView.js +76 -0
- package/lib/crystal3d/ui/CrystalStructureView.js.map +1 -0
- package/lib/crystal3d/ui/CrystalStructureViewer.d.ts +22 -0
- package/lib/crystal3d/ui/CrystalStructureViewer.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalStructureViewer.js +29 -0
- package/lib/crystal3d/ui/CrystalStructureViewer.js.map +1 -0
- package/lib/crystal3d/ui/CrystalViewControls.d.ts +25 -0
- package/lib/crystal3d/ui/CrystalViewControls.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalViewControls.js +22 -0
- package/lib/crystal3d/ui/CrystalViewControls.js.map +1 -0
- package/lib/crystal3d/ui/CrystalViewer3D.d.ts +72 -0
- package/lib/crystal3d/ui/CrystalViewer3D.d.ts.map +1 -0
- package/lib/crystal3d/ui/CrystalViewer3D.js +70 -0
- package/lib/crystal3d/ui/CrystalViewer3D.js.map +1 -0
- package/lib/crystal3d/ui/crystalScene.d.ts +91 -0
- package/lib/crystal3d/ui/crystalScene.d.ts.map +1 -0
- package/lib/crystal3d/ui/crystalScene.js +10 -0
- package/lib/crystal3d/ui/crystalScene.js.map +1 -0
- package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts +52 -0
- package/lib/crystal3d/ui/crystalStructureViewerProps.d.ts.map +1 -0
- package/lib/crystal3d/ui/crystalStructureViewerProps.js +2 -0
- package/lib/crystal3d/ui/crystalStructureViewerProps.js.map +1 -0
- package/lib/crystal3d/ui/index.d.ts +16 -0
- package/lib/crystal3d/ui/index.d.ts.map +1 -0
- package/lib/crystal3d/ui/index.js +12 -0
- package/lib/crystal3d/ui/index.js.map +1 -0
- package/lib/crystal3d/ui/useCrystalCaption.d.ts +14 -0
- package/lib/crystal3d/ui/useCrystalCaption.d.ts.map +1 -0
- package/lib/crystal3d/ui/useCrystalCaption.js +32 -0
- package/lib/crystal3d/ui/useCrystalCaption.js.map +1 -0
- package/lib/crystal3d/viewer/animate.d.ts +49 -0
- package/lib/crystal3d/viewer/animate.d.ts.map +1 -0
- package/lib/crystal3d/viewer/animate.js +83 -0
- package/lib/crystal3d/viewer/animate.js.map +1 -0
- package/lib/crystal3d/viewer/camera.d.ts +44 -0
- package/lib/crystal3d/viewer/camera.d.ts.map +1 -0
- package/lib/crystal3d/viewer/camera.js +103 -0
- package/lib/crystal3d/viewer/camera.js.map +1 -0
- package/lib/crystal3d/viewer/index.d.ts +13 -0
- package/lib/crystal3d/viewer/index.d.ts.map +1 -0
- package/lib/crystal3d/viewer/index.js +8 -0
- package/lib/crystal3d/viewer/index.js.map +1 -0
- package/lib/crystal3d/viewer/layerRegistry.d.ts +24 -0
- package/lib/crystal3d/viewer/layerRegistry.d.ts.map +1 -0
- package/lib/crystal3d/viewer/layerRegistry.js +39 -0
- package/lib/crystal3d/viewer/layerRegistry.js.map +1 -0
- package/lib/crystal3d/viewer/meshPrimitives.d.ts +13 -0
- package/lib/crystal3d/viewer/meshPrimitives.d.ts.map +1 -0
- package/lib/crystal3d/viewer/meshPrimitives.js +76 -0
- package/lib/crystal3d/viewer/meshPrimitives.js.map +1 -0
- package/lib/crystal3d/viewer/plugin.d.ts +133 -0
- package/lib/crystal3d/viewer/plugin.d.ts.map +1 -0
- package/lib/crystal3d/viewer/plugin.js +181 -0
- package/lib/crystal3d/viewer/plugin.js.map +1 -0
- package/lib/crystal3d/viewer/renderCell.d.ts +43 -0
- package/lib/crystal3d/viewer/renderCell.d.ts.map +1 -0
- package/lib/crystal3d/viewer/renderCell.js +53 -0
- package/lib/crystal3d/viewer/renderCell.js.map +1 -0
- package/lib/crystal3d/viewer/renderElements.d.ts +54 -0
- package/lib/crystal3d/viewer/renderElements.d.ts.map +1 -0
- package/lib/crystal3d/viewer/renderElements.js +77 -0
- package/lib/crystal3d/viewer/renderElements.js.map +1 -0
- package/lib/crystal3d/viewer/renderStructure.d.ts +55 -0
- package/lib/crystal3d/viewer/renderStructure.d.ts.map +1 -0
- package/lib/crystal3d/viewer/renderStructure.js +103 -0
- package/lib/crystal3d/viewer/renderStructure.js.map +1 -0
- package/lib/crystal3d/viewer/sceneParts.d.ts +32 -0
- package/lib/crystal3d/viewer/sceneParts.d.ts.map +1 -0
- package/lib/crystal3d/viewer/sceneParts.js +77 -0
- package/lib/crystal3d/viewer/sceneParts.js.map +1 -0
- package/lib/crystal3d/viewer/shapeLayer.d.ts +41 -0
- package/lib/crystal3d/viewer/shapeLayer.d.ts.map +1 -0
- package/lib/crystal3d/viewer/shapeLayer.js +57 -0
- package/lib/crystal3d/viewer/shapeLayer.js.map +1 -0
- package/lib/crystal3d/viewer/textLayer.d.ts +21 -0
- package/lib/crystal3d/viewer/textLayer.d.ts.map +1 -0
- package/lib/crystal3d/viewer/textLayer.js +59 -0
- package/lib/crystal3d/viewer/textLayer.js.map +1 -0
- package/lib/crystal3d/viewer/viewer.d.ts +110 -0
- package/lib/crystal3d/viewer/viewer.d.ts.map +1 -0
- package/lib/crystal3d/viewer/viewer.js +157 -0
- package/lib/crystal3d/viewer/viewer.js.map +1 -0
- package/lib/crystal3d.d.ts +12 -0
- package/lib/crystal3d.d.ts.map +1 -0
- package/lib/crystal3d.js +12 -0
- package/lib/crystal3d.js.map +1 -0
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/locales/de.json +19 -1
- package/lib/locales/en.json +19 -1
- package/lib/locales/es.json +19 -1
- package/lib/locales/fr.json +19 -1
- package/lib/locales/it.json +19 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.d.ts.map +1 -1
- package/lib/molecule3d/ui/MoleculeCanvas3D.js +16 -27
- package/lib/molecule3d/ui/MoleculeCanvas3D.js.map +1 -1
- package/lib/molstar/bonds/bondRule.d.ts +16 -0
- package/lib/molstar/bonds/bondRule.d.ts.map +1 -0
- package/lib/molstar/bonds/bondRule.js +23 -0
- package/lib/molstar/bonds/bondRule.js.map +1 -0
- package/lib/molstar/bonds/index.d.ts +9 -0
- package/lib/molstar/bonds/index.d.ts.map +1 -0
- package/lib/molstar/bonds/index.js +9 -0
- package/lib/molstar/bonds/index.js.map +1 -0
- package/lib/molstar/ui/MolstarToolbar.d.ts +47 -0
- package/lib/molstar/ui/MolstarToolbar.d.ts.map +1 -0
- package/lib/molstar/ui/MolstarToolbar.js +28 -0
- package/lib/molstar/ui/MolstarToolbar.js.map +1 -0
- package/lib/molstar/ui/index.d.ts +10 -0
- package/lib/molstar/ui/index.d.ts.map +1 -0
- package/lib/molstar/ui/index.js +8 -0
- package/lib/molstar/ui/index.js.map +1 -0
- package/lib/molstar/ui/useMolstarTools.d.ts +63 -0
- package/lib/molstar/ui/useMolstarTools.d.ts.map +1 -0
- package/lib/molstar/ui/useMolstarTools.js +36 -0
- package/lib/molstar/ui/useMolstarTools.js.map +1 -0
- package/package.json +4 -1
- package/src/crystal/core/bondGrid.ts +98 -0
- package/src/crystal/core/cellAtoms.ts +106 -0
- package/src/crystal/core/cellBonds.ts +121 -0
- package/src/crystal/core/cif/element.ts +40 -0
- package/src/crystal/core/cif/index.ts +12 -0
- package/src/crystal/core/cif/number.ts +62 -0
- package/src/crystal/core/cif/read.ts +218 -0
- package/src/crystal/core/cif/readGeometry.ts +104 -0
- package/src/crystal/core/cif/tags.ts +143 -0
- package/src/crystal/core/cif/types.ts +164 -0
- package/src/crystal/core/components.ts +183 -0
- package/src/crystal/core/covalentRadii.ts +56 -0
- package/src/crystal/core/disorder.ts +190 -0
- package/src/crystal/core/expand.ts +105 -0
- package/src/crystal/core/index.ts +46 -0
- package/src/crystal/core/moleculeOf.ts +169 -0
- package/src/crystal/core/moleculeTypes.ts +85 -0
- package/src/crystal/core/molecules.ts +128 -0
- package/src/crystal/core/operations.ts +79 -0
- package/src/crystal/core/packing.ts +116 -0
- package/src/crystal/core/periodicBonds.ts +234 -0
- package/src/crystal/core/resolve.ts +187 -0
- package/src/crystal/core/spaceGroups/index.ts +16 -0
- package/src/crystal/core/spaceGroups/spaceGroupOperations.ts +32 -0
- package/src/crystal/core/spaceGroups/spaceGroupRows.ts +536 -0
- package/src/crystal/core/spaceGroups/spaceGroupSymbols.ts +179 -0
- package/src/crystal/core/spaceGroups/spaceGroups.ts +154 -0
- package/src/crystal/core/symmetry/group.ts +42 -0
- package/src/crystal/core/symmetry/index.ts +23 -0
- package/src/crystal/core/symmetry/integerMatrix.ts +153 -0
- package/src/crystal/core/symmetry/lattice.ts +152 -0
- package/src/crystal/core/symmetry/operation.ts +223 -0
- package/src/crystal/core/symmetry/parseOperation.ts +180 -0
- package/src/crystal/core/symmetry/types.ts +32 -0
- package/src/crystal/core/symmetryClasses.ts +105 -0
- package/src/crystal.ts +12 -0
- package/src/crystal3d/core/cellClip.ts +229 -0
- package/src/crystal3d/core/cellGeometry.ts +193 -0
- package/src/crystal3d/core/cellStack.ts +87 -0
- package/src/crystal3d/core/crystalView.ts +114 -0
- package/src/crystal3d/core/drawingSet.ts +71 -0
- package/src/crystal3d/core/elementDrawing.ts +147 -0
- package/src/crystal3d/core/elementExtent.ts +81 -0
- package/src/crystal3d/core/elementLabels.ts +130 -0
- package/src/crystal3d/core/elementShapes.ts +141 -0
- package/src/crystal3d/core/frame.ts +56 -0
- package/src/crystal3d/core/framing.ts +101 -0
- package/src/crystal3d/core/index.ts +132 -0
- package/src/crystal3d/core/labelText.ts +44 -0
- package/src/crystal3d/core/latticeBasis.ts +110 -0
- package/src/crystal3d/core/mat3.ts +163 -0
- package/src/crystal3d/core/operationMatrix.ts +255 -0
- package/src/crystal3d/core/orientation.ts +229 -0
- package/src/crystal3d/core/palette.ts +43 -0
- package/src/crystal3d/core/primitives.ts +183 -0
- package/src/crystal3d/core/structureText.ts +43 -0
- package/src/crystal3d/core/supercell.ts +40 -0
- package/src/crystal3d/core/types.ts +186 -0
- package/src/crystal3d/core/vec3.ts +127 -0
- package/src/crystal3d/ui/CrystalCanvas3D.tsx +384 -0
- package/src/crystal3d/ui/CrystalStructureView.tsx +148 -0
- package/src/crystal3d/ui/CrystalStructureViewer.tsx +39 -0
- package/src/crystal3d/ui/CrystalViewControls.tsx +100 -0
- package/src/crystal3d/ui/CrystalViewer3D.tsx +183 -0
- package/src/crystal3d/ui/crystalScene.ts +100 -0
- package/src/crystal3d/ui/crystalStructureViewerProps.ts +54 -0
- package/src/crystal3d/ui/index.ts +20 -0
- package/src/crystal3d/ui/useCrystalCaption.ts +38 -0
- package/src/crystal3d/viewer/animate.ts +113 -0
- package/src/crystal3d/viewer/camera.ts +139 -0
- package/src/crystal3d/viewer/index.ts +13 -0
- package/src/crystal3d/viewer/layerRegistry.ts +47 -0
- package/src/crystal3d/viewer/meshPrimitives.ts +102 -0
- package/src/crystal3d/viewer/plugin.ts +258 -0
- package/src/crystal3d/viewer/renderCell.ts +98 -0
- package/src/crystal3d/viewer/renderElements.ts +121 -0
- package/src/crystal3d/viewer/renderStructure.ts +144 -0
- package/src/crystal3d/viewer/sceneParts.ts +119 -0
- package/src/crystal3d/viewer/shapeLayer.ts +108 -0
- package/src/crystal3d/viewer/textLayer.ts +85 -0
- package/src/crystal3d/viewer/viewer.ts +207 -0
- package/src/crystal3d.ts +12 -0
- package/src/locales/de.json +19 -1
- package/src/locales/en.json +19 -1
- package/src/locales/es.json +19 -1
- package/src/locales/fr.json +19 -1
- package/src/locales/it.json +19 -1
- package/src/molecule3d/ui/MoleculeCanvas3D.tsx +45 -71
- package/src/molstar/bonds/bondRule.ts +34 -0
- package/src/molstar/bonds/index.ts +9 -0
- package/src/molstar/ui/MolstarToolbar.tsx +103 -0
- package/src/molstar/ui/index.ts +14 -0
- package/src/molstar/ui/useMolstarTools.ts +98 -0
- package/styles/chrome.css +90 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { CrystalSite, CrystalStructure } from './cif/types.ts';
|
|
2
|
+
import type { ExpandedAtom } from './expand.ts';
|
|
3
|
+
import { expandSite } from './expand.ts';
|
|
4
|
+
import { structureOperations } from './operations.ts';
|
|
5
|
+
import { findPeriodicBonds } from './periodicBonds.ts';
|
|
6
|
+
import type { Lattice } from './symmetry/lattice.ts';
|
|
7
|
+
import { createLattice } from './symmetry/lattice.ts';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Two atoms of different disorder groups closer than this, in ångström, are
|
|
11
|
+
* alternatives: the two groups are never kept together.
|
|
12
|
+
*/
|
|
13
|
+
export const DISORDER_OVERLAP = 1.1;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The same, for two groups of one disorder assembly, which the file already
|
|
17
|
+
* says are alternatives where they meet: a CF₃ group turned by 60° puts its
|
|
18
|
+
* fluorines 1.3 Å from where they were.
|
|
19
|
+
*/
|
|
20
|
+
export const ASSEMBLY_OVERLAP = 2;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Which atoms of the asymmetric unit a molecule is built from, as
|
|
24
|
+
* {@link chooseDisorder} decides it.
|
|
25
|
+
* @param structure - What `readCif` returned.
|
|
26
|
+
* @returns One flag per site, 1 to keep it.
|
|
27
|
+
* @throws {Error} When the file names no space group and lists no operation.
|
|
28
|
+
*/
|
|
29
|
+
export function keptSites(structure: CrystalStructure): Uint8Array {
|
|
30
|
+
const operations = structureOperations(structure);
|
|
31
|
+
const atoms: ExpandedAtom[] = [];
|
|
32
|
+
for (let index = 0; index < structure.sites.length; index++) {
|
|
33
|
+
const site = structure.sites[index] as CrystalSite;
|
|
34
|
+
if (isDummy(site)) continue;
|
|
35
|
+
const images = expandSite(site, index, operations);
|
|
36
|
+
for (let image = 0; image < images.length; image++) {
|
|
37
|
+
atoms.push(images[image] as ExpandedAtom);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return chooseDisorder(structure.sites, atoms, createLattice(structure.cell));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Which atoms of the asymmetric unit a molecule is built from: one model of
|
|
45
|
+
* the crystal, never two disordered parts on top of each other.
|
|
46
|
+
*
|
|
47
|
+
* - A dummy atom (`_atom_site_calc_flag` `dum`) is never kept.
|
|
48
|
+
* - An atom in no disorder group — `.` or `0`, as SHELX writes it — is always
|
|
49
|
+
* kept.
|
|
50
|
+
* - The disorder groups, each named by its assembly and its group, are kept
|
|
51
|
+
* by decreasing mean occupancy, the one written first on a tie, and a group
|
|
52
|
+
* is left out when one of its atoms lies within {@link ASSEMBLY_OVERLAP} of
|
|
53
|
+
* an atom of another group of the same assembly already kept, or within
|
|
54
|
+
* {@link DISORDER_OVERLAP} of one of another assembly and another group
|
|
55
|
+
* number, symmetry copies included. Groups sharing a number — SHELX's
|
|
56
|
+
* `PART 1` in two assemblies — are never alternatives.
|
|
57
|
+
*
|
|
58
|
+
* So a 70:30 disorder keeps its major part, a 50:50 one the part written
|
|
59
|
+
* first, and several disorders of one structure each keep one part, however
|
|
60
|
+
* the file spreads them over assemblies.
|
|
61
|
+
* @param sites - The asymmetric unit, in file order.
|
|
62
|
+
* @param atoms - The atoms of one cell the sites that are not dummies make.
|
|
63
|
+
* @param lattice - The cell.
|
|
64
|
+
* @returns One flag per site, 1 to keep it.
|
|
65
|
+
*/
|
|
66
|
+
export function chooseDisorder(
|
|
67
|
+
sites: readonly CrystalSite[],
|
|
68
|
+
atoms: readonly ExpandedAtom[],
|
|
69
|
+
lattice: Lattice,
|
|
70
|
+
): Uint8Array {
|
|
71
|
+
const kept = new Uint8Array(sites.length);
|
|
72
|
+
const unitOf = new Int32Array(sites.length).fill(-1);
|
|
73
|
+
const units: DisorderUnit[] = [];
|
|
74
|
+
const unitIndex = new Map<string, number>();
|
|
75
|
+
for (let index = 0; index < sites.length; index++) {
|
|
76
|
+
const site = sites[index] as CrystalSite;
|
|
77
|
+
if (isDummy(site)) continue;
|
|
78
|
+
const group = disorderGroupOf(site);
|
|
79
|
+
if (group === null) {
|
|
80
|
+
kept[index] = 1;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const key = `${site.disorderAssembly ?? ''}\n${group}`;
|
|
84
|
+
let unit = unitIndex.get(key);
|
|
85
|
+
if (unit === undefined) {
|
|
86
|
+
unit = units.length;
|
|
87
|
+
unitIndex.set(key, unit);
|
|
88
|
+
units.push({
|
|
89
|
+
assembly: site.disorderAssembly ?? '',
|
|
90
|
+
group,
|
|
91
|
+
occupancy: 0,
|
|
92
|
+
count: 0,
|
|
93
|
+
first: index,
|
|
94
|
+
conflicts: [],
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const tally = units[unit] as DisorderUnit;
|
|
98
|
+
tally.occupancy += site.occupancy;
|
|
99
|
+
tally.count += 1;
|
|
100
|
+
unitOf[index] = unit;
|
|
101
|
+
}
|
|
102
|
+
if (units.length === 0) return kept;
|
|
103
|
+
findConflicts(units, unitOf, atoms, lattice);
|
|
104
|
+
const order = units.toSorted((a, b) => {
|
|
105
|
+
const difference = b.occupancy / b.count - a.occupancy / a.count;
|
|
106
|
+
return Math.abs(difference) > 1e-6 ? difference : a.first - b.first;
|
|
107
|
+
});
|
|
108
|
+
const chosen = new Set<DisorderUnit>();
|
|
109
|
+
for (const unit of order) {
|
|
110
|
+
let free = true;
|
|
111
|
+
for (const other of unit.conflicts) {
|
|
112
|
+
if (chosen.has(units[other] as DisorderUnit)) free = false;
|
|
113
|
+
}
|
|
114
|
+
if (free) chosen.add(unit);
|
|
115
|
+
}
|
|
116
|
+
for (let index = 0; index < sites.length; index++) {
|
|
117
|
+
const unit = unitOf[index] ?? -1;
|
|
118
|
+
if (unit !== -1 && chosen.has(units[unit] as DisorderUnit)) kept[index] = 1;
|
|
119
|
+
}
|
|
120
|
+
return kept;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The disorder group a site belongs to.
|
|
125
|
+
* @param site - One atom of the asymmetric unit.
|
|
126
|
+
* @returns The group as the file writes it, or `null` for an atom in none.
|
|
127
|
+
*/
|
|
128
|
+
export function disorderGroupOf(site: CrystalSite): string | null {
|
|
129
|
+
const group = site.disorderGroup;
|
|
130
|
+
return group === undefined || group === '0' ? null : group;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Whether a site is a dummy atom, which stands for no atom at all.
|
|
135
|
+
* @param site - One atom of the asymmetric unit.
|
|
136
|
+
* @returns Whether its calc flag is `dum`.
|
|
137
|
+
*/
|
|
138
|
+
export function isDummy(site: CrystalSite): boolean {
|
|
139
|
+
return site.calcFlag?.toLowerCase() === 'dum';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface DisorderUnit {
|
|
143
|
+
readonly assembly: string;
|
|
144
|
+
readonly group: string;
|
|
145
|
+
occupancy: number;
|
|
146
|
+
count: number;
|
|
147
|
+
first: number;
|
|
148
|
+
/** Indices of the units it may not be kept with. */
|
|
149
|
+
conflicts: number[];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Note which disorder groups put atoms on top of each other.
|
|
154
|
+
* @param units - The disorder groups; their conflicts are filled in.
|
|
155
|
+
* @param unitOf - The group of each site, -1 for none.
|
|
156
|
+
* @param atoms - The atoms of one cell.
|
|
157
|
+
* @param lattice - The cell.
|
|
158
|
+
*/
|
|
159
|
+
function findConflicts(
|
|
160
|
+
units: DisorderUnit[],
|
|
161
|
+
unitOf: Int32Array,
|
|
162
|
+
atoms: readonly ExpandedAtom[],
|
|
163
|
+
lattice: Lattice,
|
|
164
|
+
) {
|
|
165
|
+
const disordered: ExpandedAtom[] = [];
|
|
166
|
+
for (let index = 0; index < atoms.length; index++) {
|
|
167
|
+
const atom = atoms[index] as ExpandedAtom;
|
|
168
|
+
if ((unitOf[atom.siteIndex] ?? -1) !== -1) disordered.push(atom);
|
|
169
|
+
}
|
|
170
|
+
const close = findPeriodicBonds(disordered, lattice, () => ASSEMBLY_OVERLAP, {
|
|
171
|
+
samePlace: 0,
|
|
172
|
+
});
|
|
173
|
+
for (let pair = 0; pair < close.count; pair++) {
|
|
174
|
+
const first = disordered[close.from[pair] ?? 0] as ExpandedAtom;
|
|
175
|
+
const second = disordered[close.to[pair] ?? 0] as ExpandedAtom;
|
|
176
|
+
const a = unitOf[first.siteIndex] ?? -1;
|
|
177
|
+
const b = unitOf[second.siteIndex] ?? -1;
|
|
178
|
+
const unitA = units[a] as DisorderUnit;
|
|
179
|
+
const unitB = units[b] as DisorderUnit;
|
|
180
|
+
if (unitA.group === unitB.group) continue;
|
|
181
|
+
if (
|
|
182
|
+
unitA.assembly !== unitB.assembly &&
|
|
183
|
+
(close.lengths[pair] ?? 0) >= DISORDER_OVERLAP
|
|
184
|
+
) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
(units[a] as DisorderUnit).conflicts.push(b);
|
|
188
|
+
(units[b] as DisorderUnit).conflicts.push(a);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
|
|
11
|
+
import { orbit } from './symmetry/operation.ts';
|
|
12
|
+
import type { CrystalOperation, Dimension } from './symmetry/types.ts';
|
|
13
|
+
|
|
14
|
+
/** One line of the asymmetric unit, as a CIF or the atom table gives it. */
|
|
15
|
+
export interface AsymmetricSite {
|
|
16
|
+
/** `Na1` — the label the file uses, unique within the structure. */
|
|
17
|
+
readonly label: string;
|
|
18
|
+
/** Chemical symbol, `Na`. */
|
|
19
|
+
readonly element: string;
|
|
20
|
+
/** Fractional coordinate along **a**. */
|
|
21
|
+
readonly x: number;
|
|
22
|
+
/** Fractional coordinate along **b**. */
|
|
23
|
+
readonly y: number;
|
|
24
|
+
/** Fractional coordinate along **c**. */
|
|
25
|
+
readonly z: number;
|
|
26
|
+
/**
|
|
27
|
+
* How much of the site this atom occupies.
|
|
28
|
+
* @default 1
|
|
29
|
+
*/
|
|
30
|
+
readonly occupancy?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** One atom of the filled cell, and where it came from. */
|
|
34
|
+
export interface ExpandedAtom {
|
|
35
|
+
/** The label of the site it came from. */
|
|
36
|
+
readonly label: string;
|
|
37
|
+
readonly element: string;
|
|
38
|
+
/** Fractional position, wrapped into [0, 1). */
|
|
39
|
+
readonly position: readonly [number, number, number];
|
|
40
|
+
/** Index into the asymmetric unit it was generated from. */
|
|
41
|
+
readonly siteIndex: number;
|
|
42
|
+
/** Index into the operation list of the operation that generated it. */
|
|
43
|
+
readonly operationIndex: number;
|
|
44
|
+
readonly occupancy: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Every atom of one cell, in fractional coordinates.
|
|
49
|
+
* @param sites - The asymmetric unit, in the order the file lists it.
|
|
50
|
+
* @param operations - The full coset list of the setting, centring included.
|
|
51
|
+
* @param tolerance - Fractional distance below which two images are one atom.
|
|
52
|
+
* @default 1e-4
|
|
53
|
+
* @returns The atoms, grouped by the site they came from, each carrying the
|
|
54
|
+
* index of the operation that generated it.
|
|
55
|
+
*/
|
|
56
|
+
export function expandStructure(
|
|
57
|
+
sites: readonly AsymmetricSite[],
|
|
58
|
+
operations: ReadonlyArray<CrystalOperation<Dimension>>,
|
|
59
|
+
tolerance?: number,
|
|
60
|
+
): ExpandedAtom[] {
|
|
61
|
+
const atoms: ExpandedAtom[] = [];
|
|
62
|
+
for (let index = 0; index < sites.length; index++) {
|
|
63
|
+
const site = sites[index];
|
|
64
|
+
if (site === undefined) continue;
|
|
65
|
+
const images = expandSite(site, index, operations, tolerance);
|
|
66
|
+
for (let image = 0; image < images.length; image++) {
|
|
67
|
+
atoms.push(images[image] as ExpandedAtom);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return atoms;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The orbit of one site.
|
|
75
|
+
* @param site - The line of the asymmetric unit.
|
|
76
|
+
* @param siteIndex - Where it sits in that list, carried onto every atom.
|
|
77
|
+
* @param operations - The full coset list.
|
|
78
|
+
* @param tolerance - As {@link expandStructure}.
|
|
79
|
+
* @default 1e-4
|
|
80
|
+
* @returns One atom per distinct image, the site's own position first.
|
|
81
|
+
*/
|
|
82
|
+
export function expandSite(
|
|
83
|
+
site: AsymmetricSite,
|
|
84
|
+
siteIndex: number,
|
|
85
|
+
operations: ReadonlyArray<CrystalOperation<Dimension>>,
|
|
86
|
+
tolerance?: number,
|
|
87
|
+
): ExpandedAtom[] {
|
|
88
|
+
const images = orbit([site.x, site.y, site.z], operations, tolerance);
|
|
89
|
+
const atoms: ExpandedAtom[] = [];
|
|
90
|
+
for (const image of images) {
|
|
91
|
+
atoms.push({
|
|
92
|
+
label: site.label,
|
|
93
|
+
element: site.element,
|
|
94
|
+
position: [
|
|
95
|
+
image.position[0] ?? 0,
|
|
96
|
+
image.position[1] ?? 0,
|
|
97
|
+
image.position[2] ?? 0,
|
|
98
|
+
],
|
|
99
|
+
siteIndex,
|
|
100
|
+
operationIndex: image.operationIndex,
|
|
101
|
+
occupancy: site.occupancy ?? 1,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return atoms;
|
|
105
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type { CellAtoms, CellAtomsOptions } from './cellAtoms.ts';
|
|
2
|
+
export { crystalCellAtoms } from './cellAtoms.ts';
|
|
3
|
+
export * from './cif/index.ts';
|
|
4
|
+
export type { BondGraph, PeriodicComponent } from './components.ts';
|
|
5
|
+
export {
|
|
6
|
+
BOND_TOLERANCE,
|
|
7
|
+
covalentBondLimit,
|
|
8
|
+
covalentRadius,
|
|
9
|
+
} from './covalentRadii.ts';
|
|
10
|
+
export {
|
|
11
|
+
ASSEMBLY_OVERLAP,
|
|
12
|
+
DISORDER_OVERLAP,
|
|
13
|
+
chooseDisorder,
|
|
14
|
+
disorderGroupOf,
|
|
15
|
+
isDummy,
|
|
16
|
+
keptSites,
|
|
17
|
+
} from './disorder.ts';
|
|
18
|
+
export type { AsymmetricSite, ExpandedAtom } from './expand.ts';
|
|
19
|
+
export { expandSite, expandStructure } from './expand.ts';
|
|
20
|
+
export type {
|
|
21
|
+
CrystalMolecule,
|
|
22
|
+
CrystalMoleculeAtom,
|
|
23
|
+
CrystalMoleculeBond,
|
|
24
|
+
CrystalMolecules,
|
|
25
|
+
CrystalMoleculesOptions,
|
|
26
|
+
CrystalNetwork,
|
|
27
|
+
} from './moleculeTypes.ts';
|
|
28
|
+
export { SAME_ATOM_DISTANCE, crystalMolecules } from './molecules.ts';
|
|
29
|
+
export { structureOperations } from './operations.ts';
|
|
30
|
+
export type { PackingResult } from './packing.ts';
|
|
31
|
+
export { MAX_PACKED_ATOMS, packMolecules } from './packing.ts';
|
|
32
|
+
export type {
|
|
33
|
+
BondLimit,
|
|
34
|
+
PackedAtom,
|
|
35
|
+
PeriodicBondOptions,
|
|
36
|
+
PeriodicPairs,
|
|
37
|
+
} from './periodicBonds.ts';
|
|
38
|
+
export { findPeriodicBonds } from './periodicBonds.ts';
|
|
39
|
+
export type { ResolvedSetting } from './resolve.ts';
|
|
40
|
+
export {
|
|
41
|
+
operationsBelong,
|
|
42
|
+
resolveStructureSetting,
|
|
43
|
+
settingOfOperations,
|
|
44
|
+
} from './resolve.ts';
|
|
45
|
+
export * from './spaceGroups/index.ts';
|
|
46
|
+
export * from './symmetry/index.ts';
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { CrystalSite } from './cif/types.ts';
|
|
2
|
+
import type { BondGraph } from './components.ts';
|
|
3
|
+
import { disorderGroupOf } from './disorder.ts';
|
|
4
|
+
import type { ExpandedAtom } from './expand.ts';
|
|
5
|
+
import type {
|
|
6
|
+
CrystalMolecule,
|
|
7
|
+
CrystalMoleculeAtom,
|
|
8
|
+
CrystalMoleculeBond,
|
|
9
|
+
} from './moleculeTypes.ts';
|
|
10
|
+
import type { Lattice } from './symmetry/lattice.ts';
|
|
11
|
+
|
|
12
|
+
/** Slack on a centroid sitting on a cell face, so it lands in one cell only. */
|
|
13
|
+
const CENTRE_TOLERANCE = 1e-6;
|
|
14
|
+
|
|
15
|
+
/** What a molecule is read from: the cell, its bonds, and the walk over them. */
|
|
16
|
+
export interface MoleculeContext {
|
|
17
|
+
readonly atoms: readonly ExpandedAtom[];
|
|
18
|
+
readonly sites: readonly CrystalSite[];
|
|
19
|
+
readonly graph: BondGraph;
|
|
20
|
+
/** The cell each atom was reached in, three integers per atom. */
|
|
21
|
+
readonly shifts: Int32Array;
|
|
22
|
+
readonly lattice: Lattice;
|
|
23
|
+
/** Index of the identity in the operation list, -1 when it is absent. */
|
|
24
|
+
readonly identityIndex: number;
|
|
25
|
+
/** One slot per atom of the cell, -1 everywhere between two calls. */
|
|
26
|
+
readonly localOf: Int32Array;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* One molecule, whole, placed where the file wrote it.
|
|
31
|
+
*
|
|
32
|
+
* The molecule is moved by a whole number of cells so the first atom the
|
|
33
|
+
* file's own position generates sits at the coordinates the file gives it.
|
|
34
|
+
* A molecule with no such atom is moved to the cell its centre falls in.
|
|
35
|
+
* @param members - Its atoms, as indices into the cell.
|
|
36
|
+
* @param copies - How many copies of it one cell holds.
|
|
37
|
+
* @param context - The cell it is read from.
|
|
38
|
+
* @returns The molecule.
|
|
39
|
+
*/
|
|
40
|
+
export function buildMolecule(
|
|
41
|
+
members: readonly number[],
|
|
42
|
+
copies: number,
|
|
43
|
+
context: MoleculeContext,
|
|
44
|
+
): CrystalMolecule {
|
|
45
|
+
const { atoms, sites, shifts, lattice, localOf } = context;
|
|
46
|
+
const order = moleculeOrder(members, context);
|
|
47
|
+
const move = placement(order, context);
|
|
48
|
+
const m = lattice.cartesian;
|
|
49
|
+
const placed: CrystalMoleculeAtom[] = [];
|
|
50
|
+
for (let local = 0; local < order.length; local++) {
|
|
51
|
+
const index = order[local] ?? 0;
|
|
52
|
+
localOf[index] = local;
|
|
53
|
+
const atom = atoms[index] as ExpandedAtom;
|
|
54
|
+
const site = sites[atom.siteIndex] as CrystalSite;
|
|
55
|
+
const fractional = [0, 0, 0];
|
|
56
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
57
|
+
fractional[axis] =
|
|
58
|
+
(atom.position[axis] ?? 0) +
|
|
59
|
+
(shifts[index * 3 + axis] ?? 0) +
|
|
60
|
+
(move[axis] ?? 0);
|
|
61
|
+
}
|
|
62
|
+
const [x = 0, y = 0, z = 0] = fractional;
|
|
63
|
+
placed.push({
|
|
64
|
+
element: atom.element,
|
|
65
|
+
label: atom.label,
|
|
66
|
+
siteIndex: atom.siteIndex,
|
|
67
|
+
operationIndex: atom.operationIndex,
|
|
68
|
+
position: [
|
|
69
|
+
(m[0]?.[0] ?? 0) * x + (m[0]?.[1] ?? 0) * y + (m[0]?.[2] ?? 0) * z,
|
|
70
|
+
(m[1]?.[0] ?? 0) * x + (m[1]?.[1] ?? 0) * y + (m[1]?.[2] ?? 0) * z,
|
|
71
|
+
(m[2]?.[0] ?? 0) * x + (m[2]?.[1] ?? 0) * y + (m[2]?.[2] ?? 0) * z,
|
|
72
|
+
],
|
|
73
|
+
occupancy: atom.occupancy,
|
|
74
|
+
disorderGroup: disorderGroupOf(site),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const bonds = moleculeBonds(order, context);
|
|
78
|
+
for (let local = 0; local < order.length; local++) {
|
|
79
|
+
localOf[order[local] ?? 0] = -1;
|
|
80
|
+
}
|
|
81
|
+
return { atoms: placed, bonds, copies };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The atoms the identity generates first, in site order, then the others by
|
|
86
|
+
* operation and site.
|
|
87
|
+
* @param members - The atoms of the molecule, as indices into the cell.
|
|
88
|
+
* @param context - The cell they are read from.
|
|
89
|
+
* @returns The atoms, as indices into the cell, in molecule order.
|
|
90
|
+
*/
|
|
91
|
+
function moleculeOrder(
|
|
92
|
+
members: readonly number[],
|
|
93
|
+
context: MoleculeContext,
|
|
94
|
+
): Int32Array {
|
|
95
|
+
const { atoms, sites, identityIndex } = context;
|
|
96
|
+
const total = atoms.length;
|
|
97
|
+
const keys = new Float64Array(members.length);
|
|
98
|
+
for (let index = 0; index < members.length; index++) {
|
|
99
|
+
const member = members[index] ?? 0;
|
|
100
|
+
const atom = atoms[member] as ExpandedAtom;
|
|
101
|
+
const rank =
|
|
102
|
+
atom.operationIndex === identityIndex ? 0 : atom.operationIndex + 1;
|
|
103
|
+
keys[index] = (rank * sites.length + atom.siteIndex) * total + member;
|
|
104
|
+
}
|
|
105
|
+
const sorted = keys.toSorted();
|
|
106
|
+
const order = new Int32Array(members.length);
|
|
107
|
+
for (let index = 0; index < sorted.length; index++) {
|
|
108
|
+
order[index] = (sorted[index] ?? 0) % total;
|
|
109
|
+
}
|
|
110
|
+
return order;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The whole cells that put the molecule where the file wrote it.
|
|
115
|
+
* @param order - The atoms of the molecule, in molecule order.
|
|
116
|
+
* @param context - The cell they are read from.
|
|
117
|
+
* @returns The cell translation, in whole cells.
|
|
118
|
+
*/
|
|
119
|
+
function placement(
|
|
120
|
+
order: Int32Array,
|
|
121
|
+
context: MoleculeContext,
|
|
122
|
+
): [number, number, number] {
|
|
123
|
+
const { atoms, sites, shifts, identityIndex } = context;
|
|
124
|
+
const first = order[0] ?? 0;
|
|
125
|
+
const anchor = atoms[first] as ExpandedAtom;
|
|
126
|
+
if (anchor.operationIndex === identityIndex) {
|
|
127
|
+
const site = sites[anchor.siteIndex] as CrystalSite;
|
|
128
|
+
return [
|
|
129
|
+
Math.round(site.x - (anchor.position[0] + (shifts[first * 3] ?? 0))),
|
|
130
|
+
Math.round(site.y - (anchor.position[1] + (shifts[first * 3 + 1] ?? 0))),
|
|
131
|
+
Math.round(site.z - (anchor.position[2] + (shifts[first * 3 + 2] ?? 0))),
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
const centre = [0, 0, 0];
|
|
135
|
+
for (let local = 0; local < order.length; local++) {
|
|
136
|
+
const index = order[local] ?? 0;
|
|
137
|
+
const position = (atoms[index] as ExpandedAtom).position;
|
|
138
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
139
|
+
centre[axis] =
|
|
140
|
+
(centre[axis] ?? 0) +
|
|
141
|
+
(position[axis] ?? 0) +
|
|
142
|
+
(shifts[index * 3 + axis] ?? 0);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return [
|
|
146
|
+
-Math.floor((centre[0] ?? 0) / order.length + CENTRE_TOLERANCE),
|
|
147
|
+
-Math.floor((centre[1] ?? 0) / order.length + CENTRE_TOLERANCE),
|
|
148
|
+
-Math.floor((centre[2] ?? 0) / order.length + CENTRE_TOLERANCE),
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function moleculeBonds(
|
|
153
|
+
order: Int32Array,
|
|
154
|
+
context: MoleculeContext,
|
|
155
|
+
): CrystalMoleculeBond[] {
|
|
156
|
+
const { graph, localOf } = context;
|
|
157
|
+
const bonds: CrystalMoleculeBond[] = [];
|
|
158
|
+
for (let from = 0; from < order.length; from++) {
|
|
159
|
+
const index = order[from] ?? 0;
|
|
160
|
+
const last = graph.offsets[index + 1] ?? 0;
|
|
161
|
+
for (let bond = graph.offsets[index] ?? 0; bond < last; bond++) {
|
|
162
|
+
const to = localOf[graph.targets[bond] ?? 0] ?? -1;
|
|
163
|
+
if (to > from) {
|
|
164
|
+
bonds.push({ from, to, length: graph.lengths[bond] ?? 0 });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return bonds.toSorted((a, b) => a.from - b.from || a.to - b.to);
|
|
169
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { BondLimit } from './periodicBonds.ts';
|
|
2
|
+
|
|
3
|
+
/** Options of `crystalMolecules`. */
|
|
4
|
+
export interface CrystalMoleculesOptions {
|
|
5
|
+
/**
|
|
6
|
+
* When two atoms are bonded.
|
|
7
|
+
* @default covalentBondLimit
|
|
8
|
+
*/
|
|
9
|
+
readonly bondLimit?: BondLimit;
|
|
10
|
+
/**
|
|
11
|
+
* The most atoms one cell may hold. A larger cell is not searched, and the
|
|
12
|
+
* result says so with `tooLarge`.
|
|
13
|
+
* @default 100000
|
|
14
|
+
*/
|
|
15
|
+
readonly maxAtoms?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** One atom of a molecule. */
|
|
19
|
+
export interface CrystalMoleculeAtom {
|
|
20
|
+
/** Chemical symbol, e.g. `C`. */
|
|
21
|
+
readonly element: string;
|
|
22
|
+
/** The label of the site it is a copy of, e.g. `C12`. */
|
|
23
|
+
readonly label: string;
|
|
24
|
+
/** Index into `structure.sites` of that site. */
|
|
25
|
+
readonly siteIndex: number;
|
|
26
|
+
/** Index into the operation list of the operation that put it here. */
|
|
27
|
+
readonly operationIndex: number;
|
|
28
|
+
/** Cartesian coordinates, in ångström, in the cell's Cartesian frame. */
|
|
29
|
+
readonly position: readonly [number, number, number];
|
|
30
|
+
/** How much of the site the atom occupies, 1 when the file gives none. */
|
|
31
|
+
readonly occupancy: number;
|
|
32
|
+
/** The disorder group of its site, or `null` when it is in none. */
|
|
33
|
+
readonly disorderGroup: string | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** One bond of a molecule. */
|
|
37
|
+
export interface CrystalMoleculeBond {
|
|
38
|
+
/** Index into the molecule's atoms. */
|
|
39
|
+
readonly from: number;
|
|
40
|
+
/** Index into the molecule's atoms, always above `from`. */
|
|
41
|
+
readonly to: number;
|
|
42
|
+
/** In ångström. */
|
|
43
|
+
readonly length: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** One crystallographically independent molecule, whole. */
|
|
47
|
+
export interface CrystalMolecule {
|
|
48
|
+
/**
|
|
49
|
+
* Its atoms: the copies the file's own position generates first, in the
|
|
50
|
+
* order the file lists their sites, then those its symmetry completes.
|
|
51
|
+
*/
|
|
52
|
+
readonly atoms: readonly CrystalMoleculeAtom[];
|
|
53
|
+
/** Its bonds, ordered on `from` then `to`. */
|
|
54
|
+
readonly bonds: readonly CrystalMoleculeBond[];
|
|
55
|
+
/** How many copies of it one cell holds. */
|
|
56
|
+
readonly copies: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** A set of atoms bonded to its own translate: a chain, a layer or a framework. */
|
|
60
|
+
export interface CrystalNetwork {
|
|
61
|
+
/** The sites of the asymmetric unit it is built from, ascending. */
|
|
62
|
+
readonly siteIndices: readonly number[];
|
|
63
|
+
/** How many atoms of one cell belong to it, every symmetry copy included. */
|
|
64
|
+
readonly cellAtoms: number;
|
|
65
|
+
/** How many independent directions it extends along: 1, 2 or 3. */
|
|
66
|
+
readonly periodicity: 1 | 2 | 3;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** What `crystalMolecules` found. */
|
|
70
|
+
export interface CrystalMolecules {
|
|
71
|
+
/**
|
|
72
|
+
* One per crystallographically independent molecule — a lone ion or atom
|
|
73
|
+
* included — ordered on the first site of the file each holds.
|
|
74
|
+
*/
|
|
75
|
+
readonly molecules: readonly CrystalMolecule[];
|
|
76
|
+
/** One per independent network, ordered the same way. */
|
|
77
|
+
readonly networks: readonly CrystalNetwork[];
|
|
78
|
+
/**
|
|
79
|
+
* How many atoms one cell holds, once the disorder left out and the atoms
|
|
80
|
+
* written twice are removed.
|
|
81
|
+
*/
|
|
82
|
+
readonly cellAtoms: number;
|
|
83
|
+
/** Whether the cell held more than `maxAtoms` atoms, so nothing was searched. */
|
|
84
|
+
readonly tooLarge: boolean;
|
|
85
|
+
}
|