matterviz 0.4.0 → 0.4.2
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 +12 -14
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/app.css +53 -0
- package/dist/brillouin/BrillouinZone.svelte +132 -219
- package/dist/brillouin/BrillouinZone.svelte.d.ts +9 -20
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +47 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +15 -42
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +63 -230
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +3 -23
- 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 +80 -77
- 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 +33 -38
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +143 -246
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +652 -976
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -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 +3 -3
- package/dist/chempot-diagram/compute.js +3 -1
- 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.d.ts +0 -4
- package/dist/colors/index.js +21 -22
- package/dist/composition/BarChart.svelte +37 -31
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +7 -11
- package/dist/composition/Formula.svelte +18 -25
- package/dist/composition/FormulaFilter.svelte +96 -98
- package/dist/composition/PieChart.svelte +60 -46
- package/dist/composition/chem-sys.js +3 -2
- package/dist/composition/format.js +4 -3
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -3
- package/dist/composition/parse.js +27 -28
- package/dist/constants.js +11 -9
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +20 -25
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +176 -256
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +269 -804
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +236 -755
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +264 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +128 -49
- 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 +210 -351
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +16 -14
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +17 -21
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- 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 +279 -0
- package/dist/convex-hull/helpers.d.ts +47 -17
- package/dist/convex-hull/helpers.js +186 -101
- 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 +9 -7
- package/dist/convex-hull/index.js +7 -2
- package/dist/convex-hull/thermodynamics.js +109 -937
- package/dist/convex-hull/types.d.ts +12 -4
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +41 -43
- 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 +6 -8
- 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 +24 -29
- package/dist/element/ElementTile.svelte.d.ts +1 -1
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +1 -2
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +1 -0
- package/dist/element/index.js +3 -0
- package/dist/feedback/DragOverlay.svelte +5 -3
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -1
- package/dist/feedback/StatusMessage.svelte +20 -7
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +78 -165
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +9 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceScene.svelte +93 -272
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +14 -13
- package/dist/fermi-surface/export.js +4 -15
- 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 +84 -97
- package/dist/fermi-surface/types.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +161 -185
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +6 -5
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +12 -9
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +8 -2
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +170 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -36
- package/dist/io/export.d.ts +9 -1
- package/dist/io/export.js +37 -29
- package/dist/io/fetch.d.ts +2 -4
- package/dist/io/fetch.js +0 -11
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +13 -0
- package/dist/io/index.d.ts +1 -0
- package/dist/io/index.js +3 -0
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/types.d.ts +13 -0
- package/dist/io/url-drop.js +13 -25
- package/dist/isosurface/Isosurface.svelte +17 -23
- package/dist/isosurface/IsosurfaceControls.svelte +37 -42
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +50 -48
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +44 -14
- package/dist/layout/FullscreenButton.svelte +34 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +12 -12
- package/dist/layout/InfoCard.svelte +7 -18
- 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 +21 -17
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +115 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +18 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +36 -0
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.js +4 -0
- package/dist/layout/json-tree/JsonNode.svelte +8 -11
- package/dist/layout/json-tree/JsonTree.svelte +53 -77
- package/dist/layout/json-tree/JsonValue.svelte +7 -15
- package/dist/layout/json-tree/utils.js +14 -23
- package/dist/math.d.ts +9 -3
- package/dist/math.js +37 -21
- package/dist/overlays/ContextMenu.svelte +4 -2
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +81 -26
- package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
- package/dist/overlays/GlassChip.svelte +30 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +11 -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 +115 -146
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +73 -96
- 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 +49 -134
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +3 -3
- package/dist/phase-diagram/colors.js +1 -1
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.d.ts +2 -1
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +21 -15
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +494 -692
- package/dist/plot/bar/BarPlot.svelte.d.ts +9 -15
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +5 -7
- package/dist/plot/bar/SpacegroupBarPlot.svelte +31 -37
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +361 -439
- package/dist/plot/box/BoxPlot.svelte.d.ts +6 -3
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
- package/dist/plot/box/Violin.svelte.d.ts +2 -1
- package/dist/plot/box/box-plot.d.ts +3 -2
- package/dist/plot/box/box-plot.js +6 -3
- package/dist/plot/box/kde.d.ts +2 -1
- package/dist/plot/box/kde.js +4 -4
- package/dist/plot/core/auto-place.d.ts +1 -1
- package/dist/plot/core/auto-place.js +5 -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 +106 -111
- package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
- 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 +21 -11
- package/dist/plot/core/components/Line.svelte.d.ts +5 -2
- package/dist/plot/core/components/PlotAxis.svelte +42 -18
- package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
- 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 +56 -59
- package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
- package/dist/plot/core/components/ReferencePlane.svelte +9 -10
- package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
- 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 +29 -476
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +7 -4
- package/dist/plot/core/fill-utils.js +34 -9
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.d.ts +5 -1
- package/dist/plot/core/interactions.js +14 -2
- package/dist/plot/core/layout.d.ts +3 -1
- package/dist/plot/core/layout.js +22 -13
- 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 +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/core/reference-line.d.ts +10 -10
- package/dist/plot/core/reference-line.js +7 -7
- package/dist/plot/core/scales.d.ts +40 -25
- package/dist/plot/core/scales.js +49 -21
- package/dist/plot/core/svg.d.ts +2 -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 +47 -331
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
- package/dist/plot/core/utils/hierarchy-chart.js +179 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +99 -0
- package/dist/plot/core/utils/label-placement.d.ts +1 -1
- package/dist/plot/core/utils/label-placement.js +5 -5
- package/dist/plot/core/utils.d.ts +2 -1
- package/dist/plot/histogram/Histogram.svelte +373 -631
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
- 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 +79 -73
- package/dist/plot/sankey/Sankey.svelte.d.ts +3 -3
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/sankey/sankey.js +3 -1
- package/dist/plot/scatter/BinnedScatterPlot.svelte +264 -112
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +11 -4
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +623 -821
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +9 -15
- 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/binned-scatter-types.d.ts +6 -12
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/index.d.ts +1 -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 +40 -60
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +17 -15
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +232 -234
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
- package/dist/plot/scatter-3d/Surface3D.svelte +9 -17
- package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
- package/dist/plot/sunburst/Sunburst.svelte +256 -338
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
- 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 +14 -4
- package/dist/plot/treemap/Treemap.svelte +907 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
- package/dist/plot/treemap/index.d.ts +3 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/treemap.d.ts +26 -0
- package/dist/plot/treemap/treemap.js +99 -0
- package/dist/rdf/RdfPlot.svelte +22 -26
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +4 -8
- 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 +22 -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 +33 -11
- package/dist/settings.js +136 -51
- package/dist/spectral/Bands.svelte +231 -237
- package/dist/spectral/Bands.svelte.d.ts +3 -2
- package/dist/spectral/BandsAndDos.svelte +29 -29
- package/dist/spectral/BrillouinBandsDos.svelte +21 -29
- package/dist/spectral/Dos.svelte +75 -77
- package/dist/spectral/Dos.svelte.d.ts +2 -1
- package/dist/spectral/helpers.d.ts +9 -9
- package/dist/spectral/helpers.js +66 -70
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +5 -24
- package/dist/structure/Arrow.svelte +6 -21
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +115 -75
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +16 -3
- package/dist/structure/CellSelect.svelte +22 -29
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- 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 +725 -735
- package/dist/structure/Structure.svelte.d.ts +8 -16
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +298 -325
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +62 -168
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +77 -69
- package/dist/structure/StructureInfoPane.svelte.d.ts +6 -6
- package/dist/structure/StructureScene.svelte +758 -600
- package/dist/structure/StructureScene.svelte.d.ts +24 -20
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +18 -0
- package/dist/structure/atom-label-placement.js +115 -0
- package/dist/structure/atom-properties.d.ts +3 -1
- package/dist/structure/atom-properties.js +115 -54
- package/dist/structure/bond-order-perception.js +2 -4
- package/dist/structure/bonding.d.ts +12 -2
- package/dist/structure/bonding.js +172 -73
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +25 -4
- package/dist/structure/export.js +103 -153
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +22 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +18 -1
- package/dist/structure/index.js +15 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +5 -3
- package/dist/structure/parse.js +551 -567
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +5 -3
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +204 -51
- package/dist/structure/polyhedra.d.ts +40 -0
- package/dist/structure/polyhedra.js +587 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +10 -15
- 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 +350 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +142 -49
- package/dist/symmetry/WyckoffTable.svelte +58 -16
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +8 -14
- package/dist/symmetry/index.d.ts +15 -4
- package/dist/symmetry/index.js +308 -81
- package/dist/symmetry/spacegroups.d.ts +5 -1
- package/dist/symmetry/spacegroups.js +18 -3
- 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 +1104 -378
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +5 -12
- 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/index.d.ts +1 -5
- package/dist/theme/index.js +4 -10
- package/dist/theme/themes.mjs +14 -7
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +2 -5
- package/dist/trajectory/Trajectory.svelte +556 -352
- package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +28 -54
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +88 -99
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +73 -71
- package/dist/trajectory/format-detect.d.ts +0 -1
- package/dist/trajectory/format-detect.js +13 -17
- package/dist/trajectory/frame-reader.d.ts +2 -1
- package/dist/trajectory/frame-reader.js +74 -136
- package/dist/trajectory/helpers.d.ts +12 -2
- package/dist/trajectory/helpers.js +68 -37
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- 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/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 +3 -4
- package/dist/trajectory/parse/index.js +68 -119
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +14 -16
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +13 -9
- 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 +5 -0
- package/dist/trajectory/parse/vaspout-h5.js +284 -0
- package/dist/trajectory/parse/xyz.d.ts +9 -21
- package/dist/trajectory/parse/xyz.js +38 -39
- package/dist/trajectory/plotting.d.ts +8 -10
- package/dist/trajectory/plotting.js +102 -127
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +8 -1
- package/dist/xrd/XrdPlot.svelte +56 -85
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +8 -15
- package/dist/xrd/index.d.ts +2 -2
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +77 -36
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- 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/core/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/core/hover-lock.svelte.js +0 -45
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
- package/dist/structure/label-placement.d.ts +0 -14
- package/dist/structure/label-placement.js +0 -72
|
@@ -2,7 +2,9 @@
|
|
|
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
|
+
// clamp01 guards float jitter at the cell boundary
|
|
7
|
+
import { clamp01 } from '../utils';
|
|
6
8
|
const safe_mod = (val, dim) => ((val % dim) + dim) % dim;
|
|
7
9
|
// Precompute Catmull-Rom coefficients for a given t value
|
|
8
10
|
// Returns [c0, c1, c2, c3] where result = c0*p0 + c1*p1 + c2*p2 + c3*p3
|
|
@@ -29,7 +31,7 @@ function tricubic_interpolate(grid, fx, fy, fz, px, py, pz) {
|
|
|
29
31
|
const [cz0, cz1, cz2, cz3] = catmull_rom_coeffs(fz - iz);
|
|
30
32
|
// Wrapped stencil indices (modulo hoisted out of the inner loop); a zero period
|
|
31
33
|
// (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((
|
|
34
|
+
const stencil = (idx, period) => [idx - 1, idx, idx + 1, idx + 2].map((stencil_idx) => period > 0 ? ((stencil_idx % period) + period) % period : 0);
|
|
33
35
|
const [wx, wy, wz] = [stencil(ix, px), stencil(iy, py), stencil(iz, pz)];
|
|
34
36
|
// Interpolate along z, then y, then x (fully inlined)
|
|
35
37
|
let result = 0;
|
|
@@ -60,8 +62,8 @@ function upsample_grid(grid, factor, periodic = false) {
|
|
|
60
62
|
// period (count of unique points) doubles as the resampling span numerator
|
|
61
63
|
const endpoint = periodic ? 0 : 1;
|
|
62
64
|
const dims = [grid.length, grid[0]?.length || 0, grid[0]?.[0]?.length || 0];
|
|
63
|
-
const [px, py, pz] = dims.map((
|
|
64
|
-
const [new_nx, new_ny, new_nz] = [px, py, pz].map((
|
|
65
|
+
const [px, py, pz] = dims.map((dim) => dim - endpoint);
|
|
66
|
+
const [new_nx, new_ny, new_nz] = [px, py, pz].map((period) => Math.round(period * factor) + endpoint);
|
|
65
67
|
// Map new index → source coordinate; a single-point axis (span 0) pins its lone
|
|
66
68
|
// output to source 0 to avoid 0/0 = NaN
|
|
67
69
|
const src_coords = (new_n, period) => {
|
|
@@ -142,7 +144,8 @@ export function extract_fermi_surface(band_data, options = {}) {
|
|
|
142
144
|
if (compute_velocities && band_data.velocities) {
|
|
143
145
|
isosurface.properties = compute_fermi_velocities(isosurface, band_data.velocities[spin_idx][band_idx], band_data.k_lattice, band_data.k_grid, periodic);
|
|
144
146
|
isosurface.avg_velocity =
|
|
145
|
-
isosurface.properties.reduce((
|
|
147
|
+
isosurface.properties.reduce((sum, velocity) => sum + velocity, 0) /
|
|
148
|
+
isosurface.properties.length;
|
|
146
149
|
}
|
|
147
150
|
// Compute dimensionality if requested
|
|
148
151
|
if (compute_dimensionality) {
|
|
@@ -203,7 +206,7 @@ export function compute_surface_area(surface) {
|
|
|
203
206
|
const cy = e1z * e2x - e1x * e2z;
|
|
204
207
|
const cz = e1x * e2y - e1y * e2x;
|
|
205
208
|
// Area is half the magnitude of cross product
|
|
206
|
-
total_area += Math.
|
|
209
|
+
total_area += Math.hypot(cx, cy, cz) * 0.5;
|
|
207
210
|
}
|
|
208
211
|
return total_area;
|
|
209
212
|
}
|
|
@@ -217,8 +220,6 @@ function compute_fermi_velocities(surface, velocity_grid, k_lattice, k_grid, per
|
|
|
217
220
|
const k_inv = math.matrix_inverse_3x3(math.transpose_3x3_matrix(k_lattice));
|
|
218
221
|
// Grid point i sits at frac i/(n−1) (endpoint-inclusive BXSF) or i/n (periodic)
|
|
219
222
|
const [sx, sy, sz] = periodic ? [nx, ny, nz] : [nx - 1, ny - 1, nz - 1];
|
|
220
|
-
// Clamp guards float jitter at the cell boundary
|
|
221
|
-
const clamp01 = (val) => Math.min(Math.max(val, 0), 1);
|
|
222
223
|
for (const vertex of surface.vertices) {
|
|
223
224
|
const frac = math.mat3x3_vec3_multiply(k_inv, vertex); // centered, in [-0.5, 0.5]
|
|
224
225
|
const gx = clamp01(frac[0] + 0.5) * sx;
|
|
@@ -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,16 +1,5 @@
|
|
|
1
|
+
import { download } from '../io/fetch';
|
|
1
2
|
import { to_error } from '../utils';
|
|
2
|
-
// Helper to trigger file download
|
|
3
|
-
function download_file(content, filename, mime_type) {
|
|
4
|
-
const blob = new Blob([content], { type: mime_type });
|
|
5
|
-
const url = URL.createObjectURL(blob);
|
|
6
|
-
const link = document.createElement(`a`);
|
|
7
|
-
link.href = url;
|
|
8
|
-
link.download = filename;
|
|
9
|
-
document.body.append(link);
|
|
10
|
-
link.click();
|
|
11
|
-
document.body.removeChild(link);
|
|
12
|
-
URL.revokeObjectURL(url);
|
|
13
|
-
}
|
|
14
3
|
// Export scene to STL format (good for 3D printing)
|
|
15
4
|
export async function export_to_stl(scene, filename) {
|
|
16
5
|
const { STLExporter } = await import(`three/addons/exporters/STLExporter.js`);
|
|
@@ -18,14 +7,14 @@ export async function export_to_stl(scene, filename) {
|
|
|
18
7
|
const result = exporter.parse(scene, { binary: true });
|
|
19
8
|
// Binary STL returns DataView, convert to ArrayBuffer for Blob
|
|
20
9
|
const buffer = result instanceof DataView ? result.buffer : result;
|
|
21
|
-
|
|
10
|
+
download(buffer, `${filename}.stl`, `application/octet-stream`);
|
|
22
11
|
}
|
|
23
12
|
// Export scene to OBJ format (widely compatible)
|
|
24
13
|
export async function export_to_obj(scene, filename) {
|
|
25
14
|
const { OBJExporter } = await import(`three/addons/exporters/OBJExporter.js`);
|
|
26
15
|
const exporter = new OBJExporter();
|
|
27
16
|
const result = exporter.parse(scene);
|
|
28
|
-
|
|
17
|
+
download(result, `${filename}.obj`, `text/plain`);
|
|
29
18
|
}
|
|
30
19
|
// Export scene to GLTF format (modern web/AR standard)
|
|
31
20
|
export async function export_to_gltf(scene, filename) {
|
|
@@ -34,7 +23,7 @@ export async function export_to_gltf(scene, filename) {
|
|
|
34
23
|
return new Promise((resolve, reject) => {
|
|
35
24
|
exporter.parse(scene, (gltf) => {
|
|
36
25
|
const output = JSON.stringify(gltf, null, 2);
|
|
37
|
-
|
|
26
|
+
download(output, `${filename}.gltf`, `application/json`);
|
|
38
27
|
resolve();
|
|
39
28
|
}, (error) => reject(to_error(error)), { binary: false });
|
|
40
29
|
});
|
|
@@ -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,10 +1,13 @@
|
|
|
1
|
+
import * as math from '../math';
|
|
2
|
+
import { is_plain_object, normalize_scientific_notation, parse_leading_num, to_error, } 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
|
-
// Parse whitespace-separated floats from a line
|
|
5
|
-
|
|
6
|
+
// Parse whitespace-separated floats from a line. Normalizes Fortran D-exponents
|
|
7
|
+
// (`0.1234D+01`) which Fortran codes emit in BXSF/FRMSF and Number() rejects
|
|
8
|
+
const parse_floats = (line) => parse_number_tokens(normalize_scientific_notation(line)).map(Number);
|
|
6
9
|
// Parse whitespace-separated integers from a line
|
|
7
|
-
const parse_ints = (line) => parse_number_tokens(line).map((part) =>
|
|
10
|
+
const parse_ints = (line) => parse_number_tokens(line).map((part) => Math.trunc(Number(part)));
|
|
8
11
|
// Parse BXSF (Band-XSF) format used by XCrySDen, Quantum ESPRESSO, etc.
|
|
9
12
|
// Format specification: http://www.xcrysden.org/doc/XSF.html
|
|
10
13
|
function parse_bxsf(content) {
|
|
@@ -38,7 +41,7 @@ function parse_bxsf(content) {
|
|
|
38
41
|
throw new Error(`Expected BANDGRID_3D header, got: ${bandgrid_line}`);
|
|
39
42
|
}
|
|
40
43
|
// Parse number of bands
|
|
41
|
-
const n_bands =
|
|
44
|
+
const n_bands = Math.trunc(Number(next_line()));
|
|
42
45
|
if (isNaN(n_bands) || n_bands <= 0) {
|
|
43
46
|
throw new Error(`Invalid number of bands in BXSF file`);
|
|
44
47
|
}
|
|
@@ -112,9 +115,9 @@ function parse_bxsf(content) {
|
|
|
112
115
|
const lower = line.toLowerCase();
|
|
113
116
|
if (lower.includes(`fermi`) && lower.includes(`energy`)) {
|
|
114
117
|
// Match patterns like "Fermi Energy = 5.123" or "fermi_energy: -0.5"
|
|
115
|
-
const match = /(?:=|:)\s*([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/i.exec(line);
|
|
118
|
+
const match = /(?:=|:)\s*(?<value>[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/i.exec(line);
|
|
116
119
|
if (match) {
|
|
117
|
-
fermi_energy =
|
|
120
|
+
fermi_energy = Number(match[1]);
|
|
118
121
|
break;
|
|
119
122
|
}
|
|
120
123
|
}
|
|
@@ -147,12 +150,12 @@ function parse_frmsf(content) {
|
|
|
147
150
|
// 0 = Monkhorst-Pack grid (shifted)
|
|
148
151
|
// 1 = Gamma-centered grid
|
|
149
152
|
// 2 = Gamma + half grid shift
|
|
150
|
-
const lshift =
|
|
153
|
+
const lshift = Math.trunc(Number(lines[line_idx++]));
|
|
151
154
|
if (isNaN(lshift) || lshift < 0 || lshift > 2) {
|
|
152
155
|
throw new Error(`FRMSF: Invalid lshift value (expected 0, 1, or 2)`);
|
|
153
156
|
}
|
|
154
157
|
// Line 3: number of bands
|
|
155
|
-
const n_bands =
|
|
158
|
+
const n_bands = Math.trunc(Number(lines[line_idx++]));
|
|
156
159
|
if (isNaN(n_bands) || n_bands <= 0) {
|
|
157
160
|
throw new Error(`FRMSF: Invalid number of bands`);
|
|
158
161
|
}
|
|
@@ -181,17 +184,14 @@ function parse_frmsf(content) {
|
|
|
181
184
|
energies[spin_idx] = [];
|
|
182
185
|
for (let band_idx = 0; band_idx < n_bands; band_idx++) {
|
|
183
186
|
const energy_values = [];
|
|
184
|
-
// Read energy values (first value per line only, ignore auxiliary columns
|
|
187
|
+
// Read energy values (first value per line only, ignore auxiliary columns;
|
|
188
|
+
// normalize Fortran D-exponents like parse_floats does)
|
|
185
189
|
while (energy_values.length < total_points && line_idx < lines.length) {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
if (first_token && !isNaN(parseFloat(first_token))) {
|
|
189
|
-
energy_values.push(parseFloat(first_token));
|
|
190
|
-
line_idx++;
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
190
|
+
const energy = parse_leading_num(normalize_scientific_notation(lines[line_idx] ?? ``));
|
|
191
|
+
if (isNaN(energy))
|
|
193
192
|
break;
|
|
194
|
-
|
|
193
|
+
energy_values.push(energy);
|
|
194
|
+
line_idx++;
|
|
195
195
|
}
|
|
196
196
|
if (energy_values.length < total_points) {
|
|
197
197
|
throw new Error(`FRMSF spin ${spin_idx} band ${band_idx}: expected ${total_points} values, got ${energy_values.length}`);
|
|
@@ -224,14 +224,9 @@ function parse_frmsf(content) {
|
|
|
224
224
|
}
|
|
225
225
|
// Validate that an object has the required Isosurface shape
|
|
226
226
|
function is_valid_isosurface(obj) {
|
|
227
|
-
if (!obj
|
|
227
|
+
if (!is_plain_object(obj))
|
|
228
228
|
return false;
|
|
229
|
-
const
|
|
230
|
-
const vertices = isosurface_obj.vertices;
|
|
231
|
-
const faces = isosurface_obj.faces;
|
|
232
|
-
const normals = isosurface_obj.normals;
|
|
233
|
-
const band_index = isosurface_obj.band_index;
|
|
234
|
-
const spin = isosurface_obj.spin;
|
|
229
|
+
const { vertices, faces, normals, band_index, spin } = obj;
|
|
235
230
|
if (!Array.isArray(vertices) || vertices.length === 0)
|
|
236
231
|
return false;
|
|
237
232
|
if (!Array.isArray(faces))
|
|
@@ -246,27 +241,35 @@ function is_valid_isosurface(obj) {
|
|
|
246
241
|
}
|
|
247
242
|
// Validate FermiSurfaceData shape
|
|
248
243
|
function is_valid_fermi_surface_data(obj) {
|
|
249
|
-
if (!obj
|
|
244
|
+
if (!is_plain_object(obj))
|
|
250
245
|
return false;
|
|
251
|
-
const data = obj;
|
|
252
246
|
// Check required fields
|
|
253
|
-
if (!Array.isArray(
|
|
247
|
+
if (!Array.isArray(obj.isosurfaces))
|
|
254
248
|
return false;
|
|
255
|
-
if (!
|
|
249
|
+
if (!math.is_square_matrix(obj.k_lattice, 3))
|
|
256
250
|
return false;
|
|
257
|
-
if (typeof
|
|
251
|
+
if (typeof obj.fermi_energy !== `number`)
|
|
258
252
|
return false;
|
|
259
|
-
if (
|
|
253
|
+
if (obj.reciprocal_cell !== `wigner_seitz` && obj.reciprocal_cell !== `parallelepiped`) {
|
|
260
254
|
return false;
|
|
261
255
|
}
|
|
262
|
-
if (!
|
|
256
|
+
if (!obj.metadata || typeof obj.metadata !== `object`)
|
|
263
257
|
return false;
|
|
264
258
|
// Validate each isosurface
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
259
|
+
return obj.isosurfaces.every(is_valid_isosurface);
|
|
260
|
+
}
|
|
261
|
+
// Validate BandGridData shape: non-empty energies grid, 3 k-grid dims, 3x3 k-lattice
|
|
262
|
+
function is_valid_band_grid_data(obj) {
|
|
263
|
+
if (!is_plain_object(obj))
|
|
264
|
+
return false;
|
|
265
|
+
const { energies, k_grid, k_lattice } = obj;
|
|
266
|
+
if (!Array.isArray(energies) || energies.length === 0)
|
|
267
|
+
return false;
|
|
268
|
+
if (!Array.isArray(k_grid) ||
|
|
269
|
+
k_grid.length !== 3 ||
|
|
270
|
+
!k_grid.every((dim) => Number.isInteger(dim) && dim > 0))
|
|
271
|
+
return false;
|
|
272
|
+
return math.is_square_matrix(k_lattice, 3);
|
|
270
273
|
}
|
|
271
274
|
// Parse Matterviz/IFermi JSON format for Fermi surface data
|
|
272
275
|
// Throws on invalid input; returns parsed data on success
|
|
@@ -287,22 +290,21 @@ function parse_fermi_json(content) {
|
|
|
287
290
|
}
|
|
288
291
|
// Check if it's BandGridData (raw grid data)
|
|
289
292
|
if (data.energies && data.k_grid && data.k_lattice) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
data.k_grid.length !== 3 ||
|
|
294
|
-
!Array.isArray(data.k_lattice) ||
|
|
295
|
-
data.k_lattice.length !== 3)
|
|
296
|
-
throw new Error(`Invalid BandGridData JSON: malformed required fields`);
|
|
293
|
+
if (!is_valid_band_grid_data(data)) {
|
|
294
|
+
throw new Error(`Invalid BandGridData JSON: expected non-empty 'energies' grid, 3 'k_grid' dims, and 3x3 'k_lattice'`);
|
|
295
|
+
}
|
|
297
296
|
return data;
|
|
298
297
|
}
|
|
299
298
|
// Try to extract from nested structure (e.g. IFermi output)
|
|
300
299
|
if (data.fermi_surface) {
|
|
300
|
+
if (!is_valid_fermi_surface_data(data.fermi_surface)) {
|
|
301
|
+
throw new Error(`Invalid nested 'fermi_surface' JSON: expected isosurfaces array, 3x3 k_lattice, numeric fermi_energy, reciprocal_cell, and metadata`);
|
|
302
|
+
}
|
|
301
303
|
return data.fermi_surface;
|
|
302
304
|
}
|
|
303
305
|
if (data.band_structure?.energies || data.bands?.energies) {
|
|
304
306
|
const bs = data.band_structure ?? data.bands;
|
|
305
|
-
|
|
307
|
+
const grid_data = {
|
|
306
308
|
energies: bs.energies,
|
|
307
309
|
k_grid: bs.k_grid ?? bs.kgrid,
|
|
308
310
|
k_lattice: bs.k_lattice ?? bs.reciprocal_lattice,
|
|
@@ -312,6 +314,10 @@ function parse_fermi_json(content) {
|
|
|
312
314
|
// oxlint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- numeric fallback chain (0 falls through)
|
|
313
315
|
n_spins: (bs.n_spins ?? bs.nspins) || bs.energies.length || 1,
|
|
314
316
|
};
|
|
317
|
+
if (!is_valid_band_grid_data(grid_data)) {
|
|
318
|
+
throw new Error(`Invalid band_structure JSON: expected non-empty 'energies' grid, 3 'k_grid' dims, and 3x3 'k_lattice'`);
|
|
319
|
+
}
|
|
320
|
+
return grid_data;
|
|
315
321
|
}
|
|
316
322
|
// Check for pymatgen BandStructure format (k-path, not k-grid)
|
|
317
323
|
// These files cannot be used for Fermi surface visualization directly
|
|
@@ -339,7 +345,7 @@ function parse_ifermi_surface(data) {
|
|
|
339
345
|
const band_indices = new Set();
|
|
340
346
|
let has_spin = false;
|
|
341
347
|
for (const [band_key, iso_list] of Object.entries(isosurfaces_obj)) {
|
|
342
|
-
const band_index =
|
|
348
|
+
const band_index = Math.trunc(Number(band_key));
|
|
343
349
|
// spin is determined by sign: positive = up, negative = down
|
|
344
350
|
const spin = band_index < 0 ? `down` : `up`;
|
|
345
351
|
const abs_band_idx = Math.abs(band_index);
|
|
@@ -365,13 +371,13 @@ function parse_ifermi_surface(data) {
|
|
|
365
371
|
let dimensionality;
|
|
366
372
|
if (ifermi_iso.dimensionality) {
|
|
367
373
|
const dim = ifermi_iso.dimensionality.toLowerCase();
|
|
368
|
-
if (dim.includes(`1d`)
|
|
374
|
+
if (dim.includes(`1d`))
|
|
369
375
|
dimensionality = `1D`;
|
|
370
|
-
else if (dim.includes(`quasi`)
|
|
376
|
+
else if (dim.includes(`quasi`))
|
|
371
377
|
dimensionality = `quasi-2D`;
|
|
372
|
-
else if (dim.includes(`2d`)
|
|
378
|
+
else if (dim.includes(`2d`))
|
|
373
379
|
dimensionality = `2D`;
|
|
374
|
-
else if (dim.includes(`3d`)
|
|
380
|
+
else if (dim.includes(`3d`))
|
|
375
381
|
dimensionality = `3D`;
|
|
376
382
|
}
|
|
377
383
|
// Compute area for this isosurface using fan triangulation for N-gons
|
|
@@ -387,14 +393,8 @@ function parse_ifermi_surface(data) {
|
|
|
387
393
|
for (let fan_idx = 1; fan_idx < face.length - 1; fan_idx++) {
|
|
388
394
|
const v1 = vertices[face[fan_idx]];
|
|
389
395
|
const v2 = vertices[face[fan_idx + 1]];
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
const cross = [
|
|
393
|
-
e1[1] * e2[2] - e1[2] * e2[1],
|
|
394
|
-
e1[2] * e2[0] - e1[0] * e2[2],
|
|
395
|
-
e1[0] * e2[1] - e1[1] * e2[0],
|
|
396
|
-
];
|
|
397
|
-
area += 0.5 * Math.hypot(cross[0], cross[1], cross[2]);
|
|
396
|
+
const cross = math.cross_3d(math.subtract(v1, v0), math.subtract(v2, v0));
|
|
397
|
+
area += 0.5 * Math.hypot(...cross);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
isosurfaces.push({
|
|
@@ -427,68 +427,55 @@ function parse_ifermi_surface(data) {
|
|
|
427
427
|
},
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
|
-
// Auto-detect file format and parse
|
|
430
|
+
// Auto-detect file format and parse; throws an Error aggregating per-format failure reasons when nothing parses
|
|
431
431
|
export function parse_fermi_file(content, filename) {
|
|
432
432
|
const lower_name = filename?.toLowerCase() ?? ``;
|
|
433
|
-
|
|
434
|
-
|
|
433
|
+
const errors = [];
|
|
434
|
+
const attempt = (format, parse) => {
|
|
435
435
|
try {
|
|
436
|
-
return
|
|
436
|
+
return parse();
|
|
437
437
|
}
|
|
438
438
|
catch (error) {
|
|
439
|
-
|
|
439
|
+
errors.push(`${format}: ${to_error(error).message}`);
|
|
440
|
+
console.error(`${format} parse error:`, error);
|
|
440
441
|
return null;
|
|
441
442
|
}
|
|
443
|
+
};
|
|
444
|
+
const fail = () => {
|
|
445
|
+
const detail = errors.length ? `: ${errors.join(`; `)}` : `: unrecognized format`;
|
|
446
|
+
throw new Error(`Failed to parse Fermi surface file${filename ? ` '${filename}'` : ``}${detail}`);
|
|
447
|
+
};
|
|
448
|
+
// Detect by filename extension (authoritative: parse failure throws immediately)
|
|
449
|
+
if (lower_name.endsWith(`.bxsf`) || lower_name.endsWith(`.bxsf.gz`)) {
|
|
450
|
+
return attempt(`BXSF`, () => parse_bxsf(content)) ?? fail();
|
|
442
451
|
}
|
|
443
452
|
if (lower_name.endsWith(`.frmsf`) || lower_name.endsWith(`.frmsf.gz`)) {
|
|
444
|
-
|
|
445
|
-
return parse_frmsf(content);
|
|
446
|
-
}
|
|
447
|
-
catch (error) {
|
|
448
|
-
console.error(`FRMSF parse error:`, error);
|
|
449
|
-
return null;
|
|
450
|
-
}
|
|
453
|
+
return attempt(`FRMSF`, () => parse_frmsf(content)) ?? fail();
|
|
451
454
|
}
|
|
452
455
|
if (lower_name.endsWith(`.json`) || lower_name.endsWith(`.json.gz`)) {
|
|
453
|
-
|
|
454
|
-
return parse_fermi_json(content);
|
|
455
|
-
}
|
|
456
|
-
catch (error) {
|
|
457
|
-
console.error(`JSON parse error:`, error);
|
|
458
|
-
return null;
|
|
459
|
-
}
|
|
456
|
+
return attempt(`JSON`, () => parse_fermi_json(content)) ?? fail();
|
|
460
457
|
}
|
|
461
458
|
// Try auto-detection based on content
|
|
462
459
|
const trimmed = content.trim();
|
|
463
460
|
// BXSF format detection
|
|
464
461
|
if (trimmed.includes(`BEGIN_BLOCK_BANDGRID_3D`) || trimmed.includes(`BEGIN_BANDGRID_3D`)) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
catch (error) {
|
|
469
|
-
console.error(`BXSF auto-detect parse error:`, error);
|
|
470
|
-
}
|
|
462
|
+
const result = attempt(`BXSF`, () => parse_bxsf(content));
|
|
463
|
+
if (result)
|
|
464
|
+
return result;
|
|
471
465
|
}
|
|
472
466
|
// JSON format detection
|
|
473
467
|
if (trimmed.startsWith(`{`) || trimmed.startsWith(`[`)) {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
catch (error) {
|
|
478
|
-
console.error(`JSON auto-detect parse error:`, error);
|
|
479
|
-
}
|
|
468
|
+
const result = attempt(`JSON`, () => parse_fermi_json(content));
|
|
469
|
+
if (result)
|
|
470
|
+
return result;
|
|
480
471
|
}
|
|
481
472
|
// FRMSF format detection (starts with grid dimensions)
|
|
482
473
|
const first_line = trimmed.split(/\r?\n/)[0];
|
|
483
474
|
const first_tokens = first_line.split(/\s+/).filter(Boolean);
|
|
484
475
|
if (first_tokens.length === 3 && first_tokens.every((token) => /^\d+$/.test(token))) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
catch (error) {
|
|
489
|
-
console.error(`FRMSF auto-detect parse error:`, error);
|
|
490
|
-
}
|
|
476
|
+
const result = attempt(`FRMSF`, () => parse_frmsf(content));
|
|
477
|
+
if (result)
|
|
478
|
+
return result;
|
|
491
479
|
}
|
|
492
|
-
|
|
493
|
-
return null;
|
|
480
|
+
return fail();
|
|
494
481
|
}
|
|
@@ -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`;
|
|
@@ -62,7 +62,7 @@ export interface FermiSliceData {
|
|
|
62
62
|
}
|
|
63
63
|
export interface Isoline {
|
|
64
64
|
points: Vec3[];
|
|
65
|
-
points_2d: [
|
|
65
|
+
points_2d: Vec2[];
|
|
66
66
|
properties?: number[];
|
|
67
67
|
band_index: number;
|
|
68
68
|
spin: SpinChannel;
|