matterviz 0.4.1 → 0.4.3
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/EmptyState.svelte +10 -4
- package/dist/FilePicker.svelte +48 -60
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/api/optimade.js +10 -7
- package/dist/app.css +68 -0
- package/dist/brillouin/BrillouinZone.svelte +90 -91
- package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -7
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +18 -14
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +6 -10
- package/dist/brillouin/BrillouinZoneScene.svelte +46 -68
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/brillouin/compute.js +10 -16
- package/dist/brillouin/geometry.js +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +48 -50
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +61 -169
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +559 -755
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/async-compute.svelte.js +13 -14
- package/dist/chempot-diagram/color.d.ts +21 -1
- package/dist/chempot-diagram/color.js +70 -1
- package/dist/chempot-diagram/compute.d.ts +7 -0
- package/dist/chempot-diagram/compute.js +85 -26
- package/dist/chempot-diagram/controls-state.svelte.js +1 -1
- package/dist/chempot-diagram/export.js +1 -6
- package/dist/chempot-diagram/temperature.js +9 -10
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +19 -20
- package/dist/composition/BarChart.svelte +30 -26
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +10 -19
- package/dist/composition/Formula.svelte +20 -27
- package/dist/composition/FormulaFilter.svelte +115 -184
- package/dist/composition/PieChart.svelte +55 -41
- package/dist/composition/format.js +7 -9
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -2
- package/dist/composition/parse.js +61 -115
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +17 -26
- package/dist/convex-hull/ConvexHull.svelte +12 -15
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +93 -94
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +127 -186
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +131 -180
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +36 -40
- package/dist/convex-hull/ConvexHullControls.svelte +46 -48
- package/dist/convex-hull/ConvexHullStats.svelte +193 -195
- package/dist/convex-hull/ConvexHullTooltip.svelte +5 -12
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +18 -22
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- package/dist/convex-hull/canvas-interactions.svelte.js +2 -1
- package/dist/convex-hull/gas-thermodynamics.js +21 -53
- package/dist/convex-hull/helpers.d.ts +8 -10
- package/dist/convex-hull/helpers.js +37 -43
- package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +37 -44
- package/dist/coordination/CoordinationBarPlot.svelte +49 -53
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/coordination/calc-coordination.d.ts +1 -1
- package/dist/coordination/calc-coordination.js +28 -25
- package/dist/element/BohrAtom.svelte +5 -9
- package/dist/element/ElementHeading.svelte +4 -1
- package/dist/element/ElementPhoto.svelte +11 -9
- package/dist/element/ElementStats.svelte +12 -10
- package/dist/element/ElementTile.svelte +44 -67
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +3 -2
- package/dist/element/data.js +5 -1
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +2 -5
- package/dist/element/index.js +4 -19
- package/dist/feedback/DragOverlay.svelte +5 -5
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -2
- package/dist/feedback/StatusMessage.svelte +7 -4
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +35 -44
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +7 -13
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +64 -136
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +25 -58
- package/dist/fermi-surface/parse.js +54 -88
- package/dist/file-viewer/JsonBrowser.svelte +1043 -0
- package/dist/file-viewer/JsonBrowser.svelte.d.ts +9 -0
- package/dist/file-viewer/PlotPanel.svelte +350 -0
- package/dist/file-viewer/PlotPanel.svelte.d.ts +9 -0
- package/dist/file-viewer/TrajectoryWithDos.svelte +30 -0
- package/dist/file-viewer/TrajectoryWithDos.svelte.d.ts +10 -0
- package/dist/file-viewer/detect.d.ts +11 -0
- package/dist/file-viewer/detect.js +381 -0
- package/dist/file-viewer/eligibility.d.ts +4 -0
- package/dist/file-viewer/eligibility.js +53 -0
- package/dist/file-viewer/host-protocol.d.ts +50 -0
- package/dist/file-viewer/host-transfer.d.ts +25 -0
- package/dist/file-viewer/host-transfer.js +42 -0
- package/dist/file-viewer/index.d.ts +5 -0
- package/dist/file-viewer/index.js +5 -0
- package/dist/file-viewer/main.d.ts +44 -0
- package/dist/file-viewer/main.js +535 -0
- package/dist/file-viewer/parse.d.ts +9 -0
- package/dist/file-viewer/parse.js +170 -0
- package/dist/file-viewer/plot-utils.d.ts +24 -0
- package/dist/file-viewer/plot-utils.js +191 -0
- package/dist/file-viewer/types.d.ts +4 -0
- package/dist/file-viewer/types.js +5 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +153 -219
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +9 -7
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +1 -1
- package/dist/heatmap-matrix/index.d.ts +5 -0
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/ExportPane.svelte +11 -7
- package/dist/io/decompress.d.ts +4 -1
- package/dist/io/decompress.js +24 -36
- package/dist/io/export.d.ts +11 -4
- package/dist/io/export.js +75 -19
- package/dist/io/fetch.d.ts +0 -3
- package/dist/io/fetch.js +0 -11
- package/dist/io/file-drop.js +60 -35
- package/dist/io/index.d.ts +0 -1
- package/dist/io/index.js +2 -9
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/url-drop.d.ts +2 -0
- package/dist/io/url-drop.js +40 -40
- package/dist/isosurface/Isosurface.svelte +700 -215
- package/dist/isosurface/Isosurface.svelte.d.ts +7 -1
- package/dist/isosurface/IsosurfaceControls.svelte +590 -116
- package/dist/isosurface/IsosurfaceControls.svelte.d.ts +1 -1
- package/dist/isosurface/VolumeSlice.svelte +224 -0
- package/dist/isosurface/VolumeSlice.svelte.d.ts +28 -0
- package/dist/isosurface/coloring.d.ts +20 -0
- package/dist/isosurface/coloring.js +118 -0
- package/dist/isosurface/geometry-worker-types.d.ts +38 -0
- package/dist/isosurface/geometry.worker.d.ts +1 -0
- package/dist/isosurface/geometry.worker.js +59 -0
- package/dist/isosurface/grid.d.ts +10 -0
- package/dist/isosurface/grid.js +31 -0
- package/dist/isosurface/index.d.ts +4 -0
- package/dist/isosurface/index.js +4 -0
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +6 -6
- package/dist/isosurface/profile.d.ts +12 -0
- package/dist/isosurface/profile.js +19 -0
- package/dist/isosurface/sampling.d.ts +34 -0
- package/dist/isosurface/sampling.js +408 -0
- package/dist/isosurface/slice-rendering.d.ts +13 -0
- package/dist/isosurface/slice-rendering.js +79 -0
- package/dist/isosurface/slice.d.ts +22 -2
- package/dist/isosurface/slice.js +200 -116
- package/dist/isosurface/types.d.ts +24 -1
- package/dist/isosurface/types.js +120 -8
- package/dist/json-path.d.ts +4 -0
- package/dist/json-path.js +89 -0
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +44 -14
- package/dist/layout/FullscreenButton.svelte +2 -1
- package/dist/layout/FullscreenToggle.svelte +10 -4
- package/dist/layout/InfoCard.svelte +8 -21
- package/dist/layout/InfoTag.svelte +1 -3
- package/dist/layout/NumberRangeInput.svelte +46 -0
- package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
- package/dist/layout/PropertyFilter.svelte +2 -6
- package/dist/layout/SettingsSection.svelte +57 -62
- package/dist/layout/SettingsSection.svelte.d.ts +6 -7
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +16 -11
- package/dist/layout/ViewerChrome.svelte.d.ts +2 -1
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.js +1 -2
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +22 -59
- package/dist/layout/json-tree/JsonTree.svelte +101 -172
- package/dist/layout/json-tree/JsonValue.svelte +9 -32
- package/dist/layout/json-tree/utils.d.ts +0 -3
- package/dist/layout/json-tree/utils.js +50 -188
- package/dist/marching-cubes.d.ts +8 -1
- package/dist/marching-cubes.js +115 -48
- package/dist/math.d.ts +5 -2
- package/dist/math.js +48 -38
- package/dist/overlays/ContextMenu.svelte +19 -34
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +110 -74
- package/dist/overlays/DraggablePane.svelte.d.ts +2 -1
- package/dist/overlays/GlassChip.svelte +32 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +7 -0
- package/dist/overlays/index.js +26 -0
- package/dist/overlays/portal.d.ts +2 -0
- package/dist/overlays/portal.js +14 -0
- package/dist/periodic-table/PeriodicTable.svelte +113 -145
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +37 -115
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +68 -105
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +70 -94
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +12 -12
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +4 -9
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +28 -27
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +461 -426
- package/dist/plot/bar/BarPlot.svelte.d.ts +2 -0
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +4 -6
- package/dist/plot/bar/SpacegroupBarPlot.svelte +46 -77
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +322 -226
- package/dist/plot/box/BoxPlot.svelte.d.ts +2 -0
- package/dist/plot/box/Violin.svelte.d.ts +1 -0
- package/dist/plot/box/box-plot.js +1 -1
- package/dist/plot/core/auto-place.d.ts +1 -1
- package/dist/plot/core/auto-place.js +2 -2
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +101 -106
- package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
- package/dist/plot/core/components/FillArea.svelte +10 -17
- package/dist/plot/core/components/HierarchyControls.svelte +249 -0
- package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
- package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
- package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/core/components/Line.svelte +18 -9
- package/dist/plot/core/components/Line.svelte.d.ts +2 -0
- package/dist/plot/core/components/PlotAxis.svelte +40 -17
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotLegend.svelte +31 -35
- package/dist/plot/core/components/PlotMarginals.svelte +616 -0
- package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
- package/dist/plot/core/components/PlotTooltip.svelte +1 -1
- package/dist/plot/core/components/PortalSelect.svelte +4 -8
- package/dist/plot/core/components/ReferenceLine.svelte +27 -24
- package/dist/plot/core/components/ReferenceLine3D.svelte +54 -57
- package/dist/plot/core/components/ReferencePlane.svelte +7 -8
- package/dist/plot/core/components/ZeroLines.svelte +4 -8
- package/dist/plot/core/components/ZoomRect.svelte +1 -2
- package/dist/plot/core/components/index.d.ts +1 -0
- package/dist/plot/core/components/index.js +1 -0
- package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
- package/dist/plot/core/data-cleaning-signal.js +467 -0
- package/dist/plot/core/data-cleaning.d.ts +2 -42
- package/dist/plot/core/data-cleaning.js +27 -474
- package/dist/plot/core/data-transform.d.ts +1 -2
- package/dist/plot/core/data-transform.js +9 -15
- package/dist/plot/core/fill-utils.d.ts +3 -1
- package/dist/plot/core/fill-utils.js +28 -6
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.js +0 -2
- package/dist/plot/core/layout.d.ts +15 -6
- package/dist/plot/core/layout.js +57 -38
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/pan-zoom.svelte.d.ts +2 -4
- package/dist/plot/core/pan-zoom.svelte.js +34 -17
- package/dist/plot/core/placed-tween.svelte.d.ts +3 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -21
- package/dist/plot/core/reference-line.js +1 -1
- package/dist/plot/core/scales.d.ts +23 -0
- package/dist/plot/core/scales.js +39 -13
- package/dist/plot/core/svg.js +0 -1
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +29 -324
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +52 -0
- package/dist/plot/core/utils/hierarchy-chart.js +191 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +100 -0
- package/dist/plot/core/utils/label-placement.js +2 -2
- package/dist/plot/histogram/Histogram.svelte +314 -340
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/histogram.d.ts +31 -0
- package/dist/plot/histogram/histogram.js +70 -0
- package/dist/plot/histogram/index.d.ts +1 -0
- package/dist/plot/histogram/index.js +1 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/index.js +1 -0
- package/dist/plot/sankey/Sankey.svelte +78 -69
- package/dist/plot/sankey/Sankey.svelte.d.ts +2 -2
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/sankey/sankey.js +13 -9
- package/dist/plot/scatter/BinnedScatterPlot.svelte +311 -141
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +517 -410
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +2 -0
- package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/ScatterPoint.svelte +16 -9
- package/dist/plot/scatter/adaptive-density.d.ts +1 -1
- package/dist/plot/scatter/adaptive-density.js +36 -20
- package/dist/plot/scatter/binned-scatter-types.d.ts +3 -2
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/scatter-data.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.js +8 -7
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +25 -34
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +8 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +113 -116
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/Surface3D.svelte +4 -13
- package/dist/plot/sunburst/Sunburst.svelte +269 -347
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +2 -2
- package/dist/plot/sunburst/index.d.ts +1 -1
- package/dist/plot/sunburst/index.js +2 -1
- package/dist/plot/sunburst/render.d.ts +2 -2
- package/dist/plot/sunburst/render.js +47 -22
- package/dist/plot/sunburst/sunburst.d.ts +5 -1
- package/dist/plot/sunburst/sunburst.js +10 -3
- package/dist/plot/treemap/Treemap.svelte +1022 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +90 -0
- package/dist/plot/treemap/index.d.ts +4 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/labels.d.ts +38 -0
- package/dist/plot/treemap/labels.js +80 -0
- package/dist/plot/treemap/treemap.d.ts +28 -0
- package/dist/plot/treemap/treemap.js +102 -0
- package/dist/rdf/RdfPlot.svelte +37 -59
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +63 -52
- package/dist/rdf/index.d.ts +0 -1
- package/dist/sanitize.js +85 -27
- package/dist/scene/SceneCamera.svelte +1 -1
- package/dist/scene/SceneCamera.svelte.d.ts +1 -1
- package/dist/scene/bind-renderer.svelte.js +14 -6
- package/dist/scene/index.d.ts +1 -2
- package/dist/scene/index.js +1 -1
- package/dist/scene/{props.js → props.svelte.js} +15 -1
- package/dist/settings.d.ts +19 -9
- package/dist/settings.js +229 -525
- package/dist/spectral/Bands.svelte +207 -221
- package/dist/spectral/BandsAndDos.svelte +11 -9
- package/dist/spectral/BrillouinBandsDos.svelte +19 -42
- package/dist/spectral/Dos.svelte +92 -93
- package/dist/spectral/helpers.d.ts +3 -3
- package/dist/spectral/helpers.js +65 -140
- package/dist/state.svelte.js +5 -18
- package/dist/structure/Arrow.svelte +5 -18
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +120 -85
- package/dist/structure/AtomLegend.svelte.d.ts +2 -3
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +15 -3
- package/dist/structure/CellSelect.svelte +45 -35
- package/dist/structure/Cylinder.svelte +24 -40
- package/dist/structure/InstancedAtoms.svelte +114 -0
- package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
- package/dist/structure/Lattice.svelte +85 -149
- package/dist/structure/SiteLabels.svelte +122 -0
- package/dist/structure/SiteLabels.svelte.d.ts +18 -0
- package/dist/structure/Structure.svelte +636 -504
- package/dist/structure/Structure.svelte.d.ts +4 -2
- package/dist/structure/StructureCarousel.svelte +637 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +165 -425
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +17 -21
- package/dist/structure/StructureInfoPane.svelte +128 -133
- package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
- package/dist/structure/StructureScene.svelte +535 -578
- package/dist/structure/StructureScene.svelte.d.ts +6 -2
- package/dist/structure/StructureViewport.svelte +451 -0
- package/dist/structure/StructureViewport.svelte.d.ts +65 -0
- package/dist/structure/atom-label-placement.d.ts +16 -12
- package/dist/structure/atom-label-placement.js +70 -37
- package/dist/structure/atom-properties.d.ts +2 -0
- package/dist/structure/atom-properties.js +105 -38
- package/dist/structure/bond-order-perception.js +3 -8
- package/dist/structure/bonding.d.ts +9 -3
- package/dist/structure/bonding.js +95 -46
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +1 -0
- package/dist/structure/export.js +89 -105
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +20 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +16 -1
- package/dist/structure/index.js +15 -10
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +2 -1
- package/dist/structure/parse.js +272 -313
- package/dist/structure/partial-occupancy.js +10 -5
- package/dist/structure/pbc.js +85 -107
- package/dist/structure/polyhedra.d.ts +0 -1
- package/dist/structure/polyhedra.js +7 -21
- package/dist/structure/prop-groups.d.ts +85 -0
- package/dist/structure/prop-groups.js +18 -0
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +7 -13
- package/dist/symmetry/SymmetryElements.svelte +11 -15
- package/dist/symmetry/SymmetryStats.svelte +55 -71
- package/dist/symmetry/WyckoffTable.svelte +10 -28
- package/dist/symmetry/cell-transform.js +6 -14
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +13 -10
- package/dist/symmetry/spacegroups.js +3 -2
- package/dist/table/HeatmapTable.svelte +1142 -447
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +168 -53
- package/dist/table/ToggleMenu.svelte.d.ts +1 -1
- package/dist/table/index.d.ts +21 -6
- package/dist/table/index.js +34 -21
- package/dist/theme/ThemeControl.svelte +16 -8
- package/dist/theme/embedded.d.ts +18 -0
- package/dist/theme/embedded.js +206 -0
- package/dist/theme/index.d.ts +5 -5
- package/dist/theme/index.js +5 -12
- package/dist/theme/themes.mjs +44 -66
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +3 -6
- package/dist/tooltip/TooltipContent.svelte.d.ts +1 -1
- package/dist/tooltip/index.d.ts +8 -1
- package/dist/trajectory/Trajectory.svelte +613 -386
- package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryError.svelte +12 -74
- package/dist/trajectory/TrajectoryExportPane.svelte +14 -32
- package/dist/trajectory/TrajectoryInfoPane.svelte +127 -164
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +2 -1
- package/dist/trajectory/extract.js +61 -49
- package/dist/trajectory/format-detect.d.ts +2 -0
- package/dist/trajectory/format-detect.js +17 -13
- package/dist/trajectory/frame-reader.d.ts +2 -0
- package/dist/trajectory/frame-reader.js +35 -32
- package/dist/trajectory/helpers.d.ts +2 -0
- package/dist/trajectory/helpers.js +34 -56
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +5 -8
- package/dist/trajectory/parse/ase.js +1 -1
- package/dist/trajectory/parse/h5-utils.d.ts +13 -0
- package/dist/trajectory/parse/h5-utils.js +109 -0
- package/dist/trajectory/parse/hdf5.d.ts +1 -1
- package/dist/trajectory/parse/hdf5.js +116 -106
- package/dist/trajectory/parse/index.d.ts +6 -6
- package/dist/trajectory/parse/index.js +25 -33
- package/dist/trajectory/parse/lammps.js +8 -12
- package/dist/trajectory/parse/vasp.js +10 -7
- package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
- package/dist/trajectory/parse/vaspout-electronic.js +207 -0
- package/dist/trajectory/parse/vaspout-h5.d.ts +4 -0
- package/dist/trajectory/parse/vaspout-h5.js +281 -0
- package/dist/trajectory/parse/xyz.js +59 -9
- package/dist/trajectory/plotting.d.ts +8 -9
- package/dist/trajectory/plotting.js +113 -64
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -0
- package/dist/xrd/XrdPlot.svelte +79 -118
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +24 -62
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +69 -95
- package/package.json +94 -34
- package/readme.md +6 -5
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
- package/dist/scene/types.d.ts +0 -26
- package/dist/tooltip/types.d.ts +0 -8
- package/dist/trajectory/constants.d.ts +0 -6
- package/dist/trajectory/constants.js +0 -11
- /package/dist/{scene/types.js → file-viewer/host-protocol.js} +0 -0
- /package/dist/{tooltip/types.js → isosurface/geometry-worker-types.js} +0 -0
|
@@ -143,25 +143,25 @@
|
|
|
143
143
|
if (!band_structs) return {}
|
|
144
144
|
|
|
145
145
|
// Detect single band structure by checking for characteristic fields
|
|
146
|
-
// - pymatgen format: has @class or @module markers (may also have branches)
|
|
147
146
|
// - matterviz format: has qpoints + branches (no pymatgen markers)
|
|
148
|
-
const has_qpoints =
|
|
147
|
+
const has_qpoints =
|
|
148
|
+
`qpoints` in band_structs &&
|
|
149
149
|
Array.isArray(band_structs.qpoints) &&
|
|
150
150
|
band_structs.qpoints.length > 0
|
|
151
|
-
const has_kpoints =
|
|
151
|
+
const has_kpoints =
|
|
152
|
+
`kpoints` in band_structs &&
|
|
152
153
|
Array.isArray(band_structs.kpoints) &&
|
|
153
154
|
band_structs.kpoints.length > 0
|
|
154
155
|
const has_bands = `bands` in band_structs
|
|
155
|
-
const has_frequencies_cm =
|
|
156
|
-
Array.isArray(band_structs.frequencies_cm)
|
|
156
|
+
const has_frequencies_cm =
|
|
157
|
+
`frequencies_cm` in band_structs && Array.isArray(band_structs.frequencies_cm)
|
|
157
158
|
const has_branches = `branches` in band_structs
|
|
158
159
|
// Pymatgen structures have explicit class/module markers
|
|
159
160
|
const is_pymatgen = `@class` in band_structs || `@module` in band_structs
|
|
160
161
|
|
|
161
162
|
// Pymatgen single: has markers and point/band data (may have branches too)
|
|
162
|
-
const is_pymatgen_single =
|
|
163
|
-
(has_qpoints || has_kpoints) &&
|
|
164
|
-
(has_bands || has_frequencies_cm)
|
|
163
|
+
const is_pymatgen_single =
|
|
164
|
+
is_pymatgen && (has_qpoints || has_kpoints) && (has_bands || has_frequencies_cm)
|
|
165
165
|
// Matterviz single: has qpoints + branches but NO pymatgen markers
|
|
166
166
|
const is_matterviz_single = !is_pymatgen && has_qpoints && has_branches
|
|
167
167
|
const is_single = is_matterviz_single || is_pymatgen_single
|
|
@@ -186,8 +186,11 @@
|
|
|
186
186
|
if (!band_structs) return `phonon`
|
|
187
187
|
|
|
188
188
|
// Single structure has marker fields; dict of structures has label keys
|
|
189
|
-
const is_single =
|
|
190
|
-
`
|
|
189
|
+
const is_single =
|
|
190
|
+
`@class` in band_structs ||
|
|
191
|
+
`@module` in band_structs ||
|
|
192
|
+
`kpoints` in band_structs ||
|
|
193
|
+
`qpoints` in band_structs
|
|
191
194
|
const source = (is_single ? band_structs : Object.values(band_structs)[0]) as
|
|
192
195
|
| Record<string, unknown>
|
|
193
196
|
| undefined
|
|
@@ -196,12 +199,11 @@
|
|
|
196
199
|
// Electronic: has kpoints, BandStructure* class (not Phonon*), or electronic_structure module
|
|
197
200
|
const py_class_name = String(source[`@class`] ?? ``)
|
|
198
201
|
if (
|
|
199
|
-
(`kpoints` in source && Array.isArray(source.kpoints) &&
|
|
200
|
-
|
|
201
|
-
(py_class_name.startsWith(`BandStructure`) &&
|
|
202
|
-
!py_class_name.startsWith(`Phonon`)) ||
|
|
202
|
+
(`kpoints` in source && Array.isArray(source.kpoints) && source.kpoints.length > 0) ||
|
|
203
|
+
(py_class_name.startsWith(`BandStructure`) && !py_class_name.startsWith(`Phonon`)) ||
|
|
203
204
|
String(source[`@module`] ?? ``).includes(`electronic_structure`)
|
|
204
|
-
)
|
|
205
|
+
)
|
|
206
|
+
return `electronic`
|
|
205
207
|
|
|
206
208
|
return `phonon`
|
|
207
209
|
})
|
|
@@ -212,16 +214,15 @@
|
|
|
212
214
|
if (detected_band_type !== `electronic`) return undefined
|
|
213
215
|
|
|
214
216
|
// Check raw input for efermi field
|
|
215
|
-
const source =
|
|
216
|
-
? band_structs
|
|
217
|
-
: Object.values(band_structs)[0]
|
|
217
|
+
const source =
|
|
218
|
+
`efermi` in (band_structs as object) ? band_structs : Object.values(band_structs)[0]
|
|
218
219
|
const efermi = (source as Record<string, unknown>)?.efermi
|
|
219
220
|
return typeof efermi === `number` ? efermi : undefined
|
|
220
221
|
})
|
|
221
222
|
|
|
222
223
|
let effective_spin_mode = $derived.by((): BandsSpinMode => {
|
|
223
224
|
if (detected_band_type !== `electronic`) return null
|
|
224
|
-
return
|
|
225
|
+
return band_spin_mode === `up_only` || band_spin_mode === `down_only`
|
|
225
226
|
? band_spin_mode
|
|
226
227
|
: `overlay`
|
|
227
228
|
})
|
|
@@ -249,16 +250,18 @@
|
|
|
249
250
|
|
|
250
251
|
let num_structures = $derived(Object.keys(band_structs_dict).length)
|
|
251
252
|
let all_segment_keys = $derived(Object.keys(all_segments))
|
|
252
|
-
let common_segment_keys = $derived
|
|
253
|
+
let common_segment_keys = $derived(
|
|
253
254
|
all_segment_keys.filter(
|
|
254
255
|
(segment_key) => all_segments[segment_key].length === num_structures,
|
|
255
|
-
)
|
|
256
|
+
),
|
|
256
257
|
)
|
|
257
258
|
let empty_state_attrs = $derived.by(() => {
|
|
258
259
|
const attrs: Record<string, Dom_attr_value> = {}
|
|
259
260
|
for (const [attr_name, attr_value] of Object.entries(rest)) {
|
|
260
261
|
if (
|
|
261
|
-
(attr_name === `class` ||
|
|
262
|
+
(attr_name === `class` ||
|
|
263
|
+
attr_name === `style` ||
|
|
264
|
+
attr_name === `role` ||
|
|
262
265
|
attr_name.startsWith(`aria-`)) &&
|
|
263
266
|
is_dom_attr_value(attr_value)
|
|
264
267
|
) {
|
|
@@ -299,8 +302,7 @@
|
|
|
299
302
|
}
|
|
300
303
|
const ordered_segments = helpers.get_ordered_segments(canonical, segments_to_plot)
|
|
301
304
|
|
|
302
|
-
for (
|
|
303
|
-
const segment_key = ordered_segments[seg_idx]
|
|
305
|
+
for (const segment_key of ordered_segments) {
|
|
304
306
|
if (positions[segment_key]) continue
|
|
305
307
|
|
|
306
308
|
const [start_label, end_label] = segment_key.split(`_`)
|
|
@@ -322,8 +324,8 @@
|
|
|
322
324
|
// Place at same x position as current, no advancement
|
|
323
325
|
positions[segment_key] = [current_x, current_x]
|
|
324
326
|
} else {
|
|
325
|
-
const segment_len =
|
|
326
|
-
bs.distance[matching_branch.start_index]
|
|
327
|
+
const segment_len =
|
|
328
|
+
bs.distance[matching_branch.end_index] - bs.distance[matching_branch.start_index]
|
|
327
329
|
positions[segment_key] = [current_x, current_x + segment_len]
|
|
328
330
|
current_x += segment_len
|
|
329
331
|
}
|
|
@@ -335,53 +337,75 @@
|
|
|
335
337
|
x_positions = positions
|
|
336
338
|
})
|
|
337
339
|
|
|
338
|
-
//
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
340
|
+
// Plottable branch segments with rescaled x coordinates, shared by the band-line
|
|
341
|
+
// series and fat-band ribbon computations below
|
|
342
|
+
interface PlotSegment {
|
|
343
|
+
bs_idx: number
|
|
344
|
+
label: string
|
|
345
|
+
bs: BaseBandStructure
|
|
346
|
+
start_idx: number
|
|
347
|
+
end_idx: number // exclusive
|
|
348
|
+
segment_key: string
|
|
349
|
+
scaled_distances: number[]
|
|
350
|
+
}
|
|
351
|
+
let plot_segments = $derived.by((): PlotSegment[] => {
|
|
352
|
+
const segments: PlotSegment[] = []
|
|
350
353
|
for (const [bs_idx, [label, bs]] of Object.entries(band_structs_dict).entries()) {
|
|
351
|
-
const color = PLOT_COLORS[bs_idx % PLOT_COLORS.length]
|
|
352
|
-
const structure_label = label || `Structure ${bs_idx + 1}`
|
|
353
|
-
const gamma_indices = detected_band_type === `phonon`
|
|
354
|
-
? helpers.find_gamma_indices(bs)
|
|
355
|
-
: []
|
|
356
|
-
|
|
357
354
|
for (const branch of bs.branches) {
|
|
355
|
+
// Skip discontinuous segments (consecutive labeled points)
|
|
356
|
+
if (branch.end_index - branch.start_index === 1) continue
|
|
357
|
+
|
|
358
358
|
const start_idx = branch.start_index
|
|
359
359
|
const end_idx = branch.end_index + 1
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
360
|
+
const segment_key = helpers.get_segment_key(
|
|
361
|
+
bs.qpoints[start_idx]?.label ?? undefined,
|
|
362
|
+
bs.qpoints[end_idx - 1]?.label ?? undefined,
|
|
363
|
+
)
|
|
364
364
|
if (!segments_to_plot.has(segment_key)) continue
|
|
365
365
|
|
|
366
|
-
// Skip discontinuous segments (consecutive labeled points)
|
|
367
|
-
const is_discontinuity = branch.end_index - branch.start_index === 1
|
|
368
|
-
if (is_discontinuity) continue
|
|
369
|
-
|
|
370
366
|
const [x_start, x_end] = x_positions?.[segment_key] || [0, 1]
|
|
371
|
-
|
|
372
|
-
// Scale distances for this segment
|
|
373
|
-
const segment_distances = bs.distance.slice(start_idx, end_idx)
|
|
374
367
|
const scaled_distances = helpers.scale_segment_distances(
|
|
375
|
-
|
|
368
|
+
bs.distance.slice(start_idx, end_idx),
|
|
376
369
|
x_start,
|
|
377
370
|
x_end,
|
|
378
371
|
)
|
|
372
|
+
segments.push({ bs_idx, label, bs, start_idx, end_idx, segment_key, scaled_distances })
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return segments
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
// Convert band structures to scatter plot series + track max slope in one pass
|
|
379
|
+
let { series_data, max_abs_slope } = $derived.by(
|
|
380
|
+
(): {
|
|
381
|
+
series_data: DataSeries[]
|
|
382
|
+
max_abs_slope: number
|
|
383
|
+
} => {
|
|
384
|
+
const all_series: DataSeries[] = []
|
|
385
|
+
let max_slope = 0
|
|
386
|
+
// Cache per band structure: segments share their bs, so avoid re-scanning
|
|
387
|
+
// all q-points once per plotted segment
|
|
388
|
+
const gamma_cache = new Map<BaseBandStructure, number[]>()
|
|
389
|
+
|
|
390
|
+
for (const {
|
|
391
|
+
bs_idx,
|
|
392
|
+
label,
|
|
393
|
+
bs,
|
|
394
|
+
start_idx,
|
|
395
|
+
end_idx,
|
|
396
|
+
scaled_distances,
|
|
397
|
+
} of plot_segments) {
|
|
398
|
+
const color = PLOT_COLORS[bs_idx % PLOT_COLORS.length]
|
|
399
|
+
const structure_label = label || `Structure ${bs_idx + 1}`
|
|
400
|
+
let gamma_indices = gamma_cache.get(bs)
|
|
401
|
+
if (!gamma_indices) {
|
|
402
|
+
gamma_indices = detected_band_type === `phonon` ? helpers.find_gamma_indices(bs) : []
|
|
403
|
+
gamma_cache.set(bs, gamma_indices)
|
|
404
|
+
}
|
|
379
405
|
|
|
380
406
|
// Create series for each band (and spin channel for electronic structures)
|
|
381
407
|
for (let band_idx = 0; band_idx < bs.nb_bands; band_idx++) {
|
|
382
|
-
const frequencies = convert_band_values(
|
|
383
|
-
bs.bands[band_idx].slice(start_idx, end_idx),
|
|
384
|
-
)
|
|
408
|
+
const frequencies = convert_band_values(bs.bands[band_idx].slice(start_idx, end_idx))
|
|
385
409
|
const is_acoustic = helpers.classify_acoustic(bs, band_idx, gamma_indices)
|
|
386
410
|
|
|
387
411
|
const line_style_up = get_line_style(
|
|
@@ -392,7 +416,8 @@
|
|
|
392
416
|
)
|
|
393
417
|
|
|
394
418
|
const spin_down_band = bs.spin_down_bands?.[band_idx]
|
|
395
|
-
const has_spin_down_channel =
|
|
419
|
+
const has_spin_down_channel =
|
|
420
|
+
detected_band_type === `electronic` &&
|
|
396
421
|
Array.isArray(spin_down_band) &&
|
|
397
422
|
spin_down_band.length >= end_idx
|
|
398
423
|
|
|
@@ -419,9 +444,7 @@
|
|
|
419
444
|
x: scaled_distances,
|
|
420
445
|
y: frequencies,
|
|
421
446
|
markers: `line`,
|
|
422
|
-
label: has_spin_down_channel
|
|
423
|
-
? `${structure_label} (↑)`
|
|
424
|
-
: structure_label,
|
|
447
|
+
label: has_spin_down_channel ? `${structure_label} (↑)` : structure_label,
|
|
425
448
|
line_style: line_style_up,
|
|
426
449
|
metadata: meta,
|
|
427
450
|
})
|
|
@@ -456,76 +479,46 @@
|
|
|
456
479
|
}
|
|
457
480
|
}
|
|
458
481
|
}
|
|
459
|
-
}
|
|
460
482
|
|
|
461
|
-
|
|
462
|
-
|
|
483
|
+
return { series_data: all_series, max_abs_slope: max_slope || 1 }
|
|
484
|
+
},
|
|
485
|
+
)
|
|
463
486
|
|
|
464
487
|
// Compute ribbon data for bands with width information
|
|
465
488
|
let ribbon_data = $derived.by((): RibbonData[] => {
|
|
466
|
-
if (Object.keys(band_structs_dict).length === 0 || segments_to_plot.size === 0) {
|
|
467
|
-
return []
|
|
468
|
-
}
|
|
469
|
-
|
|
470
489
|
const all_ribbons: RibbonData[] = []
|
|
471
490
|
|
|
472
|
-
for (const
|
|
491
|
+
for (const segment of plot_segments) {
|
|
492
|
+
const { bs_idx, label, bs, start_idx, end_idx, segment_key, scaled_distances } = segment
|
|
473
493
|
// Skip if this band structure has no width data
|
|
474
|
-
if (!bs.band_widths
|
|
494
|
+
if (!bs.band_widths?.length) continue
|
|
475
495
|
|
|
476
|
-
const color = PLOT_COLORS[bs_idx % PLOT_COLORS.length]
|
|
477
|
-
const structure_label = label || `Structure ${bs_idx + 1}`
|
|
478
496
|
const config = helpers.get_ribbon_config(ribbon_config, label)
|
|
497
|
+
const structure_label = label || `Structure ${bs_idx + 1}`
|
|
479
498
|
|
|
480
|
-
for
|
|
481
|
-
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
if (
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
// Create ribbon data for each band that has width data
|
|
504
|
-
for (let band_idx = 0; band_idx < bs.nb_bands; band_idx++) {
|
|
505
|
-
const band_widths = bs.band_widths[band_idx]
|
|
506
|
-
if (!band_widths) continue
|
|
507
|
-
|
|
508
|
-
const width_values = band_widths.slice(start_idx, end_idx)
|
|
509
|
-
// Skip if all widths are zero or missing
|
|
510
|
-
if (width_values.every((wv) => !wv || wv <= 0)) continue
|
|
511
|
-
|
|
512
|
-
const y_values = convert_band_values(
|
|
513
|
-
bs.bands[band_idx].slice(start_idx, end_idx),
|
|
514
|
-
)
|
|
515
|
-
|
|
516
|
-
all_ribbons.push({
|
|
517
|
-
x_values: scaled_distances,
|
|
518
|
-
y_values,
|
|
519
|
-
width_values,
|
|
520
|
-
color: config.color ?? color,
|
|
521
|
-
opacity: config.opacity ?? 0.3,
|
|
522
|
-
max_width: config.max_width ?? 6,
|
|
523
|
-
scale: config.scale ?? 1,
|
|
524
|
-
band_idx,
|
|
525
|
-
structure_label,
|
|
526
|
-
segment_key,
|
|
527
|
-
})
|
|
528
|
-
}
|
|
499
|
+
// Create ribbon data for each band that has width data
|
|
500
|
+
for (let band_idx = 0; band_idx < bs.nb_bands; band_idx++) {
|
|
501
|
+
const band_widths = bs.band_widths[band_idx]
|
|
502
|
+
if (!band_widths) continue
|
|
503
|
+
|
|
504
|
+
const width_values = band_widths.slice(start_idx, end_idx)
|
|
505
|
+
// Skip if all widths are zero or missing
|
|
506
|
+
if (width_values.every((wv) => !wv || wv <= 0)) continue
|
|
507
|
+
|
|
508
|
+
const y_values = convert_band_values(bs.bands[band_idx].slice(start_idx, end_idx))
|
|
509
|
+
|
|
510
|
+
all_ribbons.push({
|
|
511
|
+
x_values: scaled_distances,
|
|
512
|
+
y_values,
|
|
513
|
+
width_values,
|
|
514
|
+
color: config.color ?? PLOT_COLORS[bs_idx % PLOT_COLORS.length],
|
|
515
|
+
opacity: config.opacity ?? 0.3,
|
|
516
|
+
max_width: config.max_width ?? 6,
|
|
517
|
+
scale: config.scale ?? 1,
|
|
518
|
+
band_idx,
|
|
519
|
+
structure_label,
|
|
520
|
+
segment_key,
|
|
521
|
+
})
|
|
529
522
|
}
|
|
530
523
|
}
|
|
531
524
|
|
|
@@ -548,9 +541,7 @@
|
|
|
548
541
|
.sort(([, [a]], [, [b]]) => a - b)
|
|
549
542
|
.forEach(([segment_key, [x_start, x_end]]) => {
|
|
550
543
|
const [start_lbl, end_lbl] = segment_key.split(`_`)
|
|
551
|
-
const pretty_start = start_lbl !== `null`
|
|
552
|
-
? helpers.pretty_sym_point(start_lbl)
|
|
553
|
-
: ``
|
|
544
|
+
const pretty_start = start_lbl !== `null` ? helpers.pretty_sym_point(start_lbl) : ``
|
|
554
545
|
const pretty_end = end_lbl !== `null` ? helpers.pretty_sym_point(end_lbl) : ``
|
|
555
546
|
|
|
556
547
|
// Check if this is a discontinuity (zero-length segment)
|
|
@@ -569,10 +560,7 @@
|
|
|
569
560
|
|
|
570
561
|
// Merge labels at same position with pipe separator
|
|
571
562
|
return Object.fromEntries(
|
|
572
|
-
Array.from(tick_map.entries()).map(([pos, labels]) => [
|
|
573
|
-
pos,
|
|
574
|
-
labels.join(` | `),
|
|
575
|
-
]),
|
|
563
|
+
Array.from(tick_map.entries()).map(([pos, labels]) => [pos, labels.join(` | `)]),
|
|
576
564
|
)
|
|
577
565
|
})
|
|
578
566
|
|
|
@@ -588,16 +576,17 @@
|
|
|
588
576
|
...(bs.spin_down_bands?.flat() ?? []),
|
|
589
577
|
])
|
|
590
578
|
// Keep electronic y-range independent of phonon unit conversion options.
|
|
591
|
-
const display_values =
|
|
592
|
-
? convert_band_values(all_freqs)
|
|
593
|
-
: all_freqs
|
|
579
|
+
const display_values =
|
|
580
|
+
detected_band_type === `phonon` ? convert_band_values(all_freqs) : all_freqs
|
|
594
581
|
if (display_values.length === 0) return undefined
|
|
595
582
|
const finite = display_values.filter(Number.isFinite)
|
|
596
583
|
if (finite.length === 0) return undefined
|
|
597
|
-
let min_val = Math.min(...finite),
|
|
584
|
+
let min_val = Math.min(...finite),
|
|
585
|
+
max_val = Math.max(...finite)
|
|
598
586
|
if (
|
|
599
587
|
// clamp phonon min to 0 if negatives are noise
|
|
600
|
-
detected_band_type === `phonon` &&
|
|
588
|
+
detected_band_type === `phonon` &&
|
|
589
|
+
min_val < 0 &&
|
|
601
590
|
helpers.negative_fraction(finite) < helpers.IMAGINARY_MODE_NOISE_THRESHOLD
|
|
602
591
|
) {
|
|
603
592
|
min_val = 0
|
|
@@ -631,48 +620,47 @@
|
|
|
631
620
|
!shade_imaginary_modes ||
|
|
632
621
|
!y_range ||
|
|
633
622
|
y_range[0] >= 0
|
|
634
|
-
)
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
623
|
+
)
|
|
624
|
+
return []
|
|
625
|
+
return [
|
|
626
|
+
{
|
|
627
|
+
lower: y_range[0],
|
|
628
|
+
upper: 0,
|
|
629
|
+
fill: `var(--bands-imaginary-region-color, light-dark(#f8d7da, #5a1a1f))`,
|
|
630
|
+
fill_opacity: 0.2,
|
|
631
|
+
label: `Imaginary modes`,
|
|
632
|
+
show_in_legend: false,
|
|
633
|
+
z_index: `below-lines`,
|
|
634
|
+
},
|
|
635
|
+
]
|
|
644
636
|
})
|
|
645
637
|
|
|
646
|
-
let custom_highlight_regions = $derived
|
|
638
|
+
let custom_highlight_regions = $derived(
|
|
647
639
|
(highlight_regions ?? [])
|
|
648
|
-
.filter((region) =>
|
|
649
|
-
Number.isFinite(region.y_min) && Number.isFinite(region.y_max)
|
|
650
|
-
)
|
|
640
|
+
.filter((region) => Number.isFinite(region.y_min) && Number.isFinite(region.y_max))
|
|
651
641
|
.map((region) => ({
|
|
652
642
|
lower: Math.min(region.y_min, region.y_max),
|
|
653
643
|
upper: Math.max(region.y_min, region.y_max),
|
|
654
|
-
fill:
|
|
655
|
-
`var(--bands-highlight-region-color, light-dark(#f6e8c3, #4d3f20))`,
|
|
644
|
+
fill:
|
|
645
|
+
region.color ?? `var(--bands-highlight-region-color, light-dark(#f6e8c3, #4d3f20))`,
|
|
656
646
|
fill_opacity: region.opacity ?? 0.2,
|
|
657
647
|
label: region.label,
|
|
658
648
|
show_in_legend: Boolean(region.label),
|
|
659
649
|
z_index: `below-lines` as const,
|
|
660
|
-
}))
|
|
650
|
+
})),
|
|
661
651
|
)
|
|
662
652
|
|
|
663
|
-
let fill_regions = $derived([
|
|
664
|
-
...imaginary_mode_region,
|
|
665
|
-
...custom_highlight_regions,
|
|
666
|
-
])
|
|
653
|
+
let fill_regions = $derived([...imaginary_mode_region, ...custom_highlight_regions])
|
|
667
654
|
|
|
668
655
|
let electronic_gap_annotation = $derived.by(() => {
|
|
669
656
|
if (
|
|
670
657
|
!show_gap_annotation ||
|
|
671
658
|
detected_band_type !== `electronic` ||
|
|
672
659
|
effective_fermi_level === undefined
|
|
673
|
-
)
|
|
660
|
+
)
|
|
661
|
+
return null
|
|
674
662
|
const all_energies = series_data.flatMap((series_item) =>
|
|
675
|
-
series_item.y.filter(Number.isFinite)
|
|
663
|
+
series_item.y.filter(Number.isFinite),
|
|
676
664
|
)
|
|
677
665
|
const occupied = all_energies.filter((energy) => energy <= effective_fermi_level)
|
|
678
666
|
const unoccupied = all_energies.filter((energy) => energy > effective_fermi_level)
|
|
@@ -701,11 +689,14 @@
|
|
|
701
689
|
let highlight_x = $derived.by(() => {
|
|
702
690
|
if (highlighted_qpoint_index == null) return null
|
|
703
691
|
const bs = Object.values(band_structs_dict)[0]
|
|
704
|
-
return bs
|
|
692
|
+
return bs
|
|
693
|
+
? helpers.qpoint_x_position(bs, highlighted_qpoint_index, x_positions ?? {})
|
|
694
|
+
: null
|
|
705
695
|
})
|
|
706
696
|
|
|
707
697
|
let display = $state({ x_grid: false, y_grid: true, y_zero_line: true })
|
|
708
698
|
</script>
|
|
699
|
+
|
|
709
700
|
{#if has_series && !is_strict_path_error}
|
|
710
701
|
<ScatterPlot
|
|
711
702
|
{id}
|
|
@@ -728,32 +719,37 @@
|
|
|
728
719
|
>
|
|
729
720
|
{#snippet tooltip({ x, y, y_formatted, label, metadata })}
|
|
730
721
|
{@const y_label_full = internal_y_axis.label ?? ``}
|
|
731
|
-
{@const [, y_label, y_unit] = y_label_full.match(/^(.+?)\s*\(([^)]+)\)$/) ??
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
{@const
|
|
737
|
-
|
|
738
|
-
|
|
722
|
+
{@const [, y_label, y_unit] = y_label_full.match(/^(.+?)\s*\(([^)]+)\)$/) ?? [
|
|
723
|
+
,
|
|
724
|
+
y_label_full,
|
|
725
|
+
``,
|
|
726
|
+
]}
|
|
727
|
+
{@const segment = Object.entries(x_positions ?? {}).find(
|
|
728
|
+
([, [start, end]]) => x >= start && x <= end,
|
|
729
|
+
)}
|
|
730
|
+
{@const path =
|
|
731
|
+
segment?.[0]
|
|
732
|
+
.split(`_`)
|
|
733
|
+
.map((lbl) => (lbl !== `null` ? helpers.pretty_sym_point(lbl) : ``))
|
|
734
|
+
.filter(Boolean)
|
|
735
|
+
.join(` → `) || null}
|
|
739
736
|
{@const {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
737
|
+
band_idx,
|
|
738
|
+
spin,
|
|
739
|
+
is_acoustic,
|
|
740
|
+
nb_bands,
|
|
741
|
+
frac_coords,
|
|
742
|
+
qpoint_label,
|
|
743
|
+
band_width,
|
|
744
|
+
slope,
|
|
745
|
+
} = (metadata ?? {}) as Partial<helpers.BandPointMeta>}
|
|
749
746
|
{@const num_structs = Object.keys(band_structs_dict).length}
|
|
750
747
|
{#if num_structs > 1 && label}<strong>{label}</strong><br />{/if}
|
|
751
|
-
{@html sanitize_html(y_label || `Value`)}: {y_formatted}{y_unit ? ` ${y_unit}` : ``}<br
|
|
748
|
+
{@html sanitize_html(y_label || `Value`)}: {y_formatted}{y_unit ? ` ${y_unit}` : ``}<br
|
|
749
|
+
/>
|
|
752
750
|
{#if path}Path: {path}<br />{/if}
|
|
753
751
|
{#if typeof band_idx === `number`}
|
|
754
|
-
Band: {band_idx + 1}{#if typeof nb_bands === `number`} / {
|
|
755
|
-
nb_bands
|
|
756
|
-
}{/if}
|
|
752
|
+
Band: {band_idx + 1}{#if typeof nb_bands === `number`} / {nb_bands}{/if}
|
|
757
753
|
{#if typeof is_acoustic === `boolean`}
|
|
758
754
|
({is_acoustic ? `acoustic` : `optical`})
|
|
759
755
|
{:else if detected_band_type === `electronic` && effective_fermi_level !== undefined}
|
|
@@ -767,9 +763,9 @@
|
|
|
767
763
|
<br />At: {helpers.pretty_sym_point(qpoint_label)}
|
|
768
764
|
{/if}
|
|
769
765
|
{#if Array.isArray(frac_coords)}
|
|
770
|
-
<br />{detected_band_type === `electronic` ? `k` : `q`}: [{
|
|
771
|
-
|
|
772
|
-
|
|
766
|
+
<br />{detected_band_type === `electronic` ? `k` : `q`}: [{frac_coords
|
|
767
|
+
.map((coord: number) => format_num(coord, `.3f`))
|
|
768
|
+
.join(`, `)}]
|
|
773
769
|
{/if}
|
|
774
770
|
{#if typeof band_width === `number` && band_width > 0}
|
|
775
771
|
<br />Projection: {format_num(band_width, `.3~g`)}
|
|
@@ -854,19 +850,16 @@
|
|
|
854
850
|
|
|
855
851
|
{#snippet user_content({ height, x_scale_fn, y_scale_fn, pad })}
|
|
856
852
|
<!-- Fat band ribbons (rendered behind band lines) -->
|
|
857
|
-
{#each ribbon_data as
|
|
858
|
-
ribbon
|
|
859
|
-
(`${ribbon.structure_label}-${ribbon.segment_key}-${ribbon.band_idx}`)
|
|
860
|
-
}
|
|
853
|
+
{#each ribbon_data as ribbon (`${ribbon.structure_label}-${ribbon.segment_key}-${ribbon.band_idx}`)}
|
|
861
854
|
{@const path_d = helpers.generate_ribbon_path(
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
855
|
+
ribbon.x_values,
|
|
856
|
+
ribbon.y_values,
|
|
857
|
+
ribbon.width_values,
|
|
858
|
+
x_scale_fn,
|
|
859
|
+
y_scale_fn,
|
|
860
|
+
ribbon.max_width,
|
|
861
|
+
ribbon.scale,
|
|
862
|
+
)}
|
|
870
863
|
{#if path_d}
|
|
871
864
|
<path
|
|
872
865
|
d={path_d}
|
|
@@ -879,12 +872,10 @@
|
|
|
879
872
|
{/each}
|
|
880
873
|
|
|
881
874
|
<!-- Symmetry point vertical lines (filter NaN from scale) -->
|
|
882
|
-
{#each Object.keys(x_axis_ticks)
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
scaled_x
|
|
886
|
-
(scaled_x)
|
|
887
|
-
}
|
|
875
|
+
{#each Object.keys(x_axis_ticks)
|
|
876
|
+
.map(Number)
|
|
877
|
+
.map((tick) => x_scale_fn(tick))
|
|
878
|
+
.filter(Number.isFinite) as scaled_x (scaled_x)}
|
|
888
879
|
<line
|
|
889
880
|
x1={scaled_x}
|
|
890
881
|
x2={scaled_x}
|
|
@@ -914,19 +905,22 @@
|
|
|
914
905
|
{/if}
|
|
915
906
|
|
|
916
907
|
<!-- Shared geometry for Fermi level and gap annotations -->
|
|
917
|
-
{@const fermi_y =
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
908
|
+
{@const fermi_y =
|
|
909
|
+
effective_fermi_level !== undefined ? y_scale_fn(effective_fermi_level) : NaN}
|
|
910
|
+
{@const bands_x_end = x_scale_fn(
|
|
911
|
+
Object.values(x_positions ?? {})
|
|
912
|
+
.flat()
|
|
913
|
+
.at(-1) ?? 1,
|
|
914
|
+
)}
|
|
921
915
|
{@const gap_data = electronic_gap_annotation}
|
|
922
916
|
{@const vbm_y = gap_data ? y_scale_fn(gap_data.vbm) : NaN}
|
|
923
917
|
{@const cbm_y = gap_data ? y_scale_fn(gap_data.cbm) : NaN}
|
|
924
918
|
{@const gap_mid_y = (vbm_y + cbm_y) / 2}
|
|
925
|
-
{@const ef_needs_offset =
|
|
926
|
-
|
|
919
|
+
{@const ef_needs_offset =
|
|
920
|
+
Number.isFinite(gap_mid_y) && Math.abs(fermi_y - gap_mid_y) < 16}
|
|
927
921
|
{@const ef_label_y = ef_needs_offset
|
|
928
|
-
|
|
929
|
-
|
|
922
|
+
? gap_mid_y + (fermi_y >= gap_mid_y ? 16 : -16)
|
|
923
|
+
: fermi_y}
|
|
930
924
|
|
|
931
925
|
<!-- Fermi level line for electronic bands -->
|
|
932
926
|
{#if Number.isFinite(fermi_y) && Number.isFinite(bands_x_end)}
|
|
@@ -966,9 +960,8 @@
|
|
|
966
960
|
{/if}
|
|
967
961
|
|
|
968
962
|
<!-- Reference frequency horizontal line -->
|
|
969
|
-
{@const ref_freq =
|
|
970
|
-
|
|
971
|
-
: NaN}
|
|
963
|
+
{@const ref_freq =
|
|
964
|
+
reference_frequency != null ? convert_band_values([reference_frequency])[0] : NaN}
|
|
972
965
|
{@const ref_y = Number.isFinite(ref_freq) ? y_scale_fn(ref_freq) : NaN}
|
|
973
966
|
{#if Number.isFinite(ref_y) && Number.isFinite(bands_x_end)}
|
|
974
967
|
<line
|
|
@@ -984,15 +977,8 @@
|
|
|
984
977
|
{/if}
|
|
985
978
|
|
|
986
979
|
<!-- Electronic band edge and gap annotation -->
|
|
987
|
-
{#if gap_data && Number.isFinite(vbm_y) && Number.isFinite(cbm_y) &&
|
|
988
|
-
|
|
989
|
-
{#each [
|
|
990
|
-
[vbm_y, `var(--bands-gap-vbm-color, light-dark(#1f77b4, #7db7ff))`],
|
|
991
|
-
[cbm_y, `var(--bands-gap-cbm-color, light-dark(#2ca02c, #7ddc7d))`],
|
|
992
|
-
] as [number, string][] as
|
|
993
|
-
[edge_y, color]
|
|
994
|
-
(edge_y)
|
|
995
|
-
}
|
|
980
|
+
{#if gap_data && Number.isFinite(vbm_y) && Number.isFinite(cbm_y) && Number.isFinite(bands_x_end)}
|
|
981
|
+
{#each [[vbm_y, `var(--bands-gap-vbm-color, light-dark(#1f77b4, #7db7ff))`], [cbm_y, `var(--bands-gap-cbm-color, light-dark(#2ca02c, #7ddc7d))`]] as [number, string][] as [edge_y, color] (edge_y)}
|
|
996
982
|
<line
|
|
997
983
|
x1={pad.l}
|
|
998
984
|
x2={bands_x_end + 3}
|