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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// Dual perspective/orthographic camera with OrbitControls + axis Gizmo, shared by BrillouinZoneScene, FermiSurfaceScene and StructureScene
|
|
3
|
+
import type { Vec3 } from '../math'
|
|
4
|
+
import { type CameraProjection, DEFAULTS } from '../settings'
|
|
5
|
+
import { T } from '@threlte/core'
|
|
6
|
+
import * as extras from '@threlte/extras'
|
|
7
|
+
import type { ComponentProps } from 'svelte'
|
|
8
|
+
import { build_gizmo_props, build_orbit_props } from './props'
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
camera_projection = `perspective`,
|
|
12
|
+
position,
|
|
13
|
+
fov = DEFAULTS.structure.fov,
|
|
14
|
+
zoom = DEFAULTS.structure.initial_zoom,
|
|
15
|
+
near = undefined,
|
|
16
|
+
far = undefined,
|
|
17
|
+
orbit_props,
|
|
18
|
+
gizmo = false,
|
|
19
|
+
orbit_controls = $bindable(undefined),
|
|
20
|
+
}: {
|
|
21
|
+
camera_projection?: CameraProjection
|
|
22
|
+
position: Vec3 // camera position
|
|
23
|
+
fov?: number // perspective field of view
|
|
24
|
+
zoom?: number // orthographic zoom level
|
|
25
|
+
near?: number // perspective near plane (orthographic always uses -100)
|
|
26
|
+
far?: number // far plane (applied to either projection when provided)
|
|
27
|
+
orbit_props: ReturnType<typeof build_orbit_props>
|
|
28
|
+
gizmo?: boolean | ComponentProps<typeof extras.Gizmo>
|
|
29
|
+
orbit_controls?: ComponentProps<typeof extras.OrbitControls>[`ref`]
|
|
30
|
+
} = $props()
|
|
31
|
+
|
|
32
|
+
const gizmo_props = $derived(build_gizmo_props(gizmo))
|
|
33
|
+
// Only pass clipping planes that were explicitly provided so three.js defaults apply otherwise
|
|
34
|
+
const persp_planes = $derived({
|
|
35
|
+
...(near !== undefined && { near }),
|
|
36
|
+
...(far !== undefined && { far }),
|
|
37
|
+
})
|
|
38
|
+
const ortho_far = $derived(far !== undefined ? { far } : {})
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
{#snippet camera_contents()}
|
|
42
|
+
<extras.OrbitControls bind:ref={orbit_controls} {...orbit_props}>
|
|
43
|
+
{#if gizmo}<extras.Gizmo {...gizmo_props} />{/if}
|
|
44
|
+
</extras.OrbitControls>
|
|
45
|
+
{/snippet}
|
|
46
|
+
|
|
47
|
+
{#if camera_projection === `perspective`}
|
|
48
|
+
<T.PerspectiveCamera makeDefault {position} {fov} {...persp_planes}>
|
|
49
|
+
{@render camera_contents()}
|
|
50
|
+
</T.PerspectiveCamera>
|
|
51
|
+
{:else}
|
|
52
|
+
<T.OrthographicCamera makeDefault {position} {zoom} near={-100} {...ortho_far}>
|
|
53
|
+
{@render camera_contents()}
|
|
54
|
+
</T.OrthographicCamera>
|
|
55
|
+
{/if}
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
:global(.responsive-gizmo) {
|
|
59
|
+
width: clamp(70px, 18cqmin, 100px) !important;
|
|
60
|
+
height: clamp(70px, 18cqmin, 100px) !important;
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Vec3 } from '../math';
|
|
2
|
+
import { type CameraProjection } from '../settings';
|
|
3
|
+
import * as extras from '@threlte/extras';
|
|
4
|
+
import type { ComponentProps } from 'svelte';
|
|
5
|
+
import { build_orbit_props } from './props';
|
|
6
|
+
type $$ComponentProps = {
|
|
7
|
+
camera_projection?: CameraProjection;
|
|
8
|
+
position: Vec3;
|
|
9
|
+
fov?: number;
|
|
10
|
+
zoom?: number;
|
|
11
|
+
near?: number;
|
|
12
|
+
far?: number;
|
|
13
|
+
orbit_props: ReturnType<typeof build_orbit_props>;
|
|
14
|
+
gizmo?: boolean | ComponentProps<typeof extras.Gizmo>;
|
|
15
|
+
orbit_controls?: ComponentProps<typeof extras.OrbitControls>[`ref`];
|
|
16
|
+
};
|
|
17
|
+
declare const SceneCamera: import("svelte").Component<$$ComponentProps, {}, "orbit_controls">;
|
|
18
|
+
type SceneCamera = ReturnType<typeof SceneCamera>;
|
|
19
|
+
export default SceneCamera;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { renderer_registry } from '../io/export';
|
|
2
|
+
import { useThrelte } from '@threlte/core';
|
|
3
|
+
// Mirror the Threlte scene + active camera into bindable props (for export panes etc.) and register the canvas->renderer mapping so PNG-export helpers can find it. Creates an $effect (call during component init). Returns the Threlte context for further use (e.g. clipping planes).
|
|
4
|
+
export function bind_renderer(on_bind, on_renderer) {
|
|
5
|
+
const threlte = useThrelte();
|
|
6
|
+
$effect(() => {
|
|
7
|
+
on_bind(threlte.scene, threlte.camera.current);
|
|
8
|
+
if (threlte.renderer) {
|
|
9
|
+
on_renderer?.(threlte.renderer);
|
|
10
|
+
renderer_registry.set(threlte.renderer.domElement, threlte.renderer);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return threlte;
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Shared Three.js/Threlte scene boilerplate (cameras, orbit controls, gizmo,
|
|
2
|
+
// renderer binding) used by BrillouinZoneScene, FermiSurfaceScene and StructureScene.
|
|
3
|
+
export * from './bind-renderer.svelte';
|
|
4
|
+
export * from './props';
|
|
5
|
+
export { default as SceneCamera } from './SceneCamera.svelte';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AXIS_COLORS, NEG_AXIS_COLORS } from '../colors';
|
|
2
|
+
// ScatterPlot3DScene keeps its own gizmo/orbit props on purpose: its gizmo offset is
|
|
3
|
+
// ColorBar-aware (build_gizmo_props' fixed offset would clobber it) and its orbit controls
|
|
4
|
+
// differ by design (no zoom-to-cursor / ortho zoom-doubling / camera-moving tracking).
|
|
5
|
+
// Shared Gizmo config: colored +/- axis handles, transparent background, responsive sizing. An object `gizmo` overrides the per-axis defaults.
|
|
6
|
+
export function build_gizmo_props(gizmo) {
|
|
7
|
+
return {
|
|
8
|
+
background: { enabled: false },
|
|
9
|
+
className: `responsive-gizmo`,
|
|
10
|
+
...Object.fromEntries([...AXIS_COLORS, ...NEG_AXIS_COLORS].map(([axis, color, hover]) => [
|
|
11
|
+
axis,
|
|
12
|
+
{
|
|
13
|
+
color,
|
|
14
|
+
labelColor: `#111`,
|
|
15
|
+
opacity: axis.startsWith(`n`) ? 0.9 : 0.8,
|
|
16
|
+
hover: {
|
|
17
|
+
color: hover,
|
|
18
|
+
labelColor: `#222`,
|
|
19
|
+
opacity: axis.startsWith(`n`) ? 1 : 0.9,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
])),
|
|
23
|
+
...(typeof gizmo === `object` ? gizmo : {}),
|
|
24
|
+
offset: { left: 5, bottom: 5 },
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// Shared OrbitControls config; `onstart_extra` runs extra cleanup when the camera starts moving (e.g. StructureScene closes hover tooltips/context menus)
|
|
28
|
+
export function build_orbit_props(opts) {
|
|
29
|
+
const is_ortho = opts.camera_projection === `orthographic`;
|
|
30
|
+
return {
|
|
31
|
+
position: [0, 0, 0],
|
|
32
|
+
target: opts.target,
|
|
33
|
+
enableRotate: opts.rotate_speed > 0,
|
|
34
|
+
rotateSpeed: opts.rotate_speed,
|
|
35
|
+
enableZoom: opts.zoom_speed > 0,
|
|
36
|
+
zoomSpeed: is_ortho ? opts.zoom_speed * 2 : opts.zoom_speed,
|
|
37
|
+
zoomToCursor: opts.zoom_to_cursor,
|
|
38
|
+
enablePan: opts.pan_speed > 0,
|
|
39
|
+
panSpeed: opts.pan_speed,
|
|
40
|
+
maxZoom: opts.max_zoom,
|
|
41
|
+
minZoom: opts.min_zoom,
|
|
42
|
+
autoRotate: Boolean(opts.auto_rotate),
|
|
43
|
+
autoRotateSpeed: opts.auto_rotate,
|
|
44
|
+
enableDamping: Boolean(opts.rotation_damping),
|
|
45
|
+
dampingFactor: opts.rotation_damping,
|
|
46
|
+
onstart: () => {
|
|
47
|
+
opts.set_camera_is_moving?.(true);
|
|
48
|
+
opts.onstart_extra?.();
|
|
49
|
+
},
|
|
50
|
+
onend: () => opts.set_camera_is_moving?.(false),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CameraProjection } from '../settings';
|
|
2
|
+
import type { Gizmo } from '@threlte/extras';
|
|
3
|
+
import type { ComponentProps } from 'svelte';
|
|
4
|
+
import type { Camera, Scene, Vector3 } from 'three';
|
|
5
|
+
export type ThreltePointerEvent = {
|
|
6
|
+
point: Vector3;
|
|
7
|
+
nativeEvent: PointerEvent;
|
|
8
|
+
};
|
|
9
|
+
export type SceneControlProps = {
|
|
10
|
+
camera_projection?: CameraProjection;
|
|
11
|
+
rotation_damping?: number;
|
|
12
|
+
max_zoom?: number;
|
|
13
|
+
min_zoom?: number;
|
|
14
|
+
rotate_speed?: number;
|
|
15
|
+
zoom_speed?: number;
|
|
16
|
+
pan_speed?: number;
|
|
17
|
+
zoom_to_cursor?: boolean;
|
|
18
|
+
fov?: number;
|
|
19
|
+
initial_zoom?: number;
|
|
20
|
+
ambient_light?: number;
|
|
21
|
+
directional_light?: number;
|
|
22
|
+
gizmo?: boolean | ComponentProps<typeof Gizmo>;
|
|
23
|
+
auto_rotate?: number;
|
|
24
|
+
scene?: Scene;
|
|
25
|
+
camera?: Camera;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ColorScaleType, D3InterpolateName } from './colors';
|
|
2
2
|
import type { HullFaceColorMode } from './convex-hull/types';
|
|
3
3
|
import type { D3SymbolName } from './labels';
|
|
4
|
-
import type { Vec3 } from './math';
|
|
4
|
+
import type { Vec2, Vec3 } from './math';
|
|
5
5
|
import type { BandwidthOption, Orientation, SankeyNodeAlign, SankeyOrientation, SunburstLabelRotation, SunburstLabelText, SunburstShape, SunburstValueMode, ViolinKind, ViolinSide, WhiskerMode } from './plot';
|
|
6
6
|
import type { BondingStrategy } from './structure/bonding';
|
|
7
|
+
import type { PolyhedraColorMode } from './structure/polyhedra';
|
|
7
8
|
export interface SettingType<T = unknown> {
|
|
8
9
|
value: T;
|
|
9
10
|
description: string;
|
|
@@ -130,6 +131,17 @@ export interface SettingsConfig {
|
|
|
130
131
|
show_bonds: SettingType<ShowBonds>;
|
|
131
132
|
bond_color: SettingType<string>;
|
|
132
133
|
bonding_strategy: SettingType<BondingStrategy>;
|
|
134
|
+
show_polyhedra: SettingType<ShowBonds>;
|
|
135
|
+
polyhedra_opacity: SettingType<number>;
|
|
136
|
+
polyhedra_show_edges: SettingType<boolean>;
|
|
137
|
+
polyhedra_edge_color: SettingType<string>;
|
|
138
|
+
polyhedra_color_mode: SettingType<PolyhedraColorMode>;
|
|
139
|
+
polyhedra_color: SettingType<string>;
|
|
140
|
+
polyhedra_hide_center_atoms: SettingType<boolean>;
|
|
141
|
+
polyhedra_min_neighbors: SettingType<number>;
|
|
142
|
+
polyhedra_max_neighbors: SettingType<number>;
|
|
143
|
+
polyhedra_excluded_elements: SettingType<readonly string[]>;
|
|
144
|
+
polyhedra_included_elements: SettingType<readonly string[]>;
|
|
133
145
|
atom_color_mode: SettingType<AtomColorMode>;
|
|
134
146
|
atom_color_scale: SettingType<D3InterpolateName>;
|
|
135
147
|
atom_color_scale_type: SettingType<ColorScaleType>;
|
|
@@ -179,7 +191,7 @@ export interface SettingsConfig {
|
|
|
179
191
|
trajectory: {
|
|
180
192
|
auto_play: SettingType<boolean>;
|
|
181
193
|
fps: SettingType<number>;
|
|
182
|
-
fps_range: SettingType<
|
|
194
|
+
fps_range: SettingType<Vec2>;
|
|
183
195
|
display_mode: SettingType<`structure+scatter` | `structure` | `scatter` | `histogram` | `structure+histogram`>;
|
|
184
196
|
show_controls: SettingType<boolean>;
|
|
185
197
|
fullscreen_toggle: SettingType<boolean>;
|
package/dist/settings.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { symbol_names } from './labels';
|
|
4
4
|
import { merge_nested } from './utils';
|
|
5
5
|
export const SHOW_BONDS_OPTIONS = [`never`, `always`, `crystals`, `molecules`];
|
|
6
|
+
// Shared enum labels for never|always|crystals|molecules settings (bonds, polyhedra)
|
|
7
|
+
const SHOW_BONDS_ENUM = Object.fromEntries(SHOW_BONDS_OPTIONS.map((key) => [key, key[0].toUpperCase() + key.slice(1)]));
|
|
6
8
|
export const VECTOR_COLOR_MODES = [
|
|
7
9
|
`auto`,
|
|
8
10
|
`element`,
|
|
@@ -122,7 +124,7 @@ export const SETTINGS_CONFIG = {
|
|
|
122
124
|
show_bonds: {
|
|
123
125
|
value: `always`,
|
|
124
126
|
description: `When to display bonds between atoms`,
|
|
125
|
-
enum:
|
|
127
|
+
enum: SHOW_BONDS_ENUM,
|
|
126
128
|
},
|
|
127
129
|
bond_color: {
|
|
128
130
|
value: `#666666`,
|
|
@@ -136,6 +138,62 @@ export const SETTINGS_CONFIG = {
|
|
|
136
138
|
solid_angle: `Solid Angle`,
|
|
137
139
|
},
|
|
138
140
|
},
|
|
141
|
+
show_polyhedra: {
|
|
142
|
+
value: `crystals`,
|
|
143
|
+
description: `When to render coordination polyhedra around cation-like centers`,
|
|
144
|
+
enum: SHOW_BONDS_ENUM,
|
|
145
|
+
},
|
|
146
|
+
polyhedra_opacity: {
|
|
147
|
+
value: 0.2,
|
|
148
|
+
description: `Opacity of coordination polyhedra faces`,
|
|
149
|
+
minimum: 0,
|
|
150
|
+
maximum: 1,
|
|
151
|
+
},
|
|
152
|
+
polyhedra_show_edges: {
|
|
153
|
+
value: true,
|
|
154
|
+
description: `Draw outlines along coordination polyhedra edges`,
|
|
155
|
+
},
|
|
156
|
+
polyhedra_edge_color: {
|
|
157
|
+
value: `#222222`,
|
|
158
|
+
description: `Color of coordination polyhedra edge lines`,
|
|
159
|
+
},
|
|
160
|
+
polyhedra_color_mode: {
|
|
161
|
+
value: `vertex`,
|
|
162
|
+
description: `Color polyhedra by the atoms at their corners, the center atom, or a single custom color`,
|
|
163
|
+
enum: {
|
|
164
|
+
vertex: `Vertex Atoms`,
|
|
165
|
+
center: `Center Atom`,
|
|
166
|
+
uniform: `Custom Color`,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
polyhedra_color: {
|
|
170
|
+
value: `#4a90d9`,
|
|
171
|
+
description: `Custom polyhedra color (used when color mode is Custom Color)`,
|
|
172
|
+
},
|
|
173
|
+
polyhedra_hide_center_atoms: {
|
|
174
|
+
value: false,
|
|
175
|
+
description: `Hide the central atom of each rendered polyhedron`,
|
|
176
|
+
},
|
|
177
|
+
polyhedra_min_neighbors: {
|
|
178
|
+
value: 4,
|
|
179
|
+
description: `Minimum number of bonded neighbors (coordination number) to form a polyhedron`,
|
|
180
|
+
minimum: 4, // hulls of <4 points are degenerate and render nothing
|
|
181
|
+
maximum: 12,
|
|
182
|
+
},
|
|
183
|
+
polyhedra_max_neighbors: {
|
|
184
|
+
value: 8,
|
|
185
|
+
description: `Maximum number of bonded neighbors for a polyhedron (skips e.g. CN-12 cuboctahedra around large A-site cations)`,
|
|
186
|
+
minimum: 4,
|
|
187
|
+
maximum: 16,
|
|
188
|
+
},
|
|
189
|
+
polyhedra_excluded_elements: {
|
|
190
|
+
value: [],
|
|
191
|
+
description: `Elements excluded from acting as polyhedra centers`,
|
|
192
|
+
},
|
|
193
|
+
polyhedra_included_elements: {
|
|
194
|
+
value: [],
|
|
195
|
+
description: `Elements always allowed as polyhedra centers (overrides automatic hiding of spectator cations like alkali metals and the max neighbors cap)`,
|
|
196
|
+
},
|
|
139
197
|
atom_color_mode: {
|
|
140
198
|
value: `element`,
|
|
141
199
|
description: `Property to use for atom coloring`,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import EmptyState from '../EmptyState.svelte'
|
|
4
4
|
import { format_num } from '../labels'
|
|
5
5
|
import { sanitize_html } from '../sanitize'
|
|
6
|
+
import { is_plain_object } from '../utils'
|
|
6
7
|
import { SettingsSection } from '../layout'
|
|
7
8
|
import type { Vec2 } from '../math'
|
|
8
9
|
import ScatterPlot from '../plot/scatter/ScatterPlot.svelte'
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
path_mode?: PathMode
|
|
57
58
|
band_type?: BandStructureType
|
|
58
59
|
show_legend?: boolean
|
|
59
|
-
x_positions?: Record<string,
|
|
60
|
+
x_positions?: Record<string, Vec2>
|
|
60
61
|
reference_frequency?: number | null
|
|
61
62
|
// Q-point index to highlight with a vertical line (synced from BZ k-path hover)
|
|
62
63
|
highlighted_qpoint_index?: number | null
|
|
@@ -104,12 +105,12 @@
|
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
if (
|
|
108
|
+
if (is_plain_object(line_kwargs)) {
|
|
108
109
|
const mode_key = is_acoustic ? `acoustic` : `optical`
|
|
109
|
-
const mode_kwargs =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
const mode_kwargs = line_kwargs[mode_key]
|
|
111
|
+
const source: Record<string, unknown> = is_plain_object(mode_kwargs)
|
|
112
|
+
? mode_kwargs
|
|
113
|
+
: line_kwargs
|
|
113
114
|
return {
|
|
114
115
|
stroke: (source.stroke as string) ?? defaults.stroke,
|
|
115
116
|
stroke_width: (source.stroke_width as number) ?? defaults.stroke_width,
|
|
@@ -287,7 +288,7 @@
|
|
|
287
288
|
x_positions = {}
|
|
288
289
|
return
|
|
289
290
|
}
|
|
290
|
-
const positions: Record<string,
|
|
291
|
+
const positions: Record<string, Vec2> = {}
|
|
291
292
|
let current_x = 0
|
|
292
293
|
|
|
293
294
|
// Preserve physical path order using the first available structure
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Vec2 } from '../math';
|
|
1
2
|
import ScatterPlot from '../plot/scatter/ScatterPlot.svelte';
|
|
2
3
|
import type { AxisConfig } from '../plot/core/types';
|
|
3
4
|
import type { BandsSpinMode, BandStructureType, BaseBandStructure, FrequencyUnit, LineKwargs, PathMode, RibbonConfig } from './types';
|
|
@@ -10,7 +11,7 @@ type $$ComponentProps = ComponentProps<typeof ScatterPlot> & {
|
|
|
10
11
|
path_mode?: PathMode;
|
|
11
12
|
band_type?: BandStructureType;
|
|
12
13
|
show_legend?: boolean;
|
|
13
|
-
x_positions?: Record<string,
|
|
14
|
+
x_positions?: Record<string, Vec2>;
|
|
14
15
|
reference_frequency?: number | null;
|
|
15
16
|
highlighted_qpoint_index?: number | null;
|
|
16
17
|
ribbon_config?: RibbonConfig | Record<string, RibbonConfig>;
|
|
@@ -34,6 +35,6 @@ type $$ComponentProps = ComponentProps<typeof ScatterPlot> & {
|
|
|
34
35
|
id?: string;
|
|
35
36
|
'data-testid'?: string;
|
|
36
37
|
};
|
|
37
|
-
declare const Bands: import("svelte").Component<$$ComponentProps, {}, "y_axis" | "
|
|
38
|
+
declare const Bands: import("svelte").Component<$$ComponentProps, {}, "y_axis" | "x_positions" | "units" | "band_spin_mode">;
|
|
38
39
|
type Bands = ReturnType<typeof Bands>;
|
|
39
40
|
export default Bands;
|
|
@@ -74,31 +74,29 @@
|
|
|
74
74
|
if (result !== undefined) synced_zoom_range = result
|
|
75
75
|
})
|
|
76
76
|
|
|
77
|
-
// Propagate synced range to
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
// Only include range if it's valid (don't override child's auto-range with undefined)
|
|
87
|
-
bands_y_axis = bands_default_axis(base_range)
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
// Propagate synced range to DOS y-axis (untrack current to avoid overwriting child zoom)
|
|
91
|
-
$effect(() => {
|
|
77
|
+
// Propagate the synced range to a child y-axis (untrack current to avoid overwriting
|
|
78
|
+
// child zoom). Skips when the current range already matches base, or is valid but
|
|
79
|
+
// differs (child zoom in progress).
|
|
80
|
+
const propagate_synced_range = (
|
|
81
|
+
current_range: Vec2 | undefined,
|
|
82
|
+
apply: (base_range: Vec2 | undefined) => void,
|
|
83
|
+
) => {
|
|
92
84
|
const base_range = synced_zoom_range ?? shared_frequency_range
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
if (ranges_equal(current_range, base_range) || is_valid_range(current_range)) return
|
|
86
|
+
apply(base_range)
|
|
87
|
+
}
|
|
88
|
+
$effect(() =>
|
|
89
|
+
propagate_synced_range(
|
|
90
|
+
untrack(() => bands_y_axis.range) as Vec2 | undefined,
|
|
91
|
+
(base_range) => bands_y_axis = bands_default_axis(base_range),
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
$effect(() =>
|
|
95
|
+
propagate_synced_range(
|
|
96
|
+
untrack(() => dos_y_axis.range) as Vec2 | undefined,
|
|
97
|
+
(base_range) => dos_y_axis = dos_default_axis(base_range),
|
|
98
|
+
)
|
|
99
|
+
)
|
|
102
100
|
|
|
103
101
|
let hovered_frequency = $state<number | null>(null)
|
|
104
102
|
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
})
|
|
74
74
|
|
|
75
75
|
let hovered_band_point = $state<InternalPoint | null>(null)
|
|
76
|
-
let bands_x_positions = $state<Record<string,
|
|
76
|
+
let bands_x_positions = $state<Record<string, Vec2>>({})
|
|
77
77
|
let hovered_qpoint_index = $derived(
|
|
78
78
|
hovered_band_point && first_band_struct &&
|
|
79
79
|
Object.keys(bands_x_positions).length > 0
|
|
@@ -199,11 +199,11 @@
|
|
|
199
199
|
style="grid-area: bz; min-width: 0; min-height: 0; overflow: hidden; height: 100%"
|
|
200
200
|
{structure}
|
|
201
201
|
{k_path_points}
|
|
202
|
-
k_path_labels={first_band_struct?.qpoints?.flatMap((
|
|
202
|
+
k_path_labels={first_band_struct?.qpoints?.flatMap((qpoint, idx) =>
|
|
203
203
|
k_path_points[idx]
|
|
204
204
|
? [{
|
|
205
205
|
position: k_path_points[idx],
|
|
206
|
-
label:
|
|
206
|
+
label: qpoint.label ? helpers.pretty_sym_point(qpoint.label) : null,
|
|
207
207
|
}]
|
|
208
208
|
: []
|
|
209
209
|
) ?? []}
|
package/dist/spectral/Dos.svelte
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { PLOT_COLORS } from '../colors'
|
|
3
3
|
import EmptyState from '../EmptyState.svelte'
|
|
4
4
|
import { SettingsSection } from '../layout'
|
|
5
|
+
import type { Vec2 } from '../math'
|
|
5
6
|
import ScatterPlot from '../plot/scatter/ScatterPlot.svelte'
|
|
6
7
|
import type { AxisConfig, DataSeries } from '../plot/core/types'
|
|
7
8
|
import type { ComponentProps } from 'svelte'
|
|
@@ -78,7 +79,7 @@
|
|
|
78
79
|
show_sigma_control?: boolean // Show sigma/smearing control
|
|
79
80
|
show_normalize_control?: boolean // Show normalization selector
|
|
80
81
|
show_units_control?: boolean // Show units selector (phonon DOS only)
|
|
81
|
-
sigma_range?:
|
|
82
|
+
sigma_range?: Vec2 // Min/max range for sigma slider (auto-detected if not provided)
|
|
82
83
|
} = $props()
|
|
83
84
|
|
|
84
85
|
const is_horizontal = $derived(orientation === `horizontal`)
|
|
@@ -307,7 +308,7 @@
|
|
|
307
308
|
effective_spin_mode === `mirror` && has_spin_polarized,
|
|
308
309
|
)
|
|
309
310
|
|
|
310
|
-
let x_range = $derived.by(():
|
|
311
|
+
let x_range = $derived.by((): Vec2 | undefined => {
|
|
311
312
|
if (series_data.length === 0) return undefined
|
|
312
313
|
const all_x = series_data.flatMap((srs) => srs.x)
|
|
313
314
|
const min_x = Math.min(...all_x), max_x = Math.max(...all_x)
|
|
@@ -317,7 +318,7 @@
|
|
|
317
318
|
return [min_x, max_x]
|
|
318
319
|
})
|
|
319
320
|
|
|
320
|
-
let y_range = $derived.by(():
|
|
321
|
+
let y_range = $derived.by((): Vec2 | undefined => {
|
|
321
322
|
if (series_data.length === 0) return undefined
|
|
322
323
|
const all_y = series_data.flatMap((srs) => srs.y)
|
|
323
324
|
const min_y = Math.min(...all_y), max_y = Math.max(...all_y)
|
|
@@ -377,7 +378,7 @@
|
|
|
377
378
|
let has_valid_data = $derived(series_data.length > 0)
|
|
378
379
|
|
|
379
380
|
// Auto-detect sigma range based on frequency/energy range
|
|
380
|
-
let effective_sigma_range = $derived.by(():
|
|
381
|
+
let effective_sigma_range = $derived.by((): Vec2 => {
|
|
381
382
|
if (sigma_range) return sigma_range
|
|
382
383
|
if (all_freqs.length === 0) return [0, 1]
|
|
383
384
|
const freq_range = Math.max(...all_freqs) - Math.min(...all_freqs)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Vec2 } from '../math';
|
|
1
2
|
import ScatterPlot from '../plot/scatter/ScatterPlot.svelte';
|
|
2
3
|
import type { AxisConfig } from '../plot/core/types';
|
|
3
4
|
import type { ComponentProps } from 'svelte';
|
|
@@ -22,7 +23,7 @@ type $$ComponentProps = ComponentProps<typeof ScatterPlot> & {
|
|
|
22
23
|
show_sigma_control?: boolean;
|
|
23
24
|
show_normalize_control?: boolean;
|
|
24
25
|
show_units_control?: boolean;
|
|
25
|
-
sigma_range?:
|
|
26
|
+
sigma_range?: Vec2;
|
|
26
27
|
};
|
|
27
28
|
declare const Dos: import("svelte").Component<$$ComponentProps, {}, "normalize" | "y_axis" | "units" | "sigma" | "hovered_frequency" | "spin_mode">;
|
|
28
29
|
type Dos = ReturnType<typeof Dos>;
|
|
@@ -22,7 +22,7 @@ export declare function extract_spin_channels<T>(data: unknown): {
|
|
|
22
22
|
up: T;
|
|
23
23
|
down: T | null;
|
|
24
24
|
} | null;
|
|
25
|
-
export declare function normalize_band_structure(
|
|
25
|
+
export declare function normalize_band_structure(band_struct: unknown): types.BaseBandStructure | null;
|
|
26
26
|
export declare function normalize_dos(dos: unknown, options?: {
|
|
27
27
|
auto_convert_units?: boolean;
|
|
28
28
|
}): types.DosData | null;
|
|
@@ -30,8 +30,8 @@ export declare function extract_k_path_points(band_struct: types.BaseBandStructu
|
|
|
30
30
|
wrap_to_bz?: boolean;
|
|
31
31
|
}): Vec3[];
|
|
32
32
|
export declare function find_qpoint_at_distance(band_struct: types.BaseBandStructure, target: number): number | null;
|
|
33
|
-
export declare function qpoint_x_position(band_struct: types.BaseBandStructure, qpoint_index: number, x_positions: Record<string,
|
|
34
|
-
export declare function find_qpoint_at_rescaled_x(band_struct: types.BaseBandStructure, rescaled_x: number, x_positions: Record<string,
|
|
33
|
+
export declare function qpoint_x_position(band_struct: types.BaseBandStructure, qpoint_index: number, x_positions: Record<string, Vec2>): number | null;
|
|
34
|
+
export declare function find_qpoint_at_rescaled_x(band_struct: types.BaseBandStructure, rescaled_x: number, x_positions: Record<string, Vec2>): number | null;
|
|
35
35
|
type SpinDensities = Record<string, number[]>;
|
|
36
36
|
export interface PymatgenDos {
|
|
37
37
|
'@class': string;
|
|
@@ -52,7 +52,7 @@ export declare function shift_to_fermi(dos: PymatgenCompleteDos): PymatgenComple
|
|
|
52
52
|
export declare function generate_ribbon_path(x_values: number[], y_values: number[], width_values: number[], x_scale_fn: (x: number) => number, y_scale_fn: (y: number) => number, max_width_px: number, scale?: number): string;
|
|
53
53
|
export declare function extract_efermi(data: unknown): number | undefined;
|
|
54
54
|
export declare function negative_fraction(values: number[]): number;
|
|
55
|
-
export declare function compute_frequency_range(band_structs: unknown, doses: unknown, padding_factor?: number):
|
|
55
|
+
export declare function compute_frequency_range(band_structs: unknown, doses: unknown, padding_factor?: number): Vec2 | undefined;
|
|
56
56
|
export declare function format_dos_tooltip(x_formatted: string, y_formatted: string, label: string | null, is_horizontal: boolean, is_phonon: boolean, units: types.FrequencyUnit, x_axis_label: string, y_axis_label: string, num_series: number): {
|
|
57
57
|
title?: string;
|
|
58
58
|
lines: string[];
|
|
@@ -93,8 +93,8 @@ export declare const DEFAULT_SIGMA = 0;
|
|
|
93
93
|
export declare const DEFAULT_NORMALIZE: types.NormalizationMode;
|
|
94
94
|
export declare const DEFAULT_UNITS: types.FrequencyUnit;
|
|
95
95
|
export declare function format_sigma(val: number): string;
|
|
96
|
-
export declare const validate_sigma_range: ([min, max]:
|
|
97
|
-
export declare function calculate_sigma_step(range:
|
|
96
|
+
export declare const validate_sigma_range: ([min, max]: Vec2) => Vec2;
|
|
97
|
+
export declare function calculate_sigma_step(range: Vec2): number;
|
|
98
98
|
export interface BandPointMeta extends Record<string, unknown> {
|
|
99
99
|
band_idx: number;
|
|
100
100
|
spin: `up` | `down`;
|