matterviz 0.3.7 → 0.4.1
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/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +1 -1
- package/dist/api/optimade.js +32 -26
- package/dist/app.css +0 -3
- package/dist/brillouin/BrillouinZone.svelte +76 -148
- package/dist/brillouin/BrillouinZone.svelte.d.ts +6 -14
- package/dist/brillouin/BrillouinZoneExportPane.svelte +43 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +9 -32
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +97 -205
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +4 -23
- package/dist/brillouin/BrillouinZoneTooltip.svelte +16 -25
- package/dist/brillouin/ReciprocalVectors.svelte +39 -0
- package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
- package/dist/brillouin/compute.d.ts +2 -0
- package/dist/brillouin/compute.js +89 -90
- package/dist/brillouin/geometry.d.ts +8 -0
- package/dist/brillouin/geometry.js +57 -0
- package/dist/brillouin/index.d.ts +2 -0
- package/dist/brillouin/index.js +2 -0
- package/dist/brillouin/types.d.ts +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +14 -13
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +109 -203
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +180 -470
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
- package/dist/chempot-diagram/async-compute.svelte.js +3 -1
- package/dist/chempot-diagram/chempot-worker.js +2 -1
- package/dist/chempot-diagram/color.d.ts +3 -6
- package/dist/chempot-diagram/color.js +5 -5
- package/dist/chempot-diagram/compute.d.ts +4 -4
- package/dist/chempot-diagram/compute.js +20 -20
- package/dist/chempot-diagram/controls-state.svelte.d.ts +10 -0
- package/dist/chempot-diagram/controls-state.svelte.js +42 -0
- package/dist/chempot-diagram/export.d.ts +47 -0
- package/dist/chempot-diagram/export.js +133 -0
- package/dist/chempot-diagram/index.d.ts +1 -0
- package/dist/chempot-diagram/index.js +1 -0
- package/dist/chempot-diagram/pointer.d.ts +0 -10
- package/dist/chempot-diagram/pointer.js +4 -4
- package/dist/chempot-diagram/types.d.ts +3 -3
- package/dist/colors/index.js +8 -7
- package/dist/composition/FormulaFilter.svelte +18 -11
- package/dist/composition/PieChart.svelte +11 -10
- package/dist/composition/chem-sys.d.ts +8 -0
- package/dist/composition/chem-sys.js +86 -0
- package/dist/composition/format.js +7 -4
- package/dist/composition/index.d.ts +1 -0
- package/dist/composition/index.js +1 -0
- package/dist/composition/parse.d.ts +0 -1
- package/dist/composition/parse.js +41 -31
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +8 -10
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +106 -185
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +179 -683
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +183 -687
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +268 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +88 -7
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
- package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
- package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
- package/dist/convex-hull/ConvexHullStats.svelte +36 -175
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +11 -2
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- package/dist/convex-hull/GasPressureControls.svelte +4 -4
- package/dist/convex-hull/TemperatureSlider.svelte +2 -2
- package/dist/convex-hull/barycentric-coords.d.ts +2 -4
- package/dist/convex-hull/barycentric-coords.js +6 -33
- package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
- package/dist/convex-hull/canvas-interactions.svelte.js +278 -0
- package/dist/convex-hull/demo-temperature.d.ts +1 -1
- package/dist/convex-hull/demo-temperature.js +20 -22
- package/dist/convex-hull/gas-thermodynamics.d.ts +2 -2
- package/dist/convex-hull/gas-thermodynamics.js +22 -30
- package/dist/convex-hull/helpers.d.ts +42 -7
- package/dist/convex-hull/helpers.js +171 -78
- package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
- package/dist/convex-hull/hull-state.svelte.js +124 -0
- package/dist/convex-hull/index.d.ts +10 -8
- package/dist/convex-hull/index.js +7 -2
- package/dist/convex-hull/thermodynamics.js +136 -960
- package/dist/convex-hull/types.d.ts +13 -5
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +27 -34
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/element/BohrAtom.svelte +2 -1
- package/dist/element/index.d.ts +4 -0
- package/dist/element/index.js +18 -0
- package/dist/feedback/DragOverlay.svelte +3 -1
- package/dist/feedback/DragOverlay.svelte.d.ts +1 -0
- package/dist/feedback/StatusMessage.svelte +13 -3
- package/dist/fermi-surface/FermiSlice.svelte +13 -5
- package/dist/fermi-surface/FermiSurface.svelte +78 -151
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -14
- package/dist/fermi-surface/FermiSurfaceControls.svelte +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +72 -221
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +8 -34
- package/dist/fermi-surface/compute.js +67 -66
- package/dist/fermi-surface/export.js +6 -16
- package/dist/fermi-surface/index.d.ts +0 -1
- package/dist/fermi-surface/index.js +0 -1
- package/dist/fermi-surface/parse.d.ts +1 -1
- package/dist/fermi-surface/parse.js +71 -79
- package/dist/fermi-surface/types.d.ts +3 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +69 -52
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +4 -3
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +3 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +3 -2
- package/dist/heatmap-matrix/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +166 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.js +5 -4
- package/dist/io/export.d.ts +9 -5
- package/dist/io/export.js +77 -51
- package/dist/io/fetch.d.ts +2 -1
- package/dist/io/fetch.js +5 -1
- package/dist/io/file-drop.d.ts +8 -1
- package/dist/io/file-drop.js +48 -36
- package/dist/io/index.d.ts +2 -0
- package/dist/io/index.js +10 -0
- package/dist/io/types.d.ts +13 -0
- package/dist/io/url-drop.js +64 -33
- package/dist/isosurface/parse.js +52 -51
- package/dist/isosurface/slice.js +5 -4
- package/dist/isosurface/types.js +1 -1
- package/dist/keyboard.d.ts +3 -0
- package/dist/keyboard.js +23 -0
- package/dist/labels.d.ts +1 -1
- package/dist/labels.js +9 -8
- package/dist/layout/FullscreenButton.svelte +33 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +8 -14
- package/dist/layout/PropertyFilter.svelte +3 -2
- package/dist/layout/SettingsSection.svelte +1 -1
- package/dist/layout/ViewerChrome.svelte +116 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +17 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +37 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.js +3 -0
- package/dist/layout/json-tree/JsonNode.svelte +1 -1
- package/dist/layout/json-tree/JsonTree.svelte +2 -2
- package/dist/layout/json-tree/utils.js +5 -4
- package/dist/marching-cubes.js +8 -13
- package/dist/math.d.ts +12 -4
- package/dist/math.js +42 -30
- package/dist/overlays/DraggablePane.svelte +4 -4
- package/dist/overlays/index.d.ts +4 -0
- package/dist/periodic-table/PeriodicTable.svelte +27 -15
- package/dist/periodic-table/PropertySelect.svelte +1 -0
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +9 -3
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramControls.svelte +3 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +4 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +47 -132
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +1 -1
- package/dist/phase-diagram/build-diagram.js +2 -2
- package/dist/phase-diagram/colors.js +1 -1
- package/dist/phase-diagram/parse.d.ts +2 -1
- package/dist/phase-diagram/parse.js +6 -5
- package/dist/phase-diagram/types.d.ts +1 -1
- package/dist/phase-diagram/utils.d.ts +3 -3
- package/dist/phase-diagram/utils.js +8 -12
- package/dist/plot/{BarPlot.svelte → bar/BarPlot.svelte} +246 -841
- package/dist/plot/{BarPlot.svelte.d.ts → bar/BarPlot.svelte.d.ts} +8 -16
- package/dist/plot/{BarPlotControls.svelte → bar/BarPlotControls.svelte} +6 -5
- package/dist/plot/{BarPlotControls.svelte.d.ts → bar/BarPlotControls.svelte.d.ts} +3 -3
- package/dist/plot/{SpacegroupBarPlot.svelte → bar/SpacegroupBarPlot.svelte} +8 -7
- package/dist/plot/{SpacegroupBarPlot.svelte.d.ts → bar/SpacegroupBarPlot.svelte.d.ts} +1 -1
- package/dist/plot/bar/data.d.ts +40 -0
- package/dist/plot/bar/data.js +154 -0
- package/dist/plot/bar/geometry.d.ts +39 -0
- package/dist/plot/bar/geometry.js +60 -0
- package/dist/plot/bar/index.d.ts +3 -0
- package/dist/plot/bar/index.js +3 -0
- package/dist/plot/box/BoxPlot.svelte +1292 -0
- package/dist/plot/box/BoxPlot.svelte.d.ts +95 -0
- package/dist/plot/box/BoxPlotControls.svelte +109 -0
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +19 -0
- package/dist/plot/box/Violin.svelte +14 -0
- package/dist/plot/box/Violin.svelte.d.ts +70 -0
- package/dist/plot/box/box-plot.d.ts +56 -0
- package/dist/plot/box/box-plot.js +129 -0
- package/dist/plot/box/index.d.ts +5 -0
- package/dist/plot/box/index.js +5 -0
- package/dist/plot/box/kde.d.ts +17 -0
- package/dist/plot/box/kde.js +160 -0
- package/dist/plot/box/quantile.d.ts +3 -0
- package/dist/plot/box/quantile.js +53 -0
- package/dist/plot/{auto-place.d.ts → core/auto-place.d.ts} +1 -1
- package/dist/plot/{auto-place.js → core/auto-place.js} +6 -3
- package/dist/plot/core/axis-utils.d.ts +46 -0
- package/dist/plot/core/axis-utils.js +110 -0
- package/dist/plot/{AxisLabel.svelte → core/components/AxisLabel.svelte} +2 -2
- package/dist/plot/{AxisLabel.svelte.d.ts → core/components/AxisLabel.svelte.d.ts} +1 -1
- package/dist/plot/{ColorBar.svelte → core/components/ColorBar.svelte} +41 -38
- package/dist/plot/{ColorBar.svelte.d.ts → core/components/ColorBar.svelte.d.ts} +7 -6
- package/dist/plot/{ColorScaleSelect.svelte → core/components/ColorScaleSelect.svelte} +4 -3
- package/dist/plot/{ColorScaleSelect.svelte.d.ts → core/components/ColorScaleSelect.svelte.d.ts} +2 -2
- package/dist/plot/core/components/ControlPane.svelte +46 -0
- package/dist/plot/core/components/ControlPane.svelte.d.ts +13 -0
- package/dist/plot/{FillArea.svelte → core/components/FillArea.svelte} +17 -6
- package/dist/plot/{FillArea.svelte.d.ts → core/components/FillArea.svelte.d.ts} +1 -1
- package/dist/plot/{InteractiveAxisLabel.svelte → core/components/InteractiveAxisLabel.svelte} +3 -3
- package/dist/plot/{InteractiveAxisLabel.svelte.d.ts → core/components/InteractiveAxisLabel.svelte.d.ts} +2 -2
- package/dist/plot/{Line.svelte → core/components/Line.svelte} +33 -15
- package/dist/plot/{Line.svelte.d.ts → core/components/Line.svelte.d.ts} +3 -2
- package/dist/plot/{PlotAxis.svelte → core/components/PlotAxis.svelte} +9 -6
- package/dist/plot/{PlotAxis.svelte.d.ts → core/components/PlotAxis.svelte.d.ts} +5 -3
- package/dist/plot/{PlotControls.svelte → core/components/PlotControls.svelte} +17 -29
- package/dist/plot/core/components/PlotControls.svelte.d.ts +4 -0
- package/dist/plot/{PlotLegend.svelte → core/components/PlotLegend.svelte} +21 -10
- package/dist/plot/{PlotLegend.svelte.d.ts → core/components/PlotLegend.svelte.d.ts} +3 -2
- package/dist/plot/{PlotTooltip.svelte → core/components/PlotTooltip.svelte} +17 -1
- package/dist/plot/{PlotTooltip.svelte.d.ts → core/components/PlotTooltip.svelte.d.ts} +8 -0
- package/dist/plot/{PortalSelect.svelte → core/components/PortalSelect.svelte} +11 -7
- package/dist/plot/{ReferenceLine.svelte → core/components/ReferenceLine.svelte} +3 -3
- package/dist/plot/{ReferenceLine.svelte.d.ts → core/components/ReferenceLine.svelte.d.ts} +1 -1
- package/dist/plot/{ReferenceLine3D.svelte → core/components/ReferenceLine3D.svelte} +5 -5
- package/dist/plot/{ReferenceLine3D.svelte.d.ts → core/components/ReferenceLine3D.svelte.d.ts} +5 -5
- package/dist/plot/{ReferencePlane.svelte → core/components/ReferencePlane.svelte} +8 -8
- package/dist/plot/{ReferencePlane.svelte.d.ts → core/components/ReferencePlane.svelte.d.ts} +5 -5
- package/dist/plot/{ZeroLines.svelte → core/components/ZeroLines.svelte} +3 -3
- package/dist/plot/{ZeroLines.svelte.d.ts → core/components/ZeroLines.svelte.d.ts} +3 -3
- package/dist/plot/{ZoomRect.svelte → core/components/ZoomRect.svelte} +1 -1
- package/dist/plot/{ZoomRect.svelte.d.ts → core/components/ZoomRect.svelte.d.ts} +1 -1
- package/dist/plot/core/components/index.d.ts +17 -0
- package/dist/plot/core/components/index.js +17 -0
- package/dist/plot/{data-cleaning.d.ts → core/data-cleaning.d.ts} +71 -1
- package/dist/plot/{data-cleaning.js → core/data-cleaning.js} +21 -23
- package/dist/plot/{data-transform.d.ts → core/data-transform.d.ts} +2 -2
- package/dist/plot/{data-transform.js → core/data-transform.js} +3 -3
- package/dist/plot/core/fill-utils.d.ts +34 -0
- package/dist/plot/core/fill-utils.js +391 -0
- package/dist/plot/core/index.d.ts +10 -0
- package/dist/plot/core/index.js +11 -0
- package/dist/plot/core/interactions.d.ts +39 -0
- package/dist/plot/core/interactions.js +209 -0
- package/dist/plot/{layout.d.ts → core/layout.d.ts} +1 -0
- package/dist/plot/{layout.js → core/layout.js} +16 -8
- package/dist/plot/core/pan-zoom.svelte.d.ts +35 -0
- package/dist/plot/core/pan-zoom.svelte.js +221 -0
- package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -0
- package/dist/plot/{reference-line.d.ts → core/reference-line.d.ts} +11 -11
- package/dist/plot/{reference-line.js → core/reference-line.js} +29 -42
- package/dist/plot/core/scales.d.ts +40 -0
- package/dist/plot/{scales.js → core/scales.js} +94 -93
- package/dist/plot/core/svg.d.ts +3 -0
- package/dist/plot/core/svg.js +41 -0
- package/dist/plot/{types.d.ts → core/types.d.ts} +36 -85
- package/dist/plot/{types.js → core/types.js} +1 -1
- package/dist/plot/{utils → core/utils}/label-placement.d.ts +3 -3
- package/dist/plot/{utils → core/utils}/label-placement.js +3 -3
- package/dist/plot/core/utils/series-visibility.d.ts +26 -0
- package/dist/plot/{utils → core/utils}/series-visibility.js +29 -2
- package/dist/plot/core/utils.d.ts +12 -0
- package/dist/plot/core/utils.js +27 -0
- package/dist/plot/{Histogram.svelte → histogram/Histogram.svelte} +174 -551
- package/dist/plot/{Histogram.svelte.d.ts → histogram/Histogram.svelte.d.ts} +2 -2
- package/dist/plot/{HistogramControls.svelte → histogram/HistogramControls.svelte} +6 -6
- package/dist/plot/{HistogramControls.svelte.d.ts → histogram/HistogramControls.svelte.d.ts} +4 -4
- package/dist/plot/histogram/index.d.ts +2 -0
- package/dist/plot/histogram/index.js +2 -0
- package/dist/plot/index.d.ts +8 -41
- package/dist/plot/index.js +10 -39
- package/dist/plot/sankey/Sankey.svelte +697 -0
- package/dist/plot/sankey/Sankey.svelte.d.ts +74 -0
- package/dist/plot/sankey/SankeyControls.svelte +98 -0
- package/dist/plot/sankey/SankeyControls.svelte.d.ts +19 -0
- package/dist/plot/sankey/index.d.ts +4 -0
- package/dist/plot/sankey/index.js +3 -0
- package/dist/plot/sankey/sankey-types.d.ts +42 -0
- package/dist/plot/sankey/sankey-types.js +4 -0
- package/dist/plot/sankey/sankey.d.ts +52 -0
- package/dist/plot/sankey/sankey.js +189 -0
- package/dist/plot/{BinnedScatterPlot.svelte → scatter/BinnedScatterPlot.svelte} +64 -64
- package/dist/plot/{BinnedScatterPlot.svelte.d.ts → scatter/BinnedScatterPlot.svelte.d.ts} +6 -6
- package/dist/plot/{ElementScatter.svelte → scatter/ElementScatter.svelte} +6 -6
- package/dist/plot/{ElementScatter.svelte.d.ts → scatter/ElementScatter.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPlot.svelte → scatter/ScatterPlot.svelte} +297 -1008
- package/dist/plot/{ScatterPlot.svelte.d.ts → scatter/ScatterPlot.svelte.d.ts} +10 -18
- package/dist/plot/{ScatterPlotControls.svelte → scatter/ScatterPlotControls.svelte} +6 -5
- package/dist/plot/{ScatterPlotControls.svelte.d.ts → scatter/ScatterPlotControls.svelte.d.ts} +2 -2
- package/dist/plot/{ScatterPoint.svelte → scatter/ScatterPoint.svelte} +7 -7
- package/dist/plot/{ScatterPoint.svelte.d.ts → scatter/ScatterPoint.svelte.d.ts} +3 -3
- package/dist/plot/{adaptive-density.d.ts → scatter/adaptive-density.d.ts} +14 -4
- package/dist/plot/{adaptive-density.js → scatter/adaptive-density.js} +46 -20
- package/dist/plot/{binned-scatter-types.d.ts → scatter/binned-scatter-types.d.ts} +5 -12
- package/dist/plot/scatter/index.d.ts +7 -0
- package/dist/plot/scatter/index.js +5 -0
- package/dist/plot/scatter/scatter-data.d.ts +19 -0
- package/dist/plot/scatter/scatter-data.js +212 -0
- package/dist/plot/{ScatterPlot3D.svelte → scatter-3d/ScatterPlot3D.svelte} +25 -34
- package/dist/plot/{ScatterPlot3D.svelte.d.ts → scatter-3d/ScatterPlot3D.svelte.d.ts} +9 -17
- package/dist/plot/{ScatterPlot3DControls.svelte → scatter-3d/ScatterPlot3DControls.svelte} +14 -14
- package/dist/plot/{ScatterPlot3DControls.svelte.d.ts → scatter-3d/ScatterPlot3DControls.svelte.d.ts} +6 -6
- package/dist/plot/{ScatterPlot3DScene.svelte → scatter-3d/ScatterPlot3DScene.svelte} +129 -128
- package/dist/plot/{ScatterPlot3DScene.svelte.d.ts → scatter-3d/ScatterPlot3DScene.svelte.d.ts} +6 -15
- package/dist/plot/{Surface3D.svelte → scatter-3d/Surface3D.svelte} +7 -6
- package/dist/plot/{Surface3D.svelte.d.ts → scatter-3d/Surface3D.svelte.d.ts} +5 -4
- package/dist/plot/scatter-3d/index.d.ts +4 -0
- package/dist/plot/scatter-3d/index.js +4 -0
- package/dist/plot/sunburst/Sunburst.svelte +1041 -0
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +97 -0
- package/dist/plot/sunburst/SunburstControls.svelte +200 -0
- package/dist/plot/sunburst/SunburstControls.svelte.d.ts +26 -0
- package/dist/plot/sunburst/index.d.ts +4 -0
- package/dist/plot/sunburst/index.js +4 -0
- package/dist/plot/sunburst/render.d.ts +34 -0
- package/dist/plot/sunburst/render.js +122 -0
- package/dist/plot/sunburst/sunburst.d.ts +62 -0
- package/dist/plot/sunburst/sunburst.js +269 -0
- package/dist/rdf/RdfPlot.svelte +2 -1
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +11 -24
- package/dist/sanitize.js +14 -3
- package/dist/scene/SceneCamera.svelte +62 -0
- package/dist/scene/SceneCamera.svelte.d.ts +19 -0
- package/dist/scene/bind-renderer.svelte.d.ts +2 -0
- package/dist/scene/bind-renderer.svelte.js +14 -0
- package/dist/scene/index.d.ts +4 -0
- package/dist/scene/index.js +5 -0
- package/dist/scene/props.js +52 -0
- package/dist/scene/types.d.ts +26 -0
- package/dist/scene/types.js +1 -0
- package/dist/settings.d.ts +79 -3
- package/dist/settings.js +321 -1
- package/dist/spectral/Bands.svelte +47 -36
- package/dist/spectral/Bands.svelte.d.ts +6 -6
- package/dist/spectral/BandsAndDos.svelte +23 -25
- package/dist/spectral/BrillouinBandsDos.svelte +42 -30
- package/dist/spectral/Dos.svelte +15 -23
- package/dist/spectral/Dos.svelte.d.ts +4 -3
- package/dist/spectral/helpers.d.ts +8 -6
- package/dist/spectral/helpers.js +137 -65
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +0 -6
- package/dist/structure/Arrow.svelte +2 -4
- package/dist/structure/AtomLegend.svelte +8 -9
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/CanvasTooltip.svelte +1 -0
- package/dist/structure/CellSelect.svelte +12 -5
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- package/dist/structure/Cylinder.svelte +12 -8
- package/dist/structure/Cylinder.svelte.d.ts +4 -1
- package/dist/structure/Lattice.svelte +2 -2
- package/dist/structure/Structure.svelte +365 -423
- package/dist/structure/Structure.svelte.d.ts +5 -15
- package/dist/structure/StructureControls.svelte +217 -2
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +54 -156
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +10 -9
- package/dist/structure/StructureInfoPane.svelte.d.ts +5 -5
- package/dist/structure/StructureScene.svelte +376 -208
- package/dist/structure/StructureScene.svelte.d.ts +22 -20
- package/dist/structure/{label-placement.d.ts → atom-label-placement.d.ts} +3 -3
- package/dist/structure/{label-placement.js → atom-label-placement.js} +15 -5
- package/dist/structure/atom-properties.d.ts +1 -1
- package/dist/structure/atom-properties.js +17 -22
- package/dist/structure/bond-order-perception.js +3 -5
- package/dist/structure/bonding.d.ts +4 -0
- package/dist/structure/bonding.js +134 -63
- package/dist/structure/export.d.ts +24 -4
- package/dist/structure/export.js +89 -143
- package/dist/structure/index.d.ts +4 -4
- package/dist/structure/index.js +3 -3
- package/dist/structure/measure.d.ts +3 -2
- package/dist/structure/measure.js +6 -5
- package/dist/structure/parse.d.ts +3 -2
- package/dist/structure/parse.js +419 -438
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +1 -1
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +190 -13
- package/dist/structure/polyhedra.d.ts +41 -0
- package/dist/structure/polyhedra.js +602 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.js +3 -2
- package/dist/structure/validation.js +5 -6
- package/dist/symmetry/SymmetryElementControls.svelte +69 -0
- package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
- package/dist/symmetry/SymmetryElements.svelte +354 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +113 -8
- package/dist/symmetry/WyckoffTable.svelte +68 -7
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +7 -14
- package/dist/symmetry/index.d.ts +14 -4
- package/dist/symmetry/index.js +291 -72
- package/dist/symmetry/spacegroups.d.ts +12 -1
- package/dist/symmetry/spacegroups.js +63 -14
- package/dist/symmetry/symmetry-elements.d.ts +33 -0
- package/dist/symmetry/symmetry-elements.js +521 -0
- package/dist/symmetry/wyckoff-db.d.ts +9 -0
- package/dist/symmetry/wyckoff-db.js +87 -0
- package/dist/table/HeatmapTable.svelte +66 -25
- package/dist/table/HeatmapTable.svelte.d.ts +1 -1
- package/dist/table/index.d.ts +1 -3
- package/dist/table/index.js +1 -1
- package/dist/theme/index.js +8 -8
- package/dist/tooltip/KCoords.svelte +45 -0
- package/dist/tooltip/KCoords.svelte.d.ts +8 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/trajectory/Trajectory.svelte +123 -100
- package/dist/trajectory/Trajectory.svelte.d.ts +11 -22
- package/dist/trajectory/TrajectoryExportPane.svelte +17 -25
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +5 -3
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +17 -37
- package/dist/trajectory/format-detect.d.ts +1 -1
- package/dist/trajectory/format-detect.js +27 -19
- package/dist/trajectory/frame-reader.d.ts +0 -1
- package/dist/trajectory/frame-reader.js +63 -162
- package/dist/trajectory/helpers.d.ts +10 -2
- package/dist/trajectory/helpers.js +56 -36
- package/dist/trajectory/index.js +1 -1
- package/dist/trajectory/parse/ase.d.ts +9 -1
- package/dist/trajectory/parse/ase.js +47 -32
- package/dist/trajectory/parse/diagnostics.d.ts +3 -0
- package/dist/trajectory/parse/diagnostics.js +14 -0
- package/dist/trajectory/parse/hdf5.js +1 -1
- package/dist/trajectory/parse/index.d.ts +1 -1
- package/dist/trajectory/parse/index.js +65 -105
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +8 -6
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +38 -18
- package/dist/trajectory/parse/xyz.d.ts +13 -1
- package/dist/trajectory/parse/xyz.js +102 -94
- package/dist/trajectory/plotting.d.ts +1 -2
- package/dist/trajectory/plotting.js +16 -113
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +7 -5
- package/dist/xrd/XrdPlot.svelte +16 -30
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/calc-xrd.js +18 -20
- package/dist/xrd/index.d.ts +2 -2
- package/dist/xrd/parse.js +2 -2
- package/package.json +43 -26
- package/dist/element/data.json +0 -11864
- package/dist/fermi-surface/marching-cubes.d.ts +0 -2
- package/dist/fermi-surface/marching-cubes.js +0 -2
- package/dist/plot/PlotControls.svelte.d.ts +0 -4
- package/dist/plot/axis-utils.d.ts +0 -19
- package/dist/plot/axis-utils.js +0 -78
- package/dist/plot/defaults.d.ts +0 -19
- package/dist/plot/defaults.js +0 -9
- package/dist/plot/fill-utils.d.ts +0 -46
- package/dist/plot/fill-utils.js +0 -322
- package/dist/plot/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/hover-lock.svelte.js +0 -46
- package/dist/plot/interactions.d.ts +0 -12
- package/dist/plot/interactions.js +0 -101
- package/dist/plot/scales.d.ts +0 -48
- package/dist/plot/svg.d.ts +0 -1
- package/dist/plot/svg.js +0 -11
- package/dist/plot/utils/series-visibility.d.ts +0 -15
- package/dist/plot/utils.d.ts +0 -1
- package/dist/plot/utils.js +0 -14
- /package/dist/plot/{PortalSelect.svelte.d.ts → core/components/PortalSelect.svelte.d.ts} +0 -0
- /package/dist/plot/{binned-scatter-types.js → scatter/binned-scatter-types.js} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as math from '../math';
|
|
3
3
|
import { EPS } from '../math';
|
|
4
4
|
import { CLOSED_CONTOUR_TOLERANCE, IRREDUCIBLE_BZ_MIN_VERTICES, IRREDUCIBLE_BZ_TOLERANCE, SPANNING_THRESHOLD, } from './constants';
|
|
5
|
-
import { marching_cubes } from '
|
|
5
|
+
import { marching_cubes } from '../marching-cubes';
|
|
6
6
|
const safe_mod = (val, dim) => ((val % dim) + dim) % dim;
|
|
7
7
|
// Precompute Catmull-Rom coefficients for a given t value
|
|
8
8
|
// Returns [c0, c1, c2, c3] where result = c0*p0 + c1*p1 + c2*p2 + c3*p3
|
|
@@ -15,8 +15,10 @@ function catmull_rom_coeffs(t) {
|
|
|
15
15
|
const c4 = 0.5 * (-t2 + t3);
|
|
16
16
|
return [c1, c2, c3, c4];
|
|
17
17
|
}
|
|
18
|
-
// Tricubic interpolation with cached wrap indices and precomputed coefficients
|
|
19
|
-
|
|
18
|
+
// Tricubic interpolation with cached wrap indices and precomputed coefficients.
|
|
19
|
+
// px/py/pz are the wrap periods (unique points per axis): n for periodic grids,
|
|
20
|
+
// n−1 for endpoint-inclusive grids whose last point duplicates the first.
|
|
21
|
+
function tricubic_interpolate(grid, fx, fy, fz, px, py, pz) {
|
|
20
22
|
// Get integer and fractional parts
|
|
21
23
|
const ix = Math.floor(fx);
|
|
22
24
|
const iy = Math.floor(fy);
|
|
@@ -25,13 +27,10 @@ function tricubic_interpolate(grid, fx, fy, fz, nx, ny, nz) {
|
|
|
25
27
|
const [cx0, cx1, cx2, cx3] = catmull_rom_coeffs(fx - ix);
|
|
26
28
|
const [cy0, cy1, cy2, cy3] = catmull_rom_coeffs(fy - iy);
|
|
27
29
|
const [cz0, cz1, cz2, cz3] = catmull_rom_coeffs(fz - iz);
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const wx = [wrap_x(ix - 1), wrap_x(ix), wrap_x(ix + 1), wrap_x(ix + 2)];
|
|
33
|
-
const wy = [wrap_y(iy - 1), wrap_y(iy), wrap_y(iy + 1), wrap_y(iy + 2)];
|
|
34
|
-
const wz = [wrap_z(iz - 1), wrap_z(iz), wrap_z(iz + 1), wrap_z(iz + 2)];
|
|
30
|
+
// Wrapped stencil indices (modulo hoisted out of the inner loop); a zero period
|
|
31
|
+
// (single-point axis) has no neighbours, so collapse the stencil onto index 0
|
|
32
|
+
const stencil = (idx, period) => [idx - 1, idx, idx + 1, idx + 2].map((stencil_idx) => period > 0 ? ((stencil_idx % period) + period) % period : 0);
|
|
33
|
+
const [wx, wy, wz] = [stencil(ix, px), stencil(iy, py), stencil(iz, pz)];
|
|
35
34
|
// Interpolate along z, then y, then x (fully inlined)
|
|
36
35
|
let result = 0;
|
|
37
36
|
const cx = [cx0, cx1, cx2, cx3];
|
|
@@ -51,26 +50,29 @@ function tricubic_interpolate(grid, fx, fy, fz, nx, ny, nz) {
|
|
|
51
50
|
}
|
|
52
51
|
return result;
|
|
53
52
|
}
|
|
54
|
-
// Upsample a 3D grid
|
|
55
|
-
|
|
53
|
+
// Upsample a 3D grid with tricubic interpolation, preserving the grid convention:
|
|
54
|
+
// endpoint-inclusive (BXSF, point i ↔ frac i/(n−1)) vs periodic (FRMSF, i ↔ i/n).
|
|
55
|
+
// Mixing conventions rescales the surface and distorts the zone boundary.
|
|
56
|
+
function upsample_grid(grid, factor, periodic = false) {
|
|
56
57
|
if (factor <= 1)
|
|
57
58
|
return grid;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const new_nz = Math.round(
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
// Endpoint-inclusive grids carry one duplicated boundary sample per axis; the wrap
|
|
60
|
+
// period (count of unique points) doubles as the resampling span numerator
|
|
61
|
+
const endpoint = periodic ? 0 : 1;
|
|
62
|
+
const dims = [grid.length, grid[0]?.length || 0, grid[0]?.[0]?.length || 0];
|
|
63
|
+
const [px, py, pz] = dims.map((dim) => dim - endpoint);
|
|
64
|
+
const [new_nx, new_ny, new_nz] = [px, py, pz].map((period) => Math.round(period * factor) + endpoint);
|
|
65
|
+
// Map new index → source coordinate; a single-point axis (span 0) pins its lone
|
|
66
|
+
// output to source 0 to avoid 0/0 = NaN
|
|
67
|
+
const src_coords = (new_n, period) => {
|
|
68
|
+
const span = new_n - endpoint;
|
|
69
|
+
return Float64Array.from({ length: new_n }, (_, idx) => span > 0 ? (idx / span) * period : 0);
|
|
70
|
+
};
|
|
71
|
+
const [fx_arr, fy_arr, fz_arr] = [
|
|
72
|
+
[new_nx, px],
|
|
73
|
+
[new_ny, py],
|
|
74
|
+
[new_nz, pz],
|
|
75
|
+
].map(([new_n, period]) => src_coords(new_n, period));
|
|
74
76
|
// Preallocate output grid
|
|
75
77
|
const new_grid = Array(new_nx);
|
|
76
78
|
for (let ix = 0; ix < new_nx; ix++) {
|
|
@@ -80,7 +82,7 @@ function upsample_grid(grid, factor) {
|
|
|
80
82
|
const fy = fy_arr[iy];
|
|
81
83
|
const iz_arr = new Float64Array(new_nz);
|
|
82
84
|
for (let iz = 0; iz < new_nz; iz++) {
|
|
83
|
-
iz_arr[iz] = tricubic_interpolate(grid, fx, fy, fz_arr[iz],
|
|
85
|
+
iz_arr[iz] = tricubic_interpolate(grid, fx, fy, fz_arr[iz], px, py, pz);
|
|
84
86
|
}
|
|
85
87
|
// Convert Float64Array back to regular array for compatibility
|
|
86
88
|
iy_arr[iy] = Array.from(iz_arr);
|
|
@@ -109,15 +111,16 @@ export function extract_fermi_surface(band_data, options = {}) {
|
|
|
109
111
|
// Check if Fermi level intersects this band
|
|
110
112
|
if (!band_intersects_fermi(raw_energies, iso_value))
|
|
111
113
|
continue;
|
|
114
|
+
// BXSF grids are endpoint-inclusive (store both equivalent k=0 and k=1 → false);
|
|
115
|
+
// FRMSF grids store k=i/n without the duplicated endpoint (→ true)
|
|
116
|
+
const periodic = band_data.periodic ?? false;
|
|
112
117
|
// Apply interpolation for smoother surfaces
|
|
113
118
|
const energies = interpolation_factor > 1
|
|
114
|
-
? upsample_grid(raw_energies, interpolation_factor)
|
|
119
|
+
? upsample_grid(raw_energies, interpolation_factor, periodic)
|
|
115
120
|
: raw_energies;
|
|
116
121
|
// Extract isosurface using marching cubes
|
|
117
|
-
// Use periodic: false because BXSF grids include both endpoints (k=0 and k=1)
|
|
118
|
-
// which are equivalent due to BZ periodicity. This matches scikit-image behavior.
|
|
119
122
|
const mc_result = marching_cubes(energies, iso_value, band_data.k_lattice, {
|
|
120
|
-
periodic
|
|
123
|
+
periodic,
|
|
121
124
|
interpolate: true,
|
|
122
125
|
});
|
|
123
126
|
if (mc_result.vertices.length === 0)
|
|
@@ -137,13 +140,14 @@ export function extract_fermi_surface(band_data, options = {}) {
|
|
|
137
140
|
total_area += isosurface.area;
|
|
138
141
|
// Compute Fermi velocities if requested
|
|
139
142
|
if (compute_velocities && band_data.velocities) {
|
|
140
|
-
isosurface.properties = compute_fermi_velocities(isosurface, band_data.velocities[spin_idx][band_idx], band_data.k_lattice, band_data.k_grid);
|
|
143
|
+
isosurface.properties = compute_fermi_velocities(isosurface, band_data.velocities[spin_idx][band_idx], band_data.k_lattice, band_data.k_grid, periodic);
|
|
141
144
|
isosurface.avg_velocity =
|
|
142
|
-
isosurface.properties.reduce((
|
|
145
|
+
isosurface.properties.reduce((sum, velocity) => sum + velocity, 0) /
|
|
146
|
+
isosurface.properties.length;
|
|
143
147
|
}
|
|
144
148
|
// Compute dimensionality if requested
|
|
145
149
|
if (compute_dimensionality) {
|
|
146
|
-
const { dimensionality, orientation } = analyze_surface_topology(isosurface,
|
|
150
|
+
const { dimensionality, orientation } = analyze_surface_topology(isosurface, band_data.k_lattice);
|
|
147
151
|
isosurface.dimensionality = dimensionality;
|
|
148
152
|
isosurface.orientation = orientation;
|
|
149
153
|
}
|
|
@@ -205,24 +209,22 @@ export function compute_surface_area(surface) {
|
|
|
205
209
|
return total_area;
|
|
206
210
|
}
|
|
207
211
|
// Compute Fermi velocities at surface vertices
|
|
208
|
-
function compute_fermi_velocities(surface, velocity_grid, k_lattice, k_grid) {
|
|
212
|
+
function compute_fermi_velocities(surface, velocity_grid, k_lattice, k_grid, periodic = false) {
|
|
209
213
|
const [nx, ny, nz] = k_grid;
|
|
210
214
|
const velocities = [];
|
|
211
|
-
//
|
|
212
|
-
|
|
215
|
+
// Invert the marching-cubes transform cart = k_latticeᵀ·(frac − 0.5): frac =
|
|
216
|
+
// (k_latticeᵀ)⁻¹·cart + 0.5. Omitting the transpose samples wrong k-points for
|
|
217
|
+
// non-symmetric lattices; skipping the +0.5 is off by half a reciprocal cell.
|
|
218
|
+
const k_inv = math.matrix_inverse_3x3(math.transpose_3x3_matrix(k_lattice));
|
|
219
|
+
// Grid point i sits at frac i/(n−1) (endpoint-inclusive BXSF) or i/n (periodic)
|
|
220
|
+
const [sx, sy, sz] = periodic ? [nx, ny, nz] : [nx - 1, ny - 1, nz - 1];
|
|
221
|
+
// Clamp guards float jitter at the cell boundary
|
|
222
|
+
const clamp01 = (val) => Math.min(Math.max(val, 0), 1);
|
|
213
223
|
for (const vertex of surface.vertices) {
|
|
214
|
-
//
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
((frac[0] % 1) + 1) % 1,
|
|
219
|
-
((frac[1] % 1) + 1) % 1,
|
|
220
|
-
((frac[2] % 1) + 1) % 1,
|
|
221
|
-
];
|
|
222
|
-
// Grid indices (with interpolation)
|
|
223
|
-
const gx = wrapped[0] * nx;
|
|
224
|
-
const gy = wrapped[1] * ny;
|
|
225
|
-
const gz = wrapped[2] * nz;
|
|
224
|
+
const frac = math.mat3x3_vec3_multiply(k_inv, vertex); // centered, in [-0.5, 0.5]
|
|
225
|
+
const gx = clamp01(frac[0] + 0.5) * sx;
|
|
226
|
+
const gy = clamp01(frac[1] + 0.5) * sy;
|
|
227
|
+
const gz = clamp01(frac[2] + 0.5) * sz;
|
|
226
228
|
// Trilinear interpolation of velocity
|
|
227
229
|
const velocity = trilinear_interpolate_vec3(velocity_grid, gx, gy, gz);
|
|
228
230
|
velocities.push(Math.hypot(...velocity)); // magnitude
|
|
@@ -265,14 +267,15 @@ function trilinear_interpolate_vec3(grid, x, y, z) {
|
|
|
265
267
|
return math.lerp_vec3(c0, c1, zd);
|
|
266
268
|
}
|
|
267
269
|
// Analyze surface topology to determine dimensionality
|
|
268
|
-
function analyze_surface_topology(surface,
|
|
270
|
+
function analyze_surface_topology(surface, k_lattice) {
|
|
269
271
|
if (surface.vertices.length === 0) {
|
|
270
272
|
return { dimensionality: `3D`, orientation: null };
|
|
271
273
|
}
|
|
272
|
-
//
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
// Vertices live in the centered parallelepiped k_latticeᵀ·[-0.5, 0.5]³, whose bounding
|
|
275
|
+
// box along Cartesian axis j has half-extent 0.5·Σᵢ|k_lattice[i][j]| (a hardcoded box
|
|
276
|
+
// would make dimensionality depend on the absolute lattice scale)
|
|
277
|
+
const half_extent = [0, 1, 2].map((axis_idx) => 0.5 * k_lattice.reduce((sum, row) => sum + Math.abs(row[axis_idx]), 0));
|
|
278
|
+
const bz_extent = { min: half_extent.map((ext) => -ext), max: half_extent };
|
|
276
279
|
const surface_extent = math.compute_bounding_box(surface.vertices);
|
|
277
280
|
// Check spanning in each direction
|
|
278
281
|
const spans = [false, false, false];
|
|
@@ -301,10 +304,8 @@ function analyze_surface_topology(surface, bz_data) {
|
|
|
301
304
|
orientation[axis_idx] = 1;
|
|
302
305
|
return { dimensionality: `1D`, orientation };
|
|
303
306
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
return { dimensionality: `quasi-2D`, orientation: null };
|
|
307
|
-
}
|
|
307
|
+
// Spans all 3 directions - complex warped network
|
|
308
|
+
return { dimensionality: `quasi-2D`, orientation: null };
|
|
308
309
|
}
|
|
309
310
|
// Compute 2D Fermi slice along a specified plane
|
|
310
311
|
export function compute_fermi_slice(fermi_data, options = {}) {
|
|
@@ -319,7 +320,7 @@ export function compute_fermi_slice(fermi_data, options = {}) {
|
|
|
319
320
|
if (normal_len < EPS) {
|
|
320
321
|
throw new Error(`Degenerate plane normal: k_lattice vectors produce a zero-length normal for miller indices [${miller_indices.join(`, `)}]`);
|
|
321
322
|
}
|
|
322
|
-
const unit_normal = math.
|
|
323
|
+
const unit_normal = math.normalize_vec(plane_normal);
|
|
323
324
|
// Compute in-plane basis vectors
|
|
324
325
|
const [in_plane_u, in_plane_v] = math.compute_in_plane_basis(unit_normal);
|
|
325
326
|
// Slice each isosurface
|
|
@@ -348,19 +349,19 @@ function compute_edge_intersection(surface, vertex_distances, v0_idx, v1_idx) {
|
|
|
348
349
|
// Edge must cross the plane (opposite signs)
|
|
349
350
|
if (d0 * d1 >= 0)
|
|
350
351
|
return null;
|
|
351
|
-
const
|
|
352
|
+
const frac = d0 / (d0 - d1);
|
|
352
353
|
const v0 = surface.vertices[v0_idx];
|
|
353
354
|
const v1 = surface.vertices[v1_idx];
|
|
354
355
|
const point = [
|
|
355
|
-
v0[0] +
|
|
356
|
-
v0[1] +
|
|
357
|
-
v0[2] +
|
|
356
|
+
v0[0] + frac * (v1[0] - v0[0]),
|
|
357
|
+
v0[1] + frac * (v1[1] - v0[1]),
|
|
358
|
+
v0[2] + frac * (v1[2] - v0[2]),
|
|
358
359
|
];
|
|
359
360
|
let property;
|
|
360
361
|
if (surface.properties) {
|
|
361
362
|
property =
|
|
362
363
|
surface.properties[v0_idx] +
|
|
363
|
-
|
|
364
|
+
frac * (surface.properties[v1_idx] - surface.properties[v0_idx]);
|
|
364
365
|
}
|
|
365
366
|
return { point, property };
|
|
366
367
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const blob = new Blob([content], { type: mime_type });
|
|
4
|
-
const url = URL.createObjectURL(blob);
|
|
5
|
-
const link = document.createElement(`a`);
|
|
6
|
-
link.href = url;
|
|
7
|
-
link.download = filename;
|
|
8
|
-
document.body.appendChild(link);
|
|
9
|
-
link.click();
|
|
10
|
-
document.body.removeChild(link);
|
|
11
|
-
URL.revokeObjectURL(url);
|
|
12
|
-
}
|
|
1
|
+
import { download } from '../io/fetch';
|
|
2
|
+
import { to_error } from '../utils';
|
|
13
3
|
// Export scene to STL format (good for 3D printing)
|
|
14
4
|
export async function export_to_stl(scene, filename) {
|
|
15
5
|
const { STLExporter } = await import(`three/addons/exporters/STLExporter.js`);
|
|
@@ -17,14 +7,14 @@ export async function export_to_stl(scene, filename) {
|
|
|
17
7
|
const result = exporter.parse(scene, { binary: true });
|
|
18
8
|
// Binary STL returns DataView, convert to ArrayBuffer for Blob
|
|
19
9
|
const buffer = result instanceof DataView ? result.buffer : result;
|
|
20
|
-
|
|
10
|
+
download(buffer, `${filename}.stl`, `application/octet-stream`);
|
|
21
11
|
}
|
|
22
12
|
// Export scene to OBJ format (widely compatible)
|
|
23
13
|
export async function export_to_obj(scene, filename) {
|
|
24
14
|
const { OBJExporter } = await import(`three/addons/exporters/OBJExporter.js`);
|
|
25
15
|
const exporter = new OBJExporter();
|
|
26
16
|
const result = exporter.parse(scene);
|
|
27
|
-
|
|
17
|
+
download(result, `${filename}.obj`, `text/plain`);
|
|
28
18
|
}
|
|
29
19
|
// Export scene to GLTF format (modern web/AR standard)
|
|
30
20
|
export async function export_to_gltf(scene, filename) {
|
|
@@ -33,9 +23,9 @@ export async function export_to_gltf(scene, filename) {
|
|
|
33
23
|
return new Promise((resolve, reject) => {
|
|
34
24
|
exporter.parse(scene, (gltf) => {
|
|
35
25
|
const output = JSON.stringify(gltf, null, 2);
|
|
36
|
-
|
|
26
|
+
download(output, `${filename}.gltf`, `application/json`);
|
|
37
27
|
resolve();
|
|
38
|
-
}, (error) => reject(error), { binary: false });
|
|
28
|
+
}, (error) => reject(to_error(error)), { binary: false });
|
|
39
29
|
});
|
|
40
30
|
}
|
|
41
31
|
// Main export function that dispatches to the appropriate format
|
|
@@ -6,7 +6,6 @@ export { default as FermiSurfaceTooltip } from './FermiSurfaceTooltip.svelte';
|
|
|
6
6
|
export * from './compute';
|
|
7
7
|
export * from './constants';
|
|
8
8
|
export * from './export';
|
|
9
|
-
export * from './marching-cubes';
|
|
10
9
|
export * from './parse';
|
|
11
10
|
export * from './symmetry';
|
|
12
11
|
export * from './types';
|
|
@@ -7,7 +7,6 @@ export { default as FermiSurfaceTooltip } from './FermiSurfaceTooltip.svelte';
|
|
|
7
7
|
export * from './compute';
|
|
8
8
|
export * from './constants';
|
|
9
9
|
export * from './export';
|
|
10
|
-
export * from './marching-cubes';
|
|
11
10
|
export * from './parse';
|
|
12
11
|
export * from './symmetry';
|
|
13
12
|
export * from './types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { BandGridData, FermiSurfaceData } from './types';
|
|
2
|
-
export declare function parse_fermi_file(content: string, filename?: string): BandGridData | FermiSurfaceData
|
|
2
|
+
export declare function parse_fermi_file(content: string, filename?: string): BandGridData | FermiSurfaceData;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import * as math from '../math';
|
|
2
|
+
import { is_plain_object } from '../utils';
|
|
1
3
|
import * as constants from './constants';
|
|
2
|
-
import { compute_vertex_normals } from '
|
|
4
|
+
import { compute_vertex_normals } from '../marching-cubes';
|
|
3
5
|
const parse_number_tokens = (line) => line.split(/\s+/).filter(Boolean);
|
|
4
6
|
// Parse whitespace-separated floats from a line (optimized with unary +)
|
|
5
|
-
const parse_floats = (line) => parse_number_tokens(line).map(
|
|
7
|
+
const parse_floats = (line) => parse_number_tokens(line).map(Number);
|
|
6
8
|
// Parse whitespace-separated integers from a line
|
|
7
9
|
const parse_ints = (line) => parse_number_tokens(line).map((part) => parseInt(part, 10));
|
|
8
10
|
// Parse BXSF (Band-XSF) format used by XCrySDen, Quantum ESPRESSO, etc.
|
|
@@ -219,18 +221,14 @@ function parse_frmsf(content) {
|
|
|
219
221
|
fermi_energy: 0, // FRMSF typically expects Fermi level at 0
|
|
220
222
|
n_bands,
|
|
221
223
|
n_spins,
|
|
224
|
+
periodic: true, // FRMSF stores k=i/n with no duplicated endpoint (unlike BXSF)
|
|
222
225
|
};
|
|
223
226
|
}
|
|
224
227
|
// Validate that an object has the required Isosurface shape
|
|
225
228
|
function is_valid_isosurface(obj) {
|
|
226
|
-
if (!obj
|
|
229
|
+
if (!is_plain_object(obj))
|
|
227
230
|
return false;
|
|
228
|
-
const
|
|
229
|
-
const vertices = isosurface_obj.vertices;
|
|
230
|
-
const faces = isosurface_obj.faces;
|
|
231
|
-
const normals = isosurface_obj.normals;
|
|
232
|
-
const band_index = isosurface_obj.band_index;
|
|
233
|
-
const spin = isosurface_obj.spin;
|
|
231
|
+
const { vertices, faces, normals, band_index, spin } = obj;
|
|
234
232
|
if (!Array.isArray(vertices) || vertices.length === 0)
|
|
235
233
|
return false;
|
|
236
234
|
if (!Array.isArray(faces))
|
|
@@ -245,27 +243,35 @@ function is_valid_isosurface(obj) {
|
|
|
245
243
|
}
|
|
246
244
|
// Validate FermiSurfaceData shape
|
|
247
245
|
function is_valid_fermi_surface_data(obj) {
|
|
248
|
-
if (!obj
|
|
246
|
+
if (!is_plain_object(obj))
|
|
249
247
|
return false;
|
|
250
|
-
const data = obj;
|
|
251
248
|
// Check required fields
|
|
252
|
-
if (!Array.isArray(
|
|
249
|
+
if (!Array.isArray(obj.isosurfaces))
|
|
253
250
|
return false;
|
|
254
|
-
if (!
|
|
251
|
+
if (!math.is_square_matrix(obj.k_lattice, 3))
|
|
255
252
|
return false;
|
|
256
|
-
if (typeof
|
|
253
|
+
if (typeof obj.fermi_energy !== `number`)
|
|
257
254
|
return false;
|
|
258
|
-
if (
|
|
255
|
+
if (obj.reciprocal_cell !== `wigner_seitz` && obj.reciprocal_cell !== `parallelepiped`) {
|
|
259
256
|
return false;
|
|
260
257
|
}
|
|
261
|
-
if (!
|
|
258
|
+
if (!obj.metadata || typeof obj.metadata !== `object`)
|
|
262
259
|
return false;
|
|
263
260
|
// Validate each isosurface
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
261
|
+
return obj.isosurfaces.every(is_valid_isosurface);
|
|
262
|
+
}
|
|
263
|
+
// Validate BandGridData shape: non-empty energies grid, 3 k-grid dims, 3x3 k-lattice
|
|
264
|
+
function is_valid_band_grid_data(obj) {
|
|
265
|
+
if (!is_plain_object(obj))
|
|
266
|
+
return false;
|
|
267
|
+
const { energies, k_grid, k_lattice } = obj;
|
|
268
|
+
if (!Array.isArray(energies) || energies.length === 0)
|
|
269
|
+
return false;
|
|
270
|
+
if (!Array.isArray(k_grid) ||
|
|
271
|
+
k_grid.length !== 3 ||
|
|
272
|
+
!k_grid.every((dim) => Number.isInteger(dim) && dim > 0))
|
|
273
|
+
return false;
|
|
274
|
+
return math.is_square_matrix(k_lattice, 3);
|
|
269
275
|
}
|
|
270
276
|
// Parse Matterviz/IFermi JSON format for Fermi surface data
|
|
271
277
|
// Throws on invalid input; returns parsed data on success
|
|
@@ -286,29 +292,34 @@ function parse_fermi_json(content) {
|
|
|
286
292
|
}
|
|
287
293
|
// Check if it's BandGridData (raw grid data)
|
|
288
294
|
if (data.energies && data.k_grid && data.k_lattice) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
data.k_grid.length !== 3 ||
|
|
293
|
-
!Array.isArray(data.k_lattice) ||
|
|
294
|
-
data.k_lattice.length !== 3)
|
|
295
|
-
throw new Error(`Invalid BandGridData JSON: malformed required fields`);
|
|
295
|
+
if (!is_valid_band_grid_data(data)) {
|
|
296
|
+
throw new Error(`Invalid BandGridData JSON: expected non-empty 'energies' grid, 3 'k_grid' dims, and 3x3 'k_lattice'`);
|
|
297
|
+
}
|
|
296
298
|
return data;
|
|
297
299
|
}
|
|
298
300
|
// Try to extract from nested structure (e.g. IFermi output)
|
|
299
301
|
if (data.fermi_surface) {
|
|
302
|
+
if (!is_valid_fermi_surface_data(data.fermi_surface)) {
|
|
303
|
+
throw new Error(`Invalid nested 'fermi_surface' JSON: expected isosurfaces array, 3x3 k_lattice, numeric fermi_energy, reciprocal_cell, and metadata`);
|
|
304
|
+
}
|
|
300
305
|
return data.fermi_surface;
|
|
301
306
|
}
|
|
302
307
|
if (data.band_structure?.energies || data.bands?.energies) {
|
|
303
308
|
const bs = data.band_structure ?? data.bands;
|
|
304
|
-
|
|
309
|
+
const grid_data = {
|
|
305
310
|
energies: bs.energies,
|
|
306
311
|
k_grid: bs.k_grid ?? bs.kgrid,
|
|
307
312
|
k_lattice: bs.k_lattice ?? bs.reciprocal_lattice,
|
|
308
313
|
fermi_energy: bs.fermi_energy ?? bs.efermi ?? 0,
|
|
309
|
-
|
|
310
|
-
|
|
314
|
+
// oxlint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- numeric fallback chain (0 falls through)
|
|
315
|
+
n_bands: (bs.n_bands ?? bs.nbands) || bs.energies[0]?.length || 0,
|
|
316
|
+
// oxlint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- numeric fallback chain (0 falls through)
|
|
317
|
+
n_spins: (bs.n_spins ?? bs.nspins) || bs.energies.length || 1,
|
|
311
318
|
};
|
|
319
|
+
if (!is_valid_band_grid_data(grid_data)) {
|
|
320
|
+
throw new Error(`Invalid band_structure JSON: expected non-empty 'energies' grid, 3 'k_grid' dims, and 3x3 'k_lattice'`);
|
|
321
|
+
}
|
|
322
|
+
return grid_data;
|
|
312
323
|
}
|
|
313
324
|
// Check for pymatgen BandStructure format (k-path, not k-grid)
|
|
314
325
|
// These files cannot be used for Fermi surface visualization directly
|
|
@@ -384,14 +395,8 @@ function parse_ifermi_surface(data) {
|
|
|
384
395
|
for (let fan_idx = 1; fan_idx < face.length - 1; fan_idx++) {
|
|
385
396
|
const v1 = vertices[face[fan_idx]];
|
|
386
397
|
const v2 = vertices[face[fan_idx + 1]];
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
const cross = [
|
|
390
|
-
e1[1] * e2[2] - e1[2] * e2[1],
|
|
391
|
-
e1[2] * e2[0] - e1[0] * e2[2],
|
|
392
|
-
e1[0] * e2[1] - e1[1] * e2[0],
|
|
393
|
-
];
|
|
394
|
-
area += 0.5 * Math.hypot(cross[0], cross[1], cross[2]);
|
|
398
|
+
const cross = math.cross_3d(math.subtract(v1, v0), math.subtract(v2, v0));
|
|
399
|
+
area += 0.5 * Math.hypot(...cross);
|
|
395
400
|
}
|
|
396
401
|
}
|
|
397
402
|
isosurfaces.push({
|
|
@@ -424,68 +429,55 @@ function parse_ifermi_surface(data) {
|
|
|
424
429
|
},
|
|
425
430
|
};
|
|
426
431
|
}
|
|
427
|
-
// Auto-detect file format and parse
|
|
432
|
+
// Auto-detect file format and parse; throws an Error aggregating per-format failure reasons when nothing parses
|
|
428
433
|
export function parse_fermi_file(content, filename) {
|
|
429
|
-
const lower_name = filename?.toLowerCase()
|
|
430
|
-
|
|
431
|
-
|
|
434
|
+
const lower_name = filename?.toLowerCase() ?? ``;
|
|
435
|
+
const errors = [];
|
|
436
|
+
const attempt = (format, parse) => {
|
|
432
437
|
try {
|
|
433
|
-
return
|
|
438
|
+
return parse();
|
|
434
439
|
}
|
|
435
440
|
catch (error) {
|
|
436
|
-
|
|
441
|
+
errors.push(`${format}: ${error instanceof Error ? error.message : String(error)}`);
|
|
442
|
+
console.error(`${format} parse error:`, error);
|
|
437
443
|
return null;
|
|
438
444
|
}
|
|
445
|
+
};
|
|
446
|
+
const fail = () => {
|
|
447
|
+
const detail = errors.length ? `: ${errors.join(`; `)}` : `: unrecognized format`;
|
|
448
|
+
throw new Error(`Failed to parse Fermi surface file${filename ? ` '${filename}'` : ``}${detail}`);
|
|
449
|
+
};
|
|
450
|
+
// Detect by filename extension (authoritative: parse failure throws immediately)
|
|
451
|
+
if (lower_name.endsWith(`.bxsf`) || lower_name.endsWith(`.bxsf.gz`)) {
|
|
452
|
+
return attempt(`BXSF`, () => parse_bxsf(content)) ?? fail();
|
|
439
453
|
}
|
|
440
454
|
if (lower_name.endsWith(`.frmsf`) || lower_name.endsWith(`.frmsf.gz`)) {
|
|
441
|
-
|
|
442
|
-
return parse_frmsf(content);
|
|
443
|
-
}
|
|
444
|
-
catch (error) {
|
|
445
|
-
console.error(`FRMSF parse error:`, error);
|
|
446
|
-
return null;
|
|
447
|
-
}
|
|
455
|
+
return attempt(`FRMSF`, () => parse_frmsf(content)) ?? fail();
|
|
448
456
|
}
|
|
449
457
|
if (lower_name.endsWith(`.json`) || lower_name.endsWith(`.json.gz`)) {
|
|
450
|
-
|
|
451
|
-
return parse_fermi_json(content);
|
|
452
|
-
}
|
|
453
|
-
catch (error) {
|
|
454
|
-
console.error(`JSON parse error:`, error);
|
|
455
|
-
return null;
|
|
456
|
-
}
|
|
458
|
+
return attempt(`JSON`, () => parse_fermi_json(content)) ?? fail();
|
|
457
459
|
}
|
|
458
460
|
// Try auto-detection based on content
|
|
459
461
|
const trimmed = content.trim();
|
|
460
462
|
// BXSF format detection
|
|
461
463
|
if (trimmed.includes(`BEGIN_BLOCK_BANDGRID_3D`) || trimmed.includes(`BEGIN_BANDGRID_3D`)) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
catch (error) {
|
|
466
|
-
console.error(`BXSF auto-detect parse error:`, error);
|
|
467
|
-
}
|
|
464
|
+
const result = attempt(`BXSF`, () => parse_bxsf(content));
|
|
465
|
+
if (result)
|
|
466
|
+
return result;
|
|
468
467
|
}
|
|
469
468
|
// JSON format detection
|
|
470
469
|
if (trimmed.startsWith(`{`) || trimmed.startsWith(`[`)) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
catch (error) {
|
|
475
|
-
console.error(`JSON auto-detect parse error:`, error);
|
|
476
|
-
}
|
|
470
|
+
const result = attempt(`JSON`, () => parse_fermi_json(content));
|
|
471
|
+
if (result)
|
|
472
|
+
return result;
|
|
477
473
|
}
|
|
478
474
|
// FRMSF format detection (starts with grid dimensions)
|
|
479
475
|
const first_line = trimmed.split(/\r?\n/)[0];
|
|
480
476
|
const first_tokens = first_line.split(/\s+/).filter(Boolean);
|
|
481
477
|
if (first_tokens.length === 3 && first_tokens.every((token) => /^\d+$/.test(token))) {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
catch (error) {
|
|
486
|
-
console.error(`FRMSF auto-detect parse error:`, error);
|
|
487
|
-
}
|
|
478
|
+
const result = attempt(`FRMSF`, () => parse_frmsf(content));
|
|
479
|
+
if (result)
|
|
480
|
+
return result;
|
|
488
481
|
}
|
|
489
|
-
|
|
490
|
-
return null;
|
|
482
|
+
return fail();
|
|
491
483
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Matrix3x3, Point2D, Vec3 } from '../math';
|
|
1
|
+
import type { Matrix3x3, Point2D, Vec2, Vec3 } from '../math';
|
|
2
2
|
import type { TooltipConfig, TooltipProp } from '../tooltip';
|
|
3
3
|
export type SpinChannel = `up` | `down` | null;
|
|
4
4
|
export type RepresentationMode = `solid` | `wireframe` | `transparent`;
|
|
@@ -48,6 +48,7 @@ export interface BandGridData {
|
|
|
48
48
|
n_bands: number;
|
|
49
49
|
n_spins: number;
|
|
50
50
|
origin?: Vec3;
|
|
51
|
+
periodic?: boolean;
|
|
51
52
|
}
|
|
52
53
|
export interface FermiSliceData {
|
|
53
54
|
isolines: Isoline[];
|
|
@@ -61,7 +62,7 @@ export interface FermiSliceData {
|
|
|
61
62
|
}
|
|
62
63
|
export interface Isoline {
|
|
63
64
|
points: Vec3[];
|
|
64
|
-
points_2d: [
|
|
65
|
+
points_2d: Vec2[];
|
|
65
66
|
properties?: number[];
|
|
66
67
|
band_index: number;
|
|
67
68
|
spin: SpinChannel;
|