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
package/dist/xrd/XrdPlot.svelte
CHANGED
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
import { add_alpha, PLOT_COLORS } from '../colors'
|
|
3
3
|
import EmptyState from '../EmptyState.svelte'
|
|
4
4
|
import StatusMessage from '../feedback/StatusMessage.svelte'
|
|
5
|
-
import
|
|
6
|
-
decompress_data_binary,
|
|
7
|
-
decompress_file,
|
|
8
|
-
detect_compression_format,
|
|
9
|
-
drag_over_handlers,
|
|
10
|
-
handle_url_drop,
|
|
11
|
-
} from '../io'
|
|
5
|
+
import * as io from '../io'
|
|
12
6
|
import { format_value } from '../labels'
|
|
13
7
|
import { sanitize_html } from '../sanitize'
|
|
14
8
|
import SettingsSection from '../layout/SettingsSection.svelte'
|
|
@@ -34,11 +28,7 @@
|
|
|
34
28
|
const pattern_obj = obj as { x?: unknown; y?: unknown }
|
|
35
29
|
const x_vals = pattern_obj.x
|
|
36
30
|
const y_vals = pattern_obj.y
|
|
37
|
-
return (
|
|
38
|
-
Array.isArray(x_vals) &&
|
|
39
|
-
Array.isArray(y_vals) &&
|
|
40
|
-
x_vals.length === y_vals.length
|
|
41
|
-
)
|
|
31
|
+
return Array.isArray(x_vals) && Array.isArray(y_vals) && x_vals.length === y_vals.length
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
function format_hkl(hkl: Hkl, format: HklFormat): string {
|
|
@@ -82,10 +72,8 @@
|
|
|
82
72
|
broadening_params = $bindable({ ...DEFAULT_BROADENING }),
|
|
83
73
|
controls = {},
|
|
84
74
|
...rest
|
|
85
|
-
}:
|
|
86
|
-
|
|
87
|
-
& ComponentProps<typeof ScatterPlot>
|
|
88
|
-
& {
|
|
75
|
+
}: ComponentProps<typeof BarPlot> &
|
|
76
|
+
ComponentProps<typeof ScatterPlot> & {
|
|
89
77
|
patterns:
|
|
90
78
|
| XrdPattern
|
|
91
79
|
| Record<string, XrdPattern | { pattern: XrdPattern; color?: string }>
|
|
@@ -115,25 +103,18 @@
|
|
|
115
103
|
const base_entries = Array.isArray(patterns)
|
|
116
104
|
? (patterns as PatternEntry[])
|
|
117
105
|
: is_xrd_pattern(patterns)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
).map(([label, value]) =>
|
|
125
|
-
`pattern` in value
|
|
126
|
-
? { label, ...value }
|
|
127
|
-
: { label, pattern: value as XrdPattern }
|
|
128
|
-
)
|
|
106
|
+
? [{ label: `XRD Pattern`, pattern: patterns as XrdPattern }]
|
|
107
|
+
: Object.entries(
|
|
108
|
+
patterns as Record<string, XrdPattern | { pattern: XrdPattern; color?: string }>,
|
|
109
|
+
).map(([label, value]) =>
|
|
110
|
+
`pattern` in value ? { label, ...value } : { label, pattern: value as XrdPattern },
|
|
111
|
+
)
|
|
129
112
|
// Merge user-provided patterns with any dropped-on-the-fly entries
|
|
130
113
|
return [...base_entries, ...dropped_entries]
|
|
131
114
|
})
|
|
132
115
|
|
|
133
116
|
// Decide default show_angles
|
|
134
|
-
const actual_show_angles = $derived(
|
|
135
|
-
show_angles ?? pattern_entries.length <= 2,
|
|
136
|
-
)
|
|
117
|
+
const actual_show_angles = $derived(show_angles ?? pattern_entries.length <= 2)
|
|
137
118
|
|
|
138
119
|
// Compute global max intensity for normalization (as in pymatviz xrd_pattern)
|
|
139
120
|
const global_max_intensity = $derived.by(() => {
|
|
@@ -177,18 +158,17 @@
|
|
|
177
158
|
const labels: (string | null)[] = []
|
|
178
159
|
|
|
179
160
|
// Determine which peaks to annotate
|
|
180
|
-
const intens = ys
|
|
181
161
|
let selected_indices: number[] = []
|
|
182
|
-
if (annotate_peaks
|
|
162
|
+
if (annotate_peaks > 0) {
|
|
183
163
|
let candidates: { idx: number; y_val: number }[] = []
|
|
184
|
-
if (annotate_peaks
|
|
164
|
+
if (annotate_peaks < 1) {
|
|
185
165
|
const thresh = annotate_peaks * 100
|
|
186
|
-
candidates =
|
|
166
|
+
candidates = ys
|
|
187
167
|
.map((y_val, idx) => ({ y_val, idx }))
|
|
188
168
|
.filter(({ y_val }) => y_val > thresh)
|
|
189
169
|
} else {
|
|
190
|
-
const max_peaks = Math.min(
|
|
191
|
-
candidates =
|
|
170
|
+
const max_peaks = Math.min(ys.length, Math.floor(annotate_peaks))
|
|
171
|
+
candidates = ys
|
|
192
172
|
.map((y_val, idx) => ({ y_val, idx }))
|
|
193
173
|
.sort((a, b) => b.y_val - a.y_val)
|
|
194
174
|
.slice(0, max_peaks)
|
|
@@ -221,10 +201,8 @@
|
|
|
221
201
|
metadata.push({ hkls, d: d_hkl, label: entry.label })
|
|
222
202
|
|
|
223
203
|
if (selected_indices.includes(idx)) {
|
|
224
|
-
const angle_text = actual_show_angles
|
|
225
|
-
|
|
226
|
-
: ``
|
|
227
|
-
const hkl_text = hkls && hkl_format
|
|
204
|
+
const angle_text = actual_show_angles ? `${format_value(xs[idx], `.2f`)}°` : ``
|
|
205
|
+
const hkl_text = hkl_format
|
|
228
206
|
? hkls.map((hkl_val) => format_hkl(hkl_val, hkl_format)).join(`, `)
|
|
229
207
|
: ``
|
|
230
208
|
// Use @ separator between hkl and angle for better clarity
|
|
@@ -253,49 +231,32 @@
|
|
|
253
231
|
if (!broadening_enabled) return []
|
|
254
232
|
|
|
255
233
|
const include_name = pattern_entries.length > 1
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const max_y = Math.max(...all_ys, 1) // Avoid div by zero
|
|
283
|
-
|
|
284
|
-
const scale = (y_val: number) => (y_val / max_y) * 100
|
|
285
|
-
const base_color = entry.color ?? PLOT_COLORS[entry_idx % PLOT_COLORS.length]
|
|
286
|
-
// Add transparency when multiple series overlap
|
|
287
|
-
const alpha = all_processed.length > 1 ? 0.6 : 1
|
|
288
|
-
|
|
289
|
-
return {
|
|
290
|
-
x: broadened.x,
|
|
291
|
-
y: broadened.y.map(scale),
|
|
292
|
-
label: include_name ? entry.label : ``,
|
|
293
|
-
color: add_alpha(base_color, alpha),
|
|
294
|
-
markers: `line`, // Only line for profile
|
|
295
|
-
line_style: { stroke_width: 2 },
|
|
296
|
-
visible: true,
|
|
297
|
-
} as DataSeries
|
|
298
|
-
})
|
|
234
|
+
// Normalize so the highest peak across ALL broadened profiles is 100: per-profile
|
|
235
|
+
// normalization would lose relative scaling between patterns, while the stick-view
|
|
236
|
+
// global max would make broadened peaks tiny (broadening spreads intensity)
|
|
237
|
+
const broadened = pattern_entries.map((entry) =>
|
|
238
|
+
compute_broadened_pattern(entry.pattern, broadening_params, angle_range),
|
|
239
|
+
)
|
|
240
|
+
let max_y = 1 // avoid div by zero
|
|
241
|
+
for (const profile of broadened) {
|
|
242
|
+
for (const y_val of profile.y) max_y = Math.max(max_y, y_val)
|
|
243
|
+
}
|
|
244
|
+
// Add transparency when multiple series overlap
|
|
245
|
+
const alpha = pattern_entries.length > 1 ? 0.6 : 1
|
|
246
|
+
|
|
247
|
+
return broadened.map((profile, entry_idx) => {
|
|
248
|
+
const entry = pattern_entries[entry_idx]
|
|
249
|
+
const base_color = entry.color ?? PLOT_COLORS[entry_idx % PLOT_COLORS.length]
|
|
250
|
+
return {
|
|
251
|
+
x: profile.x,
|
|
252
|
+
y: profile.y.map((y_val) => (y_val / max_y) * 100),
|
|
253
|
+
label: include_name ? entry.label : ``,
|
|
254
|
+
color: add_alpha(base_color, alpha),
|
|
255
|
+
markers: `line`, // Only line for profile
|
|
256
|
+
line_style: { stroke_width: 2 },
|
|
257
|
+
visible: true,
|
|
258
|
+
} as DataSeries
|
|
259
|
+
})
|
|
299
260
|
})
|
|
300
261
|
|
|
301
262
|
async function handle_file_drop(event: DragEvent) {
|
|
@@ -305,10 +266,7 @@
|
|
|
305
266
|
loading = true
|
|
306
267
|
error_msg = undefined
|
|
307
268
|
|
|
308
|
-
const compute_and_add = async (
|
|
309
|
-
content: string | ArrayBuffer,
|
|
310
|
-
filename: string,
|
|
311
|
-
) => {
|
|
269
|
+
const compute_and_add = async (content: string | ArrayBuffer, filename: string) => {
|
|
312
270
|
const result = await add_xrd_pattern(content, filename, wavelength)
|
|
313
271
|
if (result.error) {
|
|
314
272
|
error_msg = result.error
|
|
@@ -319,20 +277,19 @@
|
|
|
319
277
|
|
|
320
278
|
try {
|
|
321
279
|
// Handle URL-based drops
|
|
322
|
-
const handled = await
|
|
323
|
-
event,
|
|
324
|
-
|
|
325
|
-
).catch(() => false)
|
|
280
|
+
const handled = await io
|
|
281
|
+
.handle_url_drop(event, on_file_drop || compute_and_add)
|
|
282
|
+
.catch(() => false)
|
|
326
283
|
if (handled) return
|
|
327
284
|
|
|
328
285
|
const file = event.dataTransfer?.files?.[0]
|
|
329
286
|
if (file) {
|
|
330
287
|
try {
|
|
331
288
|
const lower_name = file.name.toLowerCase()
|
|
332
|
-
const compression_format = detect_compression_format(lower_name)
|
|
289
|
+
const compression_format = io.detect_compression_format(lower_name)
|
|
333
290
|
// Get base filename without compression extension
|
|
334
291
|
const base_name = compression_format
|
|
335
|
-
? lower_name.replace(/\.(gz|gzip)$/i, ``)
|
|
292
|
+
? lower_name.replace(/\.(?:gz|gzip)$/i, ``)
|
|
336
293
|
: lower_name
|
|
337
294
|
const base_ext = base_name.split(`.`).pop()
|
|
338
295
|
|
|
@@ -341,7 +298,7 @@
|
|
|
341
298
|
let buffer = await file.arrayBuffer()
|
|
342
299
|
// Decompress if gzipped
|
|
343
300
|
if (compression_format === `gzip`) {
|
|
344
|
-
buffer = await decompress_data_binary(buffer, `gzip`)
|
|
301
|
+
buffer = await io.decompress_data_binary(buffer, `gzip`)
|
|
345
302
|
}
|
|
346
303
|
const output_name = base_name.endsWith(`.brml`)
|
|
347
304
|
? base_name
|
|
@@ -349,13 +306,11 @@
|
|
|
349
306
|
await (on_file_drop || compute_and_add)(buffer, output_name)
|
|
350
307
|
} else {
|
|
351
308
|
// Text-based formats (.xy, .xye, .xrdml) - decompress_file handles .gz
|
|
352
|
-
const { content, filename } = await decompress_file(file)
|
|
309
|
+
const { content, filename } = await io.decompress_file(file)
|
|
353
310
|
if (content) await (on_file_drop || compute_and_add)(content, filename)
|
|
354
311
|
}
|
|
355
312
|
} catch (exc) {
|
|
356
|
-
error_msg = `Failed to load file ${file.name}: ${
|
|
357
|
-
to_error(exc).message
|
|
358
|
-
}`
|
|
313
|
+
error_msg = `Failed to load file ${file.name}: ${to_error(exc).message}`
|
|
359
314
|
}
|
|
360
315
|
}
|
|
361
316
|
} finally {
|
|
@@ -381,11 +336,9 @@
|
|
|
381
336
|
</label>
|
|
382
337
|
|
|
383
338
|
{#if broadening_enabled}
|
|
384
|
-
<div
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
>
|
|
388
|
-
<label title="Caglioti U parameter">U:
|
|
339
|
+
<div class="pane-grid" style="display: grid; grid-template-columns: 1fr 1fr; gap: 1ex">
|
|
340
|
+
<label title="Caglioti U parameter"
|
|
341
|
+
>U:
|
|
389
342
|
<input
|
|
390
343
|
type="number"
|
|
391
344
|
step="0.001"
|
|
@@ -393,7 +346,8 @@
|
|
|
393
346
|
class="param-input"
|
|
394
347
|
/>
|
|
395
348
|
</label>
|
|
396
|
-
<label title="Caglioti V parameter"
|
|
349
|
+
<label title="Caglioti V parameter"
|
|
350
|
+
>V:
|
|
397
351
|
<input
|
|
398
352
|
type="number"
|
|
399
353
|
step="0.001"
|
|
@@ -401,7 +355,8 @@
|
|
|
401
355
|
class="param-input"
|
|
402
356
|
/>
|
|
403
357
|
</label>
|
|
404
|
-
<label title="Caglioti W parameter"
|
|
358
|
+
<label title="Caglioti W parameter"
|
|
359
|
+
>W:
|
|
405
360
|
<input
|
|
406
361
|
type="number"
|
|
407
362
|
step="0.001"
|
|
@@ -409,7 +364,8 @@
|
|
|
409
364
|
class="param-input"
|
|
410
365
|
/>
|
|
411
366
|
</label>
|
|
412
|
-
<label title="Pseudo-Voigt shape factor (0=Gaussian, 1=Lorentzian)"
|
|
367
|
+
<label title="Pseudo-Voigt shape factor (0=Gaussian, 1=Lorentzian)"
|
|
368
|
+
>η:
|
|
413
369
|
<input
|
|
414
370
|
type="number"
|
|
415
371
|
min="0"
|
|
@@ -438,8 +394,8 @@
|
|
|
438
394
|
{:else}
|
|
439
395
|
<StatusMessage
|
|
440
396
|
message={allow_file_drop
|
|
441
|
-
|
|
442
|
-
|
|
397
|
+
? `Drag and drop structure files (.cif, .json, etc.) or XRD data files (.xy, .csv, .ras, .uxd, .gsas, .xrdml, .brml, .raw, + .gz) here`
|
|
398
|
+
: `No XRD data to display`}
|
|
443
399
|
/>
|
|
444
400
|
{/if}
|
|
445
401
|
</EmptyState>
|
|
@@ -475,24 +431,26 @@
|
|
|
475
431
|
}}
|
|
476
432
|
{tooltip}
|
|
477
433
|
ondrop={handle_file_drop}
|
|
478
|
-
{...drag_over_handlers({
|
|
479
|
-
|
|
434
|
+
{...io.drag_over_handlers({
|
|
435
|
+
allow: () => allow_file_drop,
|
|
436
|
+
set_dragover: (over) => (dragover = over),
|
|
437
|
+
})}
|
|
438
|
+
class={[rest.class, dragover && `dragover`]}
|
|
480
439
|
style={`overflow: visible; ${rest.style ?? ``}`}
|
|
481
440
|
{controls}
|
|
482
441
|
controls_extra={broadening_controls_snippet}
|
|
483
442
|
/>
|
|
484
443
|
{:else}
|
|
485
444
|
<!-- Discrete Stick View -->
|
|
486
|
-
{#snippet tooltip(
|
|
487
|
-
info: BarHandlerProps<{ label?: string; hkls?: Hkl[]; d?: number }>,
|
|
488
|
-
)}
|
|
445
|
+
{#snippet tooltip(info: BarHandlerProps<{ label?: string; hkls?: Hkl[]; d?: number }>)}
|
|
489
446
|
{@const angle_text = `${format_value(info.x, `.2f`)}°`}
|
|
490
447
|
{@const intensity_text = `${format_value(info.y, `.1f`)}`}
|
|
491
448
|
{@const hkls = info.metadata?.hkls}
|
|
492
449
|
{@const d_spacing = info.metadata?.d}
|
|
493
|
-
{@const hkl_text =
|
|
494
|
-
|
|
495
|
-
|
|
450
|
+
{@const hkl_text =
|
|
451
|
+
hkls && hkl_format
|
|
452
|
+
? hkls.map((hkl: Hkl) => format_hkl(hkl, hkl_format)).join(`, `)
|
|
453
|
+
: ``}
|
|
496
454
|
{@const d_text = d_spacing != null ? `${format_value(d_spacing, `.3f`)} Å` : ``}
|
|
497
455
|
{@html sanitize_html(info.metadata?.label ?? ``)}<br />
|
|
498
456
|
2θ: {angle_text}<br />
|
|
@@ -526,8 +484,11 @@
|
|
|
526
484
|
}}
|
|
527
485
|
{tooltip}
|
|
528
486
|
ondrop={handle_file_drop}
|
|
529
|
-
{...drag_over_handlers({
|
|
530
|
-
|
|
487
|
+
{...io.drag_over_handlers({
|
|
488
|
+
allow: () => allow_file_drop,
|
|
489
|
+
set_dragover: (over) => (dragover = over),
|
|
490
|
+
})}
|
|
491
|
+
class={[rest.class, dragover && `dragover`]}
|
|
531
492
|
style={`overflow: visible; ${rest.style ?? ``}`}
|
|
532
493
|
show_controls={controls.show}
|
|
533
494
|
controls_open={controls.open}
|
package/dist/xrd/broadening.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { clamp01 } from '../utils';
|
|
1
2
|
const LOG_2 = Math.log(2);
|
|
2
3
|
export const DEFAULT_BROADENING = {
|
|
3
4
|
U: 0.04,
|
|
@@ -43,7 +44,7 @@ fwhm, // Full Width at Half Maximum
|
|
|
43
44
|
eta) {
|
|
44
45
|
// Intensity at x
|
|
45
46
|
// Clamp eta to [0, 1]
|
|
46
|
-
const safe_eta =
|
|
47
|
+
const safe_eta = clamp01(eta);
|
|
47
48
|
return safe_eta * lorentzian(x, x0, fwhm) + (1 - safe_eta) * gaussian(x, x0, fwhm);
|
|
48
49
|
}
|
|
49
50
|
// Computes a broadened XRD pattern from discrete peaks.
|
package/dist/xrd/calc-xrd.js
CHANGED
|
@@ -121,20 +121,14 @@ export function compute_xrd_pattern(structure, options = {}) {
|
|
|
121
121
|
}
|
|
122
122
|
wavelength = WAVELENGTHS[wl_input];
|
|
123
123
|
}
|
|
124
|
-
// Symmetry refinement (symprec > 0) is not implemented in TS version.
|
|
125
|
-
// Option retained for API parity.
|
|
126
|
-
// const symprec = options.symprec ?? 0
|
|
124
|
+
// Symmetry refinement (symprec > 0) is not implemented in TS version. Option retained for API parity.
|
|
127
125
|
// For row-wise lattice matrix A (rows are a, b, c), reciprocal rows are inv(A)^T
|
|
128
126
|
const recip_rows = math.transpose_3x3_matrix(math.matrix_inverse_3x3(structure.lattice.matrix));
|
|
129
127
|
// Bragg condition bounds: reciprocal vector length r = 2 sin(theta) / lambda
|
|
130
128
|
const two_theta_range = options.two_theta_range === null ? null : (options.two_theta_range ?? [0, 180]);
|
|
131
129
|
const [min_radius, max_radius] = two_theta_range === null
|
|
132
130
|
? [0, 2 / wavelength]
|
|
133
|
-
: ((
|
|
134
|
-
const r_min = (2 * Math.sin((t_min / 2) * (Math.PI / 180))) / wavelength;
|
|
135
|
-
const r_max = (2 * Math.sin((t_max / 2) * (Math.PI / 180))) / wavelength;
|
|
136
|
-
return [r_min, r_max];
|
|
137
|
-
})(two_theta_range);
|
|
131
|
+
: two_theta_range.map((angle) => (2 * Math.sin((angle / 2) * (Math.PI / 180))) / wavelength);
|
|
138
132
|
const recip_points = enumerate_reciprocal_points(recip_rows, structure.lattice.matrix, max_radius, min_radius);
|
|
139
133
|
const coeffs = [];
|
|
140
134
|
const frac_coords = [];
|
|
@@ -151,16 +145,11 @@ export function compute_xrd_pattern(structure, options = {}) {
|
|
|
151
145
|
if (!raw_coeff) {
|
|
152
146
|
throw new Error(`No atomic scattering coefficients for ${element_symbol}. Extend ATOMIC_SCATTERING_PARAMS.`);
|
|
153
147
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
coeff_entry = { a: raw_coeff.a.slice(), b: raw_coeff.b.slice(), c: raw_coeff.c };
|
|
162
|
-
}
|
|
163
|
-
coeffs.push(coeff_entry);
|
|
148
|
+
coeffs.push({
|
|
149
|
+
a: raw_coeff.map((row) => row[0]),
|
|
150
|
+
b: raw_coeff.map((row) => row[1]),
|
|
151
|
+
z: ELEMENT_Z[element_symbol],
|
|
152
|
+
});
|
|
164
153
|
frac_coords.push(site.abc);
|
|
165
154
|
occus.push(species.occu);
|
|
166
155
|
dw_factors.push(debye_waller_factors[element_symbol] ?? 0);
|
|
@@ -171,9 +160,7 @@ export function compute_xrd_pattern(structure, options = {}) {
|
|
|
171
160
|
const two_thetas = [];
|
|
172
161
|
const merge_tol = options.peak_merge_tol ?? TWO_THETA_TOL;
|
|
173
162
|
const scaled_tol = options.scaled_intensity_tol ?? SCALED_INTENSITY_TOL;
|
|
174
|
-
for (const
|
|
175
|
-
const hkl = entry.hkl;
|
|
176
|
-
const g_norm = entry.g_norm;
|
|
163
|
+
for (const { hkl, g_norm } of recip_points) {
|
|
177
164
|
if (g_norm === 0)
|
|
178
165
|
continue;
|
|
179
166
|
const asin_arg = (wavelength * g_norm) / 2;
|
|
@@ -184,18 +171,10 @@ export function compute_xrd_pattern(structure, options = {}) {
|
|
|
184
171
|
const sin_theta_over_lambda_sq = sin_theta_over_lambda * sin_theta_over_lambda;
|
|
185
172
|
// g.r for all fractional coords
|
|
186
173
|
const g_dot_r_all = frac_coords.map((frac_coord) => math.dot(frac_coord, hkl));
|
|
187
|
-
// Atomic scattering factors (
|
|
188
|
-
const f_scattering = coeffs.map((
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
const sum_terms = a_arr
|
|
192
|
-
.slice(0, num_terms)
|
|
193
|
-
.reduce((sum, a_i, term_idx) => sum + a_i * Math.exp(-b_arr[term_idx] * sin_theta_over_lambda_sq), 0);
|
|
194
|
-
// pymatgen-style fitted params: f = Z − 41.78214·s²·Σ aᵢ·exp(−bᵢ·s²)
|
|
195
|
-
if (atomic_number !== undefined) {
|
|
196
|
-
return atomic_number - 41.78214 * sin_theta_over_lambda_sq * sum_terms;
|
|
197
|
-
}
|
|
198
|
-
return sum_terms + (coeff_entry.c ?? 0);
|
|
174
|
+
// Atomic scattering factors: f = Z − 41.78214·s²·Σ aᵢ·exp(−bᵢ·s²) (pymatgen fitted params)
|
|
175
|
+
const f_scattering = coeffs.map(({ a: a_arr, b: b_arr, z: atomic_number }) => {
|
|
176
|
+
const sum_terms = a_arr.reduce((sum, a_i, term_idx) => sum + a_i * Math.exp(-b_arr[term_idx] * sin_theta_over_lambda_sq), 0);
|
|
177
|
+
return atomic_number - 41.78214 * sin_theta_over_lambda_sq * sum_terms;
|
|
199
178
|
});
|
|
200
179
|
const dw_corr = dw_factors.map((dw_b) => Math.exp(-dw_b * sin_theta_over_lambda_sq));
|
|
201
180
|
// Structure factor sum: sum(fs * occu * exp(2πi g·r) * DW)
|
|
@@ -214,28 +193,16 @@ export function compute_xrd_pattern(structure, options = {}) {
|
|
|
214
193
|
const lorentz = (1 + Math.cos(2 * theta) ** 2) / denom;
|
|
215
194
|
const intensity_hkl = (f_real * f_real + f_imag * f_imag) * lorentz;
|
|
216
195
|
const two_theta = math.to_degrees(2 * theta);
|
|
217
|
-
//
|
|
218
|
-
//
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
found_index = idx;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
if (found_index !== null) {
|
|
229
|
-
const key = two_thetas[found_index];
|
|
230
|
-
const item = peaks.get(key);
|
|
231
|
-
if (item) {
|
|
232
|
-
item.intensity += intensity_hkl;
|
|
233
|
-
item.hkls.push(hkl_to_store);
|
|
234
|
-
}
|
|
196
|
+
// Merge peaks within tolerance. hkls stay 3-index (h, k, l) even for hexagonal
|
|
197
|
+
// systems where pymatgen presents Miller–Bravais (h, k, i, l), matching consumers.
|
|
198
|
+
const merge_key = two_thetas.find((angle) => Math.abs(angle - two_theta) < merge_tol);
|
|
199
|
+
const existing = merge_key === undefined ? undefined : peaks.get(merge_key);
|
|
200
|
+
if (existing) {
|
|
201
|
+
existing.intensity += intensity_hkl;
|
|
202
|
+
existing.hkls.push(hkl);
|
|
235
203
|
}
|
|
236
204
|
else {
|
|
237
|
-
|
|
238
|
-
peaks.set(two_theta, { intensity: intensity_hkl, hkls: [hkl_to_store], d_hkl });
|
|
205
|
+
peaks.set(two_theta, { intensity: intensity_hkl, hkls: [hkl], d_hkl: 1 / g_norm });
|
|
239
206
|
two_thetas.push(two_theta);
|
|
240
207
|
}
|
|
241
208
|
}
|
|
@@ -259,7 +226,7 @@ export function compute_xrd_pattern(structure, options = {}) {
|
|
|
259
226
|
const fam = get_unique_families(item.hkls);
|
|
260
227
|
const fam_array = [];
|
|
261
228
|
for (const [repr_key, multiplicity] of fam.entries()) {
|
|
262
|
-
const repr = repr_key.split(`,`).map(
|
|
229
|
+
const repr = repr_key.split(`,`).map(Number);
|
|
263
230
|
fam_array.push({ hkl: repr, multiplicity });
|
|
264
231
|
}
|
|
265
232
|
hkls_out.push(fam_array);
|
|
@@ -285,14 +252,9 @@ wavelength) {
|
|
|
285
252
|
// Check if file is a direct XRD data file (.xy, .brml)
|
|
286
253
|
if (is_xrd_data_file(filename)) {
|
|
287
254
|
// Convert ArrayBufferLike to ArrayBuffer if needed (handles SharedArrayBuffer)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
buffer_content =
|
|
294
|
-
content instanceof ArrayBuffer ? content : new Uint8Array(content).slice().buffer;
|
|
295
|
-
}
|
|
255
|
+
const buffer_content = typeof content === `string` || content instanceof ArrayBuffer
|
|
256
|
+
? content
|
|
257
|
+
: new Uint8Array(content).slice().buffer;
|
|
296
258
|
const pattern = await parse_xrd_file(buffer_content, filename);
|
|
297
259
|
if (pattern && pattern.x.length > 0) {
|
|
298
260
|
return { pattern: { label: filename || `XRD data`, pattern } };
|
package/dist/xrd/parse.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { XrdPattern } from './index';
|
|
2
2
|
export declare function parse_xy_file(content: string): XrdPattern | null;
|
|
3
|
-
export declare function parse_xye_file(content: string): XrdPattern | null;
|
|
4
3
|
export declare function parse_ras_file(content: string): XrdPattern | null;
|
|
5
4
|
export declare function parse_uxd_file(content: string): XrdPattern | null;
|
|
6
5
|
export declare function parse_gsas_file(content: string): XrdPattern | null;
|