matterviz 0.4.0 → 0.4.1
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/brillouin/BrillouinZone.svelte +68 -145
- package/dist/brillouin/BrillouinZone.svelte.d.ts +5 -14
- package/dist/brillouin/BrillouinZoneExportPane.svelte +43 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +9 -32
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +49 -203
- 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.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +100 -191
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +176 -464
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -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.js +2 -2
- package/dist/composition/FormulaFilter.svelte +6 -5
- package/dist/composition/PieChart.svelte +5 -5
- package/dist/composition/chem-sys.js +3 -2
- package/dist/composition/format.js +3 -2
- package/dist/composition/parse.d.ts +0 -1
- package/dist/composition/parse.js +17 -19
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +8 -10
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +94 -175
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +176 -680
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +180 -680
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +268 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +88 -7
- 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 +29 -168
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +11 -2
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- 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 +278 -0
- package/dist/convex-hull/helpers.d.ts +39 -7
- package/dist/convex-hull/helpers.js +154 -69
- 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 +91 -920
- package/dist/convex-hull/types.d.ts +12 -4
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +4 -11
- package/dist/element/BohrAtom.svelte +2 -1
- package/dist/element/ElementTile.svelte.d.ts +1 -1
- package/dist/element/index.d.ts +4 -0
- package/dist/element/index.js +18 -0
- package/dist/feedback/DragOverlay.svelte +3 -1
- package/dist/feedback/DragOverlay.svelte.d.ts +1 -0
- package/dist/feedback/StatusMessage.svelte +13 -3
- package/dist/fermi-surface/FermiSurface.svelte +67 -146
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +5 -14
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +72 -224
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/compute.js +11 -10
- 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 +64 -75
- package/dist/fermi-surface/types.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +55 -40
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +4 -3
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +3 -2
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +166 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.js +1 -2
- package/dist/io/export.d.ts +5 -1
- package/dist/io/export.js +32 -28
- package/dist/io/fetch.d.ts +2 -1
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +13 -0
- package/dist/io/index.d.ts +2 -0
- package/dist/io/index.js +10 -0
- package/dist/io/types.d.ts +13 -0
- package/dist/isosurface/parse.js +46 -44
- package/dist/labels.js +1 -1
- package/dist/layout/FullscreenButton.svelte +33 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +8 -14
- package/dist/layout/ViewerChrome.svelte +116 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +17 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +37 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.js +3 -0
- package/dist/math.d.ts +7 -3
- package/dist/math.js +18 -21
- package/dist/overlays/index.d.ts +4 -0
- package/dist/periodic-table/PeriodicTable.svelte +9 -8
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramControls.svelte +3 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +2 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +47 -132
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- package/dist/phase-diagram/colors.js +1 -1
- package/dist/phase-diagram/parse.d.ts +2 -1
- package/dist/plot/bar/BarPlot.svelte +79 -316
- package/dist/plot/bar/BarPlot.svelte.d.ts +7 -15
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +1 -1
- package/dist/plot/bar/SpacegroupBarPlot.svelte +2 -1
- package/dist/plot/box/BoxPlot.svelte +76 -246
- package/dist/plot/box/BoxPlot.svelte.d.ts +4 -3
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
- package/dist/plot/box/Violin.svelte.d.ts +1 -1
- package/dist/plot/box/box-plot.d.ts +3 -2
- package/dist/plot/box/box-plot.js +5 -2
- 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 +4 -1
- package/dist/plot/core/components/ColorBar.svelte +5 -5
- package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
- package/dist/plot/core/components/Line.svelte +3 -2
- package/dist/plot/core/components/Line.svelte.d.ts +3 -2
- package/dist/plot/core/components/PlotAxis.svelte +2 -1
- package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
- package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
- package/dist/plot/core/components/ReferenceLine3D.svelte +2 -2
- package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
- package/dist/plot/core/components/ReferencePlane.svelte +2 -2
- package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
- package/dist/plot/core/data-cleaning.js +18 -18
- package/dist/plot/core/fill-utils.d.ts +4 -3
- package/dist/plot/core/fill-utils.js +6 -3
- package/dist/plot/core/interactions.d.ts +5 -1
- package/dist/plot/core/interactions.js +14 -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 +6 -6
- package/dist/plot/core/scales.d.ts +17 -25
- package/dist/plot/core/scales.js +10 -8
- package/dist/plot/core/svg.d.ts +2 -1
- package/dist/plot/core/types.d.ts +18 -7
- package/dist/plot/core/utils/label-placement.d.ts +1 -1
- package/dist/plot/core/utils/label-placement.js +3 -3
- package/dist/plot/core/utils.d.ts +2 -1
- package/dist/plot/histogram/Histogram.svelte +77 -314
- package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
- package/dist/plot/sankey/Sankey.svelte +2 -5
- package/dist/plot/sankey/Sankey.svelte.d.ts +1 -1
- package/dist/plot/sankey/sankey.js +3 -1
- package/dist/plot/scatter/BinnedScatterPlot.svelte +3 -5
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +4 -4
- package/dist/plot/scatter/ScatterPlot.svelte +160 -450
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +7 -15
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/binned-scatter-types.d.ts +4 -11
- package/dist/plot/scatter/index.d.ts +1 -1
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +15 -26
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +9 -10
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +122 -121
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
- package/dist/plot/scatter-3d/Surface3D.svelte +6 -5
- package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
- package/dist/plot/sunburst/Sunburst.svelte +16 -20
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
- package/dist/plot/sunburst/SunburstControls.svelte.d.ts +1 -1
- package/dist/plot/sunburst/sunburst.js +4 -1
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/sanitize.js +13 -2
- 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 +14 -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 +14 -2
- package/dist/settings.js +59 -1
- package/dist/spectral/Bands.svelte +8 -7
- package/dist/spectral/Bands.svelte.d.ts +3 -2
- package/dist/spectral/BandsAndDos.svelte +22 -24
- package/dist/spectral/BrillouinBandsDos.svelte +3 -3
- package/dist/spectral/Dos.svelte +5 -4
- package/dist/spectral/Dos.svelte.d.ts +2 -1
- package/dist/spectral/helpers.d.ts +6 -6
- package/dist/spectral/helpers.js +43 -37
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +0 -6
- package/dist/structure/Arrow.svelte +2 -4
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/CanvasTooltip.svelte +1 -0
- package/dist/structure/CellSelect.svelte +11 -3
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- package/dist/structure/Lattice.svelte +2 -2
- package/dist/structure/Structure.svelte +291 -355
- package/dist/structure/Structure.svelte.d.ts +5 -15
- package/dist/structure/StructureControls.svelte +217 -2
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +54 -156
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +5 -3
- package/dist/structure/StructureInfoPane.svelte.d.ts +5 -5
- package/dist/structure/StructureScene.svelte +365 -198
- package/dist/structure/StructureScene.svelte.d.ts +22 -20
- package/dist/structure/{label-placement.d.ts → atom-label-placement.d.ts} +3 -3
- package/dist/structure/{label-placement.js → atom-label-placement.js} +12 -2
- package/dist/structure/atom-properties.d.ts +1 -1
- package/dist/structure/atom-properties.js +11 -16
- package/dist/structure/bond-order-perception.js +2 -4
- package/dist/structure/bonding.d.ts +3 -0
- package/dist/structure/bonding.js +91 -48
- package/dist/structure/export.d.ts +24 -4
- package/dist/structure/export.js +64 -122
- package/dist/structure/index.d.ts +2 -0
- package/dist/structure/index.js +2 -0
- package/dist/structure/parse.d.ts +3 -2
- package/dist/structure/parse.js +333 -370
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +1 -1
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +186 -13
- package/dist/structure/polyhedra.d.ts +41 -0
- package/dist/structure/polyhedra.js +602 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.js +3 -2
- 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 +354 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +111 -6
- package/dist/symmetry/WyckoffTable.svelte +68 -7
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +7 -14
- package/dist/symmetry/index.d.ts +14 -4
- package/dist/symmetry/index.js +301 -80
- package/dist/symmetry/spacegroups.d.ts +5 -1
- package/dist/symmetry/spacegroups.js +15 -1
- 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 +4 -15
- package/dist/table/HeatmapTable.svelte.d.ts +1 -1
- package/dist/trajectory/Trajectory.svelte +58 -61
- package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
- package/dist/trajectory/TrajectoryExportPane.svelte +15 -24
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +3 -2
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +17 -37
- package/dist/trajectory/format-detect.d.ts +0 -1
- package/dist/trajectory/format-detect.js +3 -9
- package/dist/trajectory/frame-reader.d.ts +0 -1
- package/dist/trajectory/frame-reader.js +62 -128
- package/dist/trajectory/helpers.d.ts +10 -2
- package/dist/trajectory/helpers.js +56 -36
- 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/index.d.ts +1 -1
- package/dist/trajectory/parse/index.js +54 -102
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +8 -6
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +4 -3
- package/dist/trajectory/parse/xyz.d.ts +9 -21
- package/dist/trajectory/parse/xyz.js +28 -33
- package/dist/trajectory/plotting.d.ts +0 -1
- package/dist/trajectory/plotting.js +3 -100
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -1
- package/dist/xrd/XrdPlot.svelte +14 -29
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/calc-xrd.js +6 -11
- package/dist/xrd/index.d.ts +2 -2
- package/package.json +29 -16
- 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
|
@@ -32,18 +32,9 @@ function extract_property_statistics(trajectory, data_extractor) {
|
|
|
32
32
|
if (typeof value !== `number` || key === `Step` || key.startsWith(`constant_`)) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
const stat = property_stats.get(key);
|
|
40
|
-
if (stat) {
|
|
41
|
-
stat.values.push(value);
|
|
42
|
-
stat.sum += value;
|
|
43
|
-
stat.sum_squares += value * value;
|
|
44
|
-
stat.min = Math.min(stat.min, value);
|
|
45
|
-
stat.max = Math.max(stat.max, value);
|
|
46
|
-
}
|
|
35
|
+
const stat = property_stats.get(key) ?? { values: [] };
|
|
36
|
+
property_stats.set(key, stat);
|
|
37
|
+
stat.values.push(value);
|
|
47
38
|
});
|
|
48
39
|
});
|
|
49
40
|
// Convert to final format with variation detection
|
|
@@ -201,94 +192,6 @@ const is_default_visible = (property_key, default_properties) => {
|
|
|
201
192
|
}
|
|
202
193
|
return false;
|
|
203
194
|
};
|
|
204
|
-
// Optimized series visibility toggling
|
|
205
|
-
export function toggle_series_visibility(series, target_series_idx) {
|
|
206
|
-
if (target_series_idx < 0 || target_series_idx >= series.length)
|
|
207
|
-
return series;
|
|
208
|
-
const target_series = series[target_series_idx];
|
|
209
|
-
const new_visibility = !target_series.visible;
|
|
210
|
-
// Create unit groups from current state
|
|
211
|
-
const unit_groups = create_unit_groups_from_series(series);
|
|
212
|
-
const target_group = unit_groups.find((group) => group.series.includes(target_series));
|
|
213
|
-
if (!target_group)
|
|
214
|
-
return series;
|
|
215
|
-
// Start with updating the target series visibility
|
|
216
|
-
const updated_series = series.map((srs) => srs === target_series ? { ...srs, visible: new_visibility } : { ...srs });
|
|
217
|
-
// Handle smart group replacement for new groups
|
|
218
|
-
if (new_visibility && !target_group.is_visible) {
|
|
219
|
-
const visible_groups = unit_groups.filter((group) => group.is_visible);
|
|
220
|
-
if (visible_groups.length >= 2) {
|
|
221
|
-
// Hide lowest priority group (highest priority number)
|
|
222
|
-
const lowest_priority_group = visible_groups
|
|
223
|
-
.sort((g1, g2) => g1.priority - g2.priority)
|
|
224
|
-
.pop(); // Get the last (lowest priority) group
|
|
225
|
-
if (lowest_priority_group) {
|
|
226
|
-
lowest_priority_group.is_visible = false;
|
|
227
|
-
// Also hide the actual series in this group
|
|
228
|
-
lowest_priority_group.series.forEach((srs1) => {
|
|
229
|
-
const series_idx = updated_series.findIndex((srs2) => srs2.label === srs1.label && srs2.unit === srs1.unit);
|
|
230
|
-
if (series_idx !== -1) {
|
|
231
|
-
updated_series[series_idx] = { ...updated_series[series_idx], visible: false };
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
target_group.is_visible = true;
|
|
237
|
-
}
|
|
238
|
-
// Recalculate group visibility and reassign axes
|
|
239
|
-
update_group_visibility_and_axes(updated_series, unit_groups);
|
|
240
|
-
return updated_series;
|
|
241
|
-
}
|
|
242
|
-
function create_unit_groups_from_series(series) {
|
|
243
|
-
const unit_map = new Map();
|
|
244
|
-
for (const srs of series) {
|
|
245
|
-
const unit = srs.unit ?? `dimensionless`;
|
|
246
|
-
const group = unit_map.get(unit) ?? [];
|
|
247
|
-
group.push(srs);
|
|
248
|
-
unit_map.set(unit, group);
|
|
249
|
-
}
|
|
250
|
-
return Array.from(unit_map.entries())
|
|
251
|
-
.map(([unit, group_series]) => ({
|
|
252
|
-
unit,
|
|
253
|
-
series: group_series,
|
|
254
|
-
priority: calculate_priority(unit, group_series),
|
|
255
|
-
is_visible: group_series.some((srs) => srs.visible),
|
|
256
|
-
}))
|
|
257
|
-
.sort((a, b) => a.priority - b.priority);
|
|
258
|
-
}
|
|
259
|
-
function update_group_visibility_and_axes(series, unit_groups) {
|
|
260
|
-
// Update group visibility based on series
|
|
261
|
-
for (const group of unit_groups) {
|
|
262
|
-
group.is_visible = group.series.some((srs1) => series.find((srs2) => srs2.label === srs1.label && srs2.unit === srs1.unit)?.visible);
|
|
263
|
-
}
|
|
264
|
-
// Apply 2-group limit
|
|
265
|
-
if (unit_groups.filter((unit_group) => unit_group.is_visible).length > 2) {
|
|
266
|
-
for (const group of unit_groups.filter((unit_group) => unit_group.is_visible).slice(2)) {
|
|
267
|
-
group.is_visible = false;
|
|
268
|
-
for (const srs1 of group.series) {
|
|
269
|
-
const idx = series.findIndex((srs2) => srs2.label === srs1.label && srs2.unit === srs1.unit);
|
|
270
|
-
if (idx !== -1)
|
|
271
|
-
series[idx] = { ...series[idx], visible: false };
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
// Assign axes
|
|
276
|
-
const final_visible = unit_groups
|
|
277
|
-
.filter((group) => group.is_visible)
|
|
278
|
-
.sort((g1, g2) => g1.priority - g2.priority);
|
|
279
|
-
const axis_map = new Map();
|
|
280
|
-
if (final_visible.length > 0)
|
|
281
|
-
axis_map.set(final_visible[0], `y1`);
|
|
282
|
-
if (final_visible.length === 2)
|
|
283
|
-
axis_map.set(final_visible[1], `y2`);
|
|
284
|
-
// Apply to series
|
|
285
|
-
for (const [idx, srs] of series.entries()) {
|
|
286
|
-
const group = unit_groups.find((unit_group) => unit_group.series.some((member) => member.label === srs.label && member.unit === srs.unit));
|
|
287
|
-
if (group && axis_map.has(group)) {
|
|
288
|
-
series[idx] = { ...srs, y_axis: axis_map.get(group) };
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
195
|
// Utility functions
|
|
293
196
|
export function should_hide_plot(trajectory, plot_series, tolerance = 1e-10) {
|
|
294
197
|
if (!trajectory || trajectory.frames.length <= 1 || plot_series.length === 0) {
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const is_plain_object: (val: unknown) => val is Record<string, unknown>;
|
|
1
2
|
export declare function merge_nested<T extends Record<string, unknown>>(obj1: T, obj2?: Partial<T>): T;
|
|
2
3
|
export declare const escape_html: (unsafe_string: string) => string;
|
|
3
4
|
export declare const normalize_unicode_minus: (value: string) => string;
|
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Check if value is a plain object (not array, null, or other types)
|
|
2
|
-
const is_plain_object = (val) => typeof val === `object` && val !== null && !Array.isArray(val);
|
|
2
|
+
export const is_plain_object = (val) => typeof val === `object` && val !== null && !Array.isArray(val);
|
|
3
3
|
// Merge nested objects (1 level deep).
|
|
4
4
|
export function merge_nested(obj1, obj2) {
|
|
5
5
|
const result = { ...obj1, ...obj2 };
|
package/dist/xrd/XrdPlot.svelte
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
decompress_data_binary,
|
|
7
7
|
decompress_file,
|
|
8
8
|
detect_compression_format,
|
|
9
|
+
drag_over_handlers,
|
|
9
10
|
handle_url_drop,
|
|
10
11
|
} from '../io'
|
|
11
12
|
import { format_value } from '../labels'
|
|
@@ -31,12 +32,12 @@
|
|
|
31
32
|
function is_xrd_pattern(obj: unknown): obj is XrdPattern {
|
|
32
33
|
if (!obj || typeof obj !== `object`) return false
|
|
33
34
|
const pattern_obj = obj as { x?: unknown; y?: unknown }
|
|
34
|
-
const
|
|
35
|
-
const
|
|
35
|
+
const x_vals = pattern_obj.x
|
|
36
|
+
const y_vals = pattern_obj.y
|
|
36
37
|
return (
|
|
37
|
-
Array.isArray(
|
|
38
|
-
Array.isArray(
|
|
39
|
-
|
|
38
|
+
Array.isArray(x_vals) &&
|
|
39
|
+
Array.isArray(y_vals) &&
|
|
40
|
+
x_vals.length === y_vals.length
|
|
40
41
|
)
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -138,7 +139,7 @@
|
|
|
138
139
|
const global_max_intensity = $derived.by(() => {
|
|
139
140
|
let max_val = 0
|
|
140
141
|
for (const entry of pattern_entries) {
|
|
141
|
-
for (const
|
|
142
|
+
for (const intensity of entry.pattern.y) if (intensity > max_val) max_val = intensity
|
|
142
143
|
}
|
|
143
144
|
return max_val || 1
|
|
144
145
|
})
|
|
@@ -159,7 +160,7 @@
|
|
|
159
160
|
})
|
|
160
161
|
|
|
161
162
|
// Scaled intensities are normalized to 0..100, add 10% top padding for peak labels
|
|
162
|
-
const intensity_range:
|
|
163
|
+
const intensity_range: Vec2 = [0, 110]
|
|
163
164
|
|
|
164
165
|
// Build BarPlot series from entries (for Discrete/Stick view)
|
|
165
166
|
const bar_series = $derived.by<BarSeries[]>(() => {
|
|
@@ -168,7 +169,7 @@
|
|
|
168
169
|
const include_name = pattern_entries.length > 1
|
|
169
170
|
// Add transparency when multiple series overlap
|
|
170
171
|
const alpha = pattern_entries.length > 1 ? 0.6 : 1
|
|
171
|
-
const scale = (
|
|
172
|
+
const scale = (y_val: number) => (y_val / global_max_intensity) * 100
|
|
172
173
|
return pattern_entries.map((entry, entry_idx) => {
|
|
173
174
|
const xs = entry.pattern.x
|
|
174
175
|
const ys = entry.pattern.y.map((val) => scale(val || 0))
|
|
@@ -280,7 +281,7 @@
|
|
|
280
281
|
const all_ys = all_processed.flatMap((processed) => processed.broadened.y)
|
|
281
282
|
const max_y = Math.max(...all_ys, 1) // Avoid div by zero
|
|
282
283
|
|
|
283
|
-
const scale = (
|
|
284
|
+
const scale = (y_val: number) => (y_val / max_y) * 100
|
|
284
285
|
const base_color = entry.color ?? PLOT_COLORS[entry_idx % PLOT_COLORS.length]
|
|
285
286
|
// Add transparency when multiple series overlap
|
|
286
287
|
const alpha = all_processed.length > 1 ? 0.6 : 1
|
|
@@ -474,15 +475,7 @@
|
|
|
474
475
|
}}
|
|
475
476
|
{tooltip}
|
|
476
477
|
ondrop={handle_file_drop}
|
|
477
|
-
|
|
478
|
-
event.preventDefault()
|
|
479
|
-
if (!allow_file_drop) return
|
|
480
|
-
dragover = true
|
|
481
|
-
}}
|
|
482
|
-
ondragleave={(event) => {
|
|
483
|
-
event.preventDefault()
|
|
484
|
-
dragover = false
|
|
485
|
-
}}
|
|
478
|
+
{...drag_over_handlers({ allow: () => allow_file_drop, set_dragover: (over) => dragover = over })}
|
|
486
479
|
class={(rest.class ?? ``) + (dragover ? ` dragover` : ``)}
|
|
487
480
|
style={`overflow: visible; ${rest.style ?? ``}`}
|
|
488
481
|
{controls}
|
|
@@ -496,11 +489,11 @@
|
|
|
496
489
|
{@const angle_text = `${format_value(info.x, `.2f`)}°`}
|
|
497
490
|
{@const intensity_text = `${format_value(info.y, `.1f`)}`}
|
|
498
491
|
{@const hkls = info.metadata?.hkls}
|
|
499
|
-
{@const
|
|
492
|
+
{@const d_spacing = info.metadata?.d}
|
|
500
493
|
{@const hkl_text = hkls && hkl_format
|
|
501
494
|
? hkls.map((hkl: Hkl) => format_hkl(hkl, hkl_format)).join(`, `)
|
|
502
495
|
: ``}
|
|
503
|
-
{@const d_text =
|
|
496
|
+
{@const d_text = d_spacing != null ? `${format_value(d_spacing, `.3f`)} Å` : ``}
|
|
504
497
|
{@html sanitize_html(info.metadata?.label ?? ``)}<br />
|
|
505
498
|
2θ: {angle_text}<br />
|
|
506
499
|
Intensity: {intensity_text}
|
|
@@ -533,15 +526,7 @@
|
|
|
533
526
|
}}
|
|
534
527
|
{tooltip}
|
|
535
528
|
ondrop={handle_file_drop}
|
|
536
|
-
|
|
537
|
-
event.preventDefault()
|
|
538
|
-
if (!allow_file_drop) return
|
|
539
|
-
dragover = true
|
|
540
|
-
}}
|
|
541
|
-
ondragleave={(event) => {
|
|
542
|
-
event.preventDefault()
|
|
543
|
-
dragover = false
|
|
544
|
-
}}
|
|
529
|
+
{...drag_over_handlers({ allow: () => allow_file_drop, set_dragover: (over) => dragover = over })}
|
|
545
530
|
class={(rest.class ?? ``) + (dragover ? ` dragover` : ``)}
|
|
546
531
|
style={`overflow: visible; ${rest.style ?? ``}`}
|
|
547
532
|
show_controls={controls.show}
|
package/dist/xrd/broadening.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Vec2 } from '../math';
|
|
1
2
|
import type { XrdPattern } from './index';
|
|
2
3
|
export type BroadeningParams = {
|
|
3
4
|
U: number;
|
|
@@ -16,5 +17,5 @@ fwhm: number, // Full Width at Half Maximum
|
|
|
16
17
|
eta: number): number;
|
|
17
18
|
export declare function compute_broadened_pattern(pattern: XrdPattern, // Discrete XRD pattern (peaks)
|
|
18
19
|
params: BroadeningParams, // Broadening parameters (U, V, W, shape_factor)
|
|
19
|
-
range:
|
|
20
|
+
range: Vec2, // Angular range [min, max] in degrees
|
|
20
21
|
step_size?: number): XrdPattern;
|
package/dist/xrd/calc-xrd.js
CHANGED
|
@@ -67,13 +67,6 @@ function get_unique_families(hkls) {
|
|
|
67
67
|
}
|
|
68
68
|
return family_map;
|
|
69
69
|
}
|
|
70
|
-
function compute_reciprocal_lattice_rows(structure) {
|
|
71
|
-
// For row-wise lattice matrix A (rows are a, b, c), reciprocal rows are inv(A)^T
|
|
72
|
-
const direct = structure.lattice.matrix;
|
|
73
|
-
const inv = math.matrix_inverse_3x3(direct);
|
|
74
|
-
const recip = math.transpose_3x3_matrix(inv);
|
|
75
|
-
return recip;
|
|
76
|
-
}
|
|
77
70
|
function enumerate_reciprocal_points(recip_rows, direct_rows, max_radius, min_radius) {
|
|
78
71
|
const recip_b1 = recip_rows[0];
|
|
79
72
|
const recip_b2 = recip_rows[1];
|
|
@@ -131,7 +124,8 @@ export function compute_xrd_pattern(structure, options = {}) {
|
|
|
131
124
|
// Symmetry refinement (symprec > 0) is not implemented in TS version.
|
|
132
125
|
// Option retained for API parity.
|
|
133
126
|
// const symprec = options.symprec ?? 0
|
|
134
|
-
|
|
127
|
+
// For row-wise lattice matrix A (rows are a, b, c), reciprocal rows are inv(A)^T
|
|
128
|
+
const recip_rows = math.transpose_3x3_matrix(math.matrix_inverse_3x3(structure.lattice.matrix));
|
|
135
129
|
// Bragg condition bounds: reciprocal vector length r = 2 sin(theta) / lambda
|
|
136
130
|
const two_theta_range = options.two_theta_range === null ? null : (options.two_theta_range ?? [0, 180]);
|
|
137
131
|
const [min_radius, max_radius] = two_theta_range === null
|
|
@@ -192,14 +186,15 @@ export function compute_xrd_pattern(structure, options = {}) {
|
|
|
192
186
|
const g_dot_r_all = frac_coords.map((frac_coord) => math.dot(frac_coord, hkl));
|
|
193
187
|
// Atomic scattering factors (vectorized style)
|
|
194
188
|
const f_scattering = coeffs.map((coeff_entry) => {
|
|
195
|
-
const { a: a_arr, b: b_arr, z } = coeff_entry;
|
|
189
|
+
const { a: a_arr, b: b_arr, z: atomic_number } = coeff_entry;
|
|
196
190
|
const num_terms = Math.min(a_arr.length, b_arr.length);
|
|
197
191
|
const sum_terms = a_arr
|
|
198
192
|
.slice(0, num_terms)
|
|
199
193
|
.reduce((sum, a_i, term_idx) => sum + a_i * Math.exp(-b_arr[term_idx] * sin_theta_over_lambda_sq), 0);
|
|
200
194
|
// pymatgen-style fitted params: f = Z − 41.78214·s²·Σ aᵢ·exp(−bᵢ·s²)
|
|
201
|
-
if (
|
|
202
|
-
return
|
|
195
|
+
if (atomic_number !== undefined) {
|
|
196
|
+
return atomic_number - 41.78214 * sin_theta_over_lambda_sq * sum_terms;
|
|
197
|
+
}
|
|
203
198
|
return sum_terms + (coeff_entry.c ?? 0);
|
|
204
199
|
});
|
|
205
200
|
const dw_corr = dw_factors.map((dw_b) => Math.exp(-dw_b * sin_theta_over_lambda_sq));
|
package/dist/xrd/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompositionType } from '../composition';
|
|
2
|
-
import type { Vec3 } from '../math';
|
|
2
|
+
import type { Vec2, Vec3 } from '../math';
|
|
3
3
|
import type { RadiationKey } from './calc-xrd';
|
|
4
4
|
export * from './broadening';
|
|
5
5
|
export * from './calc-xrd';
|
|
@@ -26,7 +26,7 @@ export type XrdOptions = {
|
|
|
26
26
|
symprec?: number;
|
|
27
27
|
debye_waller_factors?: CompositionType;
|
|
28
28
|
scaled?: boolean;
|
|
29
|
-
two_theta_range?:
|
|
29
|
+
two_theta_range?: Vec2 | null;
|
|
30
30
|
peak_merge_tol?: number;
|
|
31
31
|
scaled_intensity_tol?: number;
|
|
32
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterviz",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Interactive visualizations for materials science: periodic tables, 3D structures, MD trajectories, heatmaps, scatter plots.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chemistry",
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"type": "module",
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"**/*.css"
|
|
24
|
+
],
|
|
22
25
|
"exports": {
|
|
23
26
|
".": {
|
|
24
27
|
"types": "./dist/index.d.ts",
|
|
@@ -30,7 +33,6 @@
|
|
|
30
33
|
"default": "./dist/element/data.js"
|
|
31
34
|
},
|
|
32
35
|
"./app.css": {
|
|
33
|
-
"types": "./dist/app.css.d.ts",
|
|
34
36
|
"default": "./dist/app.css"
|
|
35
37
|
},
|
|
36
38
|
"./brillouin": {
|
|
@@ -109,10 +111,18 @@
|
|
|
109
111
|
"types": "./dist/plot/index.d.ts",
|
|
110
112
|
"default": "./dist/plot/index.js"
|
|
111
113
|
},
|
|
114
|
+
"./plot/*": {
|
|
115
|
+
"types": "./dist/plot/*/index.d.ts",
|
|
116
|
+
"default": "./dist/plot/*/index.js"
|
|
117
|
+
},
|
|
112
118
|
"./rdf": {
|
|
113
119
|
"types": "./dist/rdf/index.d.ts",
|
|
114
120
|
"default": "./dist/rdf/index.js"
|
|
115
121
|
},
|
|
122
|
+
"./scene": {
|
|
123
|
+
"types": "./dist/scene/index.d.ts",
|
|
124
|
+
"default": "./dist/scene/index.js"
|
|
125
|
+
},
|
|
116
126
|
"./spectral": {
|
|
117
127
|
"types": "./dist/spectral/index.d.ts",
|
|
118
128
|
"default": "./dist/spectral/index.js"
|
|
@@ -138,7 +148,6 @@
|
|
|
138
148
|
"default": "./dist/theme/index.js"
|
|
139
149
|
},
|
|
140
150
|
"./theme/themes": {
|
|
141
|
-
"types": "./dist/theme/themes.d.ts",
|
|
142
151
|
"default": "./dist/theme/themes.mjs"
|
|
143
152
|
},
|
|
144
153
|
"./tooltip": {
|
|
@@ -169,14 +178,16 @@
|
|
|
169
178
|
"scripts": {
|
|
170
179
|
"test": "vp test --run && playwright test",
|
|
171
180
|
"knip": "knip --include dependencies,devDependencies",
|
|
181
|
+
"knip:exports": "knip --include exports,types,nsExports",
|
|
182
|
+
"publint": "publint",
|
|
172
183
|
"package-dist-assets": "node scripts/package-dist-assets.ts",
|
|
173
184
|
"package:dist": "svelte-package && pnpm run package-dist-assets",
|
|
174
185
|
"prepare": "svelte-kit sync && pnpm run package:dist",
|
|
175
186
|
"prepublishOnly": "pnpm run package:dist"
|
|
176
187
|
},
|
|
177
188
|
"dependencies": {
|
|
178
|
-
"@spglib/moyo-wasm": "^0.
|
|
179
|
-
"@sveltejs/kit": "2.
|
|
189
|
+
"@spglib/moyo-wasm": "^0.12.0",
|
|
190
|
+
"@sveltejs/kit": "2.65.1",
|
|
180
191
|
"@threlte/core": "^8.5.16",
|
|
181
192
|
"@threlte/extras": "^9.21.0",
|
|
182
193
|
"d3-array": "^3.2.4",
|
|
@@ -189,11 +200,11 @@
|
|
|
189
200
|
"d3-scale-chromatic": "^3.1.0",
|
|
190
201
|
"d3-shape": "^3.2.0",
|
|
191
202
|
"d3-time-format": "^4.1.0",
|
|
192
|
-
"dompurify": "3.4.
|
|
203
|
+
"dompurify": "3.4.7",
|
|
193
204
|
"fflate": "^0.8.3",
|
|
194
|
-
"h5wasm": "^0.10.
|
|
205
|
+
"h5wasm": "^0.10.3",
|
|
195
206
|
"js-yaml": "^4.2.0",
|
|
196
|
-
"svelte-multiselect": "^11.7.
|
|
207
|
+
"svelte-multiselect": "^11.7.2",
|
|
197
208
|
"three": "^0.184.0"
|
|
198
209
|
},
|
|
199
210
|
"devDependencies": {
|
|
@@ -213,18 +224,19 @@
|
|
|
213
224
|
"@types/d3-shape": "^3.1.8",
|
|
214
225
|
"@types/d3-time-format": "^4.0.3",
|
|
215
226
|
"@types/js-yaml": "^4.0.9",
|
|
216
|
-
"@types/node": "^25.9.
|
|
227
|
+
"@types/node": "^25.9.3",
|
|
217
228
|
"@types/three": "^0.184.1",
|
|
218
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
229
|
+
"@typescript/native-preview": "7.0.0-dev.20260614.1",
|
|
219
230
|
"@vitest/coverage-v8": "4.1.8",
|
|
220
|
-
"@wooorm/starry-night": "^3.
|
|
221
|
-
"happy-dom": "^20.10.
|
|
222
|
-
"knip": "^6.16.
|
|
231
|
+
"@wooorm/starry-night": "^3.10.0",
|
|
232
|
+
"happy-dom": "^20.10.3",
|
|
233
|
+
"knip": "^6.16.1",
|
|
223
234
|
"mdsvex": "^0.12.7",
|
|
235
|
+
"publint": "^0.3.21",
|
|
224
236
|
"rehype-katex": "^7.0.1",
|
|
225
237
|
"remark-math": "3.0.1",
|
|
226
|
-
"svelte": "^5.56.
|
|
227
|
-
"svelte-check-rs": "0.
|
|
238
|
+
"svelte": "^5.56.3",
|
|
239
|
+
"svelte-check-rs": "0.10.1",
|
|
228
240
|
"typescript": "6.0.3",
|
|
229
241
|
"vite": "^8.0.16",
|
|
230
242
|
"vite-plus": "latest",
|
|
@@ -239,7 +251,8 @@
|
|
|
239
251
|
"packageManager": "pnpm@11.5.0",
|
|
240
252
|
"knip": {
|
|
241
253
|
"entry": [
|
|
242
|
-
"svelte.config.ts"
|
|
254
|
+
"svelte.config.ts",
|
|
255
|
+
"src/site/**/*.{js,ts,svelte}"
|
|
243
256
|
],
|
|
244
257
|
"ignore": [
|
|
245
258
|
"extensions/**"
|