matterviz 0.4.2 → 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/FilePicker.svelte +40 -50
- package/dist/api/optimade.js +10 -7
- package/dist/app.css +15 -0
- package/dist/brillouin/BrillouinZone.svelte +18 -9
- package/dist/brillouin/BrillouinZoneScene.svelte +20 -29
- package/dist/brillouin/compute.js +10 -16
- package/dist/brillouin/geometry.js +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +18 -15
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +17 -113
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +104 -264
- package/dist/chempot-diagram/async-compute.svelte.js +12 -13
- 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/export.js +1 -6
- package/dist/chempot-diagram/temperature.js +9 -10
- package/dist/composition/BarChart.svelte +7 -9
- package/dist/composition/Composition.svelte +3 -8
- package/dist/composition/Formula.svelte +2 -2
- package/dist/composition/FormulaFilter.svelte +27 -93
- package/dist/composition/format.js +6 -8
- package/dist/composition/parse.js +50 -105
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +6 -17
- package/dist/convex-hull/ConvexHull2D.svelte +0 -2
- package/dist/convex-hull/ConvexHull3D.svelte +19 -47
- package/dist/convex-hull/ConvexHull4D.svelte +65 -95
- package/dist/convex-hull/StructurePopup.svelte +1 -1
- package/dist/convex-hull/gas-thermodynamics.js +21 -53
- package/dist/convex-hull/helpers.js +1 -7
- package/dist/convex-hull/thermodynamics.js +19 -27
- package/dist/coordination/CoordinationBarPlot.svelte +12 -21
- package/dist/element/BohrAtom.svelte +0 -1
- package/dist/element/ElementTile.svelte +26 -44
- package/dist/element/data.d.ts +2 -0
- package/dist/element/data.js +5 -1
- package/dist/element/index.d.ts +1 -1
- package/dist/element/index.js +1 -1
- package/dist/fermi-surface/FermiSurface.svelte +22 -23
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +2 -6
- package/dist/fermi-surface/FermiSurfaceScene.svelte +32 -77
- package/dist/fermi-surface/compute.js +22 -55
- package/dist/fermi-surface/parse.js +38 -70
- 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 +57 -84
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/ExportPane.svelte +1 -1
- package/dist/io/decompress.d.ts +2 -0
- package/dist/io/decompress.js +3 -2
- package/dist/io/export.d.ts +7 -4
- package/dist/io/export.js +70 -18
- package/dist/io/file-drop.js +60 -35
- package/dist/io/url-drop.d.ts +2 -0
- package/dist/io/url-drop.js +28 -16
- package/dist/isosurface/Isosurface.svelte +687 -196
- package/dist/isosurface/Isosurface.svelte.d.ts +7 -1
- package/dist/isosurface/IsosurfaceControls.svelte +564 -85
- 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/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.js +1 -1
- package/dist/layout/InfoCard.svelte +1 -3
- package/dist/layout/SettingsSection.svelte +52 -61
- package/dist/layout/SettingsSection.svelte.d.ts +6 -7
- package/dist/layout/ViewerChrome.svelte +7 -1
- package/dist/layout/json-tree/JsonNode.svelte +14 -48
- package/dist/layout/json-tree/JsonTree.svelte +48 -95
- package/dist/layout/json-tree/JsonValue.svelte +3 -18
- package/dist/layout/json-tree/utils.d.ts +0 -3
- package/dist/layout/json-tree/utils.js +50 -179
- package/dist/marching-cubes.d.ts +8 -1
- package/dist/marching-cubes.js +115 -48
- package/dist/math.d.ts +3 -2
- package/dist/math.js +29 -38
- package/dist/overlays/ContextMenu.svelte +15 -32
- package/dist/overlays/DraggablePane.svelte +39 -58
- package/dist/overlays/DraggablePane.svelte.d.ts +1 -1
- package/dist/overlays/GlassChip.svelte +3 -1
- package/dist/periodic-table/PeriodicTableControls.svelte +26 -52
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +18 -34
- package/dist/phase-diagram/build-diagram.js +1 -6
- package/dist/phase-diagram/svg-to-diagram.js +9 -14
- package/dist/plot/bar/BarPlot.svelte +38 -42
- package/dist/plot/bar/SpacegroupBarPlot.svelte +18 -42
- package/dist/plot/box/BoxPlot.svelte +27 -23
- package/dist/plot/core/auto-place.d.ts +1 -1
- package/dist/plot/core/auto-place.js +1 -1
- package/dist/plot/core/data-transform.d.ts +1 -2
- package/dist/plot/core/data-transform.js +0 -10
- package/dist/plot/core/layout.d.ts +12 -5
- package/dist/plot/core/layout.js +37 -27
- 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/svg.js +0 -1
- package/dist/plot/core/utils/hierarchy-chart.d.ts +1 -0
- package/dist/plot/core/utils/hierarchy-chart.js +12 -0
- package/dist/plot/core/utils/hierarchy-labels.js +3 -2
- package/dist/plot/histogram/Histogram.svelte +21 -26
- package/dist/plot/sankey/sankey.js +13 -9
- package/dist/plot/scatter/BinnedScatterPlot.svelte +59 -43
- package/dist/plot/scatter/ScatterPlot.svelte +67 -52
- package/dist/plot/scatter/adaptive-density.d.ts +1 -1
- package/dist/plot/scatter/adaptive-density.js +36 -20
- package/dist/plot/sunburst/Sunburst.svelte +20 -20
- package/dist/plot/treemap/Treemap.svelte +175 -60
- package/dist/plot/treemap/Treemap.svelte.d.ts +6 -0
- package/dist/plot/treemap/index.d.ts +1 -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 +4 -2
- package/dist/plot/treemap/treemap.js +5 -2
- package/dist/rdf/RdfPlot.svelte +17 -35
- package/dist/rdf/calc-rdf.js +59 -44
- package/dist/rdf/index.d.ts +0 -1
- package/dist/sanitize.js +84 -26
- package/dist/scene/SceneCamera.svelte +1 -1
- package/dist/scene/SceneCamera.svelte.d.ts +1 -1
- 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.js +159 -482
- package/dist/spectral/Bands.svelte +151 -158
- package/dist/spectral/BrillouinBandsDos.svelte +4 -19
- package/dist/spectral/Dos.svelte +26 -24
- package/dist/spectral/helpers.js +40 -105
- package/dist/structure/AtomLegend.svelte +8 -13
- package/dist/structure/AtomLegend.svelte.d.ts +2 -3
- package/dist/structure/CellSelect.svelte +35 -10
- package/dist/structure/Structure.svelte +177 -99
- package/dist/structure/Structure.svelte.d.ts +1 -1
- package/dist/structure/StructureCarousel.svelte +10 -3
- package/dist/structure/StructureControls.svelte +8 -26
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureInfoPane.svelte +65 -76
- package/dist/structure/StructureScene.svelte +75 -109
- package/dist/structure/StructureScene.svelte.d.ts +3 -1
- package/dist/structure/StructureViewport.svelte +120 -55
- package/dist/structure/StructureViewport.svelte.d.ts +3 -1
- package/dist/structure/atom-properties.d.ts +1 -1
- package/dist/structure/atom-properties.js +4 -3
- package/dist/structure/bond-order-perception.js +3 -8
- package/dist/structure/bonding.d.ts +0 -1
- package/dist/structure/bonding.js +16 -23
- package/dist/structure/export.js +50 -74
- package/dist/structure/format-detect.js +5 -7
- package/dist/structure/index.js +6 -12
- package/dist/structure/parse.js +38 -100
- package/dist/structure/partial-occupancy.js +7 -4
- package/dist/structure/pbc.js +8 -10
- package/dist/structure/polyhedra.js +5 -4
- package/dist/structure/prop-groups.d.ts +85 -0
- package/dist/structure/prop-groups.js +18 -0
- package/dist/symmetry/SymmetryStats.svelte +0 -4
- package/dist/symmetry/WyckoffTable.svelte +5 -4
- package/dist/symmetry/cell-transform.js +5 -14
- package/dist/symmetry/index.js +6 -9
- package/dist/table/HeatmapTable.svelte +61 -103
- package/dist/table/ToggleMenu.svelte +166 -44
- package/dist/table/ToggleMenu.svelte.d.ts +1 -1
- package/dist/theme/embedded.d.ts +18 -0
- package/dist/theme/embedded.js +206 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +1 -2
- package/dist/theme/themes.mjs +31 -60
- package/dist/tooltip/TooltipContent.svelte +1 -1
- package/dist/tooltip/TooltipContent.svelte.d.ts +1 -1
- package/dist/tooltip/index.d.ts +8 -1
- package/dist/trajectory/Trajectory.svelte +140 -120
- package/dist/trajectory/TrajectoryError.svelte +1 -66
- package/dist/trajectory/TrajectoryExportPane.svelte +0 -1
- package/dist/trajectory/TrajectoryInfoPane.svelte +55 -80
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +2 -1
- package/dist/trajectory/extract.js +19 -29
- package/dist/trajectory/format-detect.d.ts +2 -0
- package/dist/trajectory/format-detect.js +7 -5
- package/dist/trajectory/frame-reader.js +3 -4
- package/dist/trajectory/helpers.js +16 -49
- package/dist/trajectory/index.js +2 -8
- package/dist/trajectory/parse/ase.js +1 -1
- package/dist/trajectory/parse/index.d.ts +4 -3
- package/dist/trajectory/parse/index.js +12 -17
- package/dist/trajectory/parse/vaspout-h5.d.ts +0 -1
- package/dist/trajectory/parse/vaspout-h5.js +1 -4
- package/dist/trajectory/parse/xyz.js +48 -2
- package/dist/trajectory/plotting.js +14 -37
- package/dist/xrd/XrdPlot.svelte +43 -68
- package/dist/xrd/calc-xrd.js +22 -58
- package/dist/xrd/parse.js +13 -22
- package/package.json +40 -8
- package/readme.md +6 -5
- 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
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
popup_div?: HTMLDivElement
|
|
39
39
|
} = $props()
|
|
40
40
|
|
|
41
|
-
const formula_html = $derived
|
|
41
|
+
const formula_html = $derived(
|
|
42
42
|
sanitize_formula(get_electro_neg_formula(stats?.formula ?? structure, true)),
|
|
43
43
|
)
|
|
44
44
|
const context = $derived({ structure, stats, formula_html })
|
|
@@ -24,47 +24,23 @@ export const GAS_STOICHIOMETRY = {
|
|
|
24
24
|
CO2: { C: 1, O: 2 },
|
|
25
25
|
H2O: { H: 2, O: 1 },
|
|
26
26
|
};
|
|
27
|
-
// Default
|
|
27
|
+
// Default Thermodynamic Data (abstracted - users can provide their own)
|
|
28
|
+
// Temperature grid (K) shared by all tabulated T*S data below
|
|
29
|
+
// oxfmt-ignore
|
|
30
|
+
const TS_TEMPERATURES = [0, 298, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000];
|
|
31
|
+
// Default T*S values (eV/molecule) at TS_TEMPERATURES, interpolated between grid points.
|
|
28
32
|
// Source: Barin Thermochemical Tables and NBS Thermochemical Tables
|
|
29
33
|
// Data compiled to match PIRO (https://github.com/GENESIS-EFRC/piro)
|
|
30
|
-
//
|
|
34
|
+
// F2 not in Barin/NBS tables used by PIRO - approximated from similar homonuclear diatomics (O2, N2)
|
|
31
35
|
// oxfmt-ignore
|
|
32
36
|
const DEFAULT_TS_DATA = {
|
|
33
|
-
O2:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
N2: {
|
|
42
|
-
temperatures: [0, 298, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],
|
|
43
|
-
values: [0, 0.2959, 0.2981, 0.4149, 0.5356, 0.6596, 0.7866, 0.9161, 1.0481, 1.1822, 1.3184, 1.4563, 1.596, 1.7372, 1.8799, 2.0239, 2.1693, 2.3158, 2.4634, 2.6122],
|
|
44
|
-
},
|
|
45
|
-
CO: {
|
|
46
|
-
temperatures: [0, 298, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],
|
|
47
|
-
values: [0, 0.3054, 0.3076, 0.4275, 0.5515, 0.6788, 0.8092, 0.9423, 1.0778, 1.2155, 1.3552, 1.4967, 1.64, 1.7848, 1.9311, 2.0788, 2.2277, 2.3779, 2.5291, 2.6815],
|
|
48
|
-
},
|
|
49
|
-
CO2: {
|
|
50
|
-
temperatures: [0, 298, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],
|
|
51
|
-
values: [0, 0.2202, 0.2218, 0.3113, 0.4057, 0.5042, 0.6064, 0.7116, 0.8197, 0.9303, 1.0432, 1.1582, 1.2751, 1.3938, 1.5141, 1.636, 1.7593, 1.8839, 2.0098, 2.1369],
|
|
52
|
-
},
|
|
53
|
-
H2O: {
|
|
54
|
-
temperatures: [0, 298, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000],
|
|
55
|
-
values: [0, 0.1946, 0.1961, 0.2749, 0.357, 0.4419, 0.5293, 0.6189, 0.7107, 0.8045, 0.9001, 0.9975, 1.0966, 1.1972, 1.2994, 1.403, 1.5079, 1.6142, 1.7216, 1.8303],
|
|
56
|
-
},
|
|
57
|
-
F2: {
|
|
58
|
-
// F2 not in Barin/NBS tables used by PIRO - approximated from similar homonuclear diatomics (O2, N2)
|
|
59
|
-
temperatures: [
|
|
60
|
-
0, 298, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600,
|
|
61
|
-
1700, 1800, 1900, 2000,
|
|
62
|
-
],
|
|
63
|
-
values: [
|
|
64
|
-
0, 0.31, 0.312, 0.435, 0.56, 0.69, 0.82, 0.96, 1.1, 1.24, 1.38, 1.53, 1.68, 1.83,
|
|
65
|
-
1.98, 2.13, 2.29, 2.45, 2.61, 2.77,
|
|
66
|
-
],
|
|
67
|
-
},
|
|
37
|
+
O2: [0, 0.317, 0.3192, 0.4433, 0.5718, 0.7041, 0.8396, 0.9781, 1.119, 1.2623, 1.4075, 1.5547, 1.7036, 1.8541, 2.006, 2.1594, 2.3141, 2.47, 2.6271, 2.7854],
|
|
38
|
+
H2: [0, 0.2019, 0.2034, 0.2886, 0.3776, 0.4697, 0.5645, 0.6614, 0.7605, 0.8614, 0.964, 1.0683, 1.1741, 1.2815, 1.3902, 1.5003, 1.6116, 1.7242, 1.838, 1.9528],
|
|
39
|
+
N2: [0, 0.2959, 0.2981, 0.4149, 0.5356, 0.6596, 0.7866, 0.9161, 1.0481, 1.1822, 1.3184, 1.4563, 1.596, 1.7372, 1.8799, 2.0239, 2.1693, 2.3158, 2.4634, 2.6122],
|
|
40
|
+
CO: [0, 0.3054, 0.3076, 0.4275, 0.5515, 0.6788, 0.8092, 0.9423, 1.0778, 1.2155, 1.3552, 1.4967, 1.64, 1.7848, 1.9311, 2.0788, 2.2277, 2.3779, 2.5291, 2.6815],
|
|
41
|
+
CO2: [0, 0.2202, 0.2218, 0.3113, 0.4057, 0.5042, 0.6064, 0.7116, 0.8197, 0.9303, 1.0432, 1.1582, 1.2751, 1.3938, 1.5141, 1.636, 1.7593, 1.8839, 2.0098, 2.1369],
|
|
42
|
+
H2O: [0, 0.1946, 0.1961, 0.2749, 0.357, 0.4419, 0.5293, 0.6189, 0.7107, 0.8045, 0.9001, 0.9975, 1.0966, 1.1972, 1.2994, 1.403, 1.5079, 1.6142, 1.7216, 1.8303],
|
|
43
|
+
F2: [0, 0.31, 0.312, 0.435, 0.56, 0.69, 0.82, 0.96, 1.1, 1.24, 1.38, 1.53, 1.68, 1.83, 1.98, 2.13, 2.29, 2.45, 2.61, 2.77],
|
|
68
44
|
};
|
|
69
45
|
// Formation enthalpies H_f at 0K in eV/molecule
|
|
70
46
|
// These are the reference energies for formation from elements
|
|
@@ -76,27 +52,19 @@ const DEFAULT_ENTHALPY = {
|
|
|
76
52
|
H2O: -0.82547,
|
|
77
53
|
// O2, N2, H2, F2 are reference states with H_f = 0
|
|
78
54
|
};
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// Clamp to valid range
|
|
84
|
-
if (T <= temperatures[0])
|
|
55
|
+
// Linearly interpolate T*S value at given temperature (clamped to the tabulated range)
|
|
56
|
+
function interpolate_ts(values, T) {
|
|
57
|
+
const temps = TS_TEMPERATURES;
|
|
58
|
+
if (T <= temps[0])
|
|
85
59
|
return values[0];
|
|
86
|
-
if (T >=
|
|
60
|
+
if (T >= temps[temps.length - 1])
|
|
87
61
|
return values[values.length - 1];
|
|
88
|
-
}
|
|
89
62
|
// Find bracketing indices
|
|
90
63
|
let idx = 0;
|
|
91
|
-
while (idx <
|
|
64
|
+
while (idx < temps.length - 1 && temps[idx + 1] < T)
|
|
92
65
|
idx++;
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
const v_low = values[idx];
|
|
96
|
-
const v_high = values[idx + 1];
|
|
97
|
-
// Linear interpolation
|
|
98
|
-
const fraction = (T - T_low) / (T_high - T_low);
|
|
99
|
-
return v_low + fraction * (v_high - v_low);
|
|
66
|
+
const fraction = (T - temps[idx]) / (temps[idx + 1] - temps[idx]);
|
|
67
|
+
return values[idx] + fraction * (values[idx + 1] - values[idx]);
|
|
100
68
|
}
|
|
101
69
|
// Default Provider Implementation
|
|
102
70
|
// Create the default gas thermodynamics provider using built-in data
|
|
@@ -290,13 +290,7 @@ energy_source_mode) {
|
|
|
290
290
|
for (const el of Object.keys(entry.composition))
|
|
291
291
|
elements_in_entries.add(el);
|
|
292
292
|
}
|
|
293
|
-
|
|
294
|
-
for (const el of elements_in_entries) {
|
|
295
|
-
if (!unary_refs[el]) {
|
|
296
|
-
can_compute_e_form = false;
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
293
|
+
const can_compute_e_form = [...elements_in_entries].every((el) => el in unary_refs);
|
|
300
294
|
// Resolve mode to avoid inconsistent states:
|
|
301
295
|
// - If full precomputed available, honor user toggle
|
|
302
296
|
// - Else if we can compute, use on-the-fly automatically
|
|
@@ -442,40 +442,32 @@ export function compute_lower_hull_triangles(points) {
|
|
|
442
442
|
return compute_quickhull_triangles(points).filter((face) => face.normal.z < 0 - EPS);
|
|
443
443
|
}
|
|
444
444
|
export const build_lower_hull_model = (faces) => faces.map((tri) => {
|
|
445
|
-
const [
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
const [min_x, _mx, max_x] = [p1.x, p2.x, p3.x].sort((a, b) => a - b);
|
|
459
|
-
const [min_y, _my, max_y] = [p1.y, p2.y, p3.y].sort((a, b) => a - b);
|
|
460
|
-
const { x: x1, y: y1 } = p1;
|
|
461
|
-
const { x: x2, y: y2 } = p2;
|
|
462
|
-
const { x: x3, y: y3 } = p3;
|
|
463
|
-
const denom = (y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3);
|
|
445
|
+
const [{ x: x1, y: y1, z: z1 }, { x: x2, y: y2, z: z2 }, { x: x3, y: y3, z: z3 }] = tri.vertices;
|
|
446
|
+
// Fit plane z = a*x + b*y + c through the three vertices (flat fallback if degenerate)
|
|
447
|
+
const det = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
|
|
448
|
+
const plane = Math.abs(det) < 1e-12
|
|
449
|
+
? { a: 0, b: 0, c: (z1 + z2 + z3) / 3 }
|
|
450
|
+
: {
|
|
451
|
+
a: (z1 * (y2 - y3) + z2 * (y3 - y1) + z3 * (y1 - y2)) / det,
|
|
452
|
+
b: (z1 * (x3 - x2) + z2 * (x1 - x3) + z3 * (x2 - x1)) / det,
|
|
453
|
+
c: (z1 * (x2 * y3 - x3 * y2) +
|
|
454
|
+
z2 * (x3 * y1 - x1 * y3) +
|
|
455
|
+
z3 * (x1 * y2 - x2 * y1)) /
|
|
456
|
+
det,
|
|
457
|
+
};
|
|
464
458
|
return {
|
|
465
|
-
|
|
466
|
-
b: plane.b,
|
|
467
|
-
c: plane.c,
|
|
459
|
+
...plane,
|
|
468
460
|
x1,
|
|
469
461
|
y1,
|
|
470
462
|
x2,
|
|
471
463
|
y2,
|
|
472
464
|
x3,
|
|
473
465
|
y3,
|
|
474
|
-
min_x,
|
|
475
|
-
max_x,
|
|
476
|
-
min_y,
|
|
477
|
-
max_y,
|
|
478
|
-
denom,
|
|
466
|
+
min_x: Math.min(x1, x2, x3),
|
|
467
|
+
max_x: Math.max(x1, x2, x3),
|
|
468
|
+
min_y: Math.min(y1, y2, y3),
|
|
469
|
+
max_y: Math.max(y1, y2, y3),
|
|
470
|
+
denom: det,
|
|
479
471
|
};
|
|
480
472
|
});
|
|
481
473
|
function point_in_triangle_xy(model, x, y) {
|
|
@@ -97,29 +97,21 @@
|
|
|
97
97
|
})),
|
|
98
98
|
)
|
|
99
99
|
|
|
100
|
-
// Compute appropriate ranges
|
|
101
|
-
const ranges = $derived.by(() => {
|
|
102
|
-
// CN axis should always start at 0 and show at least [0,4]
|
|
103
|
-
let max_cn = 4 // minimum max value
|
|
104
|
-
for (const entry of entries_with_data) {
|
|
105
|
-
for (const [cn] of entry.data.cn_histogram) max_cn = Math.max(max_cn, cn)
|
|
106
|
-
}
|
|
107
|
-
const cn_range: Vec2 = [-0.5, max_cn + 0.5]
|
|
108
|
-
|
|
109
|
-
return { count: [0, null] as [number, null], cn: cn_range } // Count axis should always start at 0
|
|
110
|
-
})
|
|
111
|
-
|
|
112
100
|
// Derive integer CN ticks for axis labels
|
|
113
101
|
const cn_ticks = $derived.by(() => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
for (let idx = 0; idx <= 4; idx++) all_cns.add(idx)
|
|
117
|
-
// Add actual CN values from data
|
|
102
|
+
// Always include minimum CN values 0-4, then actual CN values from data
|
|
103
|
+
const all_cns = new SvelteSet<number>([0, 1, 2, 3, 4])
|
|
118
104
|
for (const entry of entries_with_data) {
|
|
119
105
|
for (const [cn] of entry.data.cn_histogram) all_cns.add(cn)
|
|
120
106
|
}
|
|
121
107
|
return Array.from(all_cns).sort((cn1, cn2) => cn1 - cn2)
|
|
122
108
|
})
|
|
109
|
+
|
|
110
|
+
// CN axis spans all ticks with half-bar margin; count axis always starts at 0
|
|
111
|
+
const ranges = $derived({
|
|
112
|
+
count: [0, null] as [number, null],
|
|
113
|
+
cn: [-0.5, (cn_ticks.at(-1) ?? 4) + 0.5] as Vec2,
|
|
114
|
+
})
|
|
123
115
|
// Build BarPlot series based on split_mode
|
|
124
116
|
const bar_series = $derived.by<BarSeries<CoordinationMetadata>[]>(() => {
|
|
125
117
|
if (split_mode === `by_element`) {
|
|
@@ -131,12 +123,11 @@
|
|
|
131
123
|
|
|
132
124
|
for (const entry of entries_with_data) {
|
|
133
125
|
for (const [element, cn_histogram] of entry.data.cn_histogram_by_element) {
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
let element_map = element_series_map.get(element)
|
|
127
|
+
if (!element_map) {
|
|
128
|
+
element_map = new SvelteMap()
|
|
129
|
+
element_series_map.set(element, element_map)
|
|
136
130
|
}
|
|
137
|
-
const element_map = element_series_map.get(element)
|
|
138
|
-
if (!element_map) continue
|
|
139
|
-
|
|
140
131
|
for (const [cn, count] of cn_histogram) {
|
|
141
132
|
all_cns.add(cn)
|
|
142
133
|
element_map.set(cn, (element_map.get(cn) ?? 0) + count)
|
|
@@ -109,7 +109,6 @@
|
|
|
109
109
|
{number_electrons(elec_idx)}
|
|
110
110
|
{:else if number_electrons === `hierarchical`}
|
|
111
111
|
{shell_idx + 1}.{elec_idx + 1}
|
|
112
|
-
<!-- {:else if [`sequential`, true].includes(number_electrons)} -->
|
|
113
112
|
{:else}
|
|
114
113
|
{@const nth_electron =
|
|
115
114
|
shells.slice(0, shell_idx).reduce((sum, count) => sum + count, 0) +
|
|
@@ -94,57 +94,39 @@
|
|
|
94
94
|
return !is_color(value)
|
|
95
95
|
})
|
|
96
96
|
|
|
97
|
+
// CSS classes for segments and value positions, keyed by `layout-count`
|
|
98
|
+
const layout_classes: Record<string, { segments: string[]; positions: string[] }> = {
|
|
99
|
+
'diagonal-2': {
|
|
100
|
+
segments: [`diagonal-top`, `diagonal-bottom`],
|
|
101
|
+
positions: [`top-left`, `bottom-right`],
|
|
102
|
+
},
|
|
103
|
+
'horizontal-3': {
|
|
104
|
+
segments: [`horizontal-top`, `horizontal-middle`, `horizontal-bottom`],
|
|
105
|
+
positions: [`bar-top-left`, `bar-middle-right`, `bar-bottom-left`],
|
|
106
|
+
},
|
|
107
|
+
'vertical-3': {
|
|
108
|
+
segments: [`vertical-left`, `vertical-middle`, `vertical-right`],
|
|
109
|
+
positions: [`bar-left-top`, `bar-middle-bottom`, `bar-right-top`],
|
|
110
|
+
},
|
|
111
|
+
'triangular-4': {
|
|
112
|
+
segments: [`top`, `right`, `bottom`, `left`].map((pos) => `triangle-${pos}`),
|
|
113
|
+
positions: [`top`, `right`, `bottom`, `left`].map((pos) => `triangle-${pos}-pos`),
|
|
114
|
+
},
|
|
115
|
+
'quadrant-4': {
|
|
116
|
+
segments: [`tl`, `tr`, `bl`, `br`].map((pos) => `quadrant-${pos}`),
|
|
117
|
+
positions: [`tl`, `tr`, `bl`, `br`].map((pos) => `value-quadrant-${pos}`),
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
|
|
97
121
|
// Get the appropriate CSS classes for segments and positions based on layout
|
|
98
122
|
const layout_config = $derived.by(() => {
|
|
99
123
|
if (!Array.isArray(value)) return null
|
|
100
|
-
|
|
101
124
|
const count = value.length
|
|
102
125
|
// Use explicit split_layout or auto-determine based on count
|
|
103
126
|
const layout =
|
|
104
127
|
split_layout ??
|
|
105
|
-
({
|
|
106
|
-
|
|
107
|
-
3: `horizontal`,
|
|
108
|
-
4: `quadrant`,
|
|
109
|
-
}[count] as SplitLayout | undefined)
|
|
110
|
-
|
|
111
|
-
if (!layout) return null
|
|
112
|
-
|
|
113
|
-
if (layout === `diagonal` && count === 2) {
|
|
114
|
-
return {
|
|
115
|
-
segments: [`diagonal-top`, `diagonal-bottom`],
|
|
116
|
-
positions: [`top-left`, `bottom-right`],
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (layout === `horizontal` && count === 3) {
|
|
121
|
-
return {
|
|
122
|
-
segments: [`horizontal-top`, `horizontal-middle`, `horizontal-bottom`],
|
|
123
|
-
positions: [`bar-top-left`, `bar-middle-right`, `bar-bottom-left`],
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (layout === `vertical` && count === 3) {
|
|
128
|
-
return {
|
|
129
|
-
segments: [`vertical-left`, `vertical-middle`, `vertical-right`],
|
|
130
|
-
positions: [`bar-left-top`, `bar-middle-bottom`, `bar-right-top`],
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (layout === `triangular` && count === 4) {
|
|
135
|
-
return {
|
|
136
|
-
segments: [`top`, `right`, `bottom`, `left`].map((pos) => `triangle-${pos}`),
|
|
137
|
-
positions: [`top`, `right`, `bottom`, `left`].map((pos) => `triangle-${pos}-pos`),
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (layout === `quadrant` && count === 4) {
|
|
142
|
-
const segments = [`tl`, `tr`, `bl`, `br`].map((pos) => `quadrant-${pos}`)
|
|
143
|
-
const positions = [`tl`, `tr`, `bl`, `br`].map((pos) => `value-quadrant-${pos}`)
|
|
144
|
-
return { segments, positions }
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return null
|
|
128
|
+
({ 2: `diagonal`, 3: `horizontal`, 4: `quadrant` }[count] as SplitLayout | undefined)
|
|
129
|
+
return layout ? (layout_classes[`${layout}-${count}`] ?? null) : null
|
|
148
130
|
})
|
|
149
131
|
</script>
|
|
150
132
|
|
package/dist/element/data.d.ts
CHANGED