matterviz 0.4.1 → 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 +75 -85
- 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 +26 -39
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +62 -74
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +511 -547
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -1
- package/dist/chempot-diagram/controls-state.svelte.js +1 -1
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +19 -20
- 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 +92 -95
- package/dist/composition/PieChart.svelte +55 -41
- package/dist/composition/format.js +1 -1
- 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 +11 -10
- package/dist/constants.js +11 -9
- 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 -92
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +109 -140
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +75 -94
- 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 +17 -21
- 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/helpers.d.ts +8 -10
- package/dist/convex-hull/helpers.js +36 -36
- package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +18 -17
- package/dist/coordination/CoordinationBarPlot.svelte +38 -33
- 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 -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/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 -4
- package/dist/element/index.js +3 -18
- 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 +14 -22
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -7
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +37 -64
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +3 -3
- package/dist/fermi-surface/parse.js +22 -24
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +109 -148
- 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/io/ExportPane.svelte +10 -6
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -35
- package/dist/io/export.d.ts +4 -0
- package/dist/io/export.js +5 -1
- package/dist/io/fetch.d.ts +0 -3
- package/dist/io/fetch.js +0 -11
- 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.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 +6 -6
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +43 -13
- package/dist/layout/FullscreenButton.svelte +2 -1
- package/dist/layout/FullscreenToggle.svelte +10 -4
- 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 +9 -10
- 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 +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 +2 -0
- package/dist/math.js +19 -0
- 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 +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 +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 +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 +3 -3
- 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 +21 -15
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +430 -391
- 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 +29 -36
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +301 -209
- 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.js +1 -1
- 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.js +9 -5
- 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 +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/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/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 +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.js +2 -2
- package/dist/plot/histogram/Histogram.svelte +304 -325
- 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/scatter/BinnedScatterPlot.svelte +263 -109
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +477 -385
- 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/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 +251 -329
- 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 +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 +1 -1
- package/dist/scene/bind-renderer.svelte.js +14 -6
- package/dist/settings.d.ts +19 -9
- package/dist/settings.js +77 -50
- package/dist/spectral/Bands.svelte +223 -230
- package/dist/spectral/BandsAndDos.svelte +11 -9
- package/dist/spectral/BrillouinBandsDos.svelte +19 -27
- package/dist/spectral/Dos.svelte +70 -73
- package/dist/spectral/helpers.d.ts +3 -3
- package/dist/spectral/helpers.js +25 -35
- 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 +115 -75
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +15 -3
- package/dist/structure/CellSelect.svelte +11 -26
- 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 +473 -419
- package/dist/structure/Structure.svelte.d.ts +4 -2
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +157 -399
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +17 -21
- package/dist/structure/StructureInfoPane.svelte +72 -66
- package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
- package/dist/structure/StructureScene.svelte +467 -476
- package/dist/structure/StructureScene.svelte.d.ts +3 -1
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -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 +104 -38
- package/dist/structure/bonding.d.ts +10 -3
- package/dist/structure/bonding.js +84 -28
- 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 +39 -31
- 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 +16 -1
- package/dist/structure/index.js +13 -2
- 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 +243 -222
- package/dist/structure/partial-occupancy.js +4 -2
- package/dist/structure/pbc.js +78 -98
- package/dist/structure/polyhedra.d.ts +0 -1
- package/dist/structure/polyhedra.js +3 -18
- 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 +56 -68
- package/dist/symmetry/WyckoffTable.svelte +5 -24
- package/dist/symmetry/cell-transform.js +1 -0
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +8 -2
- package/dist/symmetry/spacegroups.js +3 -2
- package/dist/table/HeatmapTable.svelte +1102 -365
- 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 +515 -308
- package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +14 -31
- package/dist/trajectory/TrajectoryInfoPane.svelte +85 -97
- package/dist/trajectory/extract.js +56 -34
- package/dist/trajectory/format-detect.js +11 -9
- package/dist/trajectory/frame-reader.d.ts +2 -0
- package/dist/trajectory/frame-reader.js +33 -29
- package/dist/trajectory/helpers.d.ts +2 -0
- package/dist/trajectory/helpers.js +18 -7
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -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 +2 -3
- package/dist/trajectory/parse/index.js +17 -20
- 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 +5 -0
- package/dist/trajectory/parse/vaspout-h5.js +284 -0
- package/dist/trajectory/parse/xyz.js +11 -7
- package/dist/trajectory/plotting.d.ts +8 -9
- package/dist/trajectory/plotting.js +99 -27
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -0
- package/dist/xrd/XrdPlot.svelte +47 -61
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +2 -4
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +61 -33
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
|
@@ -136,9 +136,7 @@
|
|
|
136
136
|
spinner_props?: ComponentProps<typeof Spinner>
|
|
137
137
|
loading?: boolean
|
|
138
138
|
error_msg?: string
|
|
139
|
-
children?: Snippet<
|
|
140
|
-
[{ fermi_data?: FermiSurfaceData; bz_data?: BrillouinZoneData }]
|
|
141
|
-
>
|
|
139
|
+
children?: Snippet<[{ fermi_data?: FermiSurfaceData; bz_data?: BrillouinZoneData }]>
|
|
142
140
|
on_file_drop?: (filename: string) => void
|
|
143
141
|
on_file_load?: (data: FermiFileLoadData) => void
|
|
144
142
|
on_error?: (data: FermiErrorData) => void
|
|
@@ -173,17 +171,12 @@
|
|
|
173
171
|
// Yield to browser so spinner can render before heavy computation
|
|
174
172
|
const tick = () =>
|
|
175
173
|
new Promise<void>((resolve) =>
|
|
176
|
-
requestAnimationFrame(() => requestAnimationFrame(() => resolve()))
|
|
174
|
+
requestAnimationFrame(() => requestAnimationFrame(() => resolve())),
|
|
177
175
|
)
|
|
178
176
|
|
|
179
177
|
// Parse and load Fermi surface from content (async for UI responsiveness)
|
|
180
|
-
async function parse_fermi_content(
|
|
181
|
-
content
|
|
182
|
-
filename: string,
|
|
183
|
-
) {
|
|
184
|
-
const text = content instanceof ArrayBuffer
|
|
185
|
-
? new TextDecoder().decode(content)
|
|
186
|
-
: content
|
|
178
|
+
async function parse_fermi_content(content: string | ArrayBuffer, filename: string) {
|
|
179
|
+
const text = content instanceof ArrayBuffer ? new TextDecoder().decode(content) : content
|
|
187
180
|
|
|
188
181
|
// parse_fermi_file throws a descriptive error when parsing fails
|
|
189
182
|
const parsed = parse_fermi_file(text, filename)
|
|
@@ -208,9 +201,7 @@
|
|
|
208
201
|
try {
|
|
209
202
|
await parse_fermi_content(content, filename)
|
|
210
203
|
} catch (err) {
|
|
211
|
-
error_msg = `Failed to parse ${filename}: ${
|
|
212
|
-
to_error(err).message
|
|
213
|
-
}`
|
|
204
|
+
error_msg = `Failed to parse ${filename}: ${to_error(err).message}`
|
|
214
205
|
on_error?.({ error_msg, filename })
|
|
215
206
|
}
|
|
216
207
|
}
|
|
@@ -277,11 +268,10 @@
|
|
|
277
268
|
// Compute BZ when structure or fermi_data changes
|
|
278
269
|
$effect(() => {
|
|
279
270
|
// Get k_lattice from available sources (priority order)
|
|
280
|
-
const k_lattice =
|
|
271
|
+
const k_lattice =
|
|
272
|
+
fermi_data?.k_lattice ??
|
|
281
273
|
band_data?.k_lattice ??
|
|
282
|
-
(structure?.lattice?.matrix
|
|
283
|
-
? reciprocal_lattice(structure.lattice.matrix)
|
|
284
|
-
: null)
|
|
274
|
+
(structure?.lattice?.matrix ? reciprocal_lattice(structure.lattice.matrix) : null)
|
|
285
275
|
|
|
286
276
|
if (!k_lattice) {
|
|
287
277
|
bz_data = undefined
|
|
@@ -361,8 +351,7 @@
|
|
|
361
351
|
set_fullscreen: (val) => (fullscreen = val),
|
|
362
352
|
bg_css_var: `--fermi-bg-fullscreen`,
|
|
363
353
|
on_request_error: () => (fullscreen = false),
|
|
364
|
-
on_change: (val) =>
|
|
365
|
-
on_fullscreen_change?.({ fermi_data, bz_data, fullscreen: val }),
|
|
354
|
+
on_change: (val) => on_fullscreen_change?.({ fermi_data, bz_data, fullscreen: val }),
|
|
366
355
|
})
|
|
367
356
|
</script>
|
|
368
357
|
|
|
@@ -379,9 +368,12 @@
|
|
|
379
368
|
onmouseenter={() => (hovered = true)}
|
|
380
369
|
onmouseleave={() => (hovered = false)}
|
|
381
370
|
ondrop={handle_file_drop}
|
|
382
|
-
{...drag_over_handlers({
|
|
371
|
+
{...drag_over_handlers({
|
|
372
|
+
allow: () => allow_file_drop,
|
|
373
|
+
set_dragover: (over) => (dragover = over),
|
|
374
|
+
})}
|
|
383
375
|
{...rest}
|
|
384
|
-
class=
|
|
376
|
+
class={[`fermi-surface`, rest.class]}
|
|
385
377
|
>
|
|
386
378
|
{@render children?.({ fermi_data, bz_data })}
|
|
387
379
|
{#if loading}
|
|
@@ -52,12 +52,10 @@ type $$ComponentProps = {
|
|
|
52
52
|
spinner_props?: ComponentProps<typeof Spinner>;
|
|
53
53
|
loading?: boolean;
|
|
54
54
|
error_msg?: string;
|
|
55
|
-
children?: Snippet<[
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
]>;
|
|
55
|
+
children?: Snippet<[{
|
|
56
|
+
fermi_data?: FermiSurfaceData;
|
|
57
|
+
bz_data?: BrillouinZoneData;
|
|
58
|
+
}]>;
|
|
61
59
|
on_file_drop?: (filename: string) => void;
|
|
62
60
|
on_file_load?: (data: FermiFileLoadData) => void;
|
|
63
61
|
on_error?: (data: FermiErrorData) => void;
|
|
@@ -69,6 +67,6 @@ type $$ComponentProps = {
|
|
|
69
67
|
on_point_hover?: (data: FermiHoverData | null) => void;
|
|
70
68
|
on_hover?: (data: FermiHoverData | null) => void;
|
|
71
69
|
} & HTMLAttributes<HTMLDivElement>;
|
|
72
|
-
declare const FermiSurface: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "dragover" | "fullscreen" | "wrapper" | "hovered" | "controls_open" | "
|
|
70
|
+
declare const FermiSurface: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "dragover" | "fullscreen" | "wrapper" | "hovered" | "controls_open" | "camera_projection" | "color_scale" | "loading" | "error_msg" | "surface_opacity" | "show_vectors" | "bz_data" | "mu" | "selected_bands" | "interpolation_factor" | "fermi_data" | "band_data" | "color_property" | "representation" | "show_bz" | "bz_opacity" | "tile_bz" | "clip_enabled" | "clip_axis" | "clip_position" | "clip_flip">;
|
|
73
71
|
type FermiSurface = ReturnType<typeof FermiSurface>;
|
|
74
72
|
export default FermiSurface;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import SettingsSection from '../layout/SettingsSection.svelte'
|
|
3
3
|
import DraggablePane from '../overlays/DraggablePane.svelte'
|
|
4
4
|
import type { CameraProjection } from '../settings'
|
|
5
|
-
import { make_change_detector } from '../utils'
|
|
5
|
+
import { make_change_detector, parse_num_token } from '../utils'
|
|
6
6
|
import type { Snippet } from 'svelte'
|
|
7
7
|
import type {
|
|
8
8
|
BandGridData,
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
let available_bands = $derived(
|
|
91
91
|
fermi_data
|
|
92
92
|
? [...new Set(fermi_data.isosurfaces.map((iso) => iso.band_index))].toSorted(
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
(a, b) => a - b,
|
|
94
|
+
)
|
|
95
95
|
: [],
|
|
96
96
|
)
|
|
97
97
|
let available_bands_key = $derived(available_bands.join(`,`))
|
|
@@ -119,8 +119,7 @@
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function handle_mu_change(event: Event & { currentTarget: HTMLInputElement }) {
|
|
122
|
-
const
|
|
123
|
-
const parsed = parseFloat(trimmed)
|
|
122
|
+
const parsed = parse_num_token(event.currentTarget.value)
|
|
124
123
|
// Only update mu when input is valid; keep last valid value during transient
|
|
125
124
|
// invalid states (e.g. empty string while user is typing a new value)
|
|
126
125
|
if (Number.isFinite(parsed)) {
|
|
@@ -147,14 +146,7 @@
|
|
|
147
146
|
>
|
|
148
147
|
<label>
|
|
149
148
|
<span>μ offset (eV):</span>
|
|
150
|
-
<input
|
|
151
|
-
type="range"
|
|
152
|
-
min="-1"
|
|
153
|
-
max="1"
|
|
154
|
-
step="0.01"
|
|
155
|
-
value={mu}
|
|
156
|
-
oninput={handle_mu_change}
|
|
157
|
-
/>
|
|
149
|
+
<input type="range" min="-1" max="1" step="0.01" value={mu} oninput={handle_mu_change} />
|
|
158
150
|
<input
|
|
159
151
|
type="number"
|
|
160
152
|
step="0.01"
|
|
@@ -300,13 +292,7 @@
|
|
|
300
292
|
</label>
|
|
301
293
|
<label>
|
|
302
294
|
<span>Position:</span>
|
|
303
|
-
<input
|
|
304
|
-
type="range"
|
|
305
|
-
min="-1"
|
|
306
|
-
max="1"
|
|
307
|
-
step="0.01"
|
|
308
|
-
bind:value={clip_position}
|
|
309
|
-
/>
|
|
295
|
+
<input type="range" min="-1" max="1" step="0.01" bind:value={clip_position} />
|
|
310
296
|
<span class="value">{clip_position.toFixed(2)}</span>
|
|
311
297
|
</label>
|
|
312
298
|
<label>
|
|
@@ -30,6 +30,6 @@ type $$ComponentProps = {
|
|
|
30
30
|
band_data?: BandGridData;
|
|
31
31
|
}]>;
|
|
32
32
|
};
|
|
33
|
-
declare const FermiSurfaceControls: import("svelte").Component<$$ComponentProps, {}, "controls_open" | "
|
|
33
|
+
declare const FermiSurfaceControls: import("svelte").Component<$$ComponentProps, {}, "controls_open" | "camera_projection" | "color_scale" | "surface_opacity" | "show_vectors" | "mu" | "selected_bands" | "interpolation_factor" | "color_property" | "representation" | "show_bz" | "bz_opacity" | "tile_bz" | "clip_enabled" | "clip_axis" | "clip_position" | "clip_flip">;
|
|
34
34
|
type FermiSurfaceControls = ReturnType<typeof FermiSurfaceControls>;
|
|
35
35
|
export default FermiSurfaceControls;
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
bz_color = `#888888`,
|
|
58
58
|
bz_opacity = 0.1,
|
|
59
59
|
bz_edge_color = `#333333`,
|
|
60
|
-
bz_edge_width = 0.
|
|
60
|
+
bz_edge_width = 0.002,
|
|
61
61
|
show_vectors = true,
|
|
62
62
|
tile_bz = false,
|
|
63
63
|
// Clipping plane
|
|
@@ -153,8 +153,8 @@
|
|
|
153
153
|
|
|
154
154
|
// Filter surfaces based on selected bands
|
|
155
155
|
let visible_surfaces = $derived(
|
|
156
|
-
fermi_data?.isosurfaces.filter(
|
|
157
|
-
selected_bands === undefined || selected_bands.includes(surface.band_index)
|
|
156
|
+
fermi_data?.isosurfaces.filter(
|
|
157
|
+
(surface) => selected_bands === undefined || selected_bands.includes(surface.band_index),
|
|
158
158
|
) ?? [],
|
|
159
159
|
)
|
|
160
160
|
|
|
@@ -208,9 +208,6 @@
|
|
|
208
208
|
|
|
209
209
|
// Get color for a surface/vertex
|
|
210
210
|
function get_surface_color(surface: Isosurface, vertex_idx?: number): string {
|
|
211
|
-
if (color_property === `band`) {
|
|
212
|
-
return constants.BAND_COLORS[surface.band_index % constants.BAND_COLORS.length]
|
|
213
|
-
}
|
|
214
211
|
if (
|
|
215
212
|
(color_property === `velocity` || color_property === `custom`) &&
|
|
216
213
|
surface.properties &&
|
|
@@ -218,9 +215,7 @@
|
|
|
218
215
|
) {
|
|
219
216
|
const prop = surface.properties[vertex_idx]
|
|
220
217
|
const [min_val, max_val] = property_range
|
|
221
|
-
const normalized = max_val > min_val
|
|
222
|
-
? (prop - min_val) / (max_val - min_val)
|
|
223
|
-
: 0.5
|
|
218
|
+
const normalized = max_val > min_val ? (prop - min_val) / (max_val - min_val) : 0.5
|
|
224
219
|
return get_d3_interpolator(color_scale as D3InterpolateName)(normalized)
|
|
225
220
|
}
|
|
226
221
|
// Spin coloring
|
|
@@ -240,8 +235,7 @@
|
|
|
240
235
|
const normals: number[] = []
|
|
241
236
|
const colors: number[] = []
|
|
242
237
|
|
|
243
|
-
const use_vertex_colors = color_property === `velocity` ||
|
|
244
|
-
color_property === `custom`
|
|
238
|
+
const use_vertex_colors = color_property === `velocity` || color_property === `custom`
|
|
245
239
|
|
|
246
240
|
const n_vertices = surface.vertices.length
|
|
247
241
|
|
|
@@ -257,9 +251,12 @@
|
|
|
257
251
|
|
|
258
252
|
// Validate face indices are within bounds (protects against malformed JSON files)
|
|
259
253
|
if (
|
|
260
|
-
idx0 < 0 ||
|
|
261
|
-
|
|
262
|
-
|
|
254
|
+
idx0 < 0 ||
|
|
255
|
+
idx0 >= n_vertices ||
|
|
256
|
+
idx1 < 0 ||
|
|
257
|
+
idx1 >= n_vertices ||
|
|
258
|
+
idx2 < 0 ||
|
|
259
|
+
idx2 >= n_vertices
|
|
263
260
|
) {
|
|
264
261
|
continue
|
|
265
262
|
}
|
|
@@ -297,10 +294,7 @@
|
|
|
297
294
|
}
|
|
298
295
|
|
|
299
296
|
const geometry = new BufferGeometry()
|
|
300
|
-
geometry.setAttribute(
|
|
301
|
-
`position`,
|
|
302
|
-
new BufferAttribute(new Float32Array(positions), 3),
|
|
303
|
-
)
|
|
297
|
+
geometry.setAttribute(`position`, new BufferAttribute(new Float32Array(positions), 3))
|
|
304
298
|
geometry.setAttribute(`normal`, new BufferAttribute(new Float32Array(normals), 3))
|
|
305
299
|
|
|
306
300
|
if (use_vertex_colors) {
|
|
@@ -358,18 +352,20 @@
|
|
|
358
352
|
camera_position || default_camera_position(scene_size),
|
|
359
353
|
)
|
|
360
354
|
|
|
361
|
-
const orbit_controls_props = $derived(
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
355
|
+
const orbit_controls_props = $derived(
|
|
356
|
+
build_orbit_props({
|
|
357
|
+
camera_projection,
|
|
358
|
+
target: rotation_target,
|
|
359
|
+
rotate_speed,
|
|
360
|
+
zoom_speed,
|
|
361
|
+
zoom_to_cursor,
|
|
362
|
+
pan_speed,
|
|
363
|
+
max_zoom,
|
|
364
|
+
min_zoom,
|
|
365
|
+
auto_rotate,
|
|
366
|
+
rotation_damping,
|
|
367
|
+
}),
|
|
368
|
+
)
|
|
373
369
|
|
|
374
370
|
// Create BZ geometry
|
|
375
371
|
const bz_geometry = $derived(
|
|
@@ -423,11 +419,7 @@
|
|
|
423
419
|
let [min_dist, nearest_idx] = [Infinity, 0]
|
|
424
420
|
for (let idx = 0; idx < surface.vertices.length; idx++) {
|
|
425
421
|
const vertex = surface.vertices[idx]
|
|
426
|
-
const dist = Math.hypot(
|
|
427
|
-
point[0] - vertex[0],
|
|
428
|
-
point[1] - vertex[1],
|
|
429
|
-
point[2] - vertex[2],
|
|
430
|
-
)
|
|
422
|
+
const dist = Math.hypot(point[0] - vertex[0], point[1] - vertex[1], point[2] - vertex[2])
|
|
431
423
|
if (dist < min_dist) {
|
|
432
424
|
min_dist = dist
|
|
433
425
|
nearest_idx = idx
|
|
@@ -459,9 +451,8 @@
|
|
|
459
451
|
const nearest_idx = find_nearest_vertex(surface, local_position)
|
|
460
452
|
const property_value = surface.properties?.[nearest_idx]
|
|
461
453
|
const has_velocities = fermi_data?.metadata?.has_velocities
|
|
462
|
-
const property_name =
|
|
463
|
-
? (has_velocities ? `velocity` : `custom`)
|
|
464
|
-
: undefined
|
|
454
|
+
const property_name =
|
|
455
|
+
property_value != null ? (has_velocities ? `velocity` : `custom`) : undefined
|
|
465
456
|
|
|
466
457
|
const { clientX, clientY } = event.nativeEvent
|
|
467
458
|
return {
|
|
@@ -533,19 +524,11 @@
|
|
|
533
524
|
|
|
534
525
|
<!-- Reciprocal lattice vectors -->
|
|
535
526
|
{#if show_vectors && fermi_data?.k_lattice}
|
|
536
|
-
<ReciprocalVectors
|
|
537
|
-
k_lattice={fermi_data.k_lattice}
|
|
538
|
-
{vector_scale}
|
|
539
|
-
size={scene_size}
|
|
540
|
-
/>
|
|
527
|
+
<ReciprocalVectors k_lattice={fermi_data.k_lattice} {vector_scale} size={scene_size} />
|
|
541
528
|
{/if}
|
|
542
529
|
|
|
543
530
|
<!-- Fermi surfaces (with optional symmetry tiling) -->
|
|
544
|
-
{#each visible_surfaces as
|
|
545
|
-
surface,
|
|
546
|
-
surface_idx
|
|
547
|
-
(`surface-${surface.band_index}-${surface.spin}-${surface_idx}`)
|
|
548
|
-
}
|
|
531
|
+
{#each visible_surfaces as surface, surface_idx (`surface-${surface.band_index}-${surface.spin}-${surface_idx}`)}
|
|
549
532
|
{@const geo_key = `${surface.band_index}-${surface.spin}-${surface_idx}`}
|
|
550
533
|
{@const geo_data = geometry_cache.get(geo_key)}
|
|
551
534
|
{@const surface_color = get_surface_color(surface)}
|
|
@@ -562,7 +545,7 @@
|
|
|
562
545
|
matrixAutoUpdate={false}
|
|
563
546
|
{renderOrder}
|
|
564
547
|
onpointermove={(event: ThreltePointerEvent) =>
|
|
565
|
-
|
|
548
|
+
handle_pointer_move(event, surface, surface_color, sym_idx, sym_matrix)}
|
|
566
549
|
onpointerleave={clear_hover}
|
|
567
550
|
>
|
|
568
551
|
<T.MeshBasicMaterial
|
|
@@ -583,7 +566,7 @@
|
|
|
583
566
|
matrixAutoUpdate={false}
|
|
584
567
|
renderOrder={renderOrder * 2}
|
|
585
568
|
onpointermove={(event: ThreltePointerEvent) =>
|
|
586
|
-
|
|
569
|
+
handle_pointer_move(event, surface, surface_color, sym_idx, sym_matrix)}
|
|
587
570
|
onpointerleave={clear_hover}
|
|
588
571
|
>
|
|
589
572
|
<T.MeshStandardMaterial
|
|
@@ -600,16 +583,11 @@
|
|
|
600
583
|
matrixAutoUpdate={false}
|
|
601
584
|
renderOrder={renderOrder * 2 + 1}
|
|
602
585
|
onpointermove={(event: ThreltePointerEvent) =>
|
|
603
|
-
|
|
586
|
+
handle_pointer_move(event, surface, surface_color, sym_idx, sym_matrix)}
|
|
604
587
|
onpointerleave={clear_hover}
|
|
605
588
|
>
|
|
606
589
|
<T.MeshStandardMaterial
|
|
607
|
-
{...get_material_props(
|
|
608
|
-
surface_color,
|
|
609
|
-
use_vertex_colors,
|
|
610
|
-
surface_idx,
|
|
611
|
-
`front`,
|
|
612
|
-
)}
|
|
590
|
+
{...get_material_props(surface_color, use_vertex_colors, surface_idx, `front`)}
|
|
613
591
|
metalness={0.1}
|
|
614
592
|
roughness={0.6}
|
|
615
593
|
flatShading={false}
|
|
@@ -623,16 +601,11 @@
|
|
|
623
601
|
matrixAutoUpdate={false}
|
|
624
602
|
{renderOrder}
|
|
625
603
|
onpointermove={(event: ThreltePointerEvent) =>
|
|
626
|
-
|
|
604
|
+
handle_pointer_move(event, surface, surface_color, sym_idx, sym_matrix)}
|
|
627
605
|
onpointerleave={clear_hover}
|
|
628
606
|
>
|
|
629
607
|
<T.MeshStandardMaterial
|
|
630
|
-
{...get_material_props(
|
|
631
|
-
surface_color,
|
|
632
|
-
use_vertex_colors,
|
|
633
|
-
surface_idx,
|
|
634
|
-
`front`,
|
|
635
|
-
)}
|
|
608
|
+
{...get_material_props(surface_color, use_vertex_colors, surface_idx, `front`)}
|
|
636
609
|
metalness={0.1}
|
|
637
610
|
roughness={0.6}
|
|
638
611
|
flatShading={false}
|
|
@@ -25,6 +25,6 @@ type $$ComponentProps = SceneControlProps & {
|
|
|
25
25
|
vector_scale?: number;
|
|
26
26
|
hover_data?: FermiHoverData | null;
|
|
27
27
|
};
|
|
28
|
-
declare const FermiSurfaceScene: import("svelte").Component<$$ComponentProps, {}, "
|
|
28
|
+
declare const FermiSurfaceScene: import("svelte").Component<$$ComponentProps, {}, "camera" | "camera_projection" | "camera_position" | "scene" | "surface_opacity" | "bz_data" | "hover_data" | "fermi_data">;
|
|
29
29
|
type FermiSurfaceScene = ReturnType<typeof FermiSurfaceScene>;
|
|
30
30
|
export default FermiSurfaceScene;
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
import { KCoords, TooltipContent } from '../tooltip'
|
|
6
6
|
import type { FermiHoverData, FermiTooltipProp } from './types'
|
|
7
7
|
|
|
8
|
-
let {
|
|
8
|
+
let {
|
|
9
|
+
hover_data,
|
|
10
|
+
tooltip,
|
|
11
|
+
}: {
|
|
9
12
|
hover_data: FermiHoverData
|
|
10
13
|
tooltip?: FermiTooltipProp
|
|
11
14
|
} = $props()
|
|
@@ -27,15 +30,15 @@
|
|
|
27
30
|
|
|
28
31
|
{#if hover_data.property_value != null}
|
|
29
32
|
<div class="property-row">
|
|
30
|
-
{hover_data.property_name || `Property`}: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
{hover_data.property_name || `Property`}: {format_num(
|
|
34
|
+
hover_data.property_value,
|
|
35
|
+
`.4~`,
|
|
36
|
+
)}
|
|
33
37
|
<span class="nearest-note">(nearest)</span>
|
|
34
38
|
</div>
|
|
35
39
|
{/if}
|
|
36
40
|
|
|
37
|
-
{#if hover_data.is_tiled && hover_data.symmetry_index != null &&
|
|
38
|
-
hover_data.symmetry_index > 0}
|
|
41
|
+
{#if hover_data.is_tiled && hover_data.symmetry_index != null && hover_data.symmetry_index > 0}
|
|
39
42
|
<div class="tiling-info">
|
|
40
43
|
Symmetry copy #{hover_data.symmetry_index + 1}/48
|
|
41
44
|
</div>
|
|
@@ -3,6 +3,8 @@ 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
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
|
|
@@ -204,7 +206,7 @@ export function compute_surface_area(surface) {
|
|
|
204
206
|
const cy = e1z * e2x - e1x * e2z;
|
|
205
207
|
const cz = e1x * e2y - e1y * e2x;
|
|
206
208
|
// Area is half the magnitude of cross product
|
|
207
|
-
total_area += Math.
|
|
209
|
+
total_area += Math.hypot(cx, cy, cz) * 0.5;
|
|
208
210
|
}
|
|
209
211
|
return total_area;
|
|
210
212
|
}
|
|
@@ -218,8 +220,6 @@ function compute_fermi_velocities(surface, velocity_grid, k_lattice, k_grid, per
|
|
|
218
220
|
const k_inv = math.matrix_inverse_3x3(math.transpose_3x3_matrix(k_lattice));
|
|
219
221
|
// Grid point i sits at frac i/(n−1) (endpoint-inclusive BXSF) or i/n (periodic)
|
|
220
222
|
const [sx, sy, sz] = periodic ? [nx, ny, nz] : [nx - 1, ny - 1, nz - 1];
|
|
221
|
-
// Clamp guards float jitter at the cell boundary
|
|
222
|
-
const clamp01 = (val) => Math.min(Math.max(val, 0), 1);
|
|
223
223
|
for (const vertex of surface.vertices) {
|
|
224
224
|
const frac = math.mat3x3_vec3_multiply(k_inv, vertex); // centered, in [-0.5, 0.5]
|
|
225
225
|
const gx = clamp01(frac[0] + 0.5) * sx;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as math from '../math';
|
|
2
|
-
import { is_plain_object } from '../utils';
|
|
2
|
+
import { is_plain_object, normalize_scientific_notation, parse_leading_num, to_error, } from '../utils';
|
|
3
3
|
import * as constants from './constants';
|
|
4
4
|
import { compute_vertex_normals } from '../marching-cubes';
|
|
5
5
|
const parse_number_tokens = (line) => line.split(/\s+/).filter(Boolean);
|
|
6
|
-
// Parse whitespace-separated floats from a line
|
|
7
|
-
|
|
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);
|
|
8
9
|
// Parse whitespace-separated integers from a line
|
|
9
|
-
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)));
|
|
10
11
|
// Parse BXSF (Band-XSF) format used by XCrySDen, Quantum ESPRESSO, etc.
|
|
11
12
|
// Format specification: http://www.xcrysden.org/doc/XSF.html
|
|
12
13
|
function parse_bxsf(content) {
|
|
@@ -40,7 +41,7 @@ function parse_bxsf(content) {
|
|
|
40
41
|
throw new Error(`Expected BANDGRID_3D header, got: ${bandgrid_line}`);
|
|
41
42
|
}
|
|
42
43
|
// Parse number of bands
|
|
43
|
-
const n_bands =
|
|
44
|
+
const n_bands = Math.trunc(Number(next_line()));
|
|
44
45
|
if (isNaN(n_bands) || n_bands <= 0) {
|
|
45
46
|
throw new Error(`Invalid number of bands in BXSF file`);
|
|
46
47
|
}
|
|
@@ -114,9 +115,9 @@ function parse_bxsf(content) {
|
|
|
114
115
|
const lower = line.toLowerCase();
|
|
115
116
|
if (lower.includes(`fermi`) && lower.includes(`energy`)) {
|
|
116
117
|
// Match patterns like "Fermi Energy = 5.123" or "fermi_energy: -0.5"
|
|
117
|
-
const match = /(?:=|:)\s*([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/i.exec(line);
|
|
118
|
+
const match = /(?:=|:)\s*(?<value>[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/i.exec(line);
|
|
118
119
|
if (match) {
|
|
119
|
-
fermi_energy =
|
|
120
|
+
fermi_energy = Number(match[1]);
|
|
120
121
|
break;
|
|
121
122
|
}
|
|
122
123
|
}
|
|
@@ -149,12 +150,12 @@ function parse_frmsf(content) {
|
|
|
149
150
|
// 0 = Monkhorst-Pack grid (shifted)
|
|
150
151
|
// 1 = Gamma-centered grid
|
|
151
152
|
// 2 = Gamma + half grid shift
|
|
152
|
-
const lshift =
|
|
153
|
+
const lshift = Math.trunc(Number(lines[line_idx++]));
|
|
153
154
|
if (isNaN(lshift) || lshift < 0 || lshift > 2) {
|
|
154
155
|
throw new Error(`FRMSF: Invalid lshift value (expected 0, 1, or 2)`);
|
|
155
156
|
}
|
|
156
157
|
// Line 3: number of bands
|
|
157
|
-
const n_bands =
|
|
158
|
+
const n_bands = Math.trunc(Number(lines[line_idx++]));
|
|
158
159
|
if (isNaN(n_bands) || n_bands <= 0) {
|
|
159
160
|
throw new Error(`FRMSF: Invalid number of bands`);
|
|
160
161
|
}
|
|
@@ -183,17 +184,14 @@ function parse_frmsf(content) {
|
|
|
183
184
|
energies[spin_idx] = [];
|
|
184
185
|
for (let band_idx = 0; band_idx < n_bands; band_idx++) {
|
|
185
186
|
const energy_values = [];
|
|
186
|
-
// 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)
|
|
187
189
|
while (energy_values.length < total_points && line_idx < lines.length) {
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
if (first_token && !isNaN(parseFloat(first_token))) {
|
|
191
|
-
energy_values.push(parseFloat(first_token));
|
|
192
|
-
line_idx++;
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
190
|
+
const energy = parse_leading_num(normalize_scientific_notation(lines[line_idx] ?? ``));
|
|
191
|
+
if (isNaN(energy))
|
|
195
192
|
break;
|
|
196
|
-
|
|
193
|
+
energy_values.push(energy);
|
|
194
|
+
line_idx++;
|
|
197
195
|
}
|
|
198
196
|
if (energy_values.length < total_points) {
|
|
199
197
|
throw new Error(`FRMSF spin ${spin_idx} band ${band_idx}: expected ${total_points} values, got ${energy_values.length}`);
|
|
@@ -347,7 +345,7 @@ function parse_ifermi_surface(data) {
|
|
|
347
345
|
const band_indices = new Set();
|
|
348
346
|
let has_spin = false;
|
|
349
347
|
for (const [band_key, iso_list] of Object.entries(isosurfaces_obj)) {
|
|
350
|
-
const band_index =
|
|
348
|
+
const band_index = Math.trunc(Number(band_key));
|
|
351
349
|
// spin is determined by sign: positive = up, negative = down
|
|
352
350
|
const spin = band_index < 0 ? `down` : `up`;
|
|
353
351
|
const abs_band_idx = Math.abs(band_index);
|
|
@@ -373,13 +371,13 @@ function parse_ifermi_surface(data) {
|
|
|
373
371
|
let dimensionality;
|
|
374
372
|
if (ifermi_iso.dimensionality) {
|
|
375
373
|
const dim = ifermi_iso.dimensionality.toLowerCase();
|
|
376
|
-
if (dim.includes(`1d`)
|
|
374
|
+
if (dim.includes(`1d`))
|
|
377
375
|
dimensionality = `1D`;
|
|
378
|
-
else if (dim.includes(`quasi`)
|
|
376
|
+
else if (dim.includes(`quasi`))
|
|
379
377
|
dimensionality = `quasi-2D`;
|
|
380
|
-
else if (dim.includes(`2d`)
|
|
378
|
+
else if (dim.includes(`2d`))
|
|
381
379
|
dimensionality = `2D`;
|
|
382
|
-
else if (dim.includes(`3d`)
|
|
380
|
+
else if (dim.includes(`3d`))
|
|
383
381
|
dimensionality = `3D`;
|
|
384
382
|
}
|
|
385
383
|
// Compute area for this isosurface using fan triangulation for N-gons
|
|
@@ -438,7 +436,7 @@ export function parse_fermi_file(content, filename) {
|
|
|
438
436
|
return parse();
|
|
439
437
|
}
|
|
440
438
|
catch (error) {
|
|
441
|
-
errors.push(`${format}: ${error
|
|
439
|
+
errors.push(`${format}: ${to_error(error).message}`);
|
|
442
440
|
console.error(`${format} parse error:`, error);
|
|
443
441
|
return null;
|
|
444
442
|
}
|