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,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The asymmetric unit becomes the cell.
|
|
3
|
+
*
|
|
4
|
+
* Every atom the space group generates comes from `orbit()`, which walks the
|
|
5
|
+
* coset list in exact integer arithmetic, so a special position is deduplicated
|
|
6
|
+
* rather than drawn four times on top of itself. Each atom remembers the site it
|
|
7
|
+
* came from and the operation that put it there, which is what lets the page say
|
|
8
|
+
* this chlorine is the one the c glide made*.
|
|
9
|
+
*/
|
|
10
|
+
import { orbit } from "./symmetry/operation.js";
|
|
11
|
+
/**
|
|
12
|
+
* Every atom of one cell, in fractional coordinates.
|
|
13
|
+
* @param sites - The asymmetric unit, in the order the file lists it.
|
|
14
|
+
* @param operations - The full coset list of the setting, centring included.
|
|
15
|
+
* @param tolerance - Fractional distance below which two images are one atom.
|
|
16
|
+
* @default 1e-4
|
|
17
|
+
* @returns The atoms, grouped by the site they came from, each carrying the
|
|
18
|
+
* index of the operation that generated it.
|
|
19
|
+
*/
|
|
20
|
+
export function expandStructure(sites, operations, tolerance) {
|
|
21
|
+
const atoms = [];
|
|
22
|
+
for (let index = 0; index < sites.length; index++) {
|
|
23
|
+
const site = sites[index];
|
|
24
|
+
if (site === undefined)
|
|
25
|
+
continue;
|
|
26
|
+
const images = expandSite(site, index, operations, tolerance);
|
|
27
|
+
for (let image = 0; image < images.length; image++) {
|
|
28
|
+
atoms.push(images[image]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return atoms;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The orbit of one site.
|
|
35
|
+
* @param site - The line of the asymmetric unit.
|
|
36
|
+
* @param siteIndex - Where it sits in that list, carried onto every atom.
|
|
37
|
+
* @param operations - The full coset list.
|
|
38
|
+
* @param tolerance - As {@link expandStructure}.
|
|
39
|
+
* @default 1e-4
|
|
40
|
+
* @returns One atom per distinct image, the site's own position first.
|
|
41
|
+
*/
|
|
42
|
+
export function expandSite(site, siteIndex, operations, tolerance) {
|
|
43
|
+
const images = orbit([site.x, site.y, site.z], operations, tolerance);
|
|
44
|
+
const atoms = [];
|
|
45
|
+
for (const image of images) {
|
|
46
|
+
atoms.push({
|
|
47
|
+
label: site.label,
|
|
48
|
+
element: site.element,
|
|
49
|
+
position: [
|
|
50
|
+
image.position[0] ?? 0,
|
|
51
|
+
image.position[1] ?? 0,
|
|
52
|
+
image.position[2] ?? 0,
|
|
53
|
+
],
|
|
54
|
+
siteIndex,
|
|
55
|
+
operationIndex: image.operationIndex,
|
|
56
|
+
occupancy: site.occupancy ?? 1,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return atoms;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/crystal/core/expand.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAoChD;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAgC,EAChC,UAAsD,EACtD,SAAkB;IAElB,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,IAAI,KAAK,SAAS;YAAE,SAAS;QACjC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAC9D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAiB,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,IAAoB,EACpB,SAAiB,EACjB,UAAsD,EACtD,SAAkB;IAElB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACtE,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC;YACT,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE;gBACR,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;gBACtB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;gBACtB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;aACvB;YACD,SAAS;YACT,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { BOND_TOLERANCE, covalentBondLimit, covalentRadius, } from './covalentRadii.ts';
|
|
6
|
+
export { ASSEMBLY_OVERLAP, DISORDER_OVERLAP, chooseDisorder, disorderGroupOf, isDummy, keptSites, } from './disorder.ts';
|
|
7
|
+
export type { AsymmetricSite, ExpandedAtom } from './expand.ts';
|
|
8
|
+
export { expandSite, expandStructure } from './expand.ts';
|
|
9
|
+
export type { CrystalMolecule, CrystalMoleculeAtom, CrystalMoleculeBond, CrystalMolecules, CrystalMoleculesOptions, CrystalNetwork, } from './moleculeTypes.ts';
|
|
10
|
+
export { SAME_ATOM_DISTANCE, crystalMolecules } from './molecules.ts';
|
|
11
|
+
export { structureOperations } from './operations.ts';
|
|
12
|
+
export type { PackingResult } from './packing.ts';
|
|
13
|
+
export { MAX_PACKED_ATOMS, packMolecules } from './packing.ts';
|
|
14
|
+
export type { BondLimit, PackedAtom, PeriodicBondOptions, PeriodicPairs, } from './periodicBonds.ts';
|
|
15
|
+
export { findPeriodicBonds } from './periodicBonds.ts';
|
|
16
|
+
export type { ResolvedSetting } from './resolve.ts';
|
|
17
|
+
export { operationsBelong, resolveStructureSetting, settingOfOperations, } from './resolve.ts';
|
|
18
|
+
export * from './spaceGroups/index.ts';
|
|
19
|
+
export * from './symmetry/index.ts';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,OAAO,EACP,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,YAAY,EACV,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { crystalCellAtoms } from "./cellAtoms.js";
|
|
2
|
+
export * from "./cif/index.js";
|
|
3
|
+
export { BOND_TOLERANCE, covalentBondLimit, covalentRadius, } from "./covalentRadii.js";
|
|
4
|
+
export { ASSEMBLY_OVERLAP, DISORDER_OVERLAP, chooseDisorder, disorderGroupOf, isDummy, keptSites, } from "./disorder.js";
|
|
5
|
+
export { expandSite, expandStructure } from "./expand.js";
|
|
6
|
+
export { SAME_ATOM_DISTANCE, crystalMolecules } from "./molecules.js";
|
|
7
|
+
export { structureOperations } from "./operations.js";
|
|
8
|
+
export { MAX_PACKED_ATOMS, packMolecules } from "./packing.js";
|
|
9
|
+
export { findPeriodicBonds } from "./periodicBonds.js";
|
|
10
|
+
export { operationsBelong, resolveStructureSetting, settingOfOperations, } from "./resolve.js";
|
|
11
|
+
export * from "./spaceGroups/index.js";
|
|
12
|
+
export * from "./symmetry/index.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/crystal/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,OAAO,EACP,SAAS,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAS1D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CrystalSite } from './cif/types.ts';
|
|
2
|
+
import type { BondGraph } from './components.ts';
|
|
3
|
+
import type { ExpandedAtom } from './expand.ts';
|
|
4
|
+
import type { CrystalMolecule } from './moleculeTypes.ts';
|
|
5
|
+
import type { Lattice } from './symmetry/lattice.ts';
|
|
6
|
+
/** What a molecule is read from: the cell, its bonds, and the walk over them. */
|
|
7
|
+
export interface MoleculeContext {
|
|
8
|
+
readonly atoms: readonly ExpandedAtom[];
|
|
9
|
+
readonly sites: readonly CrystalSite[];
|
|
10
|
+
readonly graph: BondGraph;
|
|
11
|
+
/** The cell each atom was reached in, three integers per atom. */
|
|
12
|
+
readonly shifts: Int32Array;
|
|
13
|
+
readonly lattice: Lattice;
|
|
14
|
+
/** Index of the identity in the operation list, -1 when it is absent. */
|
|
15
|
+
readonly identityIndex: number;
|
|
16
|
+
/** One slot per atom of the cell, -1 everywhere between two calls. */
|
|
17
|
+
readonly localOf: Int32Array;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One molecule, whole, placed where the file wrote it.
|
|
21
|
+
*
|
|
22
|
+
* The molecule is moved by a whole number of cells so the first atom the
|
|
23
|
+
* file's own position generates sits at the coordinates the file gives it.
|
|
24
|
+
* A molecule with no such atom is moved to the cell its centre falls in.
|
|
25
|
+
* @param members - Its atoms, as indices into the cell.
|
|
26
|
+
* @param copies - How many copies of it one cell holds.
|
|
27
|
+
* @param context - The cell it is read from.
|
|
28
|
+
* @returns The molecule.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildMolecule(members: readonly number[], copies: number, context: MoleculeContext): CrystalMolecule;
|
|
31
|
+
//# sourceMappingURL=moleculeOf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moleculeOf.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/moleculeOf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAKrD,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;CAC9B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,GACvB,eAAe,CAsCjB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { disorderGroupOf } from "./disorder.js";
|
|
2
|
+
/** Slack on a centroid sitting on a cell face, so it lands in one cell only. */
|
|
3
|
+
const CENTRE_TOLERANCE = 1e-6;
|
|
4
|
+
/**
|
|
5
|
+
* One molecule, whole, placed where the file wrote it.
|
|
6
|
+
*
|
|
7
|
+
* The molecule is moved by a whole number of cells so the first atom the
|
|
8
|
+
* file's own position generates sits at the coordinates the file gives it.
|
|
9
|
+
* A molecule with no such atom is moved to the cell its centre falls in.
|
|
10
|
+
* @param members - Its atoms, as indices into the cell.
|
|
11
|
+
* @param copies - How many copies of it one cell holds.
|
|
12
|
+
* @param context - The cell it is read from.
|
|
13
|
+
* @returns The molecule.
|
|
14
|
+
*/
|
|
15
|
+
export function buildMolecule(members, copies, context) {
|
|
16
|
+
const { atoms, sites, shifts, lattice, localOf } = context;
|
|
17
|
+
const order = moleculeOrder(members, context);
|
|
18
|
+
const move = placement(order, context);
|
|
19
|
+
const m = lattice.cartesian;
|
|
20
|
+
const placed = [];
|
|
21
|
+
for (let local = 0; local < order.length; local++) {
|
|
22
|
+
const index = order[local] ?? 0;
|
|
23
|
+
localOf[index] = local;
|
|
24
|
+
const atom = atoms[index];
|
|
25
|
+
const site = sites[atom.siteIndex];
|
|
26
|
+
const fractional = [0, 0, 0];
|
|
27
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
28
|
+
fractional[axis] =
|
|
29
|
+
(atom.position[axis] ?? 0) +
|
|
30
|
+
(shifts[index * 3 + axis] ?? 0) +
|
|
31
|
+
(move[axis] ?? 0);
|
|
32
|
+
}
|
|
33
|
+
const [x = 0, y = 0, z = 0] = fractional;
|
|
34
|
+
placed.push({
|
|
35
|
+
element: atom.element,
|
|
36
|
+
label: atom.label,
|
|
37
|
+
siteIndex: atom.siteIndex,
|
|
38
|
+
operationIndex: atom.operationIndex,
|
|
39
|
+
position: [
|
|
40
|
+
(m[0]?.[0] ?? 0) * x + (m[0]?.[1] ?? 0) * y + (m[0]?.[2] ?? 0) * z,
|
|
41
|
+
(m[1]?.[0] ?? 0) * x + (m[1]?.[1] ?? 0) * y + (m[1]?.[2] ?? 0) * z,
|
|
42
|
+
(m[2]?.[0] ?? 0) * x + (m[2]?.[1] ?? 0) * y + (m[2]?.[2] ?? 0) * z,
|
|
43
|
+
],
|
|
44
|
+
occupancy: atom.occupancy,
|
|
45
|
+
disorderGroup: disorderGroupOf(site),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const bonds = moleculeBonds(order, context);
|
|
49
|
+
for (let local = 0; local < order.length; local++) {
|
|
50
|
+
localOf[order[local] ?? 0] = -1;
|
|
51
|
+
}
|
|
52
|
+
return { atoms: placed, bonds, copies };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The atoms the identity generates first, in site order, then the others by
|
|
56
|
+
* operation and site.
|
|
57
|
+
* @param members - The atoms of the molecule, as indices into the cell.
|
|
58
|
+
* @param context - The cell they are read from.
|
|
59
|
+
* @returns The atoms, as indices into the cell, in molecule order.
|
|
60
|
+
*/
|
|
61
|
+
function moleculeOrder(members, context) {
|
|
62
|
+
const { atoms, sites, identityIndex } = context;
|
|
63
|
+
const total = atoms.length;
|
|
64
|
+
const keys = new Float64Array(members.length);
|
|
65
|
+
for (let index = 0; index < members.length; index++) {
|
|
66
|
+
const member = members[index] ?? 0;
|
|
67
|
+
const atom = atoms[member];
|
|
68
|
+
const rank = atom.operationIndex === identityIndex ? 0 : atom.operationIndex + 1;
|
|
69
|
+
keys[index] = (rank * sites.length + atom.siteIndex) * total + member;
|
|
70
|
+
}
|
|
71
|
+
const sorted = keys.toSorted();
|
|
72
|
+
const order = new Int32Array(members.length);
|
|
73
|
+
for (let index = 0; index < sorted.length; index++) {
|
|
74
|
+
order[index] = (sorted[index] ?? 0) % total;
|
|
75
|
+
}
|
|
76
|
+
return order;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The whole cells that put the molecule where the file wrote it.
|
|
80
|
+
* @param order - The atoms of the molecule, in molecule order.
|
|
81
|
+
* @param context - The cell they are read from.
|
|
82
|
+
* @returns The cell translation, in whole cells.
|
|
83
|
+
*/
|
|
84
|
+
function placement(order, context) {
|
|
85
|
+
const { atoms, sites, shifts, identityIndex } = context;
|
|
86
|
+
const first = order[0] ?? 0;
|
|
87
|
+
const anchor = atoms[first];
|
|
88
|
+
if (anchor.operationIndex === identityIndex) {
|
|
89
|
+
const site = sites[anchor.siteIndex];
|
|
90
|
+
return [
|
|
91
|
+
Math.round(site.x - (anchor.position[0] + (shifts[first * 3] ?? 0))),
|
|
92
|
+
Math.round(site.y - (anchor.position[1] + (shifts[first * 3 + 1] ?? 0))),
|
|
93
|
+
Math.round(site.z - (anchor.position[2] + (shifts[first * 3 + 2] ?? 0))),
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
const centre = [0, 0, 0];
|
|
97
|
+
for (let local = 0; local < order.length; local++) {
|
|
98
|
+
const index = order[local] ?? 0;
|
|
99
|
+
const position = atoms[index].position;
|
|
100
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
101
|
+
centre[axis] =
|
|
102
|
+
(centre[axis] ?? 0) +
|
|
103
|
+
(position[axis] ?? 0) +
|
|
104
|
+
(shifts[index * 3 + axis] ?? 0);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return [
|
|
108
|
+
-Math.floor((centre[0] ?? 0) / order.length + CENTRE_TOLERANCE),
|
|
109
|
+
-Math.floor((centre[1] ?? 0) / order.length + CENTRE_TOLERANCE),
|
|
110
|
+
-Math.floor((centre[2] ?? 0) / order.length + CENTRE_TOLERANCE),
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
function moleculeBonds(order, context) {
|
|
114
|
+
const { graph, localOf } = context;
|
|
115
|
+
const bonds = [];
|
|
116
|
+
for (let from = 0; from < order.length; from++) {
|
|
117
|
+
const index = order[from] ?? 0;
|
|
118
|
+
const last = graph.offsets[index + 1] ?? 0;
|
|
119
|
+
for (let bond = graph.offsets[index] ?? 0; bond < last; bond++) {
|
|
120
|
+
const to = localOf[graph.targets[bond] ?? 0] ?? -1;
|
|
121
|
+
if (to > from) {
|
|
122
|
+
bonds.push({ from, to, length: graph.lengths[bond] ?? 0 });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return bonds.toSorted((a, b) => a.from - b.from || a.to - b.to);
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=moleculeOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moleculeOf.js","sourceRoot":"","sources":["../../../src/crystal/core/moleculeOf.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAShD,gFAAgF;AAChF,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAgB9B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAC3B,OAA0B,EAC1B,MAAc,EACd,OAAwB;IAExB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC3D,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAC5B,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QACvB,MAAM,IAAI,GAAG,KAAK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AAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { BondLimit } from './periodicBonds.ts';
|
|
2
|
+
/** Options of `crystalMolecules`. */
|
|
3
|
+
export interface CrystalMoleculesOptions {
|
|
4
|
+
/**
|
|
5
|
+
* When two atoms are bonded.
|
|
6
|
+
* @default covalentBondLimit
|
|
7
|
+
*/
|
|
8
|
+
readonly bondLimit?: BondLimit;
|
|
9
|
+
/**
|
|
10
|
+
* The most atoms one cell may hold. A larger cell is not searched, and the
|
|
11
|
+
* result says so with `tooLarge`.
|
|
12
|
+
* @default 100000
|
|
13
|
+
*/
|
|
14
|
+
readonly maxAtoms?: number;
|
|
15
|
+
}
|
|
16
|
+
/** One atom of a molecule. */
|
|
17
|
+
export interface CrystalMoleculeAtom {
|
|
18
|
+
/** Chemical symbol, e.g. `C`. */
|
|
19
|
+
readonly element: string;
|
|
20
|
+
/** The label of the site it is a copy of, e.g. `C12`. */
|
|
21
|
+
readonly label: string;
|
|
22
|
+
/** Index into `structure.sites` of that site. */
|
|
23
|
+
readonly siteIndex: number;
|
|
24
|
+
/** Index into the operation list of the operation that put it here. */
|
|
25
|
+
readonly operationIndex: number;
|
|
26
|
+
/** Cartesian coordinates, in ångström, in the cell's Cartesian frame. */
|
|
27
|
+
readonly position: readonly [number, number, number];
|
|
28
|
+
/** How much of the site the atom occupies, 1 when the file gives none. */
|
|
29
|
+
readonly occupancy: number;
|
|
30
|
+
/** The disorder group of its site, or `null` when it is in none. */
|
|
31
|
+
readonly disorderGroup: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** One bond of a molecule. */
|
|
34
|
+
export interface CrystalMoleculeBond {
|
|
35
|
+
/** Index into the molecule's atoms. */
|
|
36
|
+
readonly from: number;
|
|
37
|
+
/** Index into the molecule's atoms, always above `from`. */
|
|
38
|
+
readonly to: number;
|
|
39
|
+
/** In ångström. */
|
|
40
|
+
readonly length: number;
|
|
41
|
+
}
|
|
42
|
+
/** One crystallographically independent molecule, whole. */
|
|
43
|
+
export interface CrystalMolecule {
|
|
44
|
+
/**
|
|
45
|
+
* Its atoms: the copies the file's own position generates first, in the
|
|
46
|
+
* order the file lists their sites, then those its symmetry completes.
|
|
47
|
+
*/
|
|
48
|
+
readonly atoms: readonly CrystalMoleculeAtom[];
|
|
49
|
+
/** Its bonds, ordered on `from` then `to`. */
|
|
50
|
+
readonly bonds: readonly CrystalMoleculeBond[];
|
|
51
|
+
/** How many copies of it one cell holds. */
|
|
52
|
+
readonly copies: number;
|
|
53
|
+
}
|
|
54
|
+
/** A set of atoms bonded to its own translate: a chain, a layer or a framework. */
|
|
55
|
+
export interface CrystalNetwork {
|
|
56
|
+
/** The sites of the asymmetric unit it is built from, ascending. */
|
|
57
|
+
readonly siteIndices: readonly number[];
|
|
58
|
+
/** How many atoms of one cell belong to it, every symmetry copy included. */
|
|
59
|
+
readonly cellAtoms: number;
|
|
60
|
+
/** How many independent directions it extends along: 1, 2 or 3. */
|
|
61
|
+
readonly periodicity: 1 | 2 | 3;
|
|
62
|
+
}
|
|
63
|
+
/** What `crystalMolecules` found. */
|
|
64
|
+
export interface CrystalMolecules {
|
|
65
|
+
/**
|
|
66
|
+
* One per crystallographically independent molecule — a lone ion or atom
|
|
67
|
+
* included — ordered on the first site of the file each holds.
|
|
68
|
+
*/
|
|
69
|
+
readonly molecules: readonly CrystalMolecule[];
|
|
70
|
+
/** One per independent network, ordered the same way. */
|
|
71
|
+
readonly networks: readonly CrystalNetwork[];
|
|
72
|
+
/**
|
|
73
|
+
* How many atoms one cell holds, once the disorder left out and the atoms
|
|
74
|
+
* written twice are removed.
|
|
75
|
+
*/
|
|
76
|
+
readonly cellAtoms: number;
|
|
77
|
+
/** Whether the cell held more than `maxAtoms` atoms, so nothing was searched. */
|
|
78
|
+
readonly tooLarge: boolean;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=moleculeTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moleculeTypes.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/moleculeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,qCAAqC;AACrC,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,8BAA8B;AAC9B,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,8BAA8B;AAC9B,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACjC;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moleculeTypes.js","sourceRoot":"","sources":["../../../src/crystal/core/moleculeTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CrystalStructure } from './cif/types.ts';
|
|
2
|
+
import type { CrystalMolecules, CrystalMoleculesOptions } from './moleculeTypes.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Two atoms closer than this, in ångström, are one atom written twice: no
|
|
5
|
+
* bond is that short.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SAME_ATOM_DISTANCE = 0.5;
|
|
8
|
+
/**
|
|
9
|
+
* The molecules of a crystal, each whole and once.
|
|
10
|
+
*
|
|
11
|
+
* The asymmetric unit is expanded into the cell, the cell is bonded across its
|
|
12
|
+
* faces by `bondLimit`, and every connected set of atoms is walked. Copies the
|
|
13
|
+
* space group makes of one molecule share the sites they are built from, so
|
|
14
|
+
* they are told apart from an independent molecule by that alone: Z′ = 2 gives
|
|
15
|
+
* two molecules, the four images of a molecule in P2₁/c give one, and a
|
|
16
|
+
* molecule sitting on a special position comes out whole, both halves of it.
|
|
17
|
+
*
|
|
18
|
+
* - **Networks** — a set of atoms bonded to its own translate: a salt, a
|
|
19
|
+
* mineral, a metal, a coordination polymer — are reported in `networks` and
|
|
20
|
+
* never returned as molecules.
|
|
21
|
+
* - **Disorder**: the atoms in no disorder group are kept, and the disorder
|
|
22
|
+
* groups by decreasing mean occupancy, each unless it overlaps one already
|
|
23
|
+
* kept — the major part of each disorder (see `chooseDisorder`). An atom of
|
|
24
|
+
* a negative group, as SHELX writes disorder about a special position, is
|
|
25
|
+
* not bonded to a symmetry copy of an atom in a disorder group, as SHELX
|
|
26
|
+
* itself does.
|
|
27
|
+
* - **Hydrogen** holds one bond, to its nearest neighbour.
|
|
28
|
+
* - **Atoms written twice** — two sites, or two images of one site, closer than
|
|
29
|
+
* {@link SAME_ATOM_DISTANCE} — are one atom: the higher occupancy is kept,
|
|
30
|
+
* the one written first on a tie.
|
|
31
|
+
* @param structure - What `readCif` returned.
|
|
32
|
+
* @param options - Options.
|
|
33
|
+
* @returns The independent molecules, in Cartesian coordinates, and the
|
|
34
|
+
* networks.
|
|
35
|
+
* @throws {Error} When the file names no space group and lists no operation, or its
|
|
36
|
+
* cell has angles no cell can have.
|
|
37
|
+
*/
|
|
38
|
+
export declare function crystalMolecules(structure: CrystalStructure, options?: CrystalMoleculesOptions): CrystalMolecules;
|
|
39
|
+
//# sourceMappingURL=molecules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"molecules.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/molecules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKvD,OAAO,KAAK,EAEV,gBAAgB,EAChB,uBAAuB,EAExB,MAAM,oBAAoB,CAAC;AAU5B;;;GAGG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,gBAAgB,EAC3B,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CAyDlB"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { crystalCellAtoms } from "./cellAtoms.js";
|
|
2
|
+
import { keptPairs, writtenTwice } from "./cellBonds.js";
|
|
3
|
+
import { bondGraph, walkComponents } from "./components.js";
|
|
4
|
+
import { covalentBondLimit } from "./covalentRadii.js";
|
|
5
|
+
import { buildMolecule } from "./moleculeOf.js";
|
|
6
|
+
import { findPeriodicBonds } from "./periodicBonds.js";
|
|
7
|
+
import { isIdentity } from "./symmetry/operation.js";
|
|
8
|
+
import { representative, siteIndicesOf, symmetryClasses, } from "./symmetryClasses.js";
|
|
9
|
+
/**
|
|
10
|
+
* Two atoms closer than this, in ångström, are one atom written twice: no
|
|
11
|
+
* bond is that short.
|
|
12
|
+
*/
|
|
13
|
+
export const SAME_ATOM_DISTANCE = 0.5;
|
|
14
|
+
/**
|
|
15
|
+
* The molecules of a crystal, each whole and once.
|
|
16
|
+
*
|
|
17
|
+
* The asymmetric unit is expanded into the cell, the cell is bonded across its
|
|
18
|
+
* faces by `bondLimit`, and every connected set of atoms is walked. Copies the
|
|
19
|
+
* space group makes of one molecule share the sites they are built from, so
|
|
20
|
+
* they are told apart from an independent molecule by that alone: Z′ = 2 gives
|
|
21
|
+
* two molecules, the four images of a molecule in P2₁/c give one, and a
|
|
22
|
+
* molecule sitting on a special position comes out whole, both halves of it.
|
|
23
|
+
*
|
|
24
|
+
* - **Networks** — a set of atoms bonded to its own translate: a salt, a
|
|
25
|
+
* mineral, a metal, a coordination polymer — are reported in `networks` and
|
|
26
|
+
* never returned as molecules.
|
|
27
|
+
* - **Disorder**: the atoms in no disorder group are kept, and the disorder
|
|
28
|
+
* groups by decreasing mean occupancy, each unless it overlaps one already
|
|
29
|
+
* kept — the major part of each disorder (see `chooseDisorder`). An atom of
|
|
30
|
+
* a negative group, as SHELX writes disorder about a special position, is
|
|
31
|
+
* not bonded to a symmetry copy of an atom in a disorder group, as SHELX
|
|
32
|
+
* itself does.
|
|
33
|
+
* - **Hydrogen** holds one bond, to its nearest neighbour.
|
|
34
|
+
* - **Atoms written twice** — two sites, or two images of one site, closer than
|
|
35
|
+
* {@link SAME_ATOM_DISTANCE} — are one atom: the higher occupancy is kept,
|
|
36
|
+
* the one written first on a tie.
|
|
37
|
+
* @param structure - What `readCif` returned.
|
|
38
|
+
* @param options - Options.
|
|
39
|
+
* @returns The independent molecules, in Cartesian coordinates, and the
|
|
40
|
+
* networks.
|
|
41
|
+
* @throws {Error} When the file names no space group and lists no operation, or its
|
|
42
|
+
* cell has angles no cell can have.
|
|
43
|
+
*/
|
|
44
|
+
export function crystalMolecules(structure, options = {}) {
|
|
45
|
+
const { bondLimit = covalentBondLimit, maxAtoms = 100_000 } = options;
|
|
46
|
+
const cell = crystalCellAtoms(structure, { maxAtoms });
|
|
47
|
+
if (cell.tooLarge) {
|
|
48
|
+
return {
|
|
49
|
+
molecules: [],
|
|
50
|
+
networks: [],
|
|
51
|
+
cellAtoms: cell.count,
|
|
52
|
+
tooLarge: true,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const { lattice, operations, atoms } = cell;
|
|
56
|
+
const { sites } = structure;
|
|
57
|
+
const pairs = findPeriodicBonds(atoms, lattice, bondLimit, {
|
|
58
|
+
samePlace: SAME_ATOM_DISTANCE,
|
|
59
|
+
});
|
|
60
|
+
const removed = writtenTwice(atoms, pairs.coincident);
|
|
61
|
+
const graph = bondGraph(atoms.length, pairs, keptPairs(pairs, atoms, sites, removed));
|
|
62
|
+
const { components, shifts } = walkComponents(graph, removed);
|
|
63
|
+
const context = {
|
|
64
|
+
atoms,
|
|
65
|
+
sites,
|
|
66
|
+
graph,
|
|
67
|
+
shifts,
|
|
68
|
+
lattice,
|
|
69
|
+
identityIndex: identityIndexOf(operations),
|
|
70
|
+
localOf: new Int32Array(atoms.length).fill(-1),
|
|
71
|
+
};
|
|
72
|
+
const molecules = [];
|
|
73
|
+
const networks = [];
|
|
74
|
+
for (const members of symmetryClasses(components, atoms, sites.length)) {
|
|
75
|
+
let periodicity = 0;
|
|
76
|
+
let cellAtoms = 0;
|
|
77
|
+
for (const component of members) {
|
|
78
|
+
periodicity = Math.max(periodicity, component.periodicity);
|
|
79
|
+
cellAtoms += component.atoms.length;
|
|
80
|
+
}
|
|
81
|
+
if (periodicity > 0) {
|
|
82
|
+
networks.push({
|
|
83
|
+
siteIndices: siteIndicesOf(members, atoms),
|
|
84
|
+
cellAtoms,
|
|
85
|
+
periodicity: periodicity,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const chosen = representative(members, atoms, context.identityIndex);
|
|
90
|
+
molecules.push(buildMolecule(chosen.atoms, members.length, context));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
let cellAtoms = atoms.length;
|
|
94
|
+
for (let index = 0; index < removed.length; index++) {
|
|
95
|
+
cellAtoms -= removed[index] ?? 0;
|
|
96
|
+
}
|
|
97
|
+
return { molecules, networks, cellAtoms, tooLarge: false };
|
|
98
|
+
}
|
|
99
|
+
function identityIndexOf(operations) {
|
|
100
|
+
for (let index = 0; index < operations.length; index++) {
|
|
101
|
+
if (isIdentity(operations[index]))
|
|
102
|
+
return index;
|
|
103
|
+
}
|
|
104
|
+
return -1;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=molecules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"molecules.js","sourceRoot":"","sources":["../../../src/crystal/core/molecules.ts"],"names":[],"mappings":"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AC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;YACrE,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACpD,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7D,CAAC;AAED,SAAS,eAAe,CACtB,UAA8C;IAE9C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACvD,IAAI,UAAU,CAAC,UAAU,CAAC,KAAK,CAAwB,CAAC;YAAE,OAAO,KAAK,CAAC;IACzE,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CrystalStructure } from './cif/types.ts';
|
|
2
|
+
import type { CrystalOperation } from './symmetry/types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The full coset list a structure's asymmetric unit is expanded with.
|
|
5
|
+
*
|
|
6
|
+
* The file's own operations come first, in file order, so an atom's
|
|
7
|
+
* `operationIndex` points at the line of the file that made it. A file that
|
|
8
|
+
* lists only part of the group — one coset of a centred group, or a few
|
|
9
|
+
* generators — is completed: from the setting its symbol names when every
|
|
10
|
+
* listed operation belongs to it, else by composing the listed ones. A file
|
|
11
|
+
* that lists none, or one that cannot be read, is expanded with the setting its
|
|
12
|
+
* Hall symbol, Hermann–Mauguin symbol or number names.
|
|
13
|
+
* @param structure - What `readCif` returned.
|
|
14
|
+
* @returns The operations, the identity among them.
|
|
15
|
+
* @throws {Error} When no listed operation can be used and the file names no space
|
|
16
|
+
* group the catalogue knows.
|
|
17
|
+
*/
|
|
18
|
+
export declare function structureOperations(structure: CrystalStructure): ReadonlyArray<CrystalOperation<3>>;
|
|
19
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/crystal/core/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,gBAAgB,GAC1B,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CA0BpC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { resolveStructureSetting } from "./resolve.js";
|
|
2
|
+
import { spaceGroupOperations } from "./spaceGroups/spaceGroupOperations.js";
|
|
3
|
+
import { closure } from "./symmetry/group.js";
|
|
4
|
+
import { operationKey } from "./symmetry/operation.js";
|
|
5
|
+
import { parseOperation } from "./symmetry/parseOperation.js";
|
|
6
|
+
/**
|
|
7
|
+
* The full coset list a structure's asymmetric unit is expanded with.
|
|
8
|
+
*
|
|
9
|
+
* The file's own operations come first, in file order, so an atom's
|
|
10
|
+
* `operationIndex` points at the line of the file that made it. A file that
|
|
11
|
+
* lists only part of the group — one coset of a centred group, or a few
|
|
12
|
+
* generators — is completed: from the setting its symbol names when every
|
|
13
|
+
* listed operation belongs to it, else by composing the listed ones. A file
|
|
14
|
+
* that lists none, or one that cannot be read, is expanded with the setting its
|
|
15
|
+
* Hall symbol, Hermann–Mauguin symbol or number names.
|
|
16
|
+
* @param structure - What `readCif` returned.
|
|
17
|
+
* @returns The operations, the identity among them.
|
|
18
|
+
* @throws {Error} When no listed operation can be used and the file names no space
|
|
19
|
+
* group the catalogue knows.
|
|
20
|
+
*/
|
|
21
|
+
export function structureOperations(structure) {
|
|
22
|
+
const resolved = resolveStructureSetting(structure);
|
|
23
|
+
const listed = readListed(structure.symopsXyz);
|
|
24
|
+
if (typeof listed === 'string' || listed.length === 0) {
|
|
25
|
+
if (resolved.setting !== null) {
|
|
26
|
+
return spaceGroupOperations(resolved.setting);
|
|
27
|
+
}
|
|
28
|
+
throw new Error(typeof listed === 'string'
|
|
29
|
+
? `This CIF names no space group this reader knows, and its operation list cannot be read: ${listed}.`
|
|
30
|
+
: 'This CIF names no space group this reader knows, and lists no symmetry operation.');
|
|
31
|
+
}
|
|
32
|
+
const keys = new Set();
|
|
33
|
+
const operations = [];
|
|
34
|
+
appendNew(operations, keys, listed);
|
|
35
|
+
if (resolved.setting !== null && resolved.agrees === true) {
|
|
36
|
+
appendNew(operations, keys, spaceGroupOperations(resolved.setting));
|
|
37
|
+
return operations;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
appendNew(operations, keys, closure(operations));
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Operations that close on no group are left as the file wrote them.
|
|
44
|
+
}
|
|
45
|
+
return operations;
|
|
46
|
+
}
|
|
47
|
+
function readListed(symopsXyz) {
|
|
48
|
+
const operations = [];
|
|
49
|
+
for (const xyz of symopsXyz) {
|
|
50
|
+
try {
|
|
51
|
+
operations.push(parseOperation(xyz, 3));
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return error instanceof Error ? error.message : String(error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return operations;
|
|
58
|
+
}
|
|
59
|
+
function appendNew(operations, keys, candidates) {
|
|
60
|
+
for (const operation of candidates) {
|
|
61
|
+
const key = operationKey(operation);
|
|
62
|
+
if (keys.has(key))
|
|
63
|
+
continue;
|
|
64
|
+
keys.add(key);
|
|
65
|
+
operations.push(operation);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/crystal/core/operations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAA2B;IAE3B,MAAM,QAAQ,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC9B,OAAO,oBAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;QACD,MAAM,IAAI,KAAK,CACb,OAAO,MAAM,KAAK,QAAQ;YACxB,CAAC,CAAC,2FAA2F,MAAM,GAAG;YACtG,CAAC,CAAC,mFAAmF,CACxF,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,UAAU,GAA+B,EAAE,CAAC;IAClD,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EA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