matterviz 0.3.4 → 0.3.6
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/.vscode/launch.json +13 -0
- package/.vscodeignore +7 -0
- package/dist/assets/STLExporter-BpTH3YHE.js +8 -0
- package/dist/assets/browser-DdDecX_W.js +1 -0
- package/dist/assets/export-qgn-H9y6.js +2 -0
- package/dist/assets/main-DiKYzti2.css +1 -0
- package/dist/assets/moyo_wasm_bg-0ocwg7xY.wasm +0 -0
- package/dist/extension.js +31293 -0
- package/dist/src/lib/FilePicker.svelte +360 -0
- package/dist/src/lib/MillerIndexInput.svelte +66 -0
- package/dist/src/lib/api/mp.ts +26 -0
- package/dist/src/lib/api/optimade.ts +204 -0
- package/dist/src/lib/app.css +247 -0
- package/dist/src/lib/brillouin/BrillouinZone.svelte +549 -0
- package/dist/src/lib/brillouin/BrillouinZoneControls.svelte +144 -0
- package/dist/src/lib/brillouin/BrillouinZoneExportPane.svelte +146 -0
- package/dist/src/lib/brillouin/BrillouinZoneInfoPane.svelte +146 -0
- package/dist/src/lib/brillouin/BrillouinZoneScene.svelte +476 -0
- package/dist/src/lib/brillouin/BrillouinZoneTooltip.svelte +92 -0
- package/dist/src/lib/brillouin/compute.ts +529 -0
- package/dist/src/lib/brillouin/index.ts +8 -0
- package/dist/src/lib/brillouin/types.ts +51 -0
- package/dist/src/lib/chempot-diagram/ChemPotDiagram.svelte +327 -0
- package/dist/src/lib/chempot-diagram/ChemPotDiagram2D.svelte +846 -0
- package/dist/src/lib/chempot-diagram/ChemPotDiagram3D.svelte +3193 -0
- package/dist/src/lib/chempot-diagram/async-compute.svelte.ts +94 -0
- package/dist/src/lib/chempot-diagram/chempot-worker.ts +11 -0
- package/dist/src/lib/chempot-diagram/color.ts +42 -0
- package/dist/src/lib/chempot-diagram/compute.ts +1014 -0
- package/dist/src/lib/chempot-diagram/index.ts +6 -0
- package/dist/src/lib/chempot-diagram/pointer.ts +56 -0
- package/dist/src/lib/chempot-diagram/temperature.ts +77 -0
- package/dist/src/lib/chempot-diagram/types.ts +130 -0
- package/dist/src/lib/colors/index.ts +249 -0
- package/dist/src/lib/composition/BarChart.svelte +297 -0
- package/dist/src/lib/composition/BubbleChart.svelte +218 -0
- package/dist/src/lib/composition/Composition.svelte +165 -0
- package/dist/src/lib/composition/Formula.svelte +268 -0
- package/dist/src/lib/composition/FormulaFilter.svelte +1257 -0
- package/dist/src/lib/composition/PieChart.svelte +323 -0
- package/dist/src/lib/composition/format.ts +155 -0
- package/dist/src/lib/composition/index.ts +37 -0
- package/dist/src/lib/composition/parse.ts +605 -0
- package/dist/src/lib/constants.ts +134 -0
- package/dist/src/lib/controls.ts +42 -0
- package/dist/src/lib/convex-hull/ConvexHull.svelte +157 -0
- package/dist/src/lib/convex-hull/ConvexHull2D.svelte +825 -0
- package/dist/src/lib/convex-hull/ConvexHull3D.svelte +1801 -0
- package/dist/src/lib/convex-hull/ConvexHull4D.svelte +1398 -0
- package/dist/src/lib/convex-hull/ConvexHullControls.svelte +535 -0
- package/dist/src/lib/convex-hull/ConvexHullInfoPane.svelte +125 -0
- package/dist/src/lib/convex-hull/ConvexHullStats.svelte +929 -0
- package/dist/src/lib/convex-hull/ConvexHullTooltip.svelte +131 -0
- package/dist/src/lib/convex-hull/GasPressureControls.svelte +247 -0
- package/dist/src/lib/convex-hull/StructurePopup.svelte +151 -0
- package/dist/src/lib/convex-hull/TemperatureSlider.svelte +140 -0
- package/dist/src/lib/convex-hull/barycentric-coords.ts +246 -0
- package/dist/src/lib/convex-hull/demo-temperature.ts +63 -0
- package/dist/src/lib/convex-hull/gas-thermodynamics.ts +405 -0
- package/dist/src/lib/convex-hull/helpers.ts +932 -0
- package/dist/src/lib/convex-hull/index.ts +202 -0
- package/dist/src/lib/convex-hull/thermodynamics.ts +2192 -0
- package/dist/src/lib/convex-hull/types.ts +267 -0
- package/dist/src/lib/coordination/CoordinationBarPlot.svelte +311 -0
- package/dist/src/lib/coordination/calc-coordination.ts +93 -0
- package/dist/src/lib/coordination/index.ts +9 -0
- package/dist/src/lib/effects.svelte.ts +48 -0
- package/dist/src/lib/element/BohrAtom.svelte +147 -0
- package/dist/src/lib/element/ElementHeading.svelte +26 -0
- package/dist/src/lib/element/ElementPhoto.svelte +57 -0
- package/dist/src/lib/element/ElementStats.svelte +80 -0
- package/dist/src/lib/element/ElementTile.svelte +484 -0
- package/dist/src/lib/element/data.json.gz.d.ts +4 -0
- package/dist/src/lib/element/data.ts +14 -0
- package/dist/src/lib/element/index.ts +8 -0
- package/dist/src/lib/element/types.ts +62 -0
- package/dist/src/lib/feedback/ClickFeedback.svelte +58 -0
- package/dist/src/lib/feedback/DragOverlay.svelte +42 -0
- package/dist/src/lib/feedback/index.ts +4 -0
- package/dist/src/lib/fermi-surface/FermiSlice.svelte +189 -0
- package/dist/src/lib/fermi-surface/FermiSurface.svelte +600 -0
- package/dist/src/lib/fermi-surface/FermiSurfaceControls.svelte +448 -0
- package/dist/src/lib/fermi-surface/FermiSurfaceScene.svelte +794 -0
- package/dist/src/lib/fermi-surface/FermiSurfaceTooltip.svelte +111 -0
- package/dist/src/lib/fermi-surface/compute.ts +728 -0
- package/dist/src/lib/fermi-surface/constants.ts +32 -0
- package/dist/src/lib/fermi-surface/export.ts +64 -0
- package/dist/src/lib/fermi-surface/index.ts +14 -0
- package/dist/src/lib/fermi-surface/marching-cubes.ts +3 -0
- package/dist/src/lib/fermi-surface/parse.ts +574 -0
- package/dist/src/lib/fermi-surface/symmetry.ts +56 -0
- package/dist/src/lib/fermi-surface/types.ts +159 -0
- package/dist/src/lib/heatmap-matrix/HeatmapMatrix.svelte +1545 -0
- package/dist/src/lib/heatmap-matrix/HeatmapMatrixControls.svelte +225 -0
- package/dist/src/lib/heatmap-matrix/index.ts +167 -0
- package/dist/src/lib/heatmap-matrix/shared.ts +7 -0
- package/dist/src/lib/icons.ts +650 -0
- package/dist/src/lib/index.ts +61 -0
- package/dist/src/lib/io/decompress.ts +92 -0
- package/dist/src/lib/io/export.ts +385 -0
- package/dist/src/lib/io/fetch.ts +46 -0
- package/dist/src/lib/io/file-drop.ts +51 -0
- package/dist/src/lib/io/index.ts +7 -0
- package/dist/src/lib/io/is-binary.ts +24 -0
- package/dist/src/lib/io/types.ts +8 -0
- package/dist/src/lib/io/url-drop.ts +141 -0
- package/dist/src/lib/isosurface/Isosurface.svelte +285 -0
- package/dist/src/lib/isosurface/IsosurfaceControls.svelte +277 -0
- package/dist/src/lib/isosurface/index.ts +7 -0
- package/dist/src/lib/isosurface/parse.ts +656 -0
- package/dist/src/lib/isosurface/slice.ts +175 -0
- package/dist/src/lib/isosurface/types.ts +309 -0
- package/dist/src/lib/labels.ts +320 -0
- package/dist/src/lib/layout/FullscreenToggle.svelte +50 -0
- package/dist/src/lib/layout/InfoCard.svelte +120 -0
- package/dist/src/lib/layout/InfoTag.svelte +185 -0
- package/dist/src/lib/layout/PropertyFilter.svelte +246 -0
- package/dist/src/lib/layout/SettingsSection.svelte +148 -0
- package/dist/src/lib/layout/SubpageGrid.svelte +82 -0
- package/dist/src/lib/layout/fullscreen.ts +65 -0
- package/dist/src/lib/layout/index.ts +11 -0
- package/dist/src/lib/layout/json-tree/JsonNode.svelte +548 -0
- package/dist/src/lib/layout/json-tree/JsonTree.svelte +1230 -0
- package/dist/src/lib/layout/json-tree/JsonValue.svelte +334 -0
- package/dist/src/lib/layout/json-tree/index.ts +3 -0
- package/dist/src/lib/layout/json-tree/types.ts +126 -0
- package/dist/src/lib/layout/json-tree/utils.ts +682 -0
- package/dist/src/lib/marching-cubes.ts +614 -0
- package/dist/src/lib/math.ts +1081 -0
- package/dist/src/lib/overlays/ContextMenu.svelte +162 -0
- package/dist/src/lib/overlays/CopyButton.svelte +45 -0
- package/dist/src/lib/overlays/DragControlTab.svelte +98 -0
- package/dist/src/lib/overlays/DraggablePane.svelte +487 -0
- package/dist/src/lib/overlays/InfoPaneCards.svelte +149 -0
- package/dist/src/lib/overlays/index.ts +3 -0
- package/dist/src/lib/periodic-table/PeriodicTable.svelte +469 -0
- package/dist/src/lib/periodic-table/PeriodicTableControls.svelte +557 -0
- package/dist/src/lib/periodic-table/PropertySelect.svelte +37 -0
- package/dist/src/lib/periodic-table/index.ts +12 -0
- package/dist/src/lib/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +1086 -0
- package/dist/src/lib/phase-diagram/PhaseDiagramControls.svelte +444 -0
- package/dist/src/lib/phase-diagram/PhaseDiagramEditorPane.svelte +126 -0
- package/dist/src/lib/phase-diagram/PhaseDiagramExportPane.svelte +184 -0
- package/dist/src/lib/phase-diagram/PhaseDiagramTooltip.svelte +391 -0
- package/dist/src/lib/phase-diagram/TdbInfoPanel.svelte +203 -0
- package/dist/src/lib/phase-diagram/build-diagram.ts +186 -0
- package/dist/src/lib/phase-diagram/colors.ts +58 -0
- package/dist/src/lib/phase-diagram/diagram-input.ts +40 -0
- package/dist/src/lib/phase-diagram/index.ts +13 -0
- package/dist/src/lib/phase-diagram/parse.ts +348 -0
- package/dist/src/lib/phase-diagram/svg-to-diagram.ts +1023 -0
- package/dist/src/lib/phase-diagram/types.ts +144 -0
- package/dist/src/lib/phase-diagram/utils.ts +775 -0
- package/dist/src/lib/plot/AxisLabel.svelte +51 -0
- package/dist/src/lib/plot/BarPlot.svelte +2113 -0
- package/dist/src/lib/plot/BarPlotControls.svelte +66 -0
- package/dist/src/lib/plot/BinnedScatterPlot.svelte +1114 -0
- package/dist/src/lib/plot/ColorBar.svelte +721 -0
- package/dist/src/lib/plot/ColorScaleSelect.svelte +54 -0
- package/dist/src/lib/plot/ElementScatter.svelte +63 -0
- package/dist/src/lib/plot/FillArea.svelte +223 -0
- package/dist/src/lib/plot/Histogram.svelte +1558 -0
- package/dist/src/lib/plot/HistogramControls.svelte +212 -0
- package/dist/src/lib/plot/InteractiveAxisLabel.svelte +96 -0
- package/dist/src/lib/plot/Line.svelte +84 -0
- package/dist/src/lib/plot/PlotAxis.svelte +169 -0
- package/dist/src/lib/plot/PlotControls.svelte +537 -0
- package/dist/src/lib/plot/PlotLegend.svelte +569 -0
- package/dist/src/lib/plot/PlotTooltip.svelte +67 -0
- package/dist/src/lib/plot/PortalSelect.svelte +253 -0
- package/dist/src/lib/plot/ReferenceLine3D.svelte +156 -0
- package/dist/src/lib/plot/ReferencePlane.svelte +175 -0
- package/dist/src/lib/plot/ScatterPlot.svelte +2778 -0
- package/dist/src/lib/plot/ScatterPlot3D.svelte +529 -0
- package/dist/src/lib/plot/ScatterPlot3DControls.svelte +437 -0
- package/dist/src/lib/plot/ScatterPlot3DScene.svelte +912 -0
- package/dist/src/lib/plot/ScatterPlotControls.svelte +306 -0
- package/dist/src/lib/plot/ScatterPoint.svelte +182 -0
- package/dist/src/lib/plot/SpacegroupBarPlot.svelte +293 -0
- package/dist/src/lib/plot/Surface3D.svelte +197 -0
- package/dist/src/lib/plot/ZeroLines.svelte +97 -0
- package/dist/src/lib/plot/ZoomRect.svelte +23 -0
- package/dist/src/lib/plot/adaptive-density.ts +316 -0
- package/dist/src/lib/plot/auto-place.ts +184 -0
- package/dist/src/lib/plot/axis-utils.ts +122 -0
- package/dist/src/lib/plot/binned-scatter-types.ts +83 -0
- package/dist/src/lib/plot/data-cleaning.ts +1069 -0
- package/dist/src/lib/plot/data-transform.ts +69 -0
- package/dist/src/lib/plot/defaults.ts +9 -0
- package/dist/src/lib/plot/fill-utils.ts +494 -0
- package/dist/src/lib/plot/hover-lock.svelte.ts +60 -0
- package/dist/src/lib/plot/index.ts +53 -0
- package/dist/src/lib/plot/interactions.ts +119 -0
- package/dist/src/lib/plot/layout.ts +425 -0
- package/dist/src/lib/plot/reference-line.ts +426 -0
- package/dist/src/lib/plot/scales.ts +654 -0
- package/dist/src/lib/plot/svg.ts +23 -0
- package/dist/src/lib/plot/types.ts +1144 -0
- package/dist/src/lib/plot/utils/label-placement.ts +541 -0
- package/dist/src/lib/plot/utils/series-visibility.ts +140 -0
- package/dist/src/lib/plot/utils.ts +11 -0
- package/dist/src/lib/rdf/RdfPlot.svelte +247 -0
- package/dist/src/lib/rdf/calc-rdf.ts +167 -0
- package/dist/src/lib/rdf/index.ts +27 -0
- package/dist/src/lib/sanitize.ts +126 -0
- package/dist/src/lib/settings.ts +1479 -0
- package/dist/src/lib/spectral/Bands.svelte +1040 -0
- package/dist/src/lib/spectral/BandsAndDos.svelte +134 -0
- package/dist/src/lib/spectral/BrillouinBandsDos.svelte +252 -0
- package/dist/src/lib/spectral/Dos.svelte +697 -0
- package/dist/src/lib/spectral/helpers.ts +1381 -0
- package/dist/src/lib/spectral/index.ts +8 -0
- package/dist/src/lib/spectral/types.ts +112 -0
- package/dist/src/lib/state.svelte.ts +64 -0
- package/dist/src/lib/structure/Arrow.svelte +72 -0
- package/dist/src/lib/structure/AtomLegend.svelte +815 -0
- package/dist/src/lib/structure/Bond.svelte +140 -0
- package/dist/src/lib/structure/CanvasTooltip.svelte +33 -0
- package/dist/src/lib/structure/CellSelect.svelte +349 -0
- package/dist/src/lib/structure/Cylinder.svelte +45 -0
- package/dist/src/lib/structure/Lattice.svelte +196 -0
- package/dist/src/lib/structure/Structure.svelte +2248 -0
- package/dist/src/lib/structure/StructureControls.svelte +1273 -0
- package/dist/src/lib/structure/StructureExportPane.svelte +252 -0
- package/dist/src/lib/structure/StructureInfoPane.svelte +737 -0
- package/dist/src/lib/structure/StructureScene.svelte +2255 -0
- package/dist/src/lib/structure/atom-properties.ts +316 -0
- package/dist/src/lib/structure/bond-order-perception.ts +447 -0
- package/dist/src/lib/structure/bonding.ts +944 -0
- package/dist/src/lib/structure/export.ts +861 -0
- package/dist/src/lib/structure/index.ts +291 -0
- package/dist/src/lib/structure/label-placement.ts +130 -0
- package/dist/src/lib/structure/measure.ts +45 -0
- package/dist/src/lib/structure/parse.ts +1705 -0
- package/dist/src/lib/structure/partial-occupancy.ts +183 -0
- package/dist/src/lib/structure/pbc.ts +164 -0
- package/dist/src/lib/structure/supercell.ts +226 -0
- package/dist/src/lib/structure/validation.ts +11 -0
- package/dist/src/lib/symmetry/SymmetryStats.svelte +226 -0
- package/dist/src/lib/symmetry/WyckoffTable.svelte +120 -0
- package/dist/src/lib/symmetry/cell-transform.ts +118 -0
- package/dist/src/lib/symmetry/index.ts +348 -0
- package/dist/src/lib/symmetry/spacegroups.ts +404 -0
- package/dist/src/lib/table/HeatmapTable.svelte +1833 -0
- package/dist/src/lib/table/ToggleMenu.svelte +385 -0
- package/dist/src/lib/table/index.ts +139 -0
- package/dist/src/lib/theme/ThemeControl.svelte +53 -0
- package/dist/src/lib/theme/index.ts +107 -0
- package/dist/src/lib/theme/themes.mjs +297 -0
- package/dist/src/lib/time.ts +71 -0
- package/dist/src/lib/tooltip/TooltipContent.svelte +58 -0
- package/dist/src/lib/tooltip/index.ts +2 -0
- package/dist/src/lib/tooltip/types.ts +13 -0
- package/dist/src/lib/trajectory/Trajectory.svelte +1545 -0
- package/dist/src/lib/trajectory/TrajectoryError.svelte +128 -0
- package/dist/src/lib/trajectory/TrajectoryExportPane.svelte +357 -0
- package/dist/src/lib/trajectory/TrajectoryInfoPane.svelte +313 -0
- package/dist/src/lib/trajectory/constants.ts +7 -0
- package/dist/src/lib/trajectory/extract.ts +196 -0
- package/dist/src/lib/trajectory/format-detect.ts +96 -0
- package/dist/src/lib/trajectory/frame-reader.ts +456 -0
- package/dist/src/lib/trajectory/helpers.ts +217 -0
- package/dist/src/lib/trajectory/index.ts +218 -0
- package/dist/src/lib/trajectory/parse/ase.ts +109 -0
- package/dist/src/lib/trajectory/parse/hdf5.ts +173 -0
- package/dist/src/lib/trajectory/parse/index.ts +411 -0
- package/dist/src/lib/trajectory/parse/lammps.ts +215 -0
- package/dist/src/lib/trajectory/parse/vasp.ts +102 -0
- package/dist/src/lib/trajectory/parse/xyz.ts +143 -0
- package/dist/src/lib/trajectory/plotting.ts +599 -0
- package/dist/src/lib/trajectory/types.ts +13 -0
- package/dist/src/lib/utils.ts +56 -0
- package/dist/src/lib/xrd/XrdPlot.svelte +615 -0
- package/dist/src/lib/xrd/broadening.ts +130 -0
- package/dist/src/lib/xrd/calc-xrd.ts +397 -0
- package/dist/src/lib/xrd/index.ts +38 -0
- package/dist/src/lib/xrd/parse.ts +858 -0
- package/dist/webview.js +29421 -0
- package/icon.png +0 -0
- package/license +1 -1
- package/matterviz-0.3.2.vsix +0 -0
- package/matterviz-0.3.4.vsix +0 -0
- package/matterviz-0.3.5.vsix +0 -0
- package/package.json +1461 -231
- package/readme.md +171 -98
- package/scripts/sync-config.ts +101 -0
- package/src/declarations.d.ts +2 -0
- package/src/extension.ts +972 -0
- package/src/node-io.ts +65 -0
- package/src/types.ts +17 -0
- package/src/webview/JsonBrowser.svelte +1079 -0
- package/src/webview/PlotPanel.svelte +346 -0
- package/src/webview/detect.ts +444 -0
- package/src/webview/main.ts +764 -0
- package/src/webview/plot-utils.ts +250 -0
- package/test-fixtures/all-viz-types.json.gz +0 -0
- package/test-fixtures/plot-demo-data.json.gz +0 -0
- package/tests/detect.test.ts +604 -0
- package/tests/extension.test.ts +2041 -0
- package/tests/node-io.test.ts +39 -0
- package/tests/plot-utils.test.ts +302 -0
- package/tests/vite-plugin-json-gz.test.ts +114 -0
- package/tests/vscode-mock.ts +18 -0
- package/tests/webview.test.ts +231 -0
- package/tsconfig.json +20 -0
- package/vite-plugin-json-gz.ts +29 -0
- package/vite.config.ts +34 -0
- package/vite.extension.config.ts +34 -0
- package/dist/EmptyState.svelte.d.ts +0 -9
- package/dist/FilePicker.svelte +0 -360
- package/dist/FilePicker.svelte.d.ts +0 -17
- package/dist/Icon.svelte.d.ts +0 -13
- package/dist/MillerIndexInput.svelte +0 -66
- package/dist/MillerIndexInput.svelte.d.ts +0 -7
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/api/optimade.d.ts +0 -45
- package/dist/api/optimade.js +0 -135
- package/dist/app.css +0 -240
- package/dist/brillouin/BrillouinZone.svelte +0 -543
- package/dist/brillouin/BrillouinZone.svelte.d.ts +0 -83
- package/dist/brillouin/BrillouinZoneControls.svelte +0 -144
- package/dist/brillouin/BrillouinZoneControls.svelte.d.ts +0 -17
- package/dist/brillouin/BrillouinZoneExportPane.svelte +0 -148
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +0 -15
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +0 -146
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +0 -13
- package/dist/brillouin/BrillouinZoneScene.svelte +0 -476
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +0 -48
- package/dist/brillouin/BrillouinZoneTooltip.svelte +0 -92
- package/dist/brillouin/BrillouinZoneTooltip.svelte.d.ts +0 -8
- package/dist/brillouin/compute.d.ts +0 -17
- package/dist/brillouin/compute.js +0 -422
- package/dist/brillouin/index.d.ts +0 -8
- package/dist/brillouin/index.js +0 -8
- package/dist/brillouin/types.d.ts +0 -48
- package/dist/brillouin/types.js +0 -1
- package/dist/chempot-diagram/ChemPotDiagram.svelte +0 -327
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +0 -13
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +0 -847
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +0 -16
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +0 -3194
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +0 -16
- package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +0 -7
- package/dist/chempot-diagram/async-compute.svelte.d.ts +0 -3
- package/dist/chempot-diagram/async-compute.svelte.js +0 -77
- package/dist/chempot-diagram/chempot-worker.d.ts +0 -1
- package/dist/chempot-diagram/chempot-worker.js +0 -11
- package/dist/chempot-diagram/color.d.ts +0 -10
- package/dist/chempot-diagram/color.js +0 -32
- package/dist/chempot-diagram/compute.d.ts +0 -48
- package/dist/chempot-diagram/compute.js +0 -812
- package/dist/chempot-diagram/index.d.ts +0 -6
- package/dist/chempot-diagram/index.js +0 -6
- package/dist/chempot-diagram/pointer.d.ts +0 -16
- package/dist/chempot-diagram/pointer.js +0 -40
- package/dist/chempot-diagram/temperature.d.ts +0 -15
- package/dist/chempot-diagram/temperature.js +0 -36
- package/dist/chempot-diagram/types.d.ts +0 -86
- package/dist/chempot-diagram/types.js +0 -28
- package/dist/colors/index.d.ts +0 -47
- package/dist/colors/index.js +0 -203
- package/dist/composition/BarChart.svelte +0 -297
- package/dist/composition/BarChart.svelte.d.ts +0 -39
- package/dist/composition/BubbleChart.svelte +0 -218
- package/dist/composition/BubbleChart.svelte.d.ts +0 -28
- package/dist/composition/Composition.svelte +0 -164
- package/dist/composition/Composition.svelte.d.ts +0 -15
- package/dist/composition/Formula.svelte +0 -265
- package/dist/composition/Formula.svelte.d.ts +0 -19
- package/dist/composition/FormulaFilter.svelte +0 -1259
- package/dist/composition/FormulaFilter.svelte.d.ts +0 -51
- package/dist/composition/PieChart.svelte +0 -323
- package/dist/composition/PieChart.svelte.d.ts +0 -37
- package/dist/composition/format.d.ts +0 -15
- package/dist/composition/format.js +0 -109
- package/dist/composition/index.d.ts +0 -20
- package/dist/composition/index.js +0 -14
- package/dist/composition/parse.d.ts +0 -55
- package/dist/composition/parse.js +0 -459
- package/dist/constants.d.ts +0 -29
- package/dist/constants.js +0 -105
- package/dist/controls.d.ts +0 -14
- package/dist/controls.js +0 -30
- package/dist/convex-hull/ConvexHull.svelte +0 -157
- package/dist/convex-hull/ConvexHull.svelte.d.ts +0 -13
- package/dist/convex-hull/ConvexHull2D.svelte +0 -813
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +0 -11
- package/dist/convex-hull/ConvexHull3D.svelte +0 -1788
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +0 -8
- package/dist/convex-hull/ConvexHull4D.svelte +0 -1374
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +0 -8
- package/dist/convex-hull/ConvexHullControls.svelte +0 -546
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +0 -48
- package/dist/convex-hull/ConvexHullInfoPane.svelte +0 -115
- package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +0 -18
- package/dist/convex-hull/ConvexHullStats.svelte +0 -905
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +0 -15
- package/dist/convex-hull/ConvexHullTooltip.svelte +0 -131
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +0 -33
- package/dist/convex-hull/GasPressureControls.svelte +0 -247
- package/dist/convex-hull/GasPressureControls.svelte.d.ts +0 -11
- package/dist/convex-hull/StructurePopup.svelte +0 -116
- package/dist/convex-hull/StructurePopup.svelte.d.ts +0 -18
- package/dist/convex-hull/TemperatureSlider.svelte +0 -137
- package/dist/convex-hull/TemperatureSlider.svelte.d.ts +0 -8
- package/dist/convex-hull/barycentric-coords.d.ts +0 -18
- package/dist/convex-hull/barycentric-coords.js +0 -182
- package/dist/convex-hull/demo-temperature.d.ts +0 -6
- package/dist/convex-hull/demo-temperature.js +0 -40
- package/dist/convex-hull/gas-thermodynamics.d.ts +0 -16
- package/dist/convex-hull/gas-thermodynamics.js +0 -316
- package/dist/convex-hull/helpers.d.ts +0 -103
- package/dist/convex-hull/helpers.js +0 -671
- package/dist/convex-hull/index.d.ts +0 -118
- package/dist/convex-hull/index.js +0 -57
- package/dist/convex-hull/thermodynamics.d.ts +0 -66
- package/dist/convex-hull/thermodynamics.js +0 -1752
- package/dist/convex-hull/types.d.ts +0 -162
- package/dist/convex-hull/types.js +0 -36
- package/dist/coordination/CoordinationBarPlot.svelte +0 -311
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +0 -30
- package/dist/coordination/calc-coordination.d.ts +0 -15
- package/dist/coordination/calc-coordination.js +0 -63
- package/dist/coordination/index.d.ts +0 -8
- package/dist/coordination/index.js +0 -7
- package/dist/element/BohrAtom.svelte +0 -149
- package/dist/element/BohrAtom.svelte.d.ts +0 -20
- package/dist/element/ElementHeading.svelte +0 -26
- package/dist/element/ElementHeading.svelte.d.ts +0 -8
- package/dist/element/ElementPhoto.svelte +0 -57
- package/dist/element/ElementPhoto.svelte.d.ts +0 -9
- package/dist/element/ElementStats.svelte +0 -80
- package/dist/element/ElementStats.svelte.d.ts +0 -8
- package/dist/element/ElementTile.svelte +0 -484
- package/dist/element/ElementTile.svelte.d.ts +0 -29
- package/dist/element/Nucleus.svelte.d.ts +0 -17
- package/dist/element/data.d.ts +0 -3
- package/dist/element/data.js +0 -2
- package/dist/element/data.json.gz.d.ts +0 -2
- package/dist/element/index.d.ts +0 -8
- package/dist/element/index.js +0 -8
- package/dist/element/types.d.ts +0 -57
- package/dist/element/types.js +0 -1
- package/dist/feedback/ClickFeedback.svelte +0 -58
- package/dist/feedback/ClickFeedback.svelte.d.ts +0 -12
- package/dist/feedback/DragOverlay.svelte +0 -42
- package/dist/feedback/DragOverlay.svelte.d.ts +0 -7
- package/dist/feedback/Spinner.svelte.d.ts +0 -7
- package/dist/feedback/StatusMessage.svelte.d.ts +0 -9
- package/dist/feedback/index.d.ts +0 -4
- package/dist/feedback/index.js +0 -4
- package/dist/fermi-surface/FermiSlice.svelte +0 -189
- package/dist/fermi-surface/FermiSlice.svelte.d.ts +0 -24
- package/dist/fermi-surface/FermiSurface.svelte +0 -597
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +0 -83
- package/dist/fermi-surface/FermiSurfaceControls.svelte +0 -452
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +0 -35
- package/dist/fermi-surface/FermiSurfaceScene.svelte +0 -792
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +0 -50
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +0 -111
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte.d.ts +0 -8
- package/dist/fermi-surface/compute.d.ts +0 -5
- package/dist/fermi-surface/compute.js +0 -538
- package/dist/fermi-surface/constants.d.ts +0 -9
- package/dist/fermi-surface/constants.js +0 -27
- package/dist/fermi-surface/export.d.ts +0 -5
- package/dist/fermi-surface/export.js +0 -63
- package/dist/fermi-surface/index.d.ts +0 -12
- package/dist/fermi-surface/index.js +0 -13
- package/dist/fermi-surface/marching-cubes.d.ts +0 -2
- package/dist/fermi-surface/marching-cubes.js +0 -2
- package/dist/fermi-surface/parse.d.ts +0 -2
- package/dist/fermi-surface/parse.js +0 -495
- package/dist/fermi-surface/symmetry.d.ts +0 -3
- package/dist/fermi-surface/symmetry.js +0 -46
- package/dist/fermi-surface/types.d.ts +0 -113
- package/dist/fermi-surface/types.js +0 -4
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +0 -1527
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +0 -110
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +0 -225
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +0 -30
- package/dist/heatmap-matrix/index.d.ts +0 -53
- package/dist/heatmap-matrix/index.js +0 -100
- package/dist/heatmap-matrix/shared.d.ts +0 -2
- package/dist/heatmap-matrix/shared.js +0 -4
- package/dist/icons.d.ts +0 -569
- package/dist/icons.js +0 -648
- package/dist/index.d.ts +0 -39
- package/dist/index.js +0 -39
- package/dist/io/decompress.d.ts +0 -10
- package/dist/io/decompress.js +0 -69
- package/dist/io/export.d.ts +0 -16
- package/dist/io/export.js +0 -312
- package/dist/io/fetch.d.ts +0 -5
- package/dist/io/fetch.js +0 -39
- package/dist/io/file-drop.d.ts +0 -7
- package/dist/io/file-drop.js +0 -43
- package/dist/io/index.d.ts +0 -7
- package/dist/io/index.js +0 -7
- package/dist/io/is-binary.d.ts +0 -1
- package/dist/io/is-binary.js +0 -5
- package/dist/io/types.d.ts +0 -8
- package/dist/io/types.js +0 -1
- package/dist/io/url-drop.d.ts +0 -2
- package/dist/io/url-drop.js +0 -117
- package/dist/isosurface/Isosurface.svelte +0 -285
- package/dist/isosurface/Isosurface.svelte.d.ts +0 -8
- package/dist/isosurface/IsosurfaceControls.svelte +0 -291
- package/dist/isosurface/IsosurfaceControls.svelte.d.ts +0 -9
- package/dist/isosurface/index.d.ts +0 -5
- package/dist/isosurface/index.js +0 -6
- package/dist/isosurface/parse.d.ts +0 -6
- package/dist/isosurface/parse.js +0 -553
- package/dist/isosurface/slice.d.ts +0 -11
- package/dist/isosurface/slice.js +0 -140
- package/dist/isosurface/types.d.ts +0 -56
- package/dist/isosurface/types.js +0 -227
- package/dist/labels.d.ts +0 -53
- package/dist/labels.js +0 -274
- package/dist/layout/FullscreenToggle.svelte +0 -50
- package/dist/layout/FullscreenToggle.svelte.d.ts +0 -7
- package/dist/layout/InfoCard.svelte +0 -120
- package/dist/layout/InfoCard.svelte.d.ts +0 -21
- package/dist/layout/InfoTag.svelte +0 -183
- package/dist/layout/InfoTag.svelte.d.ts +0 -19
- package/dist/layout/PropertyFilter.svelte +0 -244
- package/dist/layout/PropertyFilter.svelte.d.ts +0 -24
- package/dist/layout/SettingsSection.svelte +0 -148
- package/dist/layout/SettingsSection.svelte.d.ts +0 -17
- package/dist/layout/SubpageGrid.svelte +0 -82
- package/dist/layout/SubpageGrid.svelte.d.ts +0 -14
- package/dist/layout/fullscreen.d.ts +0 -9
- package/dist/layout/fullscreen.js +0 -53
- package/dist/layout/index.d.ts +0 -10
- package/dist/layout/index.js +0 -8
- package/dist/layout/json-tree/JsonNode.svelte +0 -547
- package/dist/layout/json-tree/JsonNode.svelte.d.ts +0 -11
- package/dist/layout/json-tree/JsonTree.svelte +0 -1222
- package/dist/layout/json-tree/JsonTree.svelte.d.ts +0 -6
- package/dist/layout/json-tree/JsonValue.svelte +0 -334
- package/dist/layout/json-tree/JsonValue.svelte.d.ts +0 -9
- package/dist/layout/json-tree/index.d.ts +0 -3
- package/dist/layout/json-tree/index.js +0 -3
- package/dist/layout/json-tree/types.d.ts +0 -73
- package/dist/layout/json-tree/types.js +0 -3
- package/dist/layout/json-tree/utils.d.ts +0 -29
- package/dist/layout/json-tree/utils.js +0 -648
- package/dist/marching-cubes.d.ts +0 -14
- package/dist/marching-cubes.js +0 -542
- package/dist/math.d.ts +0 -91
- package/dist/math.js +0 -896
- package/dist/overlays/ContextMenu.svelte +0 -162
- package/dist/overlays/ContextMenu.svelte.d.ts +0 -25
- package/dist/overlays/DraggablePane.svelte +0 -564
- package/dist/overlays/DraggablePane.svelte.d.ts +0 -36
- package/dist/overlays/index.d.ts +0 -2
- package/dist/overlays/index.js +0 -2
- package/dist/periodic-table/PeriodicTable.svelte +0 -469
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +0 -55
- package/dist/periodic-table/PeriodicTableControls.svelte +0 -557
- package/dist/periodic-table/PeriodicTableControls.svelte.d.ts +0 -24
- package/dist/periodic-table/PropertySelect.svelte +0 -37
- package/dist/periodic-table/PropertySelect.svelte.d.ts +0 -13
- package/dist/periodic-table/TableInset.svelte.d.ts +0 -9
- package/dist/periodic-table/index.d.ts +0 -10
- package/dist/periodic-table/index.js +0 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +0 -1086
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +0 -44
- package/dist/phase-diagram/PhaseDiagramControls.svelte +0 -451
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +0 -30
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +0 -126
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +0 -15
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +0 -192
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +0 -19
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +0 -392
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +0 -16
- package/dist/phase-diagram/TdbInfoPanel.svelte +0 -203
- package/dist/phase-diagram/TdbInfoPanel.svelte.d.ts +0 -12
- package/dist/phase-diagram/build-diagram.d.ts +0 -11
- package/dist/phase-diagram/build-diagram.js +0 -167
- package/dist/phase-diagram/colors.d.ts +0 -35
- package/dist/phase-diagram/colors.js +0 -51
- package/dist/phase-diagram/diagram-input.d.ts +0 -33
- package/dist/phase-diagram/diagram-input.js +0 -3
- package/dist/phase-diagram/index.d.ts +0 -13
- package/dist/phase-diagram/index.js +0 -13
- package/dist/phase-diagram/parse.d.ts +0 -55
- package/dist/phase-diagram/parse.js +0 -276
- package/dist/phase-diagram/svg-to-diagram.d.ts +0 -2
- package/dist/phase-diagram/svg-to-diagram.js +0 -869
- package/dist/phase-diagram/types.d.ts +0 -99
- package/dist/phase-diagram/types.js +0 -1
- package/dist/phase-diagram/utils.d.ts +0 -118
- package/dist/phase-diagram/utils.js +0 -606
- package/dist/plot/AxisLabel.svelte +0 -51
- package/dist/plot/AxisLabel.svelte.d.ts +0 -16
- package/dist/plot/BarPlot.svelte +0 -2256
- package/dist/plot/BarPlot.svelte.d.ts +0 -82
- package/dist/plot/BarPlotControls.svelte +0 -66
- package/dist/plot/BarPlotControls.svelte.d.ts +0 -18
- package/dist/plot/ColorBar.svelte +0 -719
- package/dist/plot/ColorBar.svelte.d.ts +0 -31
- package/dist/plot/ColorScaleSelect.svelte +0 -54
- package/dist/plot/ColorScaleSelect.svelte.d.ts +0 -15
- package/dist/plot/ElementScatter.svelte +0 -63
- package/dist/plot/ElementScatter.svelte.d.ts +0 -14
- package/dist/plot/FillArea.svelte +0 -226
- package/dist/plot/FillArea.svelte.d.ts +0 -20
- package/dist/plot/Histogram.svelte +0 -1654
- package/dist/plot/Histogram.svelte.d.ts +0 -50
- package/dist/plot/HistogramControls.svelte +0 -212
- package/dist/plot/HistogramControls.svelte.d.ts +0 -22
- package/dist/plot/InteractiveAxisLabel.svelte +0 -94
- package/dist/plot/InteractiveAxisLabel.svelte.d.ts +0 -14
- package/dist/plot/Line.svelte +0 -85
- package/dist/plot/Line.svelte.d.ts +0 -15
- package/dist/plot/PlotControls.svelte +0 -537
- package/dist/plot/PlotControls.svelte.d.ts +0 -4
- package/dist/plot/PlotLegend.svelte +0 -498
- package/dist/plot/PlotLegend.svelte.d.ts +0 -25
- package/dist/plot/PlotTooltip.svelte +0 -67
- package/dist/plot/PlotTooltip.svelte.d.ts +0 -17
- package/dist/plot/PortalSelect.svelte +0 -253
- package/dist/plot/PortalSelect.svelte.d.ts +0 -16
- package/dist/plot/ReferenceLine.svelte.d.ts +0 -20
- package/dist/plot/ReferenceLine3D.svelte +0 -154
- package/dist/plot/ReferenceLine3D.svelte.d.ts +0 -14
- package/dist/plot/ReferencePlane.svelte +0 -178
- package/dist/plot/ReferencePlane.svelte.d.ts +0 -14
- package/dist/plot/ScatterPlot.svelte +0 -2831
- package/dist/plot/ScatterPlot.svelte.d.ts +0 -92
- package/dist/plot/ScatterPlot3D.svelte +0 -499
- package/dist/plot/ScatterPlot3D.svelte.d.ts +0 -94
- package/dist/plot/ScatterPlot3DControls.svelte +0 -437
- package/dist/plot/ScatterPlot3DControls.svelte.d.ts +0 -20
- package/dist/plot/ScatterPlot3DScene.svelte +0 -912
- package/dist/plot/ScatterPlot3DScene.svelte.d.ts +0 -74
- package/dist/plot/ScatterPlotControls.svelte +0 -307
- package/dist/plot/ScatterPlotControls.svelte.d.ts +0 -17
- package/dist/plot/ScatterPoint.svelte +0 -185
- package/dist/plot/ScatterPoint.svelte.d.ts +0 -19
- package/dist/plot/SpacegroupBarPlot.svelte +0 -292
- package/dist/plot/SpacegroupBarPlot.svelte.d.ts +0 -9
- package/dist/plot/Surface3D.svelte +0 -200
- package/dist/plot/Surface3D.svelte.d.ts +0 -13
- package/dist/plot/ZeroLines.svelte +0 -96
- package/dist/plot/ZeroLines.svelte.d.ts +0 -32
- package/dist/plot/ZoomRect.svelte +0 -23
- package/dist/plot/ZoomRect.svelte.d.ts +0 -8
- package/dist/plot/axis-utils.d.ts +0 -19
- package/dist/plot/axis-utils.js +0 -80
- package/dist/plot/data-cleaning.d.ts +0 -37
- package/dist/plot/data-cleaning.js +0 -855
- package/dist/plot/data-transform.d.ts +0 -16
- package/dist/plot/data-transform.js +0 -45
- package/dist/plot/defaults.d.ts +0 -19
- package/dist/plot/defaults.js +0 -9
- package/dist/plot/fill-utils.d.ts +0 -51
- package/dist/plot/fill-utils.js +0 -337
- package/dist/plot/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/hover-lock.svelte.js +0 -46
- package/dist/plot/index.d.ts +0 -43
- package/dist/plot/index.js +0 -37
- package/dist/plot/interactions.d.ts +0 -12
- package/dist/plot/interactions.js +0 -100
- package/dist/plot/layout.d.ts +0 -60
- package/dist/plot/layout.js +0 -230
- package/dist/plot/reference-line.d.ts +0 -60
- package/dist/plot/reference-line.js +0 -316
- package/dist/plot/scales.d.ts +0 -48
- package/dist/plot/scales.js +0 -484
- package/dist/plot/svg.d.ts +0 -1
- package/dist/plot/svg.js +0 -11
- package/dist/plot/types.d.ts +0 -863
- package/dist/plot/types.js +0 -103
- package/dist/plot/utils/label-placement.d.ts +0 -47
- package/dist/plot/utils/label-placement.js +0 -256
- package/dist/plot/utils/series-visibility.d.ts +0 -9
- package/dist/plot/utils/series-visibility.js +0 -67
- package/dist/plot/utils.d.ts +0 -1
- package/dist/plot/utils.js +0 -14
- package/dist/rdf/RdfPlot.svelte +0 -247
- package/dist/rdf/RdfPlot.svelte.d.ts +0 -27
- package/dist/rdf/calc-rdf.d.ts +0 -4
- package/dist/rdf/calc-rdf.js +0 -111
- package/dist/rdf/index.d.ts +0 -23
- package/dist/rdf/index.js +0 -2
- package/dist/sanitize.d.ts +0 -4
- package/dist/sanitize.js +0 -107
- package/dist/settings.d.ts +0 -253
- package/dist/settings.js +0 -1123
- package/dist/spectral/Bands.svelte +0 -1040
- package/dist/spectral/Bands.svelte.d.ts +0 -40
- package/dist/spectral/BandsAndDos.svelte +0 -128
- package/dist/spectral/BandsAndDos.svelte.d.ts +0 -18
- package/dist/spectral/BrillouinBandsDos.svelte +0 -248
- package/dist/spectral/BrillouinBandsDos.svelte.d.ts +0 -20
- package/dist/spectral/Dos.svelte +0 -697
- package/dist/spectral/Dos.svelte.d.ts +0 -29
- package/dist/spectral/helpers.d.ts +0 -117
- package/dist/spectral/helpers.js +0 -1023
- package/dist/spectral/index.d.ts +0 -6
- package/dist/spectral/index.js +0 -7
- package/dist/spectral/types.d.ts +0 -84
- package/dist/spectral/types.js +0 -2
- package/dist/state.svelte.d.ts +0 -25
- package/dist/state.svelte.js +0 -45
- package/dist/structure/Arrow.svelte +0 -72
- package/dist/structure/Arrow.svelte.d.ts +0 -15
- package/dist/structure/AtomLegend.svelte +0 -798
- package/dist/structure/AtomLegend.svelte.d.ts +0 -34
- package/dist/structure/Bond.svelte +0 -140
- package/dist/structure/Bond.svelte.d.ts +0 -9
- package/dist/structure/CanvasTooltip.svelte +0 -33
- package/dist/structure/CanvasTooltip.svelte.d.ts +0 -12
- package/dist/structure/CellSelect.svelte +0 -351
- package/dist/structure/CellSelect.svelte.d.ts +0 -13
- package/dist/structure/Cylinder.svelte +0 -45
- package/dist/structure/Cylinder.svelte.d.ts +0 -10
- package/dist/structure/Lattice.svelte +0 -196
- package/dist/structure/Lattice.svelte.d.ts +0 -17
- package/dist/structure/Structure.svelte +0 -1857
- package/dist/structure/Structure.svelte.d.ts +0 -83
- package/dist/structure/StructureControls.svelte +0 -1184
- package/dist/structure/StructureControls.svelte.d.ts +0 -31
- package/dist/structure/StructureExportPane.svelte +0 -251
- package/dist/structure/StructureExportPane.svelte.d.ts +0 -17
- package/dist/structure/StructureInfoPane.svelte +0 -434
- package/dist/structure/StructureInfoPane.svelte.d.ts +0 -18
- package/dist/structure/StructureScene.svelte +0 -1574
- package/dist/structure/StructureScene.svelte.d.ts +0 -104
- package/dist/structure/atom-properties.d.ts +0 -37
- package/dist/structure/atom-properties.js +0 -198
- package/dist/structure/bonding.d.ts +0 -33
- package/dist/structure/bonding.js +0 -304
- package/dist/structure/export.d.ts +0 -20
- package/dist/structure/export.js +0 -725
- package/dist/structure/ferrox-wasm-types.d.ts +0 -46
- package/dist/structure/ferrox-wasm-types.js +0 -18
- package/dist/structure/ferrox-wasm.d.ts +0 -94
- package/dist/structure/ferrox-wasm.js +0 -249
- package/dist/structure/index.d.ts +0 -110
- package/dist/structure/index.js +0 -168
- package/dist/structure/measure.d.ts +0 -6
- package/dist/structure/measure.js +0 -29
- package/dist/structure/parse.d.ts +0 -65
- package/dist/structure/parse.js +0 -1374
- package/dist/structure/partial-occupancy.d.ts +0 -25
- package/dist/structure/partial-occupancy.js +0 -99
- package/dist/structure/pbc.d.ts +0 -9
- package/dist/structure/pbc.js +0 -123
- package/dist/structure/supercell.d.ts +0 -8
- package/dist/structure/supercell.js +0 -137
- package/dist/structure/validation.d.ts +0 -2
- package/dist/structure/validation.js +0 -10
- package/dist/symmetry/SymmetryStats.svelte +0 -226
- package/dist/symmetry/SymmetryStats.svelte.d.ts +0 -21
- package/dist/symmetry/WyckoffTable.svelte +0 -113
- package/dist/symmetry/WyckoffTable.svelte.d.ts +0 -11
- package/dist/symmetry/cell-transform.d.ts +0 -12
- package/dist/symmetry/cell-transform.js +0 -77
- package/dist/symmetry/index.d.ts +0 -43
- package/dist/symmetry/index.js +0 -229
- package/dist/symmetry/spacegroups.d.ts +0 -9
- package/dist/symmetry/spacegroups.js +0 -394
- package/dist/table/HeatmapTable.svelte +0 -1854
- package/dist/table/HeatmapTable.svelte.d.ts +0 -49
- package/dist/table/ToggleMenu.svelte +0 -376
- package/dist/table/ToggleMenu.svelte.d.ts +0 -11
- package/dist/table/index.d.ts +0 -74
- package/dist/table/index.js +0 -38
- package/dist/theme/ThemeControl.svelte +0 -53
- package/dist/theme/ThemeControl.svelte.d.ts +0 -9
- package/dist/theme/index.d.ts +0 -29
- package/dist/theme/index.js +0 -79
- package/dist/theme/themes.mjs +0 -285
- package/dist/time.d.ts +0 -4
- package/dist/time.js +0 -70
- package/dist/tooltip/TooltipContent.svelte +0 -58
- package/dist/tooltip/TooltipContent.svelte.d.ts +0 -31
- package/dist/tooltip/index.d.ts +0 -2
- package/dist/tooltip/index.js +0 -2
- package/dist/tooltip/types.d.ts +0 -8
- package/dist/tooltip/types.js +0 -1
- package/dist/trajectory/Trajectory.svelte +0 -1517
- package/dist/trajectory/Trajectory.svelte.d.ts +0 -77
- package/dist/trajectory/TrajectoryError.svelte +0 -128
- package/dist/trajectory/TrajectoryError.svelte.d.ts +0 -13
- package/dist/trajectory/TrajectoryExportPane.svelte +0 -357
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +0 -17
- package/dist/trajectory/TrajectoryInfoPane.svelte +0 -387
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +0 -17
- package/dist/trajectory/constants.d.ts +0 -6
- package/dist/trajectory/constants.js +0 -7
- package/dist/trajectory/extract.d.ts +0 -5
- package/dist/trajectory/extract.js +0 -162
- package/dist/trajectory/format-detect.d.ts +0 -9
- package/dist/trajectory/format-detect.js +0 -76
- package/dist/trajectory/frame-reader.d.ts +0 -17
- package/dist/trajectory/frame-reader.js +0 -332
- package/dist/trajectory/helpers.d.ts +0 -14
- package/dist/trajectory/helpers.js +0 -172
- package/dist/trajectory/index.d.ts +0 -63
- package/dist/trajectory/index.js +0 -126
- package/dist/trajectory/parse/ase.d.ts +0 -2
- package/dist/trajectory/parse/ase.js +0 -77
- package/dist/trajectory/parse/hdf5.d.ts +0 -2
- package/dist/trajectory/parse/hdf5.js +0 -129
- package/dist/trajectory/parse/index.d.ts +0 -12
- package/dist/trajectory/parse/index.js +0 -299
- package/dist/trajectory/parse/lammps.d.ts +0 -5
- package/dist/trajectory/parse/lammps.js +0 -179
- package/dist/trajectory/parse/vasp.d.ts +0 -2
- package/dist/trajectory/parse/vasp.js +0 -68
- package/dist/trajectory/parse/xyz.d.ts +0 -2
- package/dist/trajectory/parse/xyz.js +0 -110
- package/dist/trajectory/plotting.d.ts +0 -28
- package/dist/trajectory/plotting.js +0 -423
- package/dist/trajectory/types.d.ts +0 -11
- package/dist/trajectory/types.js +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.js +0 -36
- package/dist/xrd/XrdPlot.svelte +0 -615
- package/dist/xrd/XrdPlot.svelte.d.ts +0 -28
- package/dist/xrd/broadening.d.ts +0 -20
- package/dist/xrd/broadening.js +0 -97
- package/dist/xrd/calc-xrd.d.ts +0 -37
- package/dist/xrd/calc-xrd.js +0 -337
- package/dist/xrd/index.d.ts +0 -37
- package/dist/xrd/index.js +0 -4
- package/dist/xrd/parse.d.ts +0 -13
- package/dist/xrd/parse.js +0 -749
- /package/dist/{EmptyState.svelte → src/lib/EmptyState.svelte} +0 -0
- /package/dist/{Icon.svelte → src/lib/Icon.svelte} +0 -0
- /package/dist/{chempot-diagram → src/lib/chempot-diagram}/ChemPotScene3D.svelte +0 -0
- /package/dist/{colors → src/lib/colors}/alloy-colors.json +0 -0
- /package/dist/{colors → src/lib/colors}/dark-mode-colors.json +0 -0
- /package/dist/{colors → src/lib/colors}/jmol-colors.json +0 -0
- /package/dist/{colors → src/lib/colors}/muted-colors.json +0 -0
- /package/dist/{colors → src/lib/colors}/pastel-colors.json +0 -0
- /package/dist/{colors → src/lib/colors}/vesta-colors.json +0 -0
- /package/dist/{element → src/lib/element}/Nucleus.svelte +0 -0
- /package/dist/{element → src/lib/element}/data.json +0 -0
- /package/dist/{element → src/lib/element}/data.json.gz +0 -0
- /package/dist/{element → src/lib/element}/data.schema.json +0 -0
- /package/dist/{element-image-urls.json → src/lib/element-image-urls.json} +0 -0
- /package/dist/{feedback → src/lib/feedback}/Spinner.svelte +0 -0
- /package/dist/{feedback → src/lib/feedback}/StatusMessage.svelte +0 -0
- /package/dist/{periodic-table → src/lib/periodic-table}/TableInset.svelte +0 -0
- /package/dist/{plot → src/lib/plot}/ReferenceLine.svelte +0 -0
- /package/dist/{xrd → src/lib/xrd}/atomic_scattering_params.json +0 -0
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import type { ElementSymbol } from '$lib/element'
|
|
2
|
+
import type { CompositionType } from '$lib/composition'
|
|
3
|
+
import { element_data } from '$lib/element'
|
|
4
|
+
import { ELEM_SYMBOLS } from '$lib/labels'
|
|
5
|
+
|
|
6
|
+
// Create symbol/number/mass/electronegativity lookup maps for O(1) access
|
|
7
|
+
export const ATOMIC_NUMBER_TO_SYMBOL: Record<number, ElementSymbol> = {}
|
|
8
|
+
export const SYMBOL_TO_ATOMIC_NUMBER: Partial<CompositionType> = {}
|
|
9
|
+
export const ATOMIC_WEIGHTS = new Map<ElementSymbol, number>()
|
|
10
|
+
export const ELEMENT_ELECTRONEGATIVITY_MAP = new Map<ElementSymbol, number>()
|
|
11
|
+
export const ELEM_NAME_TO_SYMBOL: Record<string, ElementSymbol> = {}
|
|
12
|
+
export const ELEM_SYMBOL_TO_NAME: Partial<Record<ElementSymbol, string>> = {}
|
|
13
|
+
|
|
14
|
+
// Populate maps at module load time
|
|
15
|
+
for (const element of element_data) {
|
|
16
|
+
ATOMIC_NUMBER_TO_SYMBOL[element.number] = element.symbol
|
|
17
|
+
SYMBOL_TO_ATOMIC_NUMBER[element.symbol] = element.number
|
|
18
|
+
ATOMIC_WEIGHTS.set(element.symbol, element.atomic_mass)
|
|
19
|
+
ELEMENT_ELECTRONEGATIVITY_MAP.set(element.symbol, element.electronegativity ?? 0)
|
|
20
|
+
ELEM_NAME_TO_SYMBOL[element.name] = element.symbol
|
|
21
|
+
ELEM_SYMBOL_TO_NAME[element.symbol] = element.name
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Type guard: check if a string is a valid element symbol
|
|
25
|
+
export const is_valid_element = (sym: string): sym is ElementSymbol =>
|
|
26
|
+
(ELEM_SYMBOLS as readonly string[]).includes(sym)
|
|
27
|
+
|
|
28
|
+
// Check if object has atomic numbers as keys (1-118)
|
|
29
|
+
const is_atomic_number_composition = (obj: Record<string | number, number>): boolean => {
|
|
30
|
+
const keys = Object.keys(obj)
|
|
31
|
+
const atomic_nums = keys.map(Number)
|
|
32
|
+
return (
|
|
33
|
+
keys.length > 0 &&
|
|
34
|
+
atomic_nums.every(
|
|
35
|
+
(atomic_num) =>
|
|
36
|
+
Number.isInteger(atomic_num) && Object.hasOwn(ATOMIC_NUMBER_TO_SYMBOL, atomic_num),
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const format_state = (state: number) => (state > 0 ? `+` : ``) + state
|
|
42
|
+
const parse_count = (count?: string): number => (count ? parseFloat(count) : 1)
|
|
43
|
+
const format_count = (count: number): string => {
|
|
44
|
+
if (!Number.isFinite(count)) return `${count}`
|
|
45
|
+
return Number(count.toPrecision(12)).toLocaleString(`en-US`, {
|
|
46
|
+
maximumSignificantDigits: 12,
|
|
47
|
+
useGrouping: false,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Convert atomic numbers to element symbols
|
|
52
|
+
export const atomic_num_to_symbols = (
|
|
53
|
+
atomic_composition: Record<number, number>,
|
|
54
|
+
): CompositionType => {
|
|
55
|
+
const composition: CompositionType = {}
|
|
56
|
+
for (const [atomic_num_str, amount] of Object.entries(atomic_composition)) {
|
|
57
|
+
const symbol = ATOMIC_NUMBER_TO_SYMBOL[Number(atomic_num_str)]
|
|
58
|
+
if (!symbol) throw new Error(`Invalid atomic number: ${atomic_num_str}`)
|
|
59
|
+
if (amount > 0) composition[symbol] = (composition[symbol] ?? 0) + amount
|
|
60
|
+
}
|
|
61
|
+
return composition
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Convert element symbols to atomic numbers
|
|
65
|
+
export const atomic_symbol_to_num = (
|
|
66
|
+
symbol_composition: CompositionType,
|
|
67
|
+
): Record<number, number> => {
|
|
68
|
+
const atomic_composition: Record<number, number> = {}
|
|
69
|
+
for (const [symbol, amount] of Object.entries(symbol_composition)) {
|
|
70
|
+
if (!is_valid_element(symbol)) throw new Error(`Invalid element symbol: ${symbol}`)
|
|
71
|
+
const atomic_num = SYMBOL_TO_ATOMIC_NUMBER[symbol]
|
|
72
|
+
if (!atomic_num) throw new Error(`Invalid element symbol: ${symbol}`)
|
|
73
|
+
if (amount > 0) {
|
|
74
|
+
atomic_composition[atomic_num] = (atomic_composition[atomic_num] || 0) + amount
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return atomic_composition
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Expand parentheses in chemical formulas
|
|
81
|
+
const expand_parentheses = (formula: string): string => {
|
|
82
|
+
while (formula.includes(`(`)) {
|
|
83
|
+
formula = formula.replace(
|
|
84
|
+
/\(([^()]+)\)(\d+(?:\.\d+)?|\.\d+)?/g,
|
|
85
|
+
(_match, group, multiplier) => {
|
|
86
|
+
const mult = parse_count(multiplier)
|
|
87
|
+
return group.replace(
|
|
88
|
+
/([A-Z][a-z]?)(\d+(?:\.\d+)?|\.\d+)?/g,
|
|
89
|
+
(_m: string, element: string, count: string) => {
|
|
90
|
+
const count_str = format_count(parse_count(count) * mult)
|
|
91
|
+
return element + (count_str === `1` ? `` : count_str)
|
|
92
|
+
},
|
|
93
|
+
)
|
|
94
|
+
},
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
return formula
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Parse chemical formula string into composition object
|
|
101
|
+
export const parse_formula = (formula: string): CompositionType => {
|
|
102
|
+
const composition: CompositionType = {}
|
|
103
|
+
const cleaned_formula = expand_parentheses(formula.replace(/\s/g, ``))
|
|
104
|
+
|
|
105
|
+
for (const match of cleaned_formula.matchAll(/([A-Z][a-z]?)(\d+(?:\.\d+)?|\.\d+)?/g)) {
|
|
106
|
+
const element = match[1]
|
|
107
|
+
const count = parse_count(match[2])
|
|
108
|
+
|
|
109
|
+
if (!is_valid_element(element)) throw new Error(`Invalid element symbol: ${element}`)
|
|
110
|
+
composition[element] = (composition[element] ?? 0) + count
|
|
111
|
+
}
|
|
112
|
+
return composition
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Normalize composition to positive numbers only
|
|
116
|
+
export const normalize_composition = (
|
|
117
|
+
composition: CompositionType | Record<number, number> | Record<string | number, number>,
|
|
118
|
+
): CompositionType => {
|
|
119
|
+
if (is_atomic_number_composition(composition)) {
|
|
120
|
+
return normalize_composition(atomic_num_to_symbols(composition as Record<number, number>))
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const normalized: CompositionType = {}
|
|
124
|
+
for (const [element, amount] of Object.entries(composition)) {
|
|
125
|
+
if (typeof amount === `number` && amount > 0 && is_valid_element(element)) {
|
|
126
|
+
normalized[element] = amount
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return normalized
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Sanitize composition keys by extracting valid element symbols.
|
|
133
|
+
// Handles malformed keys like "B0.", "Fe2+", "Fe[2+]", "Ca^2+" by extracting
|
|
134
|
+
// the element symbol portion. Merges amounts for keys that map to the same element.
|
|
135
|
+
// Returns null if no valid elements can be extracted.
|
|
136
|
+
// NOTE: Only extracts the FIRST valid element from each key. Keys with multiple
|
|
137
|
+
// elements (e.g. "CO3", "Fe2O3") will lose stoichiometry - use parse_formula for those.
|
|
138
|
+
export const sanitize_composition_keys = (
|
|
139
|
+
composition: Record<string, number>,
|
|
140
|
+
): CompositionType | null => {
|
|
141
|
+
const sanitized: Record<string, number> = {}
|
|
142
|
+
for (const [key, amount] of Object.entries(composition)) {
|
|
143
|
+
if (typeof amount !== `number` || amount <= 0) continue
|
|
144
|
+
// Extract first valid element symbol from key (e.g. "B0." -> "B", "Fe2+" -> "Fe")
|
|
145
|
+
const elem = (key.match(/[A-Z][a-z]?/g) ?? []).find(is_valid_element)
|
|
146
|
+
if (elem) sanitized[elem] = (sanitized[elem] || 0) + amount
|
|
147
|
+
}
|
|
148
|
+
const result = normalize_composition(sanitized)
|
|
149
|
+
return Object.keys(result).length > 0 ? result : null
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Get total number of atoms
|
|
153
|
+
export const count_atoms_in_composition = (composition: CompositionType): number =>
|
|
154
|
+
Object.values(composition).reduce((sum, count) => sum + (count ?? 0), 0)
|
|
155
|
+
|
|
156
|
+
export const fractional_composition = (
|
|
157
|
+
composition: CompositionType,
|
|
158
|
+
by_weight = false,
|
|
159
|
+
): CompositionType => {
|
|
160
|
+
// Filter out zero/negative amounts for both branches
|
|
161
|
+
const filtered = Object.fromEntries(
|
|
162
|
+
Object.entries(composition).filter(([, amount]) => amount > 0),
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
if (by_weight) {
|
|
166
|
+
const element_weights = Object.fromEntries(
|
|
167
|
+
Object.entries(filtered).map(([element, amount]) => {
|
|
168
|
+
if (!is_valid_element(element)) throw new Error(`Unknown element: ${element}`)
|
|
169
|
+
const atomic_mass = ATOMIC_WEIGHTS.get(element)
|
|
170
|
+
if (!atomic_mass) throw new Error(`Unknown element: ${element}`)
|
|
171
|
+
return [element, amount * atomic_mass]
|
|
172
|
+
}),
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
const total_weight = Object.values(element_weights).reduce((sum, wt) => sum + wt, 0)
|
|
176
|
+
if (total_weight === 0) return {}
|
|
177
|
+
|
|
178
|
+
return Object.fromEntries(
|
|
179
|
+
Object.entries(element_weights).map(([element, weight]) => [
|
|
180
|
+
element,
|
|
181
|
+
weight / total_weight,
|
|
182
|
+
]),
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const total = count_atoms_in_composition(filtered)
|
|
187
|
+
if (total === 0) return {}
|
|
188
|
+
|
|
189
|
+
return Object.fromEntries(
|
|
190
|
+
Object.entries(filtered).map(([element, amount]) => [element, amount / total]),
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Parse composition from various input types
|
|
195
|
+
export const parse_composition = (
|
|
196
|
+
input: string | CompositionType | Record<number, number> | Record<string | number, number>,
|
|
197
|
+
): CompositionType => {
|
|
198
|
+
if (typeof input === `string`) {
|
|
199
|
+
if (input.trim().startsWith(`{`) && input.trim().endsWith(`}`)) {
|
|
200
|
+
try {
|
|
201
|
+
return normalize_composition(JSON.parse(input))
|
|
202
|
+
} catch {
|
|
203
|
+
// Fall through to formula parsing
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return normalize_composition(parse_formula(input))
|
|
207
|
+
}
|
|
208
|
+
return normalize_composition(input)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Calculate GCD of two numbers
|
|
212
|
+
const gcd = (num_a: number, num_b: number): number =>
|
|
213
|
+
num_b === 0 ? num_a : gcd(num_b, num_a % num_b)
|
|
214
|
+
|
|
215
|
+
// Get reduced formula by dividing all amounts by their GCD
|
|
216
|
+
// Example: Fe2O4 -> FeO2, H4O2 -> H2O
|
|
217
|
+
export const get_reduced_formula = (composition: CompositionType): CompositionType => {
|
|
218
|
+
const amounts = Object.values(composition).filter((amt) => amt > 0)
|
|
219
|
+
if (amounts.length === 0) return {}
|
|
220
|
+
// Find GCD of all amounts (works with integers; for floats, find approximate GCD)
|
|
221
|
+
const all_integers = amounts.every((amt) => Number.isInteger(amt))
|
|
222
|
+
if (!all_integers) return composition // Can't reduce non-integer compositions
|
|
223
|
+
const divisor = amounts.reduce((acc, amt) => gcd(acc, amt))
|
|
224
|
+
if (divisor <= 1) return composition
|
|
225
|
+
const reduced: CompositionType = {}
|
|
226
|
+
for (const [elem, amt] of Object.entries(composition)) {
|
|
227
|
+
if (is_valid_element(elem)) reduced[elem] = amt / divisor
|
|
228
|
+
}
|
|
229
|
+
return reduced
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Calculate molecular weight (sum of atomic masses * amounts)
|
|
233
|
+
export const get_molecular_weight = (composition: CompositionType): number =>
|
|
234
|
+
Object.entries(composition).reduce((total, [elem, amount]) => {
|
|
235
|
+
const mass = is_valid_element(elem) ? (ATOMIC_WEIGHTS.get(elem) ?? 0) : 0
|
|
236
|
+
return total + mass * amount
|
|
237
|
+
}, 0)
|
|
238
|
+
|
|
239
|
+
// Type for element with oxidation state information
|
|
240
|
+
export type ElementWithOxidation = {
|
|
241
|
+
element: ElementSymbol
|
|
242
|
+
amount: number
|
|
243
|
+
oxidation_state?: number
|
|
244
|
+
orig_idx: number
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Type for composition with oxidation states
|
|
248
|
+
export type OxiComposition = Record<
|
|
249
|
+
ElementSymbol,
|
|
250
|
+
{ amount: number; oxidation_state?: number }
|
|
251
|
+
>
|
|
252
|
+
|
|
253
|
+
// Parse oxidation state string (e.g. "+2", "2+", "-", "[2-]") to number
|
|
254
|
+
const parse_oxidation_state = (oxidation_str: string): number => {
|
|
255
|
+
// Handle bare signs: "+", "-" are treated as ±1
|
|
256
|
+
if (oxidation_str === `+` || oxidation_str === `-`) {
|
|
257
|
+
return oxidation_str === `+` ? 1 : -1
|
|
258
|
+
}
|
|
259
|
+
// Handle formats like "2+", "+2", "2-", "-2"
|
|
260
|
+
const ox_match = /([+-]?)(\d+)([+-]?)/.exec(oxidation_str)
|
|
261
|
+
if (!ox_match) return 0
|
|
262
|
+
|
|
263
|
+
const [, sign_before, number, sign_after] = ox_match
|
|
264
|
+
const sign = sign_before || sign_after || `+`
|
|
265
|
+
return sign === `-` ? -parseInt(number, 10) : parseInt(number, 10)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Parse chemical formula string with oxidation states into structured data.
|
|
269
|
+
// Supports both ^2+ and [2+] syntax for oxidation states.
|
|
270
|
+
// Examples: "Fe^2+O3", "Fe[2+]O3", "Ca^2+Cl^-2"
|
|
271
|
+
// Tracks original element order from the input string.
|
|
272
|
+
// When strict=true, throws on conflicting oxidation states for the same element.
|
|
273
|
+
export const parse_formula_with_oxidation = (
|
|
274
|
+
formula: string,
|
|
275
|
+
strict = false,
|
|
276
|
+
): ElementWithOxidation[] => {
|
|
277
|
+
const elements: ElementWithOxidation[] = []
|
|
278
|
+
const cleaned_formula = expand_parentheses(formula.replace(/\s/g, ``))
|
|
279
|
+
|
|
280
|
+
// Regex to match: Element, optional oxidation state and/or count in either order
|
|
281
|
+
// Pattern: ([A-Z][a-z]?) - element symbol
|
|
282
|
+
// Followed by one of:
|
|
283
|
+
// - oxidation then optional count: (?:\^([+-]?\d+[+-]?|[+-])|\[([+-]?\d+[+-]?|[+-])\])(count?)
|
|
284
|
+
// - count then optional oxidation: count(?:\^([+-]?\d+[+-]?|[+-])|\[([+-]?\d+[+-]?|[+-])\])?
|
|
285
|
+
// - just oxidation: (?:\^([+-]?\d+[+-]?|[+-])|\[([+-]?\d+[+-]?|[+-])\])
|
|
286
|
+
// - just count: count
|
|
287
|
+
// - neither
|
|
288
|
+
const regex =
|
|
289
|
+
/([A-Z][a-z]?)(?:(?:\^([+-]?\d+[+-]?|[+-])|\[([+-]?\d+[+-]?|[+-])\])((?:\d+(?:\.\d+)?|\.\d+)?)|((?:\d+(?:\.\d+)?|\.\d+))(?:\^([+-]?\d+[+-]?|[+-])|\[([+-]?\d+[+-]?|[+-])\])?)?/g
|
|
290
|
+
|
|
291
|
+
let match: RegExpExecArray | null
|
|
292
|
+
let orig_idx = 0
|
|
293
|
+
|
|
294
|
+
while ((match = regex.exec(cleaned_formula)) !== null) {
|
|
295
|
+
const element = match[1]
|
|
296
|
+
// Oxidation can be in groups 2/3 (oxidation first) or 6/7 (count first)
|
|
297
|
+
// Count can be in group 4 (after oxidation) or 5 (before oxidation)
|
|
298
|
+
const oxidation_str = match[2] || match[3] || match[6] || match[7]
|
|
299
|
+
const count_str = match[4] || match[5]
|
|
300
|
+
const count = parse_count(count_str)
|
|
301
|
+
|
|
302
|
+
if (!is_valid_element(element)) throw new Error(`Invalid element symbol: ${element}`)
|
|
303
|
+
|
|
304
|
+
const oxidation_state = oxidation_str ? parse_oxidation_state(oxidation_str) : undefined
|
|
305
|
+
|
|
306
|
+
// Find or add element entry
|
|
307
|
+
const existing = elements.find((el) => el.element === element)
|
|
308
|
+
if (existing) {
|
|
309
|
+
existing.amount += count
|
|
310
|
+
|
|
311
|
+
// Handle oxidation state conflicts
|
|
312
|
+
if (oxidation_state === undefined) {
|
|
313
|
+
// No oxidation state in current match, nothing to do
|
|
314
|
+
} else if (existing.oxidation_state === undefined) {
|
|
315
|
+
// Set oxidation state on first occurrence
|
|
316
|
+
existing.oxidation_state = oxidation_state
|
|
317
|
+
} else if (strict && existing.oxidation_state !== oxidation_state) {
|
|
318
|
+
// In strict mode, throw on conflicting oxidation states
|
|
319
|
+
throw new Error(
|
|
320
|
+
`Conflicting oxidation states for ${element}: ${format_state(
|
|
321
|
+
existing.oxidation_state,
|
|
322
|
+
)} and ${format_state(oxidation_state)}`,
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
elements.push({ element, amount: count, oxidation_state, orig_idx: orig_idx++ })
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return elements
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Convert OxiComposition to ElementWithOxidation array
|
|
334
|
+
// Does not preserve original order since objects don't have a defined order
|
|
335
|
+
export const oxi_composition_to_elements = (
|
|
336
|
+
composition: OxiComposition,
|
|
337
|
+
): ElementWithOxidation[] =>
|
|
338
|
+
Object.entries(composition).flatMap(([element, { amount, oxidation_state }], idx) =>
|
|
339
|
+
is_valid_element(element) ? [{ element, amount, oxidation_state, orig_idx: idx }] : [],
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
// Extract element symbols from a chemical formula.
|
|
343
|
+
// Default (unique=true, sorted=true): "NbZr2Nb" -> ["Nb", "Zr"]
|
|
344
|
+
// unique=false: Fast token extraction preserving order without parentheses expansion
|
|
345
|
+
// "NbZr2Nb" -> ["Nb", "Zr", "Nb"], "Fe2(SO4)3" -> ["Fe", "S", "O"]
|
|
346
|
+
// Validates tokens against ELEM_SYMBOLS, filtering out invalid ones.
|
|
347
|
+
// sorted=false: Preserves order of first appearance (only applies when unique=true)
|
|
348
|
+
// "ZrNb" -> ["Zr", "Nb"]
|
|
349
|
+
export function extract_formula_elements(
|
|
350
|
+
formula: string,
|
|
351
|
+
{ unique = true, sorted = true }: { unique?: boolean; sorted?: boolean } = {},
|
|
352
|
+
): ElementSymbol[] {
|
|
353
|
+
if (!unique) {
|
|
354
|
+
// Fast path: regex token extraction without parentheses expansion
|
|
355
|
+
const matches = formula.match(/[A-Z][a-z]?/g) ?? []
|
|
356
|
+
const elements: ElementSymbol[] = []
|
|
357
|
+
for (const match of matches) {
|
|
358
|
+
if (is_valid_element(match)) elements.push(match)
|
|
359
|
+
}
|
|
360
|
+
return elements
|
|
361
|
+
}
|
|
362
|
+
const symbols = Object.keys(parse_formula(formula)).filter(is_valid_element)
|
|
363
|
+
return sorted ? symbols.sort() : symbols
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Generate all non-empty subsets of a chemical system as hyphenated strings.
|
|
367
|
+
// Input: formula string, composition object, or element symbol array
|
|
368
|
+
// Output: All subsets sorted alphabetically: ["B", "Mo", "Sc", "B-Mo", "B-Sc", "Mo-Sc", "B-Mo-Sc"]
|
|
369
|
+
// Complexity: O(2^n) where n = number of unique elements (fine for typical ~1-5 elements)
|
|
370
|
+
export function generate_chem_sys_subspaces(
|
|
371
|
+
input: string | CompositionType | ElementSymbol[],
|
|
372
|
+
): string[] {
|
|
373
|
+
let elements: ElementSymbol[]
|
|
374
|
+
|
|
375
|
+
if (typeof input === `string`) elements = extract_formula_elements(input)
|
|
376
|
+
else if (Array.isArray(input)) {
|
|
377
|
+
const uniq = [...new Set(input)]
|
|
378
|
+
for (const elem of uniq) {
|
|
379
|
+
if (!is_valid_element(elem)) throw new Error(`Invalid element symbol: ${elem}`)
|
|
380
|
+
}
|
|
381
|
+
elements = uniq
|
|
382
|
+
} else {
|
|
383
|
+
elements = []
|
|
384
|
+
for (const elem of Object.keys(input)) {
|
|
385
|
+
if (!is_valid_element(elem)) throw new Error(`Invalid element symbol: ${elem}`)
|
|
386
|
+
elements.push(elem)
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const sorted = [...elements].sort()
|
|
391
|
+
const subspaces: string[] = []
|
|
392
|
+
const subset_count = 2 ** sorted.length
|
|
393
|
+
|
|
394
|
+
for (let mask = 1; mask < subset_count; mask++) {
|
|
395
|
+
const subset: string[] = []
|
|
396
|
+
for (let idx = 0; idx < sorted.length; idx++) {
|
|
397
|
+
if (mask & (1 << idx)) subset.push(sorted[idx])
|
|
398
|
+
}
|
|
399
|
+
subspaces.push(subset.join(`-`))
|
|
400
|
+
}
|
|
401
|
+
return subspaces
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Normalize CSV of element symbols to valid symbols in periodic order.
|
|
405
|
+
// Filters invalid symbols, removes duplicates, trims whitespace.
|
|
406
|
+
// Example: "Zr, Nb, InvalidElement, H" -> ["H", "Nb", "Zr"]
|
|
407
|
+
// Note: Matching is case-sensitive. Use all_symbols to filter against a subset.
|
|
408
|
+
export function normalize_element_symbols(csv: string): ElementSymbol[]
|
|
409
|
+
export function normalize_element_symbols<T extends string>(csv: string, all_symbols: T[]): T[]
|
|
410
|
+
export function normalize_element_symbols<T extends string>(
|
|
411
|
+
csv: string,
|
|
412
|
+
all_symbols?: T[],
|
|
413
|
+
): Array<ElementSymbol | T> {
|
|
414
|
+
const input_set = new Set(
|
|
415
|
+
csv
|
|
416
|
+
.split(`,`)
|
|
417
|
+
.map((sym) => sym.trim())
|
|
418
|
+
.filter(Boolean),
|
|
419
|
+
)
|
|
420
|
+
const symbols = all_symbols ?? ELEM_SYMBOLS
|
|
421
|
+
return symbols.filter((sym) => input_set.has(sym))
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// --- Wildcard formula parsing utilities ---
|
|
425
|
+
|
|
426
|
+
// Type for a parsed formula token (element or wildcard with count)
|
|
427
|
+
export type WildcardFormulaToken = {
|
|
428
|
+
element: ElementSymbol | null // null indicates wildcard (*)
|
|
429
|
+
count: number
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// Type for parsed chemsys with wildcards
|
|
433
|
+
export type ChemsysWithWildcards = {
|
|
434
|
+
elements: ElementSymbol[]
|
|
435
|
+
wildcard_count: number
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// Check if input contains wildcard elements (*).
|
|
439
|
+
// Works for both chemsys format (Li-Fe-*-*) and exact formula format (LiFe*2*).
|
|
440
|
+
export const has_wildcards = (input: string): boolean => input.includes(`*`)
|
|
441
|
+
|
|
442
|
+
// Parse chemsys format with wildcards: "Li-Fe-*-*" -> { elements: ["Li", "Fe"], wildcard_count: 2 }
|
|
443
|
+
// Accepts both hyphen and comma separators.
|
|
444
|
+
// Throws if any non-wildcard token is not a valid element symbol.
|
|
445
|
+
export function parse_chemsys_with_wildcards(input: string): ChemsysWithWildcards {
|
|
446
|
+
const tokens = input
|
|
447
|
+
.replace(/-/g, `,`)
|
|
448
|
+
.split(`,`)
|
|
449
|
+
.map((tok) => tok.trim())
|
|
450
|
+
.filter(Boolean)
|
|
451
|
+
|
|
452
|
+
const elements: ElementSymbol[] = []
|
|
453
|
+
let wildcard_count = 0
|
|
454
|
+
|
|
455
|
+
for (const token of tokens) {
|
|
456
|
+
if (token === `*`) {
|
|
457
|
+
wildcard_count++
|
|
458
|
+
} else if (is_valid_element(token)) {
|
|
459
|
+
elements.push(token)
|
|
460
|
+
} else {
|
|
461
|
+
throw new Error(`Invalid element symbol or wildcard: ${token}`)
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return { elements: elements.sort(), wildcard_count }
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Placeholder for wildcards during parentheses expansion (Zz is not a real element symbol).
|
|
469
|
+
// Use static regex literals to avoid escaping issues if placeholder ever changes.
|
|
470
|
+
export const ELEM_WILDCARD = {
|
|
471
|
+
placeholder: `Zz`,
|
|
472
|
+
to_placeholder: /\*/g,
|
|
473
|
+
from_placeholder: /Zz/g,
|
|
474
|
+
} as const
|
|
475
|
+
|
|
476
|
+
// Parse exact formula with wildcards: "LiFe*2*" -> [{ element: "Li", count: 1 }, { element: "Fe", count: 1 }, { element: null, count: 2 }, { element: null, count: 1 }]
|
|
477
|
+
// The * character represents any element, optionally followed by a count.
|
|
478
|
+
// Each * in the pattern represents a distinct element position (wildcards cannot share elements).
|
|
479
|
+
// Examples:
|
|
480
|
+
// "LiFe*2*" -> Li(1), Fe(1), *(2), *(1) - matches formulas with 4 distinct elements
|
|
481
|
+
// "*2O3" -> *(2), O(3) - matches any binary oxide with 2:3 ratio
|
|
482
|
+
// "**O4" -> *(1), *(1), O(4) - matches ternary oxides with 1:1:4 ratio
|
|
483
|
+
export function parse_formula_with_wildcards(formula: string): WildcardFormulaToken[] {
|
|
484
|
+
const tokens: WildcardFormulaToken[] = []
|
|
485
|
+
|
|
486
|
+
// Expand parentheses, treating * as a pseudo-element (temporarily replace to protect it)
|
|
487
|
+
let cleaned = formula.replace(/\s/g, ``)
|
|
488
|
+
|
|
489
|
+
// Protect wildcards from parentheses expansion by replacing * with placeholder
|
|
490
|
+
cleaned = cleaned.replace(ELEM_WILDCARD.to_placeholder, ELEM_WILDCARD.placeholder)
|
|
491
|
+
cleaned = expand_parentheses(cleaned)
|
|
492
|
+
// Restore wildcards
|
|
493
|
+
cleaned = cleaned.replace(ELEM_WILDCARD.from_placeholder, `*`)
|
|
494
|
+
|
|
495
|
+
// Regex to match either:
|
|
496
|
+
// 1. Standard element symbol with optional decimal count
|
|
497
|
+
// 2. Wildcard with optional decimal count
|
|
498
|
+
const regex = /([A-Z][a-z]?)((?:\d+(?:\.\d+)?|\.\d+)?)|(\*)((?:\d+(?:\.\d+)?|\.\d+)?)/g
|
|
499
|
+
|
|
500
|
+
let match: RegExpExecArray | null
|
|
501
|
+
while ((match = regex.exec(cleaned)) !== null) {
|
|
502
|
+
if (match[3] === `*`) {
|
|
503
|
+
// Wildcard match
|
|
504
|
+
const count = parse_count(match[4])
|
|
505
|
+
tokens.push({ element: null, count })
|
|
506
|
+
} else if (match[1]) {
|
|
507
|
+
// Element symbol match
|
|
508
|
+
const element = match[1]
|
|
509
|
+
const count = parse_count(match[2])
|
|
510
|
+
|
|
511
|
+
if (!is_valid_element(element)) {
|
|
512
|
+
throw new Error(`Invalid element symbol: ${element}`)
|
|
513
|
+
}
|
|
514
|
+
tokens.push({ element, count })
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return tokens
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// Check if a formula matches a chemsys pattern with wildcards.
|
|
522
|
+
// The formula must contain exactly the specified elements plus wildcard_count additional distinct elements.
|
|
523
|
+
// Example: matches_chemsys_wildcard("LiFeCoO", ["Li", "Fe"], 2) -> true (Co and O fill the wildcards)
|
|
524
|
+
export function matches_chemsys_wildcard(
|
|
525
|
+
formula: string,
|
|
526
|
+
explicit_elements: string[],
|
|
527
|
+
wildcard_count: number,
|
|
528
|
+
): boolean {
|
|
529
|
+
try {
|
|
530
|
+
const formula_elements = extract_formula_elements(formula, { unique: true })
|
|
531
|
+
const required_count = explicit_elements.length + wildcard_count
|
|
532
|
+
|
|
533
|
+
// Must have exactly the right number of elements
|
|
534
|
+
if (formula_elements.length !== required_count) return false
|
|
535
|
+
|
|
536
|
+
// Must contain all explicit elements
|
|
537
|
+
const formula_set = new Set(formula_elements)
|
|
538
|
+
for (const elem of explicit_elements) {
|
|
539
|
+
if (!is_valid_element(elem) || !formula_set.has(elem)) return false
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return true
|
|
543
|
+
} catch {
|
|
544
|
+
return false
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Check if a formula matches an exact formula pattern with wildcards.
|
|
549
|
+
// Each wildcard (*) must be satisfied by a distinct element not used by explicit elements or other wildcards.
|
|
550
|
+
// Example: matches_formula_wildcard("LiFeCoNiO4", [{element: "Li", count: 1}, {element: null, count: 1}, ...])
|
|
551
|
+
export function matches_formula_wildcard(
|
|
552
|
+
formula: string,
|
|
553
|
+
pattern: WildcardFormulaToken[],
|
|
554
|
+
): boolean {
|
|
555
|
+
try {
|
|
556
|
+
const composition = parse_formula(formula)
|
|
557
|
+
|
|
558
|
+
// Separate explicit elements and wildcards from pattern
|
|
559
|
+
const explicit_requirements: Array<{ element: ElementSymbol; count: number }> = []
|
|
560
|
+
const wildcard_counts: number[] = []
|
|
561
|
+
|
|
562
|
+
for (const token of pattern) {
|
|
563
|
+
if (token.element === null) {
|
|
564
|
+
wildcard_counts.push(token.count)
|
|
565
|
+
} else {
|
|
566
|
+
// Merge counts for same element (e.g. "LiLi" -> Li with count 2)
|
|
567
|
+
const existing = explicit_requirements.find((req) => req.element === token.element)
|
|
568
|
+
if (existing) {
|
|
569
|
+
existing.count += token.count
|
|
570
|
+
} else {
|
|
571
|
+
explicit_requirements.push({ element: token.element, count: token.count })
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// Check explicit element requirements
|
|
577
|
+
const used_elements = new Set<string>()
|
|
578
|
+
for (const req of explicit_requirements) {
|
|
579
|
+
if (composition[req.element] !== req.count) return false
|
|
580
|
+
used_elements.add(req.element)
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// Get remaining elements (candidates for wildcards)
|
|
584
|
+
const remaining_elements = Object.entries(composition)
|
|
585
|
+
.filter(([elem]) => !used_elements.has(elem))
|
|
586
|
+
.map(([elem, count]) => ({ elem, count }))
|
|
587
|
+
|
|
588
|
+
// Must have exactly as many remaining elements as wildcards
|
|
589
|
+
if (remaining_elements.length !== wildcard_counts.length) return false
|
|
590
|
+
|
|
591
|
+
// Try to match remaining elements to wildcards (each wildcard needs a distinct element)
|
|
592
|
+
// Sort both by count to enable greedy matching
|
|
593
|
+
const sorted_remaining = [...remaining_elements].sort((a, b) => a.count - b.count)
|
|
594
|
+
const sorted_wildcards = [...wildcard_counts].sort((a, b) => a - b)
|
|
595
|
+
|
|
596
|
+
// Check if counts match (simple comparison works because we need exact matches)
|
|
597
|
+
for (let idx = 0; idx < sorted_wildcards.length; idx++) {
|
|
598
|
+
if (sorted_remaining[idx].count !== sorted_wildcards[idx]) return false
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return true
|
|
602
|
+
} catch {
|
|
603
|
+
return false
|
|
604
|
+
}
|
|
605
|
+
}
|