matterviz 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmptyState.svelte +10 -4
- package/dist/FilePicker.svelte +48 -60
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/api/optimade.js +10 -7
- package/dist/app.css +68 -0
- package/dist/brillouin/BrillouinZone.svelte +90 -91
- package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -7
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +18 -14
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +6 -10
- package/dist/brillouin/BrillouinZoneScene.svelte +46 -68
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/brillouin/compute.js +10 -16
- package/dist/brillouin/geometry.js +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +48 -50
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +61 -169
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +559 -755
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +1 -1
- package/dist/chempot-diagram/async-compute.svelte.js +13 -14
- package/dist/chempot-diagram/color.d.ts +21 -1
- package/dist/chempot-diagram/color.js +70 -1
- package/dist/chempot-diagram/compute.d.ts +7 -0
- package/dist/chempot-diagram/compute.js +85 -26
- package/dist/chempot-diagram/controls-state.svelte.js +1 -1
- package/dist/chempot-diagram/export.js +1 -6
- package/dist/chempot-diagram/temperature.js +9 -10
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +19 -20
- package/dist/composition/BarChart.svelte +30 -26
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +10 -19
- package/dist/composition/Formula.svelte +20 -27
- package/dist/composition/FormulaFilter.svelte +115 -184
- package/dist/composition/PieChart.svelte +55 -41
- package/dist/composition/format.js +7 -9
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -2
- package/dist/composition/parse.js +61 -115
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +17 -26
- package/dist/convex-hull/ConvexHull.svelte +12 -15
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +93 -94
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +127 -186
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +131 -180
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +36 -40
- package/dist/convex-hull/ConvexHullControls.svelte +46 -48
- package/dist/convex-hull/ConvexHullStats.svelte +193 -195
- package/dist/convex-hull/ConvexHullTooltip.svelte +5 -12
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +18 -22
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- package/dist/convex-hull/canvas-interactions.svelte.js +2 -1
- package/dist/convex-hull/gas-thermodynamics.js +21 -53
- package/dist/convex-hull/helpers.d.ts +8 -10
- package/dist/convex-hull/helpers.js +37 -43
- package/dist/convex-hull/hull-state.svelte.d.ts +1 -1
- package/dist/convex-hull/thermodynamics.js +37 -44
- package/dist/coordination/CoordinationBarPlot.svelte +49 -53
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/coordination/calc-coordination.d.ts +1 -1
- package/dist/coordination/calc-coordination.js +28 -25
- package/dist/element/BohrAtom.svelte +5 -9
- package/dist/element/ElementHeading.svelte +4 -1
- package/dist/element/ElementPhoto.svelte +11 -9
- package/dist/element/ElementStats.svelte +12 -10
- package/dist/element/ElementTile.svelte +44 -67
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +3 -2
- package/dist/element/data.js +5 -1
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +2 -5
- package/dist/element/index.js +4 -19
- package/dist/feedback/DragOverlay.svelte +5 -5
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -2
- package/dist/feedback/StatusMessage.svelte +7 -4
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +35 -44
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +7 -13
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +64 -136
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +25 -58
- package/dist/fermi-surface/parse.js +54 -88
- package/dist/file-viewer/JsonBrowser.svelte +1043 -0
- package/dist/file-viewer/JsonBrowser.svelte.d.ts +9 -0
- package/dist/file-viewer/PlotPanel.svelte +350 -0
- package/dist/file-viewer/PlotPanel.svelte.d.ts +9 -0
- package/dist/file-viewer/TrajectoryWithDos.svelte +30 -0
- package/dist/file-viewer/TrajectoryWithDos.svelte.d.ts +10 -0
- package/dist/file-viewer/detect.d.ts +11 -0
- package/dist/file-viewer/detect.js +381 -0
- package/dist/file-viewer/eligibility.d.ts +4 -0
- package/dist/file-viewer/eligibility.js +53 -0
- package/dist/file-viewer/host-protocol.d.ts +50 -0
- package/dist/file-viewer/host-transfer.d.ts +25 -0
- package/dist/file-viewer/host-transfer.js +42 -0
- package/dist/file-viewer/index.d.ts +5 -0
- package/dist/file-viewer/index.js +5 -0
- package/dist/file-viewer/main.d.ts +44 -0
- package/dist/file-viewer/main.js +535 -0
- package/dist/file-viewer/parse.d.ts +9 -0
- package/dist/file-viewer/parse.js +170 -0
- package/dist/file-viewer/plot-utils.d.ts +24 -0
- package/dist/file-viewer/plot-utils.js +191 -0
- package/dist/file-viewer/types.d.ts +4 -0
- package/dist/file-viewer/types.js +5 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +153 -219
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +9 -7
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +1 -1
- package/dist/heatmap-matrix/index.d.ts +5 -0
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/ExportPane.svelte +11 -7
- package/dist/io/decompress.d.ts +4 -1
- package/dist/io/decompress.js +24 -36
- package/dist/io/export.d.ts +11 -4
- package/dist/io/export.js +75 -19
- package/dist/io/fetch.d.ts +0 -3
- package/dist/io/fetch.js +0 -11
- package/dist/io/file-drop.js +60 -35
- package/dist/io/index.d.ts +0 -1
- package/dist/io/index.js +2 -9
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/url-drop.d.ts +2 -0
- package/dist/io/url-drop.js +40 -40
- package/dist/isosurface/Isosurface.svelte +700 -215
- package/dist/isosurface/Isosurface.svelte.d.ts +7 -1
- package/dist/isosurface/IsosurfaceControls.svelte +590 -116
- package/dist/isosurface/IsosurfaceControls.svelte.d.ts +1 -1
- package/dist/isosurface/VolumeSlice.svelte +224 -0
- package/dist/isosurface/VolumeSlice.svelte.d.ts +28 -0
- package/dist/isosurface/coloring.d.ts +20 -0
- package/dist/isosurface/coloring.js +118 -0
- package/dist/isosurface/geometry-worker-types.d.ts +38 -0
- package/dist/isosurface/geometry.worker.d.ts +1 -0
- package/dist/isosurface/geometry.worker.js +59 -0
- package/dist/isosurface/grid.d.ts +10 -0
- package/dist/isosurface/grid.js +31 -0
- package/dist/isosurface/index.d.ts +4 -0
- package/dist/isosurface/index.js +4 -0
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +6 -6
- package/dist/isosurface/profile.d.ts +12 -0
- package/dist/isosurface/profile.js +19 -0
- package/dist/isosurface/sampling.d.ts +34 -0
- package/dist/isosurface/sampling.js +408 -0
- package/dist/isosurface/slice-rendering.d.ts +13 -0
- package/dist/isosurface/slice-rendering.js +79 -0
- package/dist/isosurface/slice.d.ts +22 -2
- package/dist/isosurface/slice.js +200 -116
- package/dist/isosurface/types.d.ts +24 -1
- package/dist/isosurface/types.js +120 -8
- package/dist/json-path.d.ts +4 -0
- package/dist/json-path.js +89 -0
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +44 -14
- package/dist/layout/FullscreenButton.svelte +2 -1
- package/dist/layout/FullscreenToggle.svelte +10 -4
- package/dist/layout/InfoCard.svelte +8 -21
- package/dist/layout/InfoTag.svelte +1 -3
- package/dist/layout/NumberRangeInput.svelte +46 -0
- package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
- package/dist/layout/PropertyFilter.svelte +2 -6
- package/dist/layout/SettingsSection.svelte +57 -62
- package/dist/layout/SettingsSection.svelte.d.ts +6 -7
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +16 -11
- package/dist/layout/ViewerChrome.svelte.d.ts +2 -1
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.js +1 -2
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +22 -59
- package/dist/layout/json-tree/JsonTree.svelte +101 -172
- package/dist/layout/json-tree/JsonValue.svelte +9 -32
- package/dist/layout/json-tree/utils.d.ts +0 -3
- package/dist/layout/json-tree/utils.js +50 -188
- package/dist/marching-cubes.d.ts +8 -1
- package/dist/marching-cubes.js +115 -48
- package/dist/math.d.ts +5 -2
- package/dist/math.js +48 -38
- package/dist/overlays/ContextMenu.svelte +19 -34
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +110 -74
- package/dist/overlays/DraggablePane.svelte.d.ts +2 -1
- package/dist/overlays/GlassChip.svelte +32 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +7 -0
- package/dist/overlays/index.js +26 -0
- package/dist/overlays/portal.d.ts +2 -0
- package/dist/overlays/portal.js +14 -0
- package/dist/periodic-table/PeriodicTable.svelte +113 -145
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +37 -115
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +68 -105
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +70 -94
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +12 -12
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +4 -9
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +28 -27
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +461 -426
- package/dist/plot/bar/BarPlot.svelte.d.ts +2 -0
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +4 -6
- package/dist/plot/bar/SpacegroupBarPlot.svelte +46 -77
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +322 -226
- package/dist/plot/box/BoxPlot.svelte.d.ts +2 -0
- package/dist/plot/box/Violin.svelte.d.ts +1 -0
- package/dist/plot/box/box-plot.js +1 -1
- package/dist/plot/core/auto-place.d.ts +1 -1
- package/dist/plot/core/auto-place.js +2 -2
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +101 -106
- package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
- package/dist/plot/core/components/FillArea.svelte +10 -17
- package/dist/plot/core/components/HierarchyControls.svelte +249 -0
- package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
- package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
- package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/core/components/Line.svelte +18 -9
- package/dist/plot/core/components/Line.svelte.d.ts +2 -0
- package/dist/plot/core/components/PlotAxis.svelte +40 -17
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotLegend.svelte +31 -35
- package/dist/plot/core/components/PlotMarginals.svelte +616 -0
- package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
- package/dist/plot/core/components/PlotTooltip.svelte +1 -1
- package/dist/plot/core/components/PortalSelect.svelte +4 -8
- package/dist/plot/core/components/ReferenceLine.svelte +27 -24
- package/dist/plot/core/components/ReferenceLine3D.svelte +54 -57
- package/dist/plot/core/components/ReferencePlane.svelte +7 -8
- package/dist/plot/core/components/ZeroLines.svelte +4 -8
- package/dist/plot/core/components/ZoomRect.svelte +1 -2
- package/dist/plot/core/components/index.d.ts +1 -0
- package/dist/plot/core/components/index.js +1 -0
- package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
- package/dist/plot/core/data-cleaning-signal.js +467 -0
- package/dist/plot/core/data-cleaning.d.ts +2 -42
- package/dist/plot/core/data-cleaning.js +27 -474
- package/dist/plot/core/data-transform.d.ts +1 -2
- package/dist/plot/core/data-transform.js +9 -15
- package/dist/plot/core/fill-utils.d.ts +3 -1
- package/dist/plot/core/fill-utils.js +28 -6
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.js +0 -2
- package/dist/plot/core/layout.d.ts +15 -6
- package/dist/plot/core/layout.js +57 -38
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/pan-zoom.svelte.d.ts +2 -4
- package/dist/plot/core/pan-zoom.svelte.js +34 -17
- package/dist/plot/core/placed-tween.svelte.d.ts +3 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -21
- package/dist/plot/core/reference-line.js +1 -1
- package/dist/plot/core/scales.d.ts +23 -0
- package/dist/plot/core/scales.js +39 -13
- package/dist/plot/core/svg.js +0 -1
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +29 -324
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +52 -0
- package/dist/plot/core/utils/hierarchy-chart.js +191 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +100 -0
- package/dist/plot/core/utils/label-placement.js +2 -2
- package/dist/plot/histogram/Histogram.svelte +314 -340
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/histogram.d.ts +31 -0
- package/dist/plot/histogram/histogram.js +70 -0
- package/dist/plot/histogram/index.d.ts +1 -0
- package/dist/plot/histogram/index.js +1 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/index.js +1 -0
- package/dist/plot/sankey/Sankey.svelte +78 -69
- package/dist/plot/sankey/Sankey.svelte.d.ts +2 -2
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/sankey/sankey.js +13 -9
- package/dist/plot/scatter/BinnedScatterPlot.svelte +311 -141
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +7 -0
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +517 -410
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +2 -0
- package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/ScatterPoint.svelte +16 -9
- package/dist/plot/scatter/adaptive-density.d.ts +1 -1
- package/dist/plot/scatter/adaptive-density.js +36 -20
- package/dist/plot/scatter/binned-scatter-types.d.ts +3 -2
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/scatter-data.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.js +8 -7
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +25 -34
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +8 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +113 -116
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/scatter-3d/Surface3D.svelte +4 -13
- package/dist/plot/sunburst/Sunburst.svelte +269 -347
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +2 -2
- package/dist/plot/sunburst/index.d.ts +1 -1
- package/dist/plot/sunburst/index.js +2 -1
- package/dist/plot/sunburst/render.d.ts +2 -2
- package/dist/plot/sunburst/render.js +47 -22
- package/dist/plot/sunburst/sunburst.d.ts +5 -1
- package/dist/plot/sunburst/sunburst.js +10 -3
- package/dist/plot/treemap/Treemap.svelte +1022 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +90 -0
- package/dist/plot/treemap/index.d.ts +4 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/labels.d.ts +38 -0
- package/dist/plot/treemap/labels.js +80 -0
- package/dist/plot/treemap/treemap.d.ts +28 -0
- package/dist/plot/treemap/treemap.js +102 -0
- package/dist/rdf/RdfPlot.svelte +37 -59
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +63 -52
- package/dist/rdf/index.d.ts +0 -1
- package/dist/sanitize.js +85 -27
- package/dist/scene/SceneCamera.svelte +1 -1
- package/dist/scene/SceneCamera.svelte.d.ts +1 -1
- package/dist/scene/bind-renderer.svelte.js +14 -6
- package/dist/scene/index.d.ts +1 -2
- package/dist/scene/index.js +1 -1
- package/dist/scene/{props.js → props.svelte.js} +15 -1
- package/dist/settings.d.ts +19 -9
- package/dist/settings.js +229 -525
- package/dist/spectral/Bands.svelte +207 -221
- package/dist/spectral/BandsAndDos.svelte +11 -9
- package/dist/spectral/BrillouinBandsDos.svelte +19 -42
- package/dist/spectral/Dos.svelte +92 -93
- package/dist/spectral/helpers.d.ts +3 -3
- package/dist/spectral/helpers.js +65 -140
- package/dist/state.svelte.js +5 -18
- package/dist/structure/Arrow.svelte +5 -18
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +120 -85
- package/dist/structure/AtomLegend.svelte.d.ts +2 -3
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +15 -3
- package/dist/structure/CellSelect.svelte +45 -35
- package/dist/structure/Cylinder.svelte +24 -40
- package/dist/structure/InstancedAtoms.svelte +114 -0
- package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
- package/dist/structure/Lattice.svelte +85 -149
- package/dist/structure/SiteLabels.svelte +122 -0
- package/dist/structure/SiteLabels.svelte.d.ts +18 -0
- package/dist/structure/Structure.svelte +636 -504
- package/dist/structure/Structure.svelte.d.ts +4 -2
- package/dist/structure/StructureCarousel.svelte +637 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +165 -425
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +17 -21
- package/dist/structure/StructureInfoPane.svelte +128 -133
- package/dist/structure/StructureInfoPane.svelte.d.ts +1 -1
- package/dist/structure/StructureScene.svelte +535 -578
- package/dist/structure/StructureScene.svelte.d.ts +6 -2
- package/dist/structure/StructureViewport.svelte +451 -0
- package/dist/structure/StructureViewport.svelte.d.ts +65 -0
- package/dist/structure/atom-label-placement.d.ts +16 -12
- package/dist/structure/atom-label-placement.js +70 -37
- package/dist/structure/atom-properties.d.ts +2 -0
- package/dist/structure/atom-properties.js +105 -38
- package/dist/structure/bond-order-perception.js +3 -8
- package/dist/structure/bonding.d.ts +9 -3
- package/dist/structure/bonding.js +95 -46
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +1 -0
- package/dist/structure/export.js +89 -105
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +20 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +16 -1
- package/dist/structure/index.js +15 -10
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +2 -1
- package/dist/structure/parse.js +272 -313
- package/dist/structure/partial-occupancy.js +10 -5
- package/dist/structure/pbc.js +85 -107
- package/dist/structure/polyhedra.d.ts +0 -1
- package/dist/structure/polyhedra.js +7 -21
- package/dist/structure/prop-groups.d.ts +85 -0
- package/dist/structure/prop-groups.js +18 -0
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +7 -13
- package/dist/symmetry/SymmetryElements.svelte +11 -15
- package/dist/symmetry/SymmetryStats.svelte +55 -71
- package/dist/symmetry/WyckoffTable.svelte +10 -28
- package/dist/symmetry/cell-transform.js +6 -14
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +13 -10
- package/dist/symmetry/spacegroups.js +3 -2
- package/dist/table/HeatmapTable.svelte +1142 -447
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +168 -53
- package/dist/table/ToggleMenu.svelte.d.ts +1 -1
- package/dist/table/index.d.ts +21 -6
- package/dist/table/index.js +34 -21
- package/dist/theme/ThemeControl.svelte +16 -8
- package/dist/theme/embedded.d.ts +18 -0
- package/dist/theme/embedded.js +206 -0
- package/dist/theme/index.d.ts +5 -5
- package/dist/theme/index.js +5 -12
- package/dist/theme/themes.mjs +44 -66
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +3 -6
- package/dist/tooltip/TooltipContent.svelte.d.ts +1 -1
- package/dist/tooltip/index.d.ts +8 -1
- package/dist/trajectory/Trajectory.svelte +613 -386
- package/dist/trajectory/Trajectory.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryError.svelte +12 -74
- package/dist/trajectory/TrajectoryExportPane.svelte +14 -32
- package/dist/trajectory/TrajectoryInfoPane.svelte +127 -164
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +2 -1
- package/dist/trajectory/extract.js +61 -49
- package/dist/trajectory/format-detect.d.ts +2 -0
- package/dist/trajectory/format-detect.js +17 -13
- package/dist/trajectory/frame-reader.d.ts +2 -0
- package/dist/trajectory/frame-reader.js +35 -32
- package/dist/trajectory/helpers.d.ts +2 -0
- package/dist/trajectory/helpers.js +34 -56
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +5 -8
- package/dist/trajectory/parse/ase.js +1 -1
- package/dist/trajectory/parse/h5-utils.d.ts +13 -0
- package/dist/trajectory/parse/h5-utils.js +109 -0
- package/dist/trajectory/parse/hdf5.d.ts +1 -1
- package/dist/trajectory/parse/hdf5.js +116 -106
- package/dist/trajectory/parse/index.d.ts +6 -6
- package/dist/trajectory/parse/index.js +25 -33
- package/dist/trajectory/parse/lammps.js +8 -12
- package/dist/trajectory/parse/vasp.js +10 -7
- package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
- package/dist/trajectory/parse/vaspout-electronic.js +207 -0
- package/dist/trajectory/parse/vaspout-h5.d.ts +4 -0
- package/dist/trajectory/parse/vaspout-h5.js +281 -0
- package/dist/trajectory/parse/xyz.js +59 -9
- package/dist/trajectory/plotting.d.ts +8 -9
- package/dist/trajectory/plotting.js +113 -64
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -0
- package/dist/xrd/XrdPlot.svelte +79 -118
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +24 -62
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +69 -95
- package/package.json +94 -34
- package/readme.md +6 -5
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
- package/dist/scene/types.d.ts +0 -26
- package/dist/tooltip/types.d.ts +0 -8
- package/dist/trajectory/constants.d.ts +0 -6
- package/dist/trajectory/constants.js +0 -11
- /package/dist/{scene/types.js → file-viewer/host-protocol.js} +0 -0
- /package/dist/{tooltip/types.js → isosurface/geometry-worker-types.js} +0 -0
|
@@ -57,12 +57,10 @@ type $$ComponentProps = {
|
|
|
57
57
|
hovered_k_point?: Vec3 | null;
|
|
58
58
|
hovered_qpoint_index?: number | null;
|
|
59
59
|
on_kpath_hover?: (qpoint_index: number | null) => void;
|
|
60
|
-
children?: Snippet<[
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
]>;
|
|
60
|
+
children?: Snippet<[{
|
|
61
|
+
structure?: Crystal;
|
|
62
|
+
bz_data?: BrillouinZoneData;
|
|
63
|
+
}]>;
|
|
66
64
|
tooltip_config?: BZTooltipProp;
|
|
67
65
|
on_file_load?: (data: BZHandlerData) => void;
|
|
68
66
|
on_error?: (data: BZHandlerData) => void;
|
|
@@ -70,6 +68,6 @@ type $$ComponentProps = {
|
|
|
70
68
|
on_point_hover?: (data: BZHoverData | null) => void;
|
|
71
69
|
on_hover?: (data: BZHoverData | null) => void;
|
|
72
70
|
} & HTMLAttributes<HTMLDivElement>;
|
|
73
|
-
declare const BrillouinZone: import("svelte").Component<$$ComponentProps, {}, "
|
|
71
|
+
declare const BrillouinZone: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "dragover" | "fullscreen" | "wrapper" | "hovered" | "controls_open" | "structure" | "camera_projection" | "vector_scale" | "loading" | "png_dpi" | "info_pane_open" | "error_msg" | "bz_order" | "surface_color" | "surface_opacity" | "edge_color" | "edge_width" | "show_vectors" | "show_ibz" | "ibz_color" | "ibz_opacity" | "bz_data" | "ibz_data">;
|
|
74
72
|
type BrillouinZone = ReturnType<typeof BrillouinZone>;
|
|
75
73
|
export default BrillouinZone;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
surface_color = $bindable(`#4488ff`),
|
|
10
10
|
surface_opacity = $bindable(0.3),
|
|
11
11
|
edge_color = $bindable(`#000000`),
|
|
12
|
-
edge_width = $bindable(0.
|
|
12
|
+
edge_width = $bindable(0.002),
|
|
13
13
|
show_vectors = $bindable(true),
|
|
14
14
|
camera_projection = $bindable(`perspective`),
|
|
15
15
|
// Irreducible BZ options
|
|
@@ -84,10 +84,7 @@
|
|
|
84
84
|
<SettingsSection
|
|
85
85
|
title="Edges"
|
|
86
86
|
current_values={{ edge_color, edge_width }}
|
|
87
|
-
on_reset={() =>
|
|
88
|
-
edge_color = `#000000`
|
|
89
|
-
edge_width = 0.05
|
|
90
|
-
}}
|
|
87
|
+
on_reset={() => ([edge_color, edge_width] = [`#000000`, 0.002])}
|
|
91
88
|
>
|
|
92
89
|
<label>
|
|
93
90
|
<span>Color:</span>
|
|
@@ -95,7 +92,7 @@
|
|
|
95
92
|
</label>
|
|
96
93
|
<label>
|
|
97
94
|
<span>Width:</span>
|
|
98
|
-
<input type="range" min="0.
|
|
95
|
+
<input type="range" min="0.002" max="0.02" step="0.001" bind:value={edge_width} />
|
|
99
96
|
<span class="value">{edge_width.toFixed(2)}</span>
|
|
100
97
|
</label>
|
|
101
98
|
</SettingsSection>
|
|
@@ -58,25 +58,29 @@
|
|
|
58
58
|
const sections = $derived<ExportSection[]>([
|
|
59
59
|
{
|
|
60
60
|
title: `Export as image`,
|
|
61
|
-
items: [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
items: [
|
|
62
|
+
{
|
|
63
|
+
label: `PNG`,
|
|
64
|
+
disabled: !scene || !camera,
|
|
65
|
+
show_dpi: true,
|
|
66
|
+
on_download: export_as_png,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
67
69
|
},
|
|
68
70
|
{
|
|
69
71
|
title: `Export as data`,
|
|
70
72
|
tooltip: `Includes vertices, faces, edges, and reciprocal lattice vectors`,
|
|
71
|
-
items: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
items: [
|
|
74
|
+
{
|
|
75
|
+
label: `JSON`,
|
|
76
|
+
disabled: !bz_data,
|
|
77
|
+
on_download: export_as_json,
|
|
78
|
+
copy_text: () => {
|
|
79
|
+
const json_data = get_json_data()
|
|
80
|
+
return json_data ? JSON.stringify(json_data, null, 2) : null
|
|
81
|
+
},
|
|
78
82
|
},
|
|
79
|
-
|
|
83
|
+
],
|
|
80
84
|
},
|
|
81
85
|
])
|
|
82
86
|
</script>
|
|
@@ -73,20 +73,16 @@
|
|
|
73
73
|
items: [
|
|
74
74
|
{
|
|
75
75
|
label: `a, b, c`,
|
|
76
|
-
value: `${
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.join(`, `)
|
|
80
|
-
} Å`,
|
|
76
|
+
value: `${[structure.lattice.a, structure.lattice.b, structure.lattice.c]
|
|
77
|
+
.map((val) => format_num(val, `.3~f`))
|
|
78
|
+
.join(`, `)} Å`,
|
|
81
79
|
key: `real-lattice-abc`,
|
|
82
80
|
},
|
|
83
81
|
{
|
|
84
82
|
label: `α, β, γ`,
|
|
85
|
-
value: `${
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.join(`, `)
|
|
89
|
-
}°`,
|
|
83
|
+
value: `${[structure.lattice.alpha, structure.lattice.beta, structure.lattice.gamma]
|
|
84
|
+
.map((val) => format_num(val, `.2~f`))
|
|
85
|
+
.join(`, `)}°`,
|
|
90
86
|
key: `real-lattice-angles`,
|
|
91
87
|
},
|
|
92
88
|
],
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
surface_color = $bindable(`#4488ff`),
|
|
26
26
|
surface_opacity = $bindable(0.3),
|
|
27
27
|
edge_color = $bindable(`#000000`),
|
|
28
|
-
edge_width = $bindable(0.
|
|
28
|
+
edge_width = $bindable(0.002),
|
|
29
29
|
show_vectors = $bindable(true),
|
|
30
30
|
vector_scale = $bindable(1.0),
|
|
31
31
|
// Irreducible BZ options
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
auto_rotate = DEFAULTS.structure.auto_rotate,
|
|
49
49
|
scene = $bindable(),
|
|
50
50
|
camera = $bindable(),
|
|
51
|
-
k_path_points = [],
|
|
51
|
+
k_path_points: input_k_path_points = [],
|
|
52
52
|
k_path_labels = [],
|
|
53
53
|
hovered_k_point = null,
|
|
54
54
|
hovered_qpoint_index = null,
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
hover_data?: BZHoverData | null
|
|
76
76
|
on_kpath_hover?: (qpoint_index: number | null) => void
|
|
77
77
|
} = $props()
|
|
78
|
+
const k_path_points = $derived(input_k_path_points ?? [])
|
|
78
79
|
|
|
79
80
|
bind_renderer((threlte_scene, threlte_camera) => {
|
|
80
81
|
scene = threlte_scene
|
|
@@ -90,29 +91,31 @@
|
|
|
90
91
|
camera_position || default_camera_position(bz_size),
|
|
91
92
|
)
|
|
92
93
|
|
|
93
|
-
const orbit_controls_props = $derived(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
const orbit_controls_props = $derived(
|
|
95
|
+
build_orbit_props({
|
|
96
|
+
camera_projection,
|
|
97
|
+
target: rotation_target,
|
|
98
|
+
rotate_speed,
|
|
99
|
+
zoom_speed,
|
|
100
|
+
zoom_to_cursor,
|
|
101
|
+
pan_speed,
|
|
102
|
+
max_zoom,
|
|
103
|
+
min_zoom,
|
|
104
|
+
auto_rotate,
|
|
105
|
+
rotation_damping,
|
|
106
|
+
}),
|
|
107
|
+
)
|
|
105
108
|
|
|
106
109
|
// K-path styling. The invisible hover proxy is twice the visible thickness so the cursor
|
|
107
110
|
// snaps to the path even when it isn't directly over the thin visible segment.
|
|
108
|
-
const KPATH_THICKNESS = 0.
|
|
111
|
+
const KPATH_THICKNESS = 0.012
|
|
109
112
|
const KPATH_HOVER_THICKNESS = KPATH_THICKNESS * 2
|
|
110
113
|
|
|
111
114
|
// Threshold for skipping k-path segments that bridge a path discontinuity (e.g. `U|K`).
|
|
112
115
|
// Band paths are densely sampled, so legit segments are tiny; a discontinuity jumps by
|
|
113
116
|
// a fraction of the zone. Skip segments far longer than the median sampling step.
|
|
114
117
|
const k_path_seg_cutoff = $derived.by(() => {
|
|
115
|
-
if (
|
|
118
|
+
if (k_path_points.length < 3) return Infinity
|
|
116
119
|
const lens = k_path_points
|
|
117
120
|
.slice(1)
|
|
118
121
|
.map((pt, idx) => Math.hypot(...math.subtract(pt as Vec3, k_path_points[idx] as Vec3)))
|
|
@@ -124,9 +127,7 @@
|
|
|
124
127
|
bz_data ? polyhedron_geometry(bz_data.vertices, bz_data.faces) : null,
|
|
125
128
|
)
|
|
126
129
|
const ibz_geometry = $derived(
|
|
127
|
-
show_ibz && ibz_data
|
|
128
|
-
? polyhedron_geometry(ibz_data.vertices, ibz_data.faces)
|
|
129
|
-
: null,
|
|
130
|
+
show_ibz && ibz_data ? polyhedron_geometry(ibz_data.vertices, ibz_data.faces) : null,
|
|
130
131
|
)
|
|
131
132
|
|
|
132
133
|
// Separate effects to avoid disposing one geometry when only the other changes
|
|
@@ -166,10 +167,7 @@
|
|
|
166
167
|
})
|
|
167
168
|
|
|
168
169
|
// Create hover data from pointer event
|
|
169
|
-
function create_hover_data(
|
|
170
|
-
event: ThreltePointerEvent,
|
|
171
|
-
is_ibz: boolean,
|
|
172
|
-
): BZHoverData | null {
|
|
170
|
+
function create_hover_data(event: ThreltePointerEvent, is_ibz: boolean): BZHoverData | null {
|
|
173
171
|
if (!bz_data) return null
|
|
174
172
|
|
|
175
173
|
const position_cartesian: Vec3 = [event.point.x, event.point.y, event.point.z]
|
|
@@ -178,9 +176,8 @@
|
|
|
178
176
|
const { clientX, clientY } = event.nativeEvent
|
|
179
177
|
const ibz_vol = ibz_data?.volume ?? null
|
|
180
178
|
// Round to nearest integer since symmetry multiplicity is the point group order
|
|
181
|
-
const symmetry_multiplicity =
|
|
182
|
-
? Math.round(bz_data.volume / ibz_vol)
|
|
183
|
-
: null
|
|
179
|
+
const symmetry_multiplicity =
|
|
180
|
+
ibz_vol != null && ibz_vol > 0 ? Math.round(bz_data.volume / ibz_vol) : null
|
|
184
181
|
|
|
185
182
|
return {
|
|
186
183
|
position_cartesian,
|
|
@@ -294,18 +291,13 @@
|
|
|
294
291
|
{/if}
|
|
295
292
|
|
|
296
293
|
<!-- K-path visualization -->
|
|
297
|
-
{#if k_path_points
|
|
298
|
-
{#each k_path_points.slice(0, -1) as
|
|
299
|
-
from_point,
|
|
300
|
-
idx
|
|
301
|
-
(`${from_point}-${k_path_points[idx + 1]}#${idx}`)
|
|
302
|
-
}
|
|
294
|
+
{#if k_path_points.length > 1}
|
|
295
|
+
{#each k_path_points.slice(0, -1) as from_point, idx (`${from_point}-${k_path_points[idx + 1]}#${idx}`)}
|
|
303
296
|
{@const to_point = k_path_points[idx + 1]}
|
|
304
|
-
{@const seg_len = Math.hypot(
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
(idx === hovered_qpoint_index || idx === hovered_qpoint_index - 1)}
|
|
297
|
+
{@const seg_len = Math.hypot(...math.subtract(to_point as Vec3, from_point as Vec3))}
|
|
298
|
+
{@const is_hovered =
|
|
299
|
+
hovered_qpoint_index !== null &&
|
|
300
|
+
(idx === hovered_qpoint_index || idx === hovered_qpoint_index - 1)}
|
|
309
301
|
{#if seg_len <= k_path_seg_cutoff}
|
|
310
302
|
<Cylinder
|
|
311
303
|
from={from_point as Vec3}
|
|
@@ -326,42 +318,28 @@
|
|
|
326
318
|
{/each}
|
|
327
319
|
{/if}
|
|
328
320
|
|
|
329
|
-
<!-- Symmetry point spheres at labeled k-path points -->
|
|
330
|
-
{#
|
|
331
|
-
{#
|
|
332
|
-
{
|
|
333
|
-
<T.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
{
|
|
344
|
-
|
|
345
|
-
<extras.HTML center position={position.map((coord) => coord * 1.1) as Vec3}>
|
|
346
|
-
<span
|
|
347
|
-
style="background: rgba(0, 0, 0, 0.3); padding: 0 3px; border-radius: 2px; color: white"
|
|
348
|
-
>
|
|
349
|
-
{label}
|
|
350
|
-
</span>
|
|
351
|
-
</extras.HTML>
|
|
352
|
-
{/if}
|
|
353
|
-
{/each}
|
|
354
|
-
{/if}
|
|
321
|
+
<!-- Symmetry point spheres + labels at labeled k-path points -->
|
|
322
|
+
{#each k_path_labels as { position, label }, idx (`${label}-${idx}`)}
|
|
323
|
+
{#if label}
|
|
324
|
+
<T.Mesh position={[position[0], position[1], position[2]]}>
|
|
325
|
+
<T.SphereGeometry args={[0.015, 16, 16]} />
|
|
326
|
+
<T.MeshStandardMaterial color="#ffcc00" metalness={0.3} roughness={0.7} />
|
|
327
|
+
</T.Mesh>
|
|
328
|
+
<extras.HTML center position={position.map((coord) => coord * 1.1) as Vec3}>
|
|
329
|
+
<span
|
|
330
|
+
style="background: rgba(0, 0, 0, 0.3); padding: 0 3px; border-radius: 2px; color: white"
|
|
331
|
+
>
|
|
332
|
+
{label}
|
|
333
|
+
</span>
|
|
334
|
+
</extras.HTML>
|
|
335
|
+
{/if}
|
|
336
|
+
{/each}
|
|
355
337
|
|
|
356
338
|
<!-- Hovered k-point highlight -->
|
|
357
339
|
{#if hovered_k_point}
|
|
358
340
|
<T.Mesh position={hovered_k_point}>
|
|
359
341
|
<T.SphereGeometry args={[0.03, 16, 16]} />
|
|
360
|
-
<T.MeshStandardMaterial
|
|
361
|
-
color="#ff0000"
|
|
362
|
-
emissive="#ff0000"
|
|
363
|
-
emissiveIntensity={1.2}
|
|
364
|
-
/>
|
|
342
|
+
<T.MeshStandardMaterial color="#ff0000" emissive="#ff0000" emissiveIntensity={1.2} />
|
|
365
343
|
</T.Mesh>
|
|
366
344
|
{/if}
|
|
367
345
|
{/if}
|
|
@@ -24,6 +24,6 @@ type $$ComponentProps = SceneControlProps & {
|
|
|
24
24
|
hover_data?: BZHoverData | null;
|
|
25
25
|
on_kpath_hover?: (qpoint_index: number | null) => void;
|
|
26
26
|
};
|
|
27
|
-
declare const BrillouinZoneScene: import("svelte").Component<$$ComponentProps, {}, "
|
|
27
|
+
declare const BrillouinZoneScene: import("svelte").Component<$$ComponentProps, {}, "camera" | "camera_projection" | "camera_position" | "vector_scale" | "scene" | "surface_color" | "surface_opacity" | "edge_color" | "edge_width" | "show_vectors" | "bz_data" | "hover_data">;
|
|
28
28
|
type BrillouinZoneScene = ReturnType<typeof BrillouinZoneScene>;
|
|
29
29
|
export default BrillouinZoneScene;
|
|
@@ -3,8 +3,6 @@ import * as math from '../math';
|
|
|
3
3
|
import { Vector3 } from 'three';
|
|
4
4
|
import { ConvexGeometry } from 'three/examples/jsm/geometries/ConvexGeometry.js';
|
|
5
5
|
const TOL = 1e-8;
|
|
6
|
-
// Check if rotation matrix is identity
|
|
7
|
-
const is_identity_rotation = (rot) => rot.every((row, idx) => row.every((val, jdx) => Math.abs(val - (idx === jdx ? 1 : 0)) < TOL));
|
|
8
6
|
// Extract unique point group rotation matrices from space group operations.
|
|
9
7
|
// Returns fractional-coordinate rotations (W matrices from spglib convention).
|
|
10
8
|
// These must be converted to Cartesian k-space before use in clipping.
|
|
@@ -111,12 +109,11 @@ export function generate_bz_vertices(k_lattice, order = 1,
|
|
|
111
109
|
// Higher values give more accurate zones but increase computation time significantly.
|
|
112
110
|
// Default values: 26 (1st order), 80 (2nd order), 150 (3rd+ order)
|
|
113
111
|
max_planes_by_order = { 1: 26, 2: 80, 3: 150 }) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const k_points = generate_k_space_grid(k_lattice, order);
|
|
112
|
+
const clamped_order = Math.min(order, 3);
|
|
113
|
+
const k_points = generate_k_space_grid(k_lattice, clamped_order);
|
|
117
114
|
const center_idx = Math.floor(k_points.length / 2);
|
|
118
|
-
//
|
|
119
|
-
const max_planes = max_planes_by_order[
|
|
115
|
+
// Fallback for partial records passed through compute_brillouin_zone
|
|
116
|
+
const max_planes = max_planes_by_order[clamped_order] ?? 150;
|
|
120
117
|
// Create Bragg planes (perpendicular bisectors of k-points)
|
|
121
118
|
const planes = k_points
|
|
122
119
|
.map((pt, idx) => {
|
|
@@ -152,12 +149,12 @@ max_planes_by_order = { 1: 26, 2: 80, 3: 150 }) {
|
|
|
152
149
|
vertex[2] * normals[p_idx][2];
|
|
153
150
|
if (dot > distances[p_idx] + TOL) {
|
|
154
151
|
beyond_count++;
|
|
155
|
-
if (beyond_count >=
|
|
152
|
+
if (beyond_count >= clamped_order)
|
|
156
153
|
break;
|
|
157
154
|
}
|
|
158
155
|
}
|
|
159
156
|
// Vertex belongs to nth BZ if it's beyond fewer than n planes
|
|
160
|
-
if (beyond_count <
|
|
157
|
+
if (beyond_count < clamped_order && !dedup.has_duplicate(vertex)) {
|
|
161
158
|
vertices.push(vertex);
|
|
162
159
|
dedup.add(vertex);
|
|
163
160
|
}
|
|
@@ -166,13 +163,10 @@ max_planes_by_order = { 1: 26, 2: 80, 3: 150 }) {
|
|
|
166
163
|
}
|
|
167
164
|
return vertices;
|
|
168
165
|
}
|
|
169
|
-
// Compute polyhedron volume via divergence theorem (sum of signed tetrahedral volumes)
|
|
166
|
+
// Compute polyhedron volume via divergence theorem (sum of signed tetrahedral volumes).
|
|
167
|
+
// Faces always come from compute_convex_hull, so each is a valid triangle.
|
|
170
168
|
function compute_hull_volume(vertices, faces) {
|
|
171
|
-
if (faces.length === 0)
|
|
172
|
-
return 0;
|
|
173
169
|
return Math.abs(faces.reduce((sum, face) => {
|
|
174
|
-
if (face.length < 3)
|
|
175
|
-
return sum;
|
|
176
170
|
const [v0, v1, v2] = face.slice(0, 3).map((idx) => vertices[idx]);
|
|
177
171
|
const area_normal = math.scale(math.cross_3d(math.subtract(v1, v0), math.subtract(v2, v0)), 0.5);
|
|
178
172
|
return sum + math.dot(v0, area_normal) / 3;
|
|
@@ -255,7 +249,7 @@ max_planes_by_order = { 1: 26, 2: 80, 3: 150 }) {
|
|
|
255
249
|
}
|
|
256
250
|
const hull = compute_convex_hull(vertices, edge_sharp_angle_deg);
|
|
257
251
|
return {
|
|
258
|
-
order,
|
|
252
|
+
order: Math.min(order, 3),
|
|
259
253
|
vertices: hull.vertices,
|
|
260
254
|
faces: hull.faces,
|
|
261
255
|
edges: hull.edges.map(([i1, i2]) => [hull.vertices[i1], hull.vertices[i2]]),
|
|
@@ -305,7 +299,7 @@ export function find_ibz_reference_direction(non_identity_ops) {
|
|
|
305
299
|
// of exactly volume(BZ)/|G|. (Using a different reference point per operation — or
|
|
306
300
|
// flipping individual planes — does NOT yield a fundamental domain in general.)
|
|
307
301
|
export function compute_ibz_clipping_planes(point_group_ops) {
|
|
308
|
-
const non_identity_ops = point_group_ops.filter((rot) => !
|
|
302
|
+
const non_identity_ops = point_group_ops.filter((rot) => !rot.every((row, idx) => row.every((val, jdx) => Math.abs(val - (idx === jdx ? 1 : 0)) < TOL)));
|
|
309
303
|
if (non_identity_ops.length === 0)
|
|
310
304
|
return [];
|
|
311
305
|
const ref_dir = find_ibz_reference_direction(non_identity_ops);
|
|
@@ -32,12 +32,12 @@ export function polyhedron_geometry(vertices, faces) {
|
|
|
32
32
|
geometry.computeBoundingSphere();
|
|
33
33
|
return geometry;
|
|
34
34
|
}
|
|
35
|
-
//
|
|
35
|
+
// Cartesian → fractional via transposed row-vector inverse; null if missing/singular
|
|
36
36
|
export function k_lattice_inverse(k_lattice) {
|
|
37
37
|
if (!k_lattice)
|
|
38
38
|
return null;
|
|
39
39
|
try {
|
|
40
|
-
return math.
|
|
40
|
+
return math.create_cart_to_frac_matrix(k_lattice);
|
|
41
41
|
}
|
|
42
42
|
catch {
|
|
43
43
|
return null;
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
import ChemPotDiagram3D from './ChemPotDiagram3D.svelte'
|
|
11
11
|
import { get_ternary_combinations } from './compute'
|
|
12
12
|
import type {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
AxisRangeData,
|
|
14
|
+
ChemPotDiagramConfig,
|
|
15
|
+
ChemPotHoverInfo,
|
|
16
|
+
ChemPotHoverInfo3D,
|
|
16
17
|
} from './types'
|
|
17
18
|
import { CHEMPOT_DEFAULTS } from './types'
|
|
18
19
|
import { to_error } from '../utils'
|
|
@@ -37,27 +38,25 @@
|
|
|
37
38
|
// Extract unique elements from all entries (composition keys are element symbols)
|
|
38
39
|
const all_elements = $derived(
|
|
39
40
|
[
|
|
40
|
-
...new Set(
|
|
41
|
-
|
|
42
|
-
.
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
...new Set(
|
|
42
|
+
entries.flatMap((entry) =>
|
|
43
|
+
Object.entries(entry.composition)
|
|
44
|
+
.filter(([, amount]) => amount > 0)
|
|
45
|
+
.map(([element]) => element),
|
|
46
|
+
),
|
|
47
|
+
),
|
|
45
48
|
].toSorted(),
|
|
46
49
|
)
|
|
47
50
|
|
|
48
51
|
// How many display axes (2 = binary/2D, 3+ = ternary/3D)
|
|
49
52
|
const display_elements = $derived(config.elements ?? all_elements)
|
|
50
53
|
const n_display = $derived(display_elements.length)
|
|
51
|
-
const show_tooltip = $derived(
|
|
52
|
-
config.show_tooltip ?? CHEMPOT_DEFAULTS.show_tooltip,
|
|
53
|
-
)
|
|
54
|
+
const show_tooltip = $derived(config.show_tooltip ?? CHEMPOT_DEFAULTS.show_tooltip)
|
|
54
55
|
const tooltip_detail_level = $derived(
|
|
55
56
|
config.tooltip_detail_level ?? CHEMPOT_DEFAULTS.tooltip_detail_level,
|
|
56
57
|
)
|
|
57
58
|
|
|
58
|
-
const projection_mode = $derived(
|
|
59
|
-
config.projection_mode ?? CHEMPOT_DEFAULTS.projection_mode,
|
|
60
|
-
)
|
|
59
|
+
const projection_mode = $derived(config.projection_mode ?? CHEMPOT_DEFAULTS.projection_mode)
|
|
61
60
|
// For quaternary+ in grid mode, generate all C(n,3) ternary projections
|
|
62
61
|
// Uses display_elements (not all_elements) so config.elements scopes the grid
|
|
63
62
|
const ternary_combos = $derived(
|
|
@@ -81,30 +80,47 @@
|
|
|
81
80
|
if (!show_grid) return
|
|
82
81
|
let cancelled = false
|
|
83
82
|
compute_chempot_async(entries, { ...config, elements: ternary_combos[0] })
|
|
84
|
-
.then(() => {
|
|
83
|
+
.then(() => {
|
|
84
|
+
if (!cancelled) grid_cache_ready = true
|
|
85
|
+
})
|
|
85
86
|
.catch((err) => {
|
|
86
87
|
if (cancelled) return
|
|
87
88
|
console.error(`Grid precompute failed:`, err)
|
|
88
89
|
grid_error = to_error(err).message
|
|
89
90
|
})
|
|
90
|
-
return () => {
|
|
91
|
+
return () => {
|
|
92
|
+
cancelled = true
|
|
93
|
+
}
|
|
91
94
|
})
|
|
92
|
-
const is_hover_info_3d = (value: ChemPotHoverInfo | null): value is ChemPotHoverInfo3D =>
|
|
95
|
+
const is_hover_info_3d = (value: ChemPotHoverInfo | null): value is ChemPotHoverInfo3D =>
|
|
96
|
+
value?.view === `3d`
|
|
93
97
|
|
|
94
98
|
let tooltip_el = $state<HTMLElement>()
|
|
95
99
|
const tooltip_pos = $derived.by(() => {
|
|
96
100
|
const pointer = hover_info?.pointer
|
|
97
101
|
if (!pointer) return { x: 4, y: 4 }
|
|
98
102
|
return constrain_tooltip_position(
|
|
99
|
-
pointer.x,
|
|
103
|
+
pointer.x,
|
|
104
|
+
pointer.y,
|
|
100
105
|
tooltip_el?.offsetWidth ?? 200,
|
|
101
106
|
tooltip_el?.offsetHeight ?? 100,
|
|
102
|
-
width,
|
|
107
|
+
width,
|
|
108
|
+
height,
|
|
103
109
|
{ offset: 0 },
|
|
104
110
|
)
|
|
105
111
|
})
|
|
106
112
|
</script>
|
|
107
113
|
|
|
114
|
+
{#snippet axis_ranges_section(ranges: AxisRangeData[])}
|
|
115
|
+
<h5 id="axis-ranges">Axis ranges</h5>
|
|
116
|
+
{#each ranges as axis_range (axis_range.element)}
|
|
117
|
+
<p>
|
|
118
|
+
{axis_range.element}: {format_num(axis_range.min_val, `.4~g`)} to
|
|
119
|
+
{format_num(axis_range.max_val, `.4~g`)} eV
|
|
120
|
+
</p>
|
|
121
|
+
{/each}
|
|
122
|
+
{/snippet}
|
|
123
|
+
|
|
108
124
|
<div class="chempot-diagram-wrapper">
|
|
109
125
|
{#if n_display < 2}
|
|
110
126
|
<div
|
|
@@ -184,17 +200,13 @@ const is_hover_info_3d = (value: ChemPotHoverInfo | null): value is ChemPotHover
|
|
|
184
200
|
style:left="{tooltip_pos.x}px"
|
|
185
201
|
style:top="{tooltip_pos.y}px"
|
|
186
202
|
>
|
|
187
|
-
<h4>
|
|
203
|
+
<h4>
|
|
204
|
+
{@html sanitize_html(get_electro_neg_formula(hover_info.formula, false, ``, `.3~s`))}
|
|
205
|
+
</h4>
|
|
188
206
|
{#if hover_info.view === `2d`}
|
|
189
207
|
<p>2D domain · Points: {hover_info.n_points}</p>
|
|
190
208
|
{#if tooltip_detail_level === `detailed`}
|
|
191
|
-
|
|
192
|
-
{#each hover_info.axis_ranges as axis_range (axis_range.element)}
|
|
193
|
-
<p>
|
|
194
|
-
{axis_range.element}: {format_num(axis_range.min_val, `.4~g`)} to
|
|
195
|
-
{format_num(axis_range.max_val, `.4~g`)} eV
|
|
196
|
-
</p>
|
|
197
|
-
{/each}
|
|
209
|
+
{@render axis_ranges_section(hover_info.axis_ranges)}
|
|
198
210
|
{/if}
|
|
199
211
|
{:else if is_hover_info_3d(hover_info)}
|
|
200
212
|
<p>
|
|
@@ -209,35 +221,24 @@ const is_hover_info_3d = (value: ChemPotHoverInfo | null): value is ChemPotHover
|
|
|
209
221
|
</p>
|
|
210
222
|
<p>
|
|
211
223
|
Entries: {hover_info.matching_entry_count}
|
|
212
|
-
{#if hover_info.min_energy_per_atom !== null &&
|
|
213
|
-
hover_info.max_energy_per_atom !== null}
|
|
224
|
+
{#if hover_info.min_energy_per_atom !== null && hover_info.max_energy_per_atom !== null}
|
|
214
225
|
· E/atom: {format_num(hover_info.min_energy_per_atom, `.4~g`)}
|
|
215
226
|
to {format_num(hover_info.max_energy_per_atom, `.4~g`)} eV
|
|
216
227
|
{/if}
|
|
217
228
|
</p>
|
|
218
229
|
{#if tooltip_detail_level === `detailed`}
|
|
219
|
-
|
|
220
|
-
{#each hover_info.axis_ranges as axis_range (axis_range.element)}
|
|
221
|
-
<p>
|
|
222
|
-
{axis_range.element}: {format_num(axis_range.min_val, `.4~g`)} to
|
|
223
|
-
{format_num(axis_range.max_val, `.4~g`)} eV
|
|
224
|
-
</p>
|
|
225
|
-
{/each}
|
|
230
|
+
{@render axis_ranges_section(hover_info.axis_ranges)}
|
|
226
231
|
<p>
|
|
227
|
-
Centroid: ({
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
)
|
|
231
|
-
})
|
|
232
|
+
Centroid: ({hover_info.ann_loc
|
|
233
|
+
.map((value) => format_num(value, `.3~g`))
|
|
234
|
+
.join(`, `)})
|
|
232
235
|
</p>
|
|
233
236
|
{#if hover_info.neighbors.length > 0}
|
|
234
237
|
<h5 id="neighbors">Neighbors ({hover_info.neighbors.length})</h5>
|
|
235
238
|
<p>
|
|
236
|
-
{
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
).join(`, `)
|
|
240
|
-
}
|
|
239
|
+
{hover_info.neighbors
|
|
240
|
+
.map((formula) => get_electro_neg_formula(formula, true, ``, `.3~s`))
|
|
241
|
+
.join(`, `)}
|
|
241
242
|
</p>
|
|
242
243
|
{/if}
|
|
243
244
|
{#if hover_info.touches_limits.length > 0}
|
|
@@ -295,10 +296,7 @@ const is_hover_info_3d = (value: ChemPotHoverInfo | null): value is ChemPotHover
|
|
|
295
296
|
.chempot-tooltip {
|
|
296
297
|
position: absolute;
|
|
297
298
|
max-width: min(32rem, 92vw);
|
|
298
|
-
background: var(
|
|
299
|
-
--tooltip-bg,
|
|
300
|
-
light-dark(rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.9))
|
|
301
|
-
);
|
|
299
|
+
background: var(--tooltip-bg, light-dark(rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.9)));
|
|
302
300
|
color: var(--tooltip-text, var(--text-color, #222));
|
|
303
301
|
border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
|
|
304
302
|
border-radius: 6px;
|