matterviz 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmptyState.svelte +10 -4
- package/dist/FilePicker.svelte +12 -14
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/app.css +53 -0
- package/dist/brillouin/BrillouinZone.svelte +132 -219
- package/dist/brillouin/BrillouinZone.svelte.d.ts +9 -20
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +47 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +15 -42
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +63 -230
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +3 -23
- package/dist/brillouin/ReciprocalVectors.svelte +39 -0
- package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
- package/dist/brillouin/compute.d.ts +2 -0
- package/dist/brillouin/compute.js +80 -77
- package/dist/brillouin/geometry.d.ts +8 -0
- package/dist/brillouin/geometry.js +57 -0
- package/dist/brillouin/index.d.ts +2 -0
- package/dist/brillouin/index.js +2 -0
- package/dist/brillouin/types.d.ts +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +143 -246
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +652 -976
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -1
- package/dist/chempot-diagram/color.d.ts +3 -6
- package/dist/chempot-diagram/color.js +5 -5
- package/dist/chempot-diagram/compute.d.ts +3 -3
- package/dist/chempot-diagram/compute.js +3 -1
- package/dist/chempot-diagram/controls-state.svelte.d.ts +10 -0
- package/dist/chempot-diagram/controls-state.svelte.js +42 -0
- package/dist/chempot-diagram/export.d.ts +47 -0
- package/dist/chempot-diagram/export.js +133 -0
- package/dist/chempot-diagram/index.d.ts +1 -0
- package/dist/chempot-diagram/index.js +1 -0
- package/dist/chempot-diagram/pointer.d.ts +0 -10
- package/dist/chempot-diagram/pointer.js +4 -4
- package/dist/chempot-diagram/types.d.ts +3 -3
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +21 -22
- package/dist/composition/BarChart.svelte +37 -31
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +7 -11
- package/dist/composition/Formula.svelte +18 -25
- package/dist/composition/FormulaFilter.svelte +96 -98
- package/dist/composition/PieChart.svelte +60 -46
- package/dist/composition/chem-sys.js +3 -2
- package/dist/composition/format.js +4 -3
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -3
- package/dist/composition/parse.js +27 -28
- package/dist/constants.js +11 -9
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +20 -25
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +176 -256
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +269 -804
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +236 -755
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +264 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +128 -49
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
- package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
- package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
- package/dist/convex-hull/ConvexHullStats.svelte +210 -351
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +16 -14
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +17 -21
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- package/dist/convex-hull/barycentric-coords.d.ts +2 -4
- package/dist/convex-hull/barycentric-coords.js +6 -33
- package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
- package/dist/convex-hull/canvas-interactions.svelte.js +279 -0
- package/dist/convex-hull/helpers.d.ts +47 -17
- package/dist/convex-hull/helpers.js +186 -101
- package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
- package/dist/convex-hull/hull-state.svelte.js +124 -0
- package/dist/convex-hull/index.d.ts +9 -7
- package/dist/convex-hull/index.js +7 -2
- package/dist/convex-hull/thermodynamics.js +109 -937
- package/dist/convex-hull/types.d.ts +12 -4
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +41 -43
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/coordination/calc-coordination.d.ts +1 -1
- package/dist/coordination/calc-coordination.js +28 -25
- package/dist/element/BohrAtom.svelte +6 -8
- package/dist/element/ElementHeading.svelte +4 -1
- package/dist/element/ElementPhoto.svelte +11 -9
- package/dist/element/ElementStats.svelte +12 -10
- package/dist/element/ElementTile.svelte +24 -29
- package/dist/element/ElementTile.svelte.d.ts +1 -1
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +1 -2
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +1 -0
- package/dist/element/index.js +3 -0
- package/dist/feedback/DragOverlay.svelte +5 -3
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -1
- package/dist/feedback/StatusMessage.svelte +20 -7
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +78 -165
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +9 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceScene.svelte +93 -272
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +14 -13
- package/dist/fermi-surface/export.js +4 -15
- package/dist/fermi-surface/index.d.ts +0 -1
- package/dist/fermi-surface/index.js +0 -1
- package/dist/fermi-surface/parse.d.ts +1 -1
- package/dist/fermi-surface/parse.js +84 -97
- package/dist/fermi-surface/types.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +161 -185
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +6 -5
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +12 -9
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +8 -2
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +170 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -36
- package/dist/io/export.d.ts +9 -1
- package/dist/io/export.js +37 -29
- package/dist/io/fetch.d.ts +2 -4
- package/dist/io/fetch.js +0 -11
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +13 -0
- package/dist/io/index.d.ts +1 -0
- package/dist/io/index.js +3 -0
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/types.d.ts +13 -0
- package/dist/io/url-drop.js +13 -25
- package/dist/isosurface/Isosurface.svelte +17 -23
- package/dist/isosurface/IsosurfaceControls.svelte +37 -42
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +50 -48
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +44 -14
- package/dist/layout/FullscreenButton.svelte +34 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +12 -12
- package/dist/layout/InfoCard.svelte +7 -18
- package/dist/layout/InfoTag.svelte +1 -3
- package/dist/layout/NumberRangeInput.svelte +46 -0
- package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
- package/dist/layout/PropertyFilter.svelte +2 -6
- package/dist/layout/SettingsSection.svelte +21 -17
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +115 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +18 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +36 -0
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.js +4 -0
- package/dist/layout/json-tree/JsonNode.svelte +8 -11
- package/dist/layout/json-tree/JsonTree.svelte +53 -77
- package/dist/layout/json-tree/JsonValue.svelte +7 -15
- package/dist/layout/json-tree/utils.js +14 -23
- package/dist/math.d.ts +9 -3
- package/dist/math.js +37 -21
- package/dist/overlays/ContextMenu.svelte +4 -2
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +81 -26
- package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
- package/dist/overlays/GlassChip.svelte +30 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +11 -0
- package/dist/overlays/index.js +26 -0
- package/dist/overlays/portal.d.ts +2 -0
- package/dist/overlays/portal.js +14 -0
- package/dist/periodic-table/PeriodicTable.svelte +115 -146
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +73 -96
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +4 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +49 -134
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +3 -3
- package/dist/phase-diagram/colors.js +1 -1
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.d.ts +2 -1
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +21 -15
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +494 -692
- package/dist/plot/bar/BarPlot.svelte.d.ts +9 -15
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +5 -7
- package/dist/plot/bar/SpacegroupBarPlot.svelte +31 -37
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +361 -439
- package/dist/plot/box/BoxPlot.svelte.d.ts +6 -3
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
- package/dist/plot/box/Violin.svelte.d.ts +2 -1
- package/dist/plot/box/box-plot.d.ts +3 -2
- package/dist/plot/box/box-plot.js +6 -3
- package/dist/plot/box/kde.d.ts +2 -1
- package/dist/plot/box/kde.js +4 -4
- package/dist/plot/core/auto-place.d.ts +1 -1
- package/dist/plot/core/auto-place.js +5 -2
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +106 -111
- package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
- package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
- package/dist/plot/core/components/FillArea.svelte +10 -17
- package/dist/plot/core/components/HierarchyControls.svelte +249 -0
- package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
- package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
- package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/core/components/Line.svelte +21 -11
- package/dist/plot/core/components/Line.svelte.d.ts +5 -2
- package/dist/plot/core/components/PlotAxis.svelte +42 -18
- package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
- package/dist/plot/core/components/PlotLegend.svelte +31 -35
- package/dist/plot/core/components/PlotMarginals.svelte +616 -0
- package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
- package/dist/plot/core/components/PlotTooltip.svelte +1 -1
- package/dist/plot/core/components/PortalSelect.svelte +4 -8
- package/dist/plot/core/components/ReferenceLine.svelte +27 -24
- package/dist/plot/core/components/ReferenceLine3D.svelte +56 -59
- package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
- package/dist/plot/core/components/ReferencePlane.svelte +9 -10
- package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
- package/dist/plot/core/components/ZeroLines.svelte +4 -8
- package/dist/plot/core/components/ZoomRect.svelte +1 -2
- package/dist/plot/core/components/index.d.ts +1 -0
- package/dist/plot/core/components/index.js +1 -0
- package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
- package/dist/plot/core/data-cleaning-signal.js +467 -0
- package/dist/plot/core/data-cleaning.d.ts +2 -42
- package/dist/plot/core/data-cleaning.js +29 -476
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +7 -4
- package/dist/plot/core/fill-utils.js +34 -9
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.d.ts +5 -1
- package/dist/plot/core/interactions.js +14 -2
- package/dist/plot/core/layout.d.ts +3 -1
- package/dist/plot/core/layout.js +22 -13
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/pan-zoom.svelte.d.ts +35 -0
- package/dist/plot/core/pan-zoom.svelte.js +221 -0
- package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -0
- package/dist/plot/core/reference-line.d.ts +10 -10
- package/dist/plot/core/reference-line.js +7 -7
- package/dist/plot/core/scales.d.ts +40 -25
- package/dist/plot/core/scales.js +49 -21
- package/dist/plot/core/svg.d.ts +2 -1
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +47 -331
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
- package/dist/plot/core/utils/hierarchy-chart.js +179 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +99 -0
- package/dist/plot/core/utils/label-placement.d.ts +1 -1
- package/dist/plot/core/utils/label-placement.js +5 -5
- package/dist/plot/core/utils.d.ts +2 -1
- package/dist/plot/histogram/Histogram.svelte +373 -631
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
- package/dist/plot/histogram/histogram.d.ts +31 -0
- package/dist/plot/histogram/histogram.js +70 -0
- package/dist/plot/histogram/index.d.ts +1 -0
- package/dist/plot/histogram/index.js +1 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/index.js +1 -0
- package/dist/plot/sankey/Sankey.svelte +79 -73
- package/dist/plot/sankey/Sankey.svelte.d.ts +3 -3
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/sankey/sankey.js +3 -1
- package/dist/plot/scatter/BinnedScatterPlot.svelte +264 -112
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +11 -4
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +623 -821
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +9 -15
- package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/ScatterPoint.svelte +16 -9
- package/dist/plot/scatter/binned-scatter-types.d.ts +6 -12
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/index.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.js +8 -7
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +40 -60
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +17 -15
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +232 -234
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
- package/dist/plot/scatter-3d/Surface3D.svelte +9 -17
- package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
- package/dist/plot/sunburst/Sunburst.svelte +256 -338
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
- package/dist/plot/sunburst/index.d.ts +1 -1
- package/dist/plot/sunburst/index.js +2 -1
- package/dist/plot/sunburst/render.d.ts +2 -2
- package/dist/plot/sunburst/render.js +47 -22
- package/dist/plot/sunburst/sunburst.d.ts +5 -1
- package/dist/plot/sunburst/sunburst.js +14 -4
- package/dist/plot/treemap/Treemap.svelte +907 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
- package/dist/plot/treemap/index.d.ts +3 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/treemap.d.ts +26 -0
- package/dist/plot/treemap/treemap.js +99 -0
- package/dist/rdf/RdfPlot.svelte +22 -26
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +4 -8
- package/dist/sanitize.js +14 -3
- package/dist/scene/SceneCamera.svelte +62 -0
- package/dist/scene/SceneCamera.svelte.d.ts +19 -0
- package/dist/scene/bind-renderer.svelte.d.ts +2 -0
- package/dist/scene/bind-renderer.svelte.js +22 -0
- package/dist/scene/index.d.ts +4 -0
- package/dist/scene/index.js +5 -0
- package/dist/scene/props.js +52 -0
- package/dist/scene/types.d.ts +26 -0
- package/dist/scene/types.js +1 -0
- package/dist/settings.d.ts +33 -11
- package/dist/settings.js +136 -51
- package/dist/spectral/Bands.svelte +231 -237
- package/dist/spectral/Bands.svelte.d.ts +3 -2
- package/dist/spectral/BandsAndDos.svelte +29 -29
- package/dist/spectral/BrillouinBandsDos.svelte +21 -29
- package/dist/spectral/Dos.svelte +75 -77
- package/dist/spectral/Dos.svelte.d.ts +2 -1
- package/dist/spectral/helpers.d.ts +9 -9
- package/dist/spectral/helpers.js +66 -70
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +5 -24
- package/dist/structure/Arrow.svelte +6 -21
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +115 -75
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +16 -3
- package/dist/structure/CellSelect.svelte +22 -29
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- package/dist/structure/Cylinder.svelte +24 -40
- package/dist/structure/InstancedAtoms.svelte +114 -0
- package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
- package/dist/structure/Lattice.svelte +85 -149
- package/dist/structure/SiteLabels.svelte +122 -0
- package/dist/structure/SiteLabels.svelte.d.ts +18 -0
- package/dist/structure/Structure.svelte +725 -735
- package/dist/structure/Structure.svelte.d.ts +8 -16
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +298 -325
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +62 -168
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +77 -69
- package/dist/structure/StructureInfoPane.svelte.d.ts +6 -6
- package/dist/structure/StructureScene.svelte +758 -600
- package/dist/structure/StructureScene.svelte.d.ts +24 -20
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +18 -0
- package/dist/structure/atom-label-placement.js +115 -0
- package/dist/structure/atom-properties.d.ts +3 -1
- package/dist/structure/atom-properties.js +115 -54
- package/dist/structure/bond-order-perception.js +2 -4
- package/dist/structure/bonding.d.ts +12 -2
- package/dist/structure/bonding.js +172 -73
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +25 -4
- package/dist/structure/export.js +103 -153
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +22 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +18 -1
- package/dist/structure/index.js +15 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +5 -3
- package/dist/structure/parse.js +551 -567
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +5 -3
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +204 -51
- package/dist/structure/polyhedra.d.ts +40 -0
- package/dist/structure/polyhedra.js +587 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +10 -15
- package/dist/structure/validation.js +5 -6
- package/dist/symmetry/SymmetryElementControls.svelte +69 -0
- package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
- package/dist/symmetry/SymmetryElements.svelte +350 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +142 -49
- package/dist/symmetry/WyckoffTable.svelte +58 -16
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +8 -14
- package/dist/symmetry/index.d.ts +15 -4
- package/dist/symmetry/index.js +308 -81
- package/dist/symmetry/spacegroups.d.ts +5 -1
- package/dist/symmetry/spacegroups.js +18 -3
- package/dist/symmetry/symmetry-elements.d.ts +33 -0
- package/dist/symmetry/symmetry-elements.js +521 -0
- package/dist/symmetry/wyckoff-db.d.ts +9 -0
- package/dist/symmetry/wyckoff-db.js +87 -0
- package/dist/table/HeatmapTable.svelte +1104 -378
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +5 -12
- package/dist/table/index.d.ts +21 -6
- package/dist/table/index.js +34 -21
- package/dist/theme/ThemeControl.svelte +16 -8
- package/dist/theme/index.d.ts +1 -5
- package/dist/theme/index.js +4 -10
- package/dist/theme/themes.mjs +14 -7
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +2 -5
- package/dist/trajectory/Trajectory.svelte +556 -352
- package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +28 -54
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +88 -99
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +73 -71
- package/dist/trajectory/format-detect.d.ts +0 -1
- package/dist/trajectory/format-detect.js +13 -17
- package/dist/trajectory/frame-reader.d.ts +2 -1
- package/dist/trajectory/frame-reader.js +74 -136
- package/dist/trajectory/helpers.d.ts +12 -2
- package/dist/trajectory/helpers.js +68 -37
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- package/dist/trajectory/parse/ase.d.ts +9 -1
- package/dist/trajectory/parse/ase.js +47 -32
- package/dist/trajectory/parse/diagnostics.d.ts +3 -0
- package/dist/trajectory/parse/diagnostics.js +14 -0
- package/dist/trajectory/parse/h5-utils.d.ts +13 -0
- package/dist/trajectory/parse/h5-utils.js +109 -0
- package/dist/trajectory/parse/hdf5.d.ts +1 -1
- package/dist/trajectory/parse/hdf5.js +116 -106
- package/dist/trajectory/parse/index.d.ts +3 -4
- package/dist/trajectory/parse/index.js +68 -119
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +14 -16
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +13 -9
- package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
- package/dist/trajectory/parse/vaspout-electronic.js +207 -0
- package/dist/trajectory/parse/vaspout-h5.d.ts +5 -0
- package/dist/trajectory/parse/vaspout-h5.js +284 -0
- package/dist/trajectory/parse/xyz.d.ts +9 -21
- package/dist/trajectory/parse/xyz.js +38 -39
- package/dist/trajectory/plotting.d.ts +8 -10
- package/dist/trajectory/plotting.js +102 -127
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +8 -1
- package/dist/xrd/XrdPlot.svelte +56 -85
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +8 -15
- package/dist/xrd/index.d.ts +2 -2
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +77 -36
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/element/data.json +0 -11864
- package/dist/fermi-surface/marching-cubes.d.ts +0 -2
- package/dist/fermi-surface/marching-cubes.js +0 -2
- package/dist/plot/core/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/core/hover-lock.svelte.js +0 -45
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
- package/dist/structure/label-placement.d.ts +0 -14
- package/dist/structure/label-placement.js +0 -72
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { is_plain_object } from '../utils';
|
|
1
2
|
export function is_crystal(obj) {
|
|
2
|
-
if (obj
|
|
3
|
+
if (!is_plain_object(obj))
|
|
3
4
|
return false;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const has_sites = Array.isArray(sites) && sites.length > 0;
|
|
8
|
-
const has_lattice = lattice !== undefined && lattice !== null && typeof lattice === `object`;
|
|
5
|
+
const has_sites = Array.isArray(obj.sites) && obj.sites.length > 0;
|
|
6
|
+
// lattice may be an object or (in some raw formats) a 3x3 array, so only reject nullish
|
|
7
|
+
const has_lattice = obj.lattice !== undefined && obj.lattice !== null && typeof obj.lattice === `object`;
|
|
9
8
|
return has_sites && has_lattice;
|
|
10
9
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!-- Legend + per-kind visibility toggles for symmetry-element overlays. Renders one
|
|
2
|
+
checkbox per element kind present in `elements`, with a color swatch matching the
|
|
3
|
+
overlay render colors and the element count. Bind `show_kinds` and pass it through to
|
|
4
|
+
SymmetryElements (via symmetry_elements_props on the structure viewer). -->
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import type { ShowSymmetryKinds, SymmetryElement } from './symmetry-elements'
|
|
7
|
+
import {
|
|
8
|
+
count_symmetry_elements,
|
|
9
|
+
DEFAULT_SHOW_SYM_KINDS,
|
|
10
|
+
SYM_ELEM_KIND_INFO,
|
|
11
|
+
SYM_ELEM_KINDS,
|
|
12
|
+
} from './symmetry-elements'
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
elements = [],
|
|
16
|
+
show_kinds = $bindable({ ...DEFAULT_SHOW_SYM_KINDS }),
|
|
17
|
+
...rest
|
|
18
|
+
}: {
|
|
19
|
+
elements?: SymmetryElement[]
|
|
20
|
+
show_kinds?: ShowSymmetryKinds
|
|
21
|
+
[key: string]: unknown
|
|
22
|
+
} = $props()
|
|
23
|
+
|
|
24
|
+
const counts = $derived(count_symmetry_elements(elements))
|
|
25
|
+
const present_kinds = $derived(SYM_ELEM_KINDS.filter((kind) => counts[kind]))
|
|
26
|
+
|
|
27
|
+
function toggle_kind(kind: (typeof SYM_ELEM_KINDS)[number], checked: boolean) {
|
|
28
|
+
// Reassign (not mutate) so bound parents always see the change
|
|
29
|
+
show_kinds = { ...show_kinds, [kind]: checked }
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
{#if present_kinds.length > 0}
|
|
34
|
+
<div class="sym-elem-controls" {...rest}>
|
|
35
|
+
{#each present_kinds as kind (kind)}
|
|
36
|
+
<label>
|
|
37
|
+
<input
|
|
38
|
+
type="checkbox"
|
|
39
|
+
checked={show_kinds[kind] ?? false}
|
|
40
|
+
onchange={(evt) => toggle_kind(kind, evt.currentTarget.checked)}
|
|
41
|
+
/>
|
|
42
|
+
<span class="swatch" style:background={SYM_ELEM_KIND_INFO[kind].color}></span>
|
|
43
|
+
{SYM_ELEM_KIND_INFO[kind].label} ({counts[kind]})
|
|
44
|
+
</label>
|
|
45
|
+
{/each}
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
.sym-elem-controls {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
gap: 3pt;
|
|
54
|
+
}
|
|
55
|
+
label {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: 6pt;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
font-size: 0.95em;
|
|
61
|
+
}
|
|
62
|
+
.swatch {
|
|
63
|
+
width: 0.9em;
|
|
64
|
+
height: 0.9em;
|
|
65
|
+
border-radius: 2px;
|
|
66
|
+
border: 1px solid var(--border-color, #ccc);
|
|
67
|
+
flex-shrink: 0;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ShowSymmetryKinds, SymmetryElement } from './symmetry-elements';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
elements?: SymmetryElement[];
|
|
4
|
+
show_kinds?: ShowSymmetryKinds;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
declare const SymmetryElementControls: import("svelte").Component<$$ComponentProps, {}, "show_kinds">;
|
|
8
|
+
type SymmetryElementControls = ReturnType<typeof SymmetryElementControls>;
|
|
9
|
+
export default SymmetryElementControls;
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
<!-- Render crystallographic symmetry elements (rotation/screw axes, mirror/glide
|
|
2
|
+
planes, inversion centers, rotoinversion axes) inside a Threlte scene. Elements come
|
|
3
|
+
from symmetry_elements_from_ops and are expressed in fractional coordinates of the cell
|
|
4
|
+
described by `lattice` — make sure both refer to the SAME cell (moyo operations are in
|
|
5
|
+
the input-cell frame, so pass the original structure's lattice).
|
|
6
|
+
|
|
7
|
+
Visual conventions (loosely following ITA diagram conventions: translation-carrying
|
|
8
|
+
elements are dashed/striped):
|
|
9
|
+
- rotation axes: solid cylinders, colored by order
|
|
10
|
+
- screw axes: DASHED cylinders (short dashes, gaps narrower than dashes; same order
|
|
11
|
+
colors, slightly thinner)
|
|
12
|
+
- mirror planes: solid translucent fills with opaque outlines
|
|
13
|
+
- glide planes: STRIPED translucent fills (stripes run along the glide-translation
|
|
14
|
+
direction) with opaque outlines
|
|
15
|
+
- inversion centers / rotoinversion markers: small faceted octahedra — themselves
|
|
16
|
+
centrosymmetric, and clearly distinct from the smooth spheres used for atoms
|
|
17
|
+
|
|
18
|
+
For performance, geometries are merged per material group (one draw call per distinct
|
|
19
|
+
color/opacity instead of one mesh per element) and disposed on change/unmount. -->
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import type { Matrix3x3, Vec2, Vec3 } from '../math'
|
|
22
|
+
import * as math from '../math'
|
|
23
|
+
import { quaternion_from_direction } from '../structure/geometry'
|
|
24
|
+
import type { ShowSymmetryKinds, SymmetryElement } from './symmetry-elements'
|
|
25
|
+
import {
|
|
26
|
+
clip_line_to_cell,
|
|
27
|
+
clip_plane_to_cell,
|
|
28
|
+
dash_segments,
|
|
29
|
+
DEFAULT_SHOW_SYM_KINDS,
|
|
30
|
+
frac_to_cart_direction,
|
|
31
|
+
} from './symmetry-elements'
|
|
32
|
+
import { T } from '@threlte/core'
|
|
33
|
+
import {
|
|
34
|
+
BufferAttribute,
|
|
35
|
+
BufferGeometry,
|
|
36
|
+
ClampToEdgeWrapping,
|
|
37
|
+
CylinderGeometry,
|
|
38
|
+
DataTexture,
|
|
39
|
+
DoubleSide,
|
|
40
|
+
LinearFilter,
|
|
41
|
+
Matrix4,
|
|
42
|
+
OctahedronGeometry,
|
|
43
|
+
RepeatWrapping,
|
|
44
|
+
RGBAFormat,
|
|
45
|
+
Vector3,
|
|
46
|
+
} from 'three'
|
|
47
|
+
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js'
|
|
48
|
+
|
|
49
|
+
let {
|
|
50
|
+
elements = [],
|
|
51
|
+
lattice,
|
|
52
|
+
// Per-kind visibility. Defaults to rotation axes ONLY: drawing every kind at once
|
|
53
|
+
// buries the structure under overlays for high-symmetry cells. Toggle additional
|
|
54
|
+
// kinds individually (e.g. via SymmetryElementControls).
|
|
55
|
+
show_kinds = DEFAULT_SHOW_SYM_KINDS,
|
|
56
|
+
// hide 2-fold axes that are sub-elements of higher-order axes on the same line
|
|
57
|
+
hide_redundant_axes = true,
|
|
58
|
+
axis_radius = 0.04,
|
|
59
|
+
screw_radius = 0.03,
|
|
60
|
+
// [dash, gap] in Å for dashed screw axes — gap narrower than dash so the line
|
|
61
|
+
// reads as continuous-but-broken rather than sparse
|
|
62
|
+
screw_dash = [0.25, 0.1] as Vec2,
|
|
63
|
+
inversion_radius = 0.12,
|
|
64
|
+
plane_opacity = 0.2,
|
|
65
|
+
glide_opacity = 0.15,
|
|
66
|
+
// opaque polygon outlines make overlapping translucent planes legible
|
|
67
|
+
show_plane_edges = true,
|
|
68
|
+
plane_edge_opacity = 0.9,
|
|
69
|
+
// stripe period in Å for glide-plane fills (stripes run along the glide direction)
|
|
70
|
+
glide_stripe_period = 0.7,
|
|
71
|
+
axis_colors = { 2: `#e63946`, 3: `#2a9d8f`, 4: `#3a6fb0`, 6: `#9c27b0` },
|
|
72
|
+
mirror_color = `#ffb703`,
|
|
73
|
+
glide_color = `#8ecae6`,
|
|
74
|
+
inversion_color = `#555555`,
|
|
75
|
+
}: {
|
|
76
|
+
elements?: SymmetryElement[]
|
|
77
|
+
lattice: Matrix3x3
|
|
78
|
+
show_kinds?: ShowSymmetryKinds
|
|
79
|
+
hide_redundant_axes?: boolean
|
|
80
|
+
axis_radius?: number
|
|
81
|
+
screw_radius?: number
|
|
82
|
+
screw_dash?: Vec2
|
|
83
|
+
inversion_radius?: number
|
|
84
|
+
plane_opacity?: number
|
|
85
|
+
glide_opacity?: number
|
|
86
|
+
show_plane_edges?: boolean
|
|
87
|
+
plane_edge_opacity?: number
|
|
88
|
+
glide_stripe_period?: number
|
|
89
|
+
axis_colors?: Record<number, string>
|
|
90
|
+
mirror_color?: string
|
|
91
|
+
glide_color?: string
|
|
92
|
+
inversion_color?: string
|
|
93
|
+
} = $props()
|
|
94
|
+
|
|
95
|
+
const UNIT_SCALE = new Vector3(1, 1, 1)
|
|
96
|
+
|
|
97
|
+
// 1D stripe alpha texture for glide fills (three.js alphaMap samples the GREEN
|
|
98
|
+
// channel): ~55% full-alpha stripe, ~45% faint background so the plane stays
|
|
99
|
+
// contiguous between stripes. Repeats along U; V is constant.
|
|
100
|
+
const stripe_texture = (() => {
|
|
101
|
+
const width = 16
|
|
102
|
+
const data = new Uint8Array(width * 4)
|
|
103
|
+
for (let px = 0; px < width; px++) {
|
|
104
|
+
const val = px < 9 ? 255 : 56
|
|
105
|
+
data.set([val, val, val, 255], px * 4)
|
|
106
|
+
}
|
|
107
|
+
const tex = new DataTexture(data, width, 1, RGBAFormat)
|
|
108
|
+
tex.wrapS = RepeatWrapping
|
|
109
|
+
tex.wrapT = ClampToEdgeWrapping
|
|
110
|
+
tex.magFilter = LinearFilter
|
|
111
|
+
tex.minFilter = LinearFilter
|
|
112
|
+
tex.needsUpdate = true
|
|
113
|
+
return tex
|
|
114
|
+
})()
|
|
115
|
+
|
|
116
|
+
// Key identifying the geometric line of an axis element (direction + intercept)
|
|
117
|
+
const line_key = (elem: SymmetryElement): string => {
|
|
118
|
+
const axis = elem.axis
|
|
119
|
+
if (!axis) return ``
|
|
120
|
+
const lambda = math.dot(elem.point, axis) / math.dot(axis, axis)
|
|
121
|
+
const intercept = elem.point.map((val, idx) => val - lambda * axis[idx])
|
|
122
|
+
return `${axis.join(`,`)}|${intercept.map((val) => val.toFixed(4)).join(`,`)}`
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
type MaterialGroup = {
|
|
126
|
+
geometry: BufferGeometry
|
|
127
|
+
color: string
|
|
128
|
+
opacity?: number
|
|
129
|
+
striped?: boolean
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Cylinder of given radius/length centered at `center` pointing along unit `dir`
|
|
133
|
+
const oriented_cylinder = (
|
|
134
|
+
center: Vector3,
|
|
135
|
+
dir_unit: Vector3,
|
|
136
|
+
radius: number,
|
|
137
|
+
length: number,
|
|
138
|
+
): CylinderGeometry => {
|
|
139
|
+
const orientation = quaternion_from_direction(dir_unit.toArray() as Vec3)
|
|
140
|
+
return new CylinderGeometry(radius, radius, length, 12).applyMatrix4(
|
|
141
|
+
new Matrix4().compose(center, orientation, UNIT_SCALE),
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Axes (cylinders) + rotoinversion center markers (spheres), merged per color/radius.
|
|
146
|
+
// Pure rotations render solid; screw axes render DASHED so the two are
|
|
147
|
+
// distinguishable at a glance (translation-carrying elements are dashed, as in ITA
|
|
148
|
+
// diagrams).
|
|
149
|
+
const axis_groups: MaterialGroup[] = $derived.by(() => {
|
|
150
|
+
const axis_elements = elements.filter(
|
|
151
|
+
(elem) =>
|
|
152
|
+
(elem.kind === `rotation` || elem.kind === `screw` || elem.kind === `rotoinversion`) &&
|
|
153
|
+
show_kinds[elem.kind] &&
|
|
154
|
+
elem.axis,
|
|
155
|
+
)
|
|
156
|
+
// Drop 2-fold axes coincident with a higher-order axis (4 contains 2, 6 contains
|
|
157
|
+
// 2 and 3, -4 contains 2, …) to reduce visual clutter. Computed over the VISIBLE
|
|
158
|
+
// elements only, so 2-folds reappear when their enclosing higher-order kind is
|
|
159
|
+
// toggled off.
|
|
160
|
+
const max_order_by_line = new Map<string, number>()
|
|
161
|
+
for (const elem of axis_elements) {
|
|
162
|
+
const key = line_key(elem)
|
|
163
|
+
max_order_by_line.set(key, Math.max(max_order_by_line.get(key) ?? 0, elem.order))
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const parts_by_group = new Map<string, BufferGeometry[]>()
|
|
167
|
+
for (const elem of axis_elements) {
|
|
168
|
+
if (hide_redundant_axes && elem.order < (max_order_by_line.get(line_key(elem)) ?? 0))
|
|
169
|
+
continue
|
|
170
|
+
const clipped = clip_line_to_cell(elem.point, elem.axis as Vec3, lattice)
|
|
171
|
+
if (!clipped) continue
|
|
172
|
+
const [start, end] = clipped
|
|
173
|
+
const span = new Vector3(...math.subtract(end, start))
|
|
174
|
+
const length = span.length()
|
|
175
|
+
if (length < 1e-6) continue
|
|
176
|
+
const dir_unit = span.clone().normalize()
|
|
177
|
+
const start_vec = new Vector3(...start)
|
|
178
|
+
|
|
179
|
+
// Radius is baked into each geometry, so one merged group per color suffices
|
|
180
|
+
const color = axis_colors[elem.order] ?? `#777777`
|
|
181
|
+
const group = parts_by_group.get(color) ?? []
|
|
182
|
+
|
|
183
|
+
if (elem.kind === `screw`) {
|
|
184
|
+
// Dashed cylinder: segments along the axis, touching both cell faces
|
|
185
|
+
for (const dash of dash_segments(length, screw_dash[0], screw_dash[1])) {
|
|
186
|
+
const center = start_vec.clone().addScaledVector(dir_unit, dash.center)
|
|
187
|
+
group.push(oriented_cylinder(center, dir_unit, screw_radius, dash.length))
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
const center = start_vec.clone().addScaledVector(dir_unit, length / 2)
|
|
191
|
+
group.push(oriented_cylinder(center, dir_unit, axis_radius, length))
|
|
192
|
+
}
|
|
193
|
+
if (elem.kind === `rotoinversion`) {
|
|
194
|
+
const [cx, cy, cz] = frac_to_cart_direction(elem.point, lattice)
|
|
195
|
+
group.push(new OctahedronGeometry(inversion_radius * 0.8).translate(cx, cy, cz))
|
|
196
|
+
}
|
|
197
|
+
parts_by_group.set(color, group)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return [...parts_by_group.entries()].flatMap(([color, geometries]) => {
|
|
201
|
+
const merged = mergeGeometries(geometries)
|
|
202
|
+
geometries.forEach((geo) => geo.dispose())
|
|
203
|
+
return merged ? [{ geometry: merged, color }] : []
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
// Visible mirror/glide planes clipped to the cell — computed once, shared by the
|
|
208
|
+
// fill and outline groups below. stripe_dir is the unit Cartesian glide direction
|
|
209
|
+
// (null for mirrors and translation-less entries).
|
|
210
|
+
const visible_planes = $derived.by(() => {
|
|
211
|
+
const planes: {
|
|
212
|
+
polygon: Vec3[]
|
|
213
|
+
color: string
|
|
214
|
+
opacity: number
|
|
215
|
+
stripe_dir: Vec3 | null
|
|
216
|
+
}[] = []
|
|
217
|
+
for (const elem of elements) {
|
|
218
|
+
if ((elem.kind !== `mirror` && elem.kind !== `glide`) || !elem.axis) continue
|
|
219
|
+
if (!show_kinds[elem.kind]) continue
|
|
220
|
+
const polygon = clip_plane_to_cell(elem.point, elem.axis, lattice)
|
|
221
|
+
if (polygon.length < 3) continue
|
|
222
|
+
const is_mirror = elem.kind === `mirror`
|
|
223
|
+
planes.push({
|
|
224
|
+
polygon,
|
|
225
|
+
color: is_mirror ? mirror_color : glide_color,
|
|
226
|
+
opacity: is_mirror ? plane_opacity : glide_opacity,
|
|
227
|
+
stripe_dir: elem.translation
|
|
228
|
+
? math.normalize_vec(frac_to_cart_direction(elem.translation, lattice))
|
|
229
|
+
: null,
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
return planes
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
// Plane FILLS: triangles concatenated per color+opacity into one geometry. Glide
|
|
236
|
+
// fills carry per-vertex UVs whose U coordinate measures Cartesian distance along
|
|
237
|
+
// the glide-translation direction, so the stripe alphaMap renders stripes running
|
|
238
|
+
// along the glide direction — the pattern shows both that the plane glides and
|
|
239
|
+
// where it translates.
|
|
240
|
+
const plane_groups: MaterialGroup[] = $derived.by(() => {
|
|
241
|
+
const groups = new Map<string, { positions: number[]; uvs: number[] }>()
|
|
242
|
+
for (const { polygon, color, opacity, stripe_dir } of visible_planes) {
|
|
243
|
+
const group_key = `${color}|${opacity}|${stripe_dir ? 1 : 0}`
|
|
244
|
+
const group = groups.get(group_key) ?? { positions: [], uvs: [] }
|
|
245
|
+
// Stripe coordinate: Cartesian distance along the glide direction / period
|
|
246
|
+
const stripe_u = (vert: Vec3): number =>
|
|
247
|
+
stripe_dir ? math.dot(vert, stripe_dir) / glide_stripe_period : 0
|
|
248
|
+
// Fan triangulation of the convex polygon
|
|
249
|
+
for (let idx = 1; idx < polygon.length - 1; idx++) {
|
|
250
|
+
for (const vert of [polygon[0], polygon[idx], polygon[idx + 1]]) {
|
|
251
|
+
group.positions.push(...vert)
|
|
252
|
+
group.uvs.push(stripe_u(vert), 0.5)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
groups.set(group_key, group)
|
|
256
|
+
}
|
|
257
|
+
return [...groups.entries()].map(([group_key, { positions, uvs }]) => {
|
|
258
|
+
const geometry = new BufferGeometry()
|
|
259
|
+
geometry.setAttribute(`position`, new BufferAttribute(new Float32Array(positions), 3))
|
|
260
|
+
geometry.setAttribute(`uv`, new BufferAttribute(new Float32Array(uvs), 2))
|
|
261
|
+
geometry.computeVertexNormals()
|
|
262
|
+
const [color, opacity, striped] = group_key.split(`|`)
|
|
263
|
+
return { geometry, color, opacity: Number(opacity), striped: striped === `1` }
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
// Opaque plane OUTLINES (line segments per color): crisp borders keep overlapping
|
|
268
|
+
// translucent planes individually legible instead of blending into a single wash.
|
|
269
|
+
const plane_edge_groups: MaterialGroup[] = $derived.by(() => {
|
|
270
|
+
if (!show_plane_edges) return []
|
|
271
|
+
const segments_by_color = new Map<string, number[]>()
|
|
272
|
+
for (const { polygon, color } of visible_planes) {
|
|
273
|
+
const positions = segments_by_color.get(color) ?? []
|
|
274
|
+
for (let idx = 0; idx < polygon.length; idx++) {
|
|
275
|
+
positions.push(...polygon[idx], ...polygon[(idx + 1) % polygon.length])
|
|
276
|
+
}
|
|
277
|
+
segments_by_color.set(color, positions)
|
|
278
|
+
}
|
|
279
|
+
return [...segments_by_color.entries()].map(([color, positions]) => {
|
|
280
|
+
const geometry = new BufferGeometry()
|
|
281
|
+
geometry.setAttribute(`position`, new BufferAttribute(new Float32Array(positions), 3))
|
|
282
|
+
return { geometry, color }
|
|
283
|
+
})
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
// Inversion centers: faceted octahedra (centrosymmetric, unlike the smooth spheres
|
|
287
|
+
// used for atoms) merged into a single geometry
|
|
288
|
+
const inversion_group: MaterialGroup | null = $derived.by(() => {
|
|
289
|
+
if (!show_kinds.inversion) return null
|
|
290
|
+
const markers = elements
|
|
291
|
+
.filter((elem) => elem.kind === `inversion`)
|
|
292
|
+
.map((elem) => {
|
|
293
|
+
const [cx, cy, cz] = frac_to_cart_direction(elem.point, lattice)
|
|
294
|
+
return new OctahedronGeometry(inversion_radius).translate(cx, cy, cz)
|
|
295
|
+
})
|
|
296
|
+
if (markers.length === 0) return null
|
|
297
|
+
const merged = mergeGeometries(markers)
|
|
298
|
+
markers.forEach((geo) => geo.dispose())
|
|
299
|
+
return merged ? { geometry: merged, color: inversion_color } : null
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
// Dispose each group's merged geometries when that group recomputes or on unmount. One
|
|
303
|
+
// $effect per group (rather than a single combined one): the deriveds recompute
|
|
304
|
+
// independently — e.g. tweaking a plane-only prop rebuilds plane_groups but not
|
|
305
|
+
// axis_groups — and a combined effect would dispose the still-mounted axis geometry.
|
|
306
|
+
const dispose_geometries = (groups: { geometry: BufferGeometry }[]) => () =>
|
|
307
|
+
groups.forEach((group) => group.geometry.dispose())
|
|
308
|
+
$effect(() => dispose_geometries(axis_groups))
|
|
309
|
+
$effect(() => dispose_geometries(plane_groups))
|
|
310
|
+
$effect(() => dispose_geometries(plane_edge_groups))
|
|
311
|
+
$effect(() => dispose_geometries(inversion_group ? [inversion_group] : []))
|
|
312
|
+
|
|
313
|
+
// Dispose the (non-reactive) stripe texture on unmount
|
|
314
|
+
$effect(() => () => stripe_texture.dispose())
|
|
315
|
+
</script>
|
|
316
|
+
|
|
317
|
+
{#each axis_groups as group, idx (idx)}
|
|
318
|
+
<T.Mesh geometry={group.geometry}>
|
|
319
|
+
<T.MeshStandardMaterial color={group.color} />
|
|
320
|
+
</T.Mesh>
|
|
321
|
+
{/each}
|
|
322
|
+
|
|
323
|
+
{#each plane_groups as group, idx (idx)}
|
|
324
|
+
<T.Mesh geometry={group.geometry}>
|
|
325
|
+
<T.MeshStandardMaterial
|
|
326
|
+
color={group.color}
|
|
327
|
+
transparent
|
|
328
|
+
opacity={group.opacity}
|
|
329
|
+
alphaMap={group.striped ? stripe_texture : null}
|
|
330
|
+
side={DoubleSide}
|
|
331
|
+
depthWrite={false}
|
|
332
|
+
/>
|
|
333
|
+
</T.Mesh>
|
|
334
|
+
{/each}
|
|
335
|
+
|
|
336
|
+
{#each plane_edge_groups as group, idx (idx)}
|
|
337
|
+
<T.LineSegments geometry={group.geometry}>
|
|
338
|
+
<T.LineBasicMaterial
|
|
339
|
+
color={group.color}
|
|
340
|
+
transparent={plane_edge_opacity < 1}
|
|
341
|
+
opacity={plane_edge_opacity}
|
|
342
|
+
/>
|
|
343
|
+
</T.LineSegments>
|
|
344
|
+
{/each}
|
|
345
|
+
|
|
346
|
+
{#if inversion_group}
|
|
347
|
+
<T.Mesh geometry={inversion_group.geometry}>
|
|
348
|
+
<T.MeshStandardMaterial color={inversion_group.color} />
|
|
349
|
+
</T.Mesh>
|
|
350
|
+
{/if}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Matrix3x3, Vec2 } from '../math';
|
|
2
|
+
import type { ShowSymmetryKinds, SymmetryElement } from './symmetry-elements';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
elements?: SymmetryElement[];
|
|
5
|
+
lattice: Matrix3x3;
|
|
6
|
+
show_kinds?: ShowSymmetryKinds;
|
|
7
|
+
hide_redundant_axes?: boolean;
|
|
8
|
+
axis_radius?: number;
|
|
9
|
+
screw_radius?: number;
|
|
10
|
+
screw_dash?: Vec2;
|
|
11
|
+
inversion_radius?: number;
|
|
12
|
+
plane_opacity?: number;
|
|
13
|
+
glide_opacity?: number;
|
|
14
|
+
show_plane_edges?: boolean;
|
|
15
|
+
plane_edge_opacity?: number;
|
|
16
|
+
glide_stripe_period?: number;
|
|
17
|
+
axis_colors?: Record<number, string>;
|
|
18
|
+
mirror_color?: string;
|
|
19
|
+
glide_color?: string;
|
|
20
|
+
inversion_color?: string;
|
|
21
|
+
};
|
|
22
|
+
declare const SymmetryElements: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
23
|
+
type SymmetryElements = ReturnType<typeof SymmetryElements>;
|
|
24
|
+
export default SymmetryElements;
|