matterviz 0.1.12 → 0.1.13
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/ContextMenu.svelte +1 -1
- package/dist/ContextMenu.svelte.d.ts +3 -3
- package/dist/DraggablePane.svelte +10 -5
- package/dist/DraggablePane.svelte.d.ts +3 -3
- package/dist/FilePicker.svelte.d.ts +3 -3
- package/dist/Icon.svelte.d.ts +3 -3
- package/dist/Nav.svelte +76 -31
- package/dist/SettingsSection.svelte.d.ts +3 -3
- package/dist/Spinner.svelte +18 -29
- package/dist/Spinner.svelte.d.ts +3 -3
- package/dist/app.css +4 -0
- package/dist/bands/Bands.svelte +216 -0
- package/dist/bands/Bands.svelte.d.ts +16 -0
- package/dist/bands/BandsAndDos.svelte +26 -0
- package/dist/bands/BandsAndDos.svelte.d.ts +16 -0
- package/dist/bands/Dos.svelte +124 -0
- package/dist/bands/Dos.svelte.d.ts +18 -0
- package/dist/bands/helpers.d.ts +11 -0
- package/dist/bands/helpers.js +195 -0
- package/dist/bands/index.d.ts +5 -0
- package/dist/bands/index.js +6 -0
- package/dist/bands/types.d.ts +54 -0
- package/dist/bands/types.js +2 -0
- package/dist/brillouin/BrillouinZone.svelte +373 -0
- package/dist/brillouin/BrillouinZone.svelte.d.ts +57 -0
- package/dist/brillouin/BrillouinZoneControls.svelte +88 -0
- package/dist/brillouin/BrillouinZoneControls.svelte.d.ts +14 -0
- package/dist/brillouin/BrillouinZoneExportPane.svelte +129 -0
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +15 -0
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +115 -0
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +13 -0
- package/dist/brillouin/BrillouinZoneScene.svelte +180 -0
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +34 -0
- package/dist/brillouin/compute.d.ts +7 -0
- package/dist/brillouin/compute.js +215 -0
- package/dist/brillouin/index.d.ts +7 -0
- package/dist/brillouin/index.js +7 -0
- package/dist/brillouin/types.d.ts +23 -0
- package/dist/brillouin/types.js +1 -0
- package/dist/composition/BarChart.svelte.d.ts +3 -3
- package/dist/composition/BubbleChart.svelte +7 -6
- package/dist/composition/BubbleChart.svelte.d.ts +3 -3
- package/dist/composition/Composition.svelte.d.ts +3 -3
- package/dist/composition/PieChart.svelte +1 -1
- package/dist/composition/PieChart.svelte.d.ts +3 -3
- package/dist/composition/parse.d.ts +3 -3
- package/dist/coordination/CoordinationBarPlot.svelte +241 -0
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +29 -0
- package/dist/coordination/calc-coordination.d.ts +15 -0
- package/dist/coordination/calc-coordination.js +66 -0
- package/dist/coordination/index.d.ts +8 -0
- package/dist/coordination/index.js +7 -0
- package/dist/element/BohrAtom.svelte.d.ts +3 -3
- package/dist/element/ElementHeading.svelte.d.ts +3 -3
- package/dist/element/ElementPhoto.svelte.d.ts +3 -3
- package/dist/element/ElementStats.svelte.d.ts +3 -3
- package/dist/element/ElementTile.svelte +1 -1
- package/dist/element/ElementTile.svelte.d.ts +4 -4
- package/dist/element/Nucleus.svelte.d.ts +3 -3
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/io/export.d.ts +1 -6
- package/dist/io/export.js +12 -12
- package/dist/labels.d.ts +19 -0
- package/dist/labels.js +59 -0
- package/dist/math.d.ts +7 -2
- package/dist/math.js +24 -12
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +3 -3
- package/dist/periodic-table/PeriodicTableControls.svelte.d.ts +3 -3
- package/dist/periodic-table/PropertySelect.svelte +1 -1
- package/dist/periodic-table/PropertySelect.svelte.d.ts +5 -4
- package/dist/periodic-table/TableInset.svelte.d.ts +3 -3
- package/dist/phase-diagram/PhaseDiagram2D.svelte +44 -107
- package/dist/phase-diagram/PhaseDiagram2D.svelte.d.ts +7 -27
- package/dist/phase-diagram/PhaseDiagram3D.svelte +67 -170
- package/dist/phase-diagram/PhaseDiagram3D.svelte.d.ts +7 -31
- package/dist/phase-diagram/PhaseDiagram4D.svelte +87 -145
- package/dist/phase-diagram/PhaseDiagram4D.svelte.d.ts +5 -28
- package/dist/phase-diagram/PhaseDiagramControls.svelte +9 -9
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +6 -6
- package/dist/phase-diagram/PhaseDiagramInfoPane.svelte +4 -4
- package/dist/phase-diagram/PhaseDiagramInfoPane.svelte.d.ts +5 -5
- package/dist/phase-diagram/PhaseDiagramStats.svelte +9 -16
- package/dist/phase-diagram/PhaseDiagramStats.svelte.d.ts +3 -3
- package/dist/phase-diagram/StructurePopup.svelte.d.ts +3 -3
- package/dist/phase-diagram/barycentric-coords.js +13 -24
- package/dist/phase-diagram/helpers.d.ts +12 -14
- package/dist/phase-diagram/helpers.js +70 -23
- package/dist/phase-diagram/index.d.ts +58 -0
- package/dist/phase-diagram/index.js +44 -0
- package/dist/phase-diagram/thermodynamics.js +2 -3
- package/dist/phase-diagram/types.d.ts +3 -8
- package/dist/plot/BarPlot.svelte +474 -240
- package/dist/plot/BarPlot.svelte.d.ts +16 -37
- package/dist/plot/BarPlotControls.svelte +33 -201
- package/dist/plot/BarPlotControls.svelte.d.ts +11 -22
- package/dist/plot/ColorBar.svelte.d.ts +3 -3
- package/dist/plot/ColorScaleSelect.svelte +1 -1
- package/dist/plot/ColorScaleSelect.svelte.d.ts +3 -3
- package/dist/plot/ElementScatter.svelte +5 -5
- package/dist/plot/ElementScatter.svelte.d.ts +8 -8
- package/dist/plot/Histogram.svelte +318 -170
- package/dist/plot/Histogram.svelte.d.ts +21 -41
- package/dist/plot/HistogramControls.svelte +115 -347
- package/dist/plot/HistogramControls.svelte.d.ts +13 -28
- package/dist/plot/Line.svelte +1 -1
- package/dist/plot/Line.svelte.d.ts +4 -4
- package/dist/plot/PlotControls.svelte +280 -0
- package/dist/plot/PlotControls.svelte.d.ts +4 -0
- package/dist/plot/PlotLegend.svelte +9 -24
- package/dist/plot/PlotLegend.svelte.d.ts +3 -3
- package/dist/plot/ScatterPlot.svelte +536 -571
- package/dist/plot/ScatterPlot.svelte.d.ts +18 -90
- package/dist/plot/ScatterPlotControls.svelte +108 -316
- package/dist/plot/ScatterPlotControls.svelte.d.ts +11 -38
- package/dist/plot/ScatterPoint.svelte +1 -1
- package/dist/plot/ScatterPoint.svelte.d.ts +5 -5
- package/dist/plot/SpacegroupBarPlot.svelte +235 -0
- package/dist/plot/SpacegroupBarPlot.svelte.d.ts +9 -0
- package/dist/plot/data-transform.d.ts +2 -2
- package/dist/plot/data-transform.js +1 -5
- package/dist/plot/index.d.ts +12 -200
- package/dist/plot/index.js +14 -6
- package/dist/plot/layout.d.ts +10 -16
- package/dist/plot/layout.js +40 -25
- package/dist/plot/scales.d.ts +7 -8
- package/dist/plot/scales.js +22 -7
- package/dist/plot/types.d.ts +303 -0
- package/dist/plot/types.js +1 -0
- package/dist/rdf/RdfPlot.svelte +156 -0
- package/dist/rdf/RdfPlot.svelte.d.ts +20 -0
- package/dist/rdf/calc-rdf.d.ts +4 -0
- package/dist/rdf/calc-rdf.js +107 -0
- package/dist/rdf/index.d.ts +22 -0
- package/dist/rdf/index.js +2 -0
- package/dist/settings.d.ts +86 -75
- package/dist/settings.js +257 -155
- package/dist/structure/Bond.svelte +126 -110
- package/dist/structure/Bond.svelte.d.ts +7 -20
- package/dist/structure/CanvasTooltip.svelte.d.ts +4 -4
- package/dist/structure/Cylinder.svelte +29 -0
- package/dist/structure/Cylinder.svelte.d.ts +10 -0
- package/dist/structure/Lattice.svelte +1 -2
- package/dist/structure/Lattice.svelte.d.ts +3 -3
- package/dist/structure/Structure.svelte +23 -8
- package/dist/structure/Structure.svelte.d.ts +10 -7
- package/dist/structure/StructureControls.svelte +25 -134
- package/dist/structure/StructureControls.svelte.d.ts +4 -9
- package/dist/structure/StructureExportPane.svelte +188 -0
- package/dist/structure/StructureExportPane.svelte.d.ts +17 -0
- package/dist/structure/StructureInfoPane.svelte.d.ts +3 -3
- package/dist/structure/StructureLegend.svelte +91 -27
- package/dist/structure/StructureLegend.svelte.d.ts +5 -4
- package/dist/structure/StructureScene.svelte +93 -100
- package/dist/structure/StructureScene.svelte.d.ts +15 -12
- package/dist/structure/Vector.svelte +19 -25
- package/dist/structure/Vector.svelte.d.ts +3 -3
- package/dist/structure/bonding.d.ts +16 -14
- package/dist/structure/bonding.js +207 -216
- package/dist/structure/export.d.ts +3 -0
- package/dist/structure/export.js +120 -0
- package/dist/structure/index.d.ts +15 -1
- package/dist/structure/index.js +2 -0
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -3
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +1 -0
- package/dist/symmetry/spacegroups.d.ts +9 -0
- package/dist/symmetry/spacegroups.js +397 -0
- package/dist/theme/ThemeControl.svelte.d.ts +3 -3
- package/dist/theme/themes.js +2 -16
- package/dist/trajectory/Trajectory.svelte +52 -78
- package/dist/trajectory/Trajectory.svelte.d.ts +5 -5
- package/dist/trajectory/TrajectoryError.svelte.d.ts +3 -3
- package/dist/trajectory/TrajectoryExportPane.svelte +1 -1
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +5 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +1 -1
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -3
- package/dist/trajectory/extract.js +2 -1
- package/dist/trajectory/index.d.ts +1 -1
- package/dist/trajectory/index.js +1 -1
- package/dist/trajectory/parse.js +21 -14
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +17 -0
- package/dist/xrd/XrdPlot.svelte +14 -11
- package/dist/xrd/XrdPlot.svelte.d.ts +6 -5
- package/package.json +20 -12
- package/readme.md +1 -1
- package/dist/material/MaterialCard.svelte +0 -123
- package/dist/material/MaterialCard.svelte.d.ts +0 -9
- package/dist/material/index.d.ts +0 -1
- package/dist/material/index.js +0 -1
- package/dist/plot/formatting.d.ts +0 -7
- package/dist/plot/formatting.js +0 -53
|
@@ -3,74 +3,34 @@ import { elem_symbol_to_name, get_electro_neg_formula } from '../composition';
|
|
|
3
3
|
import { format_fractional, format_num } from '../labels';
|
|
4
4
|
import { ScatterPlot } from '../plot';
|
|
5
5
|
import { SvelteMap } from 'svelte/reactivity';
|
|
6
|
-
import
|
|
6
|
+
import * as helpers from './helpers';
|
|
7
|
+
import { default_controls, default_pd_config, PD_STYLE } from './index';
|
|
7
8
|
import PhaseDiagramControls from './PhaseDiagramControls.svelte';
|
|
8
9
|
import PhaseDiagramInfoPane from './PhaseDiagramInfoPane.svelte';
|
|
9
10
|
import StructurePopup from './StructurePopup.svelte';
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
...controls,
|
|
15
|
-
});
|
|
16
|
-
const default_config = {
|
|
17
|
-
margin: { top: 40, right: 40, bottom: 60, left: 60 },
|
|
18
|
-
unstable_threshold: 0.2,
|
|
19
|
-
show_labels: true,
|
|
20
|
-
show_hull: true,
|
|
21
|
-
point_size: 6,
|
|
22
|
-
line_width: 2,
|
|
23
|
-
font_size: 12,
|
|
24
|
-
colors: {
|
|
25
|
-
stable: `#0072B2`,
|
|
26
|
-
unstable: `#E69F00`,
|
|
27
|
-
hull_line: `var(--accent-color, #1976D2)`,
|
|
28
|
-
background: `transparent`,
|
|
29
|
-
text: `var(--text-color, #212121)`,
|
|
30
|
-
edge: `var(--text-color, #212121)`,
|
|
31
|
-
tooltip_bg: `var(--tooltip-bg, rgba(0, 0, 0, 0.85))`,
|
|
32
|
-
tooltip_text: `var(--tooltip-text, white)`,
|
|
33
|
-
annotation: `var(--text-color, #212121)`,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
11
|
+
import * as thermo from './thermodynamics';
|
|
12
|
+
// Binary phase diagram rendered as energy vs composition (x in [0, 1])
|
|
13
|
+
let { entries, controls = {}, config = {}, on_point_click, on_point_hover, fullscreen = $bindable(false), enable_fullscreen = true, enable_info_pane = true, wrapper = $bindable(undefined), label_threshold = 50, show_stable = $bindable(true), show_unstable = $bindable(true), color_mode = $bindable(`energy`), color_scale = $bindable(`interpolateViridis`), info_pane_open = $bindable(false), legend_pane_open = $bindable(false), max_hull_dist_show_phases = $bindable(0.1), max_hull_dist_show_labels = $bindable(0.1), show_stable_labels = $bindable(true), show_unstable_labels = $bindable(false), on_file_drop, enable_structure_preview = true, energy_source_mode = $bindable(`precomputed`), phase_stats = $bindable(null), x_axis = $bindable({}), y_axis = $bindable({}), ...rest } = $props();
|
|
14
|
+
const merged_controls = $derived({ ...default_controls, ...controls });
|
|
36
15
|
const merged_config = $derived({
|
|
37
|
-
...
|
|
16
|
+
...default_pd_config,
|
|
17
|
+
point_size: 6, // Binary diagrams use slightly smaller points
|
|
38
18
|
...config,
|
|
39
|
-
|
|
40
|
-
})
|
|
41
|
-
// Decide which energy source to use per entry (consistent with 3D/4D)
|
|
42
|
-
const has_precomputed_e_form = $derived(entries.length > 0 && entries.every((e) => typeof e.e_form_per_atom === `number`));
|
|
43
|
-
const has_precomputed_hull = $derived(entries.length > 0 && entries.every((e) => typeof e.e_above_hull === `number`));
|
|
44
|
-
const unary_refs = $derived.by(() => find_lowest_energy_unary_refs(entries));
|
|
45
|
-
const can_compute_e_form = $derived.by(() => {
|
|
46
|
-
const elements_in_entries = Array.from(new Set(entries.flatMap((e) => Object.keys(e.composition))));
|
|
47
|
-
return elements_in_entries.every((el) => Boolean(unary_refs[el]));
|
|
48
|
-
});
|
|
49
|
-
// In 2D we can compute hull distances from formation energies
|
|
50
|
-
const can_compute_hull = $derived(can_compute_e_form);
|
|
51
|
-
const energy_mode = $derived((has_precomputed_e_form && has_precomputed_hull)
|
|
52
|
-
? energy_source_mode
|
|
53
|
-
: ((can_compute_e_form && can_compute_hull) ? `on-the-fly` : `precomputed`));
|
|
54
|
-
const effective_entries = $derived.by(() => {
|
|
55
|
-
if (energy_mode === `precomputed`)
|
|
56
|
-
return entries;
|
|
57
|
-
return entries.map((entry) => {
|
|
58
|
-
const e_form = compute_e_form_per_atom(entry, unary_refs);
|
|
59
|
-
if (e_form == null)
|
|
60
|
-
return entry;
|
|
61
|
-
return { ...entry, e_form_per_atom: e_form };
|
|
62
|
-
});
|
|
19
|
+
colors: { ...default_pd_config.colors, ...(config.colors || {}) },
|
|
20
|
+
margin: { t: 40, r: 40, b: 60, l: 60, ...(config.margin || {}) },
|
|
63
21
|
});
|
|
22
|
+
let { // Compute energy mode information
|
|
23
|
+
has_precomputed_e_form, has_precomputed_hull, can_compute_e_form, can_compute_hull, energy_mode, unary_refs, } = $derived(helpers.compute_energy_mode_info(entries, thermo.find_lowest_energy_unary_refs, energy_source_mode));
|
|
24
|
+
const effective_entries = $derived(helpers.get_effective_entries(entries, energy_mode, unary_refs, thermo.compute_e_form_per_atom));
|
|
64
25
|
// Process data and element set
|
|
65
26
|
const processed_entries = $derived(effective_entries);
|
|
66
|
-
const pd_data = $derived(process_pd_entries(processed_entries));
|
|
27
|
+
const pd_data = $derived(thermo.process_pd_entries(processed_entries));
|
|
67
28
|
const elements = $derived.by(() => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
console.error(`PhaseDiagram2D: Dataset contains ${all_elements.length} elements, but binary diagrams require exactly 2. Found: [${all_elements.join(`, `)}]`);
|
|
29
|
+
if (pd_data.elements.length > 2) {
|
|
30
|
+
console.error(`PhaseDiagram2D: Dataset contains ${pd_data.elements.length} elements, but binary diagrams require exactly 2. Found: [${pd_data.elements.join(`, `)}]`);
|
|
71
31
|
return [];
|
|
72
32
|
}
|
|
73
|
-
return
|
|
33
|
+
return pd_data.elements;
|
|
74
34
|
});
|
|
75
35
|
// Coordinate computation ----------------------------------------------------
|
|
76
36
|
function compute_binary_coordinates(raw_entries, elems) {
|
|
@@ -181,10 +141,10 @@ const plot_entries = $derived.by(() => {
|
|
|
181
141
|
const above = y_hull == null ? 0 : Math.max(0, e.y - y_hull);
|
|
182
142
|
const is_stable = above <= 1e-9;
|
|
183
143
|
const visible = (is_stable && show_stable) ||
|
|
184
|
-
(!is_stable && show_unstable && above <=
|
|
144
|
+
(!is_stable && show_unstable && above <= max_hull_dist_show_phases);
|
|
185
145
|
return { ...e, e_above_hull: above, is_stable, visible };
|
|
186
146
|
});
|
|
187
|
-
return enriched.filter((e) => (e.is_stable || (e.e_above_hull ?? 0) <=
|
|
147
|
+
return enriched.filter((e) => (e.is_stable || (e.e_above_hull ?? 0) <= max_hull_dist_show_phases));
|
|
188
148
|
});
|
|
189
149
|
const stable_entries = $derived(plot_entries.filter((entry) => entry.is_stable || entry.e_above_hull === 0));
|
|
190
150
|
const unstable_entries = $derived(plot_entries.filter((entry) => (entry.e_above_hull ?? 0) > 0 && !entry.is_stable));
|
|
@@ -262,15 +222,11 @@ const hull_segments_series = $derived.by(() => {
|
|
|
262
222
|
return segments;
|
|
263
223
|
});
|
|
264
224
|
const scatter_series = $derived([scatter_points_series, ...hull_segments_series]);
|
|
265
|
-
const
|
|
225
|
+
const max_hull_dist_in_data = $derived(helpers.calc_max_hull_dist_in_data(processed_entries));
|
|
266
226
|
// Phase diagram statistics - compute internally and expose via bindable prop
|
|
267
227
|
$effect(() => {
|
|
268
|
-
phase_stats = get_phase_diagram_stats(processed_entries, elements, 3);
|
|
228
|
+
phase_stats = thermo.get_phase_diagram_stats(processed_entries, elements, 3);
|
|
269
229
|
});
|
|
270
|
-
// Labels with smart defaults
|
|
271
|
-
let show_stable_labels = $state(true);
|
|
272
|
-
let show_unstable_labels = $state(false);
|
|
273
|
-
let label_energy_threshold = $state(0.1);
|
|
274
230
|
$effect(() => {
|
|
275
231
|
const total_entries = processed_entries.length;
|
|
276
232
|
if (total_entries > label_threshold) {
|
|
@@ -300,8 +256,8 @@ function reset_all() {
|
|
|
300
256
|
show_unstable = PD_DEFAULTS.binary.show_unstable;
|
|
301
257
|
show_stable_labels = PD_DEFAULTS.binary.show_stable_labels;
|
|
302
258
|
show_unstable_labels = PD_DEFAULTS.binary.show_unstable_labels;
|
|
303
|
-
|
|
304
|
-
|
|
259
|
+
max_hull_dist_show_phases = PD_DEFAULTS.binary.max_hull_dist_show_phases;
|
|
260
|
+
max_hull_dist_show_labels = PD_DEFAULTS.binary.max_hull_dist_show_labels;
|
|
305
261
|
reset_counter += 1;
|
|
306
262
|
}
|
|
307
263
|
// Custom hover tooltip state used with ScatterPlot events
|
|
@@ -320,33 +276,18 @@ const handle_keydown = (event) => {
|
|
|
320
276
|
};
|
|
321
277
|
async function handle_file_drop(event) {
|
|
322
278
|
drag_over = false;
|
|
323
|
-
const data = await parse_pd_entries_from_drop(event);
|
|
279
|
+
const data = await helpers.parse_pd_entries_from_drop(event);
|
|
324
280
|
if (data)
|
|
325
281
|
on_file_drop?.(data);
|
|
326
282
|
}
|
|
327
|
-
function calculate_modal_side() {
|
|
328
|
-
if (!wrapper)
|
|
329
|
-
return;
|
|
330
|
-
const rect = wrapper.getBoundingClientRect();
|
|
331
|
-
const viewport_width = globalThis.innerWidth;
|
|
332
|
-
const space_on_right = viewport_width - rect.right;
|
|
333
|
-
const space_on_left = rect.left;
|
|
334
|
-
modal_place_right = space_on_right >= space_on_left;
|
|
335
|
-
}
|
|
336
283
|
function close_structure_popup() {
|
|
337
284
|
modal_open = false;
|
|
338
285
|
selected_structure = null;
|
|
339
286
|
selected_entry = null;
|
|
340
287
|
}
|
|
288
|
+
// Fullscreen handling
|
|
341
289
|
$effect(() => {
|
|
342
|
-
|
|
343
|
-
if (fullscreen && !document.fullscreenElement && wrapper) {
|
|
344
|
-
wrapper.requestFullscreen().catch(console.error);
|
|
345
|
-
}
|
|
346
|
-
else if (!fullscreen && document.fullscreenElement) {
|
|
347
|
-
document.exitFullscreen();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
290
|
+
helpers.setup_fullscreen_effect(fullscreen, wrapper);
|
|
350
291
|
});
|
|
351
292
|
let style = $derived(`--pd-stable-color:${merged_config.colors?.stable || `#0072B2`};
|
|
352
293
|
--pd-unstable-color:${merged_config.colors?.unstable || `#E69F00`};
|
|
@@ -395,9 +336,9 @@ let style = $derived(`--pd-stable-color:${merged_config.colors?.stable || `#0072
|
|
|
395
336
|
{/snippet}
|
|
396
337
|
|
|
397
338
|
{#snippet user_content(
|
|
398
|
-
{ x_scale_fn, pad, height, y_scale_fn,
|
|
339
|
+
{ x_scale_fn, pad, height, y_scale_fn, y_range, width }: UserContentProps,
|
|
399
340
|
)}
|
|
400
|
-
{@const [x1, y0] = [x_scale_fn(1), y_scale_fn(
|
|
341
|
+
{@const [x1, y0] = [x_scale_fn(1), y_scale_fn(y_range[0])]}
|
|
401
342
|
{@const stroke = {
|
|
402
343
|
stroke: `var(--scatter-grid-stroke, gray)`,
|
|
403
344
|
'stroke-width': `var(--scatter-grid-width, 0.4)`,
|
|
@@ -433,14 +374,14 @@ let style = $derived(`--pd-stable-color:${merged_config.colors?.stable || `#0072
|
|
|
433
374
|
{#key reset_counter}
|
|
434
375
|
<ScatterPlot
|
|
435
376
|
series={scatter_series}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
377
|
+
display={{ x_grid: false, y_grid: false }}
|
|
378
|
+
x_axis={{
|
|
379
|
+
label: elements.length === 2 ? `x in ${elements[0]}₁₋ₓ ${elements[1]}ₓ` : `x`,
|
|
380
|
+
range: x_domain,
|
|
381
|
+
ticks: 4,
|
|
382
|
+
...x_axis,
|
|
383
|
+
}}
|
|
384
|
+
y_axis={{ label: `E<sub>form</sub> (eV/atom)`, range: y_domain, ticks: 4, ...y_axis }}
|
|
444
385
|
legend={null}
|
|
445
386
|
color_bar={{
|
|
446
387
|
title: `E<sub>above hull</sub> (eV/atom)`,
|
|
@@ -459,7 +400,7 @@ let style = $derived(`--pd-stable-color:${merged_config.colors?.stable || `#0072
|
|
|
459
400
|
if (structure) {
|
|
460
401
|
selected_structure = structure
|
|
461
402
|
selected_entry = entry
|
|
462
|
-
calculate_modal_side()
|
|
403
|
+
modal_place_right = helpers.calculate_modal_side(wrapper)
|
|
463
404
|
modal_open = true
|
|
464
405
|
}
|
|
465
406
|
}
|
|
@@ -516,12 +457,10 @@ let style = $derived(`--pd-stable-color:${merged_config.colors?.stable || `#0072
|
|
|
516
457
|
{phase_stats}
|
|
517
458
|
{stable_entries}
|
|
518
459
|
{unstable_entries}
|
|
519
|
-
{
|
|
520
|
-
{
|
|
460
|
+
{max_hull_dist_show_phases}
|
|
461
|
+
{max_hull_dist_show_labels}
|
|
521
462
|
{label_threshold}
|
|
522
|
-
toggle_props={{
|
|
523
|
-
class: `info-btn`,
|
|
524
|
-
}}
|
|
463
|
+
toggle_props={{ class: `info-btn` }}
|
|
525
464
|
/>
|
|
526
465
|
{/if}
|
|
527
466
|
|
|
@@ -544,17 +483,15 @@ let style = $derived(`--pd-stable-color:${merged_config.colors?.stable || `#0072
|
|
|
544
483
|
bind:show_unstable
|
|
545
484
|
bind:show_stable_labels
|
|
546
485
|
bind:show_unstable_labels
|
|
547
|
-
bind:
|
|
548
|
-
bind:
|
|
549
|
-
{
|
|
486
|
+
bind:max_hull_dist_show_phases
|
|
487
|
+
bind:max_hull_dist_show_labels
|
|
488
|
+
{max_hull_dist_in_data}
|
|
550
489
|
{stable_entries}
|
|
551
490
|
{unstable_entries}
|
|
552
491
|
{total_unstable_count}
|
|
553
492
|
{camera}
|
|
554
493
|
{merged_controls}
|
|
555
|
-
toggle_props={{
|
|
556
|
-
class: `legend-controls-btn`,
|
|
557
|
-
}}
|
|
494
|
+
toggle_props={{ class: `legend-controls-btn` }}
|
|
558
495
|
bind:energy_source_mode
|
|
559
496
|
{has_precomputed_e_form}
|
|
560
497
|
{can_compute_e_form}
|
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
on_point_click?: (entry: PlotEntry3D) => void;
|
|
9
|
-
on_point_hover?: (data: HoverData3D<PlotEntry3D> | null) => void;
|
|
10
|
-
fullscreen?: boolean;
|
|
11
|
-
enable_fullscreen?: boolean;
|
|
12
|
-
enable_info_pane?: boolean;
|
|
13
|
-
wrapper?: HTMLDivElement;
|
|
14
|
-
label_threshold?: number;
|
|
15
|
-
show_stable?: boolean;
|
|
16
|
-
show_unstable?: boolean;
|
|
17
|
-
color_mode?: `stability` | `energy`;
|
|
18
|
-
color_scale?: D3InterpolateName;
|
|
19
|
-
info_pane_open?: boolean;
|
|
20
|
-
legend_pane_open?: boolean;
|
|
21
|
-
energy_threshold?: number;
|
|
22
|
-
on_file_drop?: (entries: PhaseEntry[]) => void;
|
|
23
|
-
enable_structure_preview?: boolean;
|
|
24
|
-
energy_source_mode?: `precomputed` | `on-the-fly`;
|
|
25
|
-
phase_stats?: PhaseStats | null;
|
|
26
|
-
}
|
|
27
|
-
declare const PhaseDiagram2D: import("svelte").Component<Props, {}, "color_mode" | "color_scale" | "show_stable" | "show_unstable" | "energy_threshold" | "fullscreen" | "info_pane_open" | "legend_pane_open" | "wrapper" | "energy_source_mode" | "phase_stats">;
|
|
1
|
+
import { type AxisConfig } from '../plot';
|
|
2
|
+
import type { BasePhaseDiagramProps } from './index';
|
|
3
|
+
type $$ComponentProps = BasePhaseDiagramProps & {
|
|
4
|
+
x_axis?: AxisConfig;
|
|
5
|
+
y_axis?: AxisConfig;
|
|
6
|
+
};
|
|
7
|
+
declare const PhaseDiagram2D: import("svelte").Component<$$ComponentProps, {}, "color_mode" | "color_scale" | "show_stable" | "show_unstable" | "show_stable_labels" | "show_unstable_labels" | "max_hull_dist_show_phases" | "max_hull_dist_show_labels" | "fullscreen" | "info_pane_open" | "legend_pane_open" | "y_axis" | "x_axis" | "wrapper" | "energy_source_mode" | "phase_stats">;
|
|
28
8
|
type PhaseDiagram2D = ReturnType<typeof PhaseDiagram2D>;
|
|
29
9
|
export default PhaseDiagram2D;
|