matterviz 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmptyState.svelte +10 -2
- package/dist/FilePicker.svelte +123 -82
- package/dist/Icon.svelte +18 -12
- package/dist/MillerIndexInput.svelte +27 -21
- package/dist/api/optimade.js +6 -6
- package/dist/app.css +216 -207
- package/dist/brillouin/BrillouinZone.svelte +292 -149
- package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneControls.svelte +32 -5
- package/dist/brillouin/BrillouinZoneExportPane.svelte +69 -42
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +99 -68
- package/dist/brillouin/BrillouinZoneScene.svelte +275 -163
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneTooltip.svelte +17 -7
- package/dist/brillouin/compute.js +11 -6
- package/dist/chempot-diagram/ChemPotDiagram.svelte +162 -27
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +451 -281
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +2148 -1642
- package/dist/chempot-diagram/ChemPotScene3D.svelte +8 -5
- package/dist/chempot-diagram/async-compute.svelte.d.ts +3 -0
- package/dist/chempot-diagram/async-compute.svelte.js +77 -0
- package/dist/chempot-diagram/chempot-worker.d.ts +1 -0
- package/dist/chempot-diagram/chempot-worker.js +11 -0
- package/dist/chempot-diagram/color.js +1 -2
- package/dist/chempot-diagram/compute.d.ts +10 -0
- package/dist/chempot-diagram/compute.js +250 -88
- package/dist/chempot-diagram/index.d.ts +2 -1
- package/dist/chempot-diagram/index.js +2 -1
- package/dist/chempot-diagram/temperature.js +8 -9
- package/dist/chempot-diagram/types.d.ts +3 -0
- package/dist/chempot-diagram/types.js +1 -0
- package/dist/colors/index.d.ts +1 -1
- package/dist/colors/index.js +5 -3
- package/dist/composition/BarChart.svelte +128 -55
- package/dist/composition/BubbleChart.svelte +102 -49
- package/dist/composition/Composition.svelte +100 -79
- package/dist/composition/Formula.svelte +108 -62
- package/dist/composition/FormulaFilter.svelte +665 -537
- package/dist/composition/PieChart.svelte +183 -108
- package/dist/composition/format.d.ts +5 -0
- package/dist/composition/format.js +20 -3
- package/dist/composition/parse.js +14 -9
- package/dist/convex-hull/ConvexHull.svelte +93 -40
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +549 -360
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +1296 -827
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +1004 -688
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullControls.svelte +115 -28
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullInfoPane.svelte +29 -3
- package/dist/convex-hull/ConvexHullStats.svelte +425 -328
- package/dist/convex-hull/ConvexHullTooltip.svelte +40 -16
- package/dist/convex-hull/GasPressureControls.svelte +104 -61
- package/dist/convex-hull/StructurePopup.svelte +25 -4
- package/dist/convex-hull/TemperatureSlider.svelte +45 -25
- package/dist/convex-hull/barycentric-coords.js +13 -7
- package/dist/convex-hull/demo-temperature.js +8 -4
- package/dist/convex-hull/gas-thermodynamics.js +17 -12
- package/dist/convex-hull/helpers.d.ts +9 -0
- package/dist/convex-hull/helpers.js +77 -34
- package/dist/convex-hull/thermodynamics.js +61 -56
- package/dist/convex-hull/types.d.ts +9 -14
- package/dist/convex-hull/types.js +0 -17
- package/dist/coordination/CoordinationBarPlot.svelte +227 -154
- package/dist/element/BohrAtom.svelte +55 -12
- package/dist/element/ElementHeading.svelte +7 -2
- package/dist/element/ElementPhoto.svelte +15 -9
- package/dist/element/ElementStats.svelte +10 -4
- package/dist/element/ElementTile.svelte +137 -73
- package/dist/element/Nucleus.svelte +39 -11
- package/dist/feedback/ClickFeedback.svelte +16 -5
- package/dist/feedback/DragOverlay.svelte +10 -2
- package/dist/feedback/Spinner.svelte +4 -2
- package/dist/feedback/StatusMessage.svelte +8 -2
- package/dist/fermi-surface/FermiSlice.svelte +118 -88
- package/dist/fermi-surface/FermiSurface.svelte +328 -187
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte +113 -46
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +535 -342
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +14 -5
- package/dist/fermi-surface/compute.js +16 -20
- package/dist/fermi-surface/parse.js +24 -14
- package/dist/fermi-surface/symmetry.js +2 -7
- package/dist/fermi-surface/types.d.ts +3 -5
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +1019 -765
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +1 -1
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +76 -22
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +2 -3
- package/dist/icons.js +47 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/io/decompress.js +1 -1
- package/dist/io/export.d.ts +3 -0
- package/dist/io/export.js +129 -143
- package/dist/io/is-binary.js +2 -3
- package/dist/io/url-drop.js +1 -2
- package/dist/isosurface/Isosurface.svelte +202 -148
- package/dist/isosurface/IsosurfaceControls.svelte +46 -28
- package/dist/isosurface/parse.js +34 -29
- package/dist/isosurface/slice.js +5 -10
- package/dist/isosurface/types.d.ts +2 -1
- package/dist/isosurface/types.js +61 -12
- package/dist/labels.js +11 -8
- package/dist/layout/FullscreenToggle.svelte +11 -2
- package/dist/layout/InfoCard.svelte +38 -6
- package/dist/layout/InfoTag.svelte +63 -32
- package/dist/layout/PropertyFilter.svelte +82 -37
- package/dist/layout/SettingsSection.svelte +85 -55
- package/dist/layout/SubpageGrid.svelte +10 -2
- package/dist/layout/json-tree/JsonNode.svelte +183 -138
- package/dist/layout/json-tree/JsonTree.svelte +499 -413
- package/dist/layout/json-tree/JsonValue.svelte +127 -99
- package/dist/layout/json-tree/utils.js +4 -2
- package/dist/marching-cubes.js +25 -2
- package/dist/math.d.ts +13 -17
- package/dist/math.js +133 -67
- package/dist/overlays/ContextMenu.svelte +65 -40
- package/dist/overlays/DraggablePane.svelte +211 -139
- package/dist/periodic-table/PeriodicTable.svelte +278 -145
- package/dist/periodic-table/PeriodicTableControls.svelte +178 -128
- package/dist/periodic-table/PropertySelect.svelte +25 -7
- package/dist/periodic-table/TableInset.svelte +8 -3
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +446 -309
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramControls.svelte +102 -43
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +63 -40
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +71 -28
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +1 -1
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +158 -101
- package/dist/phase-diagram/TdbInfoPanel.svelte +28 -4
- package/dist/phase-diagram/build-diagram.js +9 -9
- package/dist/phase-diagram/colors.js +1 -3
- package/dist/phase-diagram/parse.js +10 -9
- package/dist/phase-diagram/svg-to-diagram.js +53 -49
- package/dist/phase-diagram/utils.d.ts +1 -0
- package/dist/phase-diagram/utils.js +80 -25
- package/dist/plot/AxisLabel.svelte +28 -3
- package/dist/plot/BarPlot.svelte +1182 -734
- package/dist/plot/BarPlot.svelte.d.ts +2 -2
- package/dist/plot/BarPlotControls.svelte +31 -5
- package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ColorBar.svelte +479 -329
- package/dist/plot/ColorScaleSelect.svelte +27 -6
- package/dist/plot/ElementScatter.svelte +36 -15
- package/dist/plot/FillArea.svelte +152 -95
- package/dist/plot/Histogram.svelte +934 -571
- package/dist/plot/Histogram.svelte.d.ts +1 -1
- package/dist/plot/HistogramControls.svelte +53 -9
- package/dist/plot/HistogramControls.svelte.d.ts +1 -1
- package/dist/plot/InteractiveAxisLabel.svelte +34 -11
- package/dist/plot/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/Line.svelte +63 -28
- package/dist/plot/PlotControls.svelte +157 -114
- package/dist/plot/PlotControls.svelte.d.ts +1 -1
- package/dist/plot/PlotLegend.svelte +174 -91
- package/dist/plot/PlotTooltip.svelte +45 -6
- package/dist/plot/PortalSelect.svelte +175 -147
- package/dist/plot/ReferenceLine.svelte +76 -22
- package/dist/plot/ReferenceLine3D.svelte +132 -107
- package/dist/plot/ReferencePlane.svelte +146 -121
- package/dist/plot/ScatterPlot.svelte +1681 -1091
- package/dist/plot/ScatterPlot.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlot3D.svelte +256 -131
- package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlot3DControls.svelte +113 -63
- package/dist/plot/ScatterPlot3DControls.svelte.d.ts +2 -1
- package/dist/plot/ScatterPlot3DScene.svelte +608 -403
- package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlotControls.svelte +65 -25
- package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ScatterPoint.svelte +98 -26
- package/dist/plot/ScatterPoint.svelte.d.ts +1 -0
- package/dist/plot/SpacegroupBarPlot.svelte +142 -85
- package/dist/plot/Surface3D.svelte +159 -108
- package/dist/plot/ZeroLines.svelte +55 -3
- package/dist/plot/ZoomRect.svelte +4 -2
- package/dist/plot/axis-utils.js +1 -3
- package/dist/plot/data-cleaning.js +12 -28
- package/dist/plot/data-transform.js +2 -1
- package/dist/plot/fill-utils.js +2 -0
- package/dist/plot/layout.d.ts +4 -1
- package/dist/plot/layout.js +33 -14
- package/dist/plot/reference-line.d.ts +2 -2
- package/dist/plot/reference-line.js +7 -5
- package/dist/plot/scales.js +24 -36
- package/dist/plot/types.d.ts +11 -23
- package/dist/plot/types.js +6 -11
- package/dist/plot/utils/label-placement.d.ts +32 -15
- package/dist/plot/utils/label-placement.js +227 -66
- package/dist/plot/utils/series-visibility.js +2 -3
- package/dist/rdf/RdfPlot.svelte +143 -91
- package/dist/rdf/calc-rdf.js +4 -5
- package/dist/sanitize.d.ts +4 -0
- package/dist/sanitize.js +107 -0
- package/dist/settings.d.ts +18 -6
- package/dist/settings.js +46 -16
- package/dist/spectral/Bands.svelte +632 -453
- package/dist/spectral/BandsAndDos.svelte +90 -49
- package/dist/spectral/BrillouinBandsDos.svelte +151 -93
- package/dist/spectral/Dos.svelte +389 -258
- package/dist/spectral/helpers.js +55 -43
- package/dist/state.svelte.d.ts +1 -1
- package/dist/state.svelte.js +3 -2
- package/dist/structure/Arrow.svelte +59 -20
- package/dist/structure/AtomLegend.svelte +215 -134
- package/dist/structure/Bond.svelte +73 -47
- package/dist/structure/CanvasTooltip.svelte +10 -2
- package/dist/structure/CellSelect.svelte +72 -45
- package/dist/structure/Cylinder.svelte +33 -17
- package/dist/structure/Lattice.svelte +88 -33
- package/dist/structure/Structure.svelte +1063 -797
- package/dist/structure/Structure.svelte.d.ts +1 -1
- package/dist/structure/StructureControls.svelte +349 -118
- package/dist/structure/StructureExportPane.svelte +124 -89
- package/dist/structure/StructureExportPane.svelte.d.ts +1 -1
- package/dist/structure/StructureInfoPane.svelte +304 -237
- package/dist/structure/StructureScene.svelte +879 -443
- package/dist/structure/StructureScene.svelte.d.ts +15 -7
- package/dist/structure/atom-properties.js +8 -8
- package/dist/structure/bonding.js +6 -7
- package/dist/structure/export.js +14 -29
- package/dist/structure/ferrox-wasm.js +1 -1
- package/dist/structure/index.d.ts +13 -3
- package/dist/structure/index.js +83 -23
- package/dist/structure/measure.d.ts +2 -2
- package/dist/structure/measure.js +4 -44
- package/dist/structure/parse.js +113 -141
- package/dist/structure/partial-occupancy.js +7 -10
- package/dist/structure/pbc.d.ts +1 -0
- package/dist/structure/pbc.js +16 -6
- package/dist/structure/supercell.d.ts +2 -2
- package/dist/structure/supercell.js +12 -22
- package/dist/structure/validation.js +1 -2
- package/dist/symmetry/SymmetryStats.svelte +84 -41
- package/dist/symmetry/WyckoffTable.svelte +26 -6
- package/dist/symmetry/cell-transform.js +5 -3
- package/dist/symmetry/index.js +8 -7
- package/dist/symmetry/spacegroups.js +148 -148
- package/dist/table/HeatmapTable.svelte +790 -554
- package/dist/table/HeatmapTable.svelte.d.ts +1 -1
- package/dist/table/ToggleMenu.svelte +125 -92
- package/dist/table/index.js +2 -4
- package/dist/theme/ThemeControl.svelte +21 -12
- package/dist/time.js +4 -1
- package/dist/tooltip/TooltipContent.svelte +33 -8
- package/dist/trajectory/Trajectory.svelte +758 -558
- package/dist/trajectory/TrajectoryError.svelte +14 -3
- package/dist/trajectory/TrajectoryExportPane.svelte +137 -83
- package/dist/trajectory/TrajectoryInfoPane.svelte +272 -143
- package/dist/trajectory/extract.js +10 -26
- package/dist/trajectory/format-detect.js +5 -5
- package/dist/trajectory/frame-reader.d.ts +1 -1
- package/dist/trajectory/frame-reader.js +5 -12
- package/dist/trajectory/helpers.d.ts +0 -1
- package/dist/trajectory/helpers.js +2 -17
- package/dist/trajectory/index.js +14 -12
- package/dist/trajectory/parse/ase.js +5 -4
- package/dist/trajectory/parse/hdf5.js +26 -18
- package/dist/trajectory/parse/index.js +13 -18
- package/dist/trajectory/parse/lammps.js +17 -7
- package/dist/trajectory/parse/vasp.js +5 -2
- package/dist/trajectory/parse/xyz.js +8 -7
- package/dist/trajectory/plotting.js +13 -8
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +13 -0
- package/dist/xrd/XrdPlot.svelte +337 -247
- package/dist/xrd/broadening.js +14 -9
- package/dist/xrd/calc-xrd.js +12 -18
- package/dist/xrd/parse.d.ts +1 -1
- package/dist/xrd/parse.js +17 -17
- package/package.json +99 -103
- package/readme.md +1 -1
- /package/dist/theme/{themes.js → themes.mjs} +0 -0
|
@@ -1,254 +1,321 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { get_electro_neg_formula } from '../composition'
|
|
3
|
+
import { element_data } from '../element'
|
|
4
|
+
import Icon from '../Icon.svelte'
|
|
5
|
+
import { format_num } from '../labels'
|
|
6
|
+
import type { InfoItem } from '../layout'
|
|
7
|
+
import DraggablePane from '../overlays/DraggablePane.svelte'
|
|
8
|
+
import type { AnyStructure, Site } from './'
|
|
9
|
+
import { get_density } from './'
|
|
10
|
+
import { wyckoff_positions_from_moyo, WyckoffTable } from '../symmetry'
|
|
11
|
+
import type { MoyoDataset } from '@spglib/moyo-wasm'
|
|
12
|
+
import type { ComponentProps } from 'svelte'
|
|
13
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
14
|
+
import { sanitize_html } from '../sanitize'
|
|
15
|
+
import { SvelteSet } from 'svelte/reactivity'
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
structure,
|
|
19
|
+
pane_open = $bindable(false),
|
|
20
|
+
atom_count_thresholds = [50, 500],
|
|
21
|
+
toggle_props = {},
|
|
22
|
+
pane_props = {},
|
|
23
|
+
highlighted_sites = $bindable([]),
|
|
24
|
+
selected_sites = $bindable([]),
|
|
25
|
+
sym_data = null,
|
|
26
|
+
...rest
|
|
27
|
+
}: Omit<HTMLAttributes<HTMLDivElement>, `onclose`> & {
|
|
28
|
+
structure: AnyStructure
|
|
29
|
+
pane_open?: boolean
|
|
30
|
+
atom_count_thresholds?: [number, number] // if atom count is less than min_threshold, show sites, if atom count is greater than max_threshold, hide sites. in between, show sites behind a toggle button.
|
|
31
|
+
toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`]
|
|
32
|
+
pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`]
|
|
33
|
+
highlighted_sites?: number[] // Sites highlighted from Wyckoff table hover
|
|
34
|
+
selected_sites?: number[] // Sites selected from Wyckoff table click
|
|
35
|
+
sym_data?: MoyoDataset | null // Symmetry analysis data (bindable for external access)
|
|
36
|
+
} = $props()
|
|
37
|
+
|
|
38
|
+
let copied_items = new SvelteSet<string>()
|
|
39
|
+
let sites_expanded = $state(false)
|
|
40
|
+
|
|
41
|
+
async function copy_to_clipboard(label: string, value: string, key: string) {
|
|
13
42
|
try {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.error(`Failed to copy to clipboard:`, error);
|
|
43
|
+
await navigator.clipboard.writeText(`${label}: ${value}`)
|
|
44
|
+
copied_items.add(key)
|
|
45
|
+
setTimeout(() => copied_items.delete(key), 1000)
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error(`Failed to copy to clipboard:`, error)
|
|
20
48
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (item.key === `sites-toggle`)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const [min_threshold, max_threshold] = atom_count_thresholds;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handle_click(item: InfoItem, section_title: string) {
|
|
52
|
+
if (section_title === `Usage Tips`) return
|
|
53
|
+
if (item.key === `sites-toggle`) sites_expanded = !sites_expanded
|
|
54
|
+
else copy_to_clipboard(item.label, String(item.value), item.key ?? item.label)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let pane_data = $derived.by(() => {
|
|
58
|
+
if (!structure) return []
|
|
59
|
+
const sections: { title: string; items: InfoItem[] }[] = []
|
|
60
|
+
const [min_threshold, max_threshold] = atom_count_thresholds
|
|
61
|
+
|
|
35
62
|
// Structure Info
|
|
36
|
-
const structure_items = [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
63
|
+
const structure_items: InfoItem[] = [
|
|
64
|
+
{
|
|
65
|
+
label: `Formula`,
|
|
66
|
+
value: `${
|
|
67
|
+
get_electro_neg_formula(structure)
|
|
68
|
+
} (${structure.sites.length} sites)`,
|
|
69
|
+
key: `structure-formula`,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: `Charge`,
|
|
73
|
+
value: `${structure.charge || 0}e`,
|
|
74
|
+
key: `structure-charge`,
|
|
75
|
+
},
|
|
76
|
+
]
|
|
77
|
+
|
|
48
78
|
if (`properties` in structure) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
79
|
+
for (const [key, value] of Object.entries(structure.properties ?? {})) {
|
|
80
|
+
// Only display scalar values (skip arrays and objects)
|
|
81
|
+
if (value == null || typeof value === `object`) continue
|
|
82
|
+
structure_items.push({
|
|
83
|
+
label: key.replace(/_/g, ` `).replace(
|
|
84
|
+
/\b\w/g,
|
|
85
|
+
(char) => char.toUpperCase(),
|
|
86
|
+
),
|
|
87
|
+
value: String(value),
|
|
88
|
+
key: `structure-prop-${key}`,
|
|
89
|
+
})
|
|
90
|
+
}
|
|
59
91
|
}
|
|
60
|
-
sections.push({ title: `Structure`, items: structure_items })
|
|
92
|
+
sections.push({ title: `Structure`, items: structure_items })
|
|
93
|
+
|
|
61
94
|
// Cell Info
|
|
62
95
|
if (`lattice` in structure) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
96
|
+
const { a, b, c, alpha, beta, gamma, volume } = structure.lattice
|
|
97
|
+
sections.push({
|
|
98
|
+
title: `Cell`,
|
|
99
|
+
items: [
|
|
100
|
+
{
|
|
101
|
+
label: `Volume, Density`,
|
|
102
|
+
value: `${format_num(volume, `.3~s`)} ų, ${
|
|
103
|
+
format_num(get_density(structure), `.3~f`)
|
|
104
|
+
} g/cm³`,
|
|
105
|
+
key: `cell-volume-density`,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: `a, b, c`,
|
|
109
|
+
value: `${format_num(a, `.4~f`)}, ${format_num(b, `.4~f`)}, ${
|
|
110
|
+
format_num(c, `.4~f`)
|
|
111
|
+
} Å`,
|
|
112
|
+
key: `cell-abc`,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: `α, β, γ`,
|
|
116
|
+
value: `${format_num(alpha, `.2~f`)}°, ${format_num(beta, `.2~f`)}°, ${
|
|
117
|
+
format_num(gamma, `.2~f`)
|
|
118
|
+
}°`,
|
|
119
|
+
key: `cell-angles`,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
})
|
|
84
123
|
}
|
|
124
|
+
|
|
85
125
|
// Symmetry Info
|
|
86
126
|
if (`lattice` in structure && sym_data) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
const { operations } = sym_data
|
|
128
|
+
let translations = 0, rotations = 0, roto_translations = 0
|
|
129
|
+
for (const op of operations) {
|
|
130
|
+
const has_translation = op.translation.some((t) => t !== 0)
|
|
131
|
+
const is_identity = String(op.rotation) === `1,0,0,0,1,0,0,0,1`
|
|
132
|
+
if (is_identity && has_translation) translations++
|
|
133
|
+
else if (!has_translation) rotations++
|
|
134
|
+
else roto_translations++
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const international_symbol = (sym_data as MoyoDataset & {
|
|
138
|
+
international_short?: string
|
|
139
|
+
}).international_short
|
|
140
|
+
const space_group_symbol = (sym_data.hm_symbol ?? international_symbol)
|
|
141
|
+
?.replace(
|
|
142
|
+
/\s+/g,
|
|
143
|
+
``,
|
|
144
|
+
)
|
|
145
|
+
const space_group_value = space_group_symbol
|
|
146
|
+
? `${sym_data.number} (${space_group_symbol})`
|
|
147
|
+
: String(sym_data.number)
|
|
148
|
+
|
|
149
|
+
sections.push({
|
|
150
|
+
title: `Symmetry`,
|
|
151
|
+
items: [
|
|
152
|
+
{
|
|
153
|
+
label: `Space Group`,
|
|
154
|
+
value: space_group_value,
|
|
155
|
+
key: `symmetry-space-group`,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
label: `Hall Number`,
|
|
159
|
+
value: String(sym_data.hall_number),
|
|
160
|
+
key: `symmetry-hall-number`,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
label: `Pearson Symbol`,
|
|
164
|
+
value: sym_data.pearson_symbol,
|
|
165
|
+
key: `symmetry-pearson-symbol`,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
label: `Symmetry Ops`,
|
|
169
|
+
value:
|
|
170
|
+
`${operations.length} (${translations} trans, ${rotations} rot, ${roto_translations} roto-trans)`,
|
|
171
|
+
key: `symmetry-operations-total`,
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
})
|
|
130
175
|
}
|
|
176
|
+
|
|
131
177
|
// Sites Section
|
|
132
|
-
const atom_count = structure.sites.length
|
|
178
|
+
const atom_count = structure.sites.length
|
|
133
179
|
if (atom_count <= max_threshold) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
180
|
+
const site_items: InfoItem[] = []
|
|
181
|
+
|
|
182
|
+
// Merged toggle button with Sites title
|
|
183
|
+
if (atom_count >= min_threshold) {
|
|
184
|
+
const toggle_label = sites_expanded
|
|
185
|
+
? `Hide Sites`
|
|
186
|
+
: `Show ${atom_count} sites`
|
|
187
|
+
site_items.push({
|
|
188
|
+
label: toggle_label,
|
|
189
|
+
value: sites_expanded ? `▲` : `▼`,
|
|
190
|
+
key: `sites-toggle`,
|
|
191
|
+
tooltip: `Click to ${
|
|
192
|
+
sites_expanded ? `hide` : `show`
|
|
193
|
+
} all site information`,
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (atom_count < min_threshold || sites_expanded) {
|
|
198
|
+
structure.sites.forEach((site: Site, idx: number) => {
|
|
199
|
+
const element = site.species?.[0]?.element || `Unknown`
|
|
200
|
+
const element_name = element_data?.find((el) =>
|
|
201
|
+
el.symbol === element
|
|
202
|
+
)?.name || element
|
|
203
|
+
|
|
204
|
+
site_items.push({
|
|
205
|
+
label: `${element}${idx + 1}`,
|
|
206
|
+
value: element_name,
|
|
207
|
+
key: `site-${idx}-header`,
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
if (site.abc) {
|
|
140
211
|
site_items.push({
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
else if (Array.isArray(prop_value)) {
|
|
189
|
-
formatted_value = `(${prop_value.map((v) => {
|
|
190
|
-
const num_val = Number(v);
|
|
191
|
-
return isNaN(num_val) ? String(v) : format_num(num_val, `.3~f`);
|
|
192
|
-
}).join(`, `)})`;
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
const num_val = Number(prop_value);
|
|
196
|
-
formatted_value = isNaN(num_val)
|
|
197
|
-
? String(prop_value)
|
|
198
|
-
: format_num(num_val, `.3~f`);
|
|
199
|
-
}
|
|
200
|
-
site_items.push({
|
|
201
|
-
label: ` ${prop_key}`,
|
|
202
|
-
value: formatted_value,
|
|
203
|
-
key: `site-${idx}-${prop_key}`,
|
|
204
|
-
tooltip,
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
}
|
|
212
|
+
label: ` Fractional`,
|
|
213
|
+
value: `(${site.abc.map((x) => format_num(x, `.4~f`)).join(`, `)})`,
|
|
214
|
+
key: `site-${idx}-fractional`,
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
if (site.xyz) {
|
|
218
|
+
site_items.push({
|
|
219
|
+
label: ` Cartesian`,
|
|
220
|
+
value: `(${site.xyz.map((x) => format_num(x, `.4~f`)).join(`, `)}) Å`,
|
|
221
|
+
key: `site-${idx}-cartesian`,
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (site.properties) {
|
|
226
|
+
for (const [prop_key, prop_value] of Object.entries(site.properties)) {
|
|
227
|
+
if (prop_value != null && prop_value !== undefined) {
|
|
228
|
+
let formatted_value: string
|
|
229
|
+
let tooltip: string | undefined
|
|
230
|
+
|
|
231
|
+
if (
|
|
232
|
+
prop_key === `force` && Array.isArray(prop_value) &&
|
|
233
|
+
prop_value.length === 3 && prop_value.every((v) =>
|
|
234
|
+
typeof v === `number`
|
|
235
|
+
)
|
|
236
|
+
) {
|
|
237
|
+
const force_magnitude = Math.hypot(...prop_value)
|
|
238
|
+
formatted_value = `${format_num(force_magnitude, `.3~f`)} eV/Å`
|
|
239
|
+
tooltip = `Force vector: (${
|
|
240
|
+
prop_value.map((force) => format_num(force, `.3~f`)).join(`, `)
|
|
241
|
+
}) eV/Å`
|
|
242
|
+
} else if (prop_key === `magmom` || prop_key.includes(`magnet`)) {
|
|
243
|
+
const num_val = Number(prop_value)
|
|
244
|
+
if (isNaN(num_val)) continue
|
|
245
|
+
formatted_value = `${format_num(num_val, `.3~f`)} μB`
|
|
246
|
+
tooltip = `Magnetic moment in Bohr magnetons`
|
|
247
|
+
} else if (Array.isArray(prop_value)) {
|
|
248
|
+
formatted_value = `(${
|
|
249
|
+
prop_value.map((v) => {
|
|
250
|
+
const num_val = Number(v)
|
|
251
|
+
return isNaN(num_val) ? String(v) : format_num(num_val, `.3~f`)
|
|
252
|
+
}).join(`, `)
|
|
253
|
+
})`
|
|
254
|
+
} else {
|
|
255
|
+
const num_val = Number(prop_value)
|
|
256
|
+
formatted_value = isNaN(num_val)
|
|
257
|
+
? String(prop_value)
|
|
258
|
+
: format_num(num_val, `.3~f`)
|
|
208
259
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
260
|
+
|
|
261
|
+
site_items.push({
|
|
262
|
+
label: ` ${prop_key}`,
|
|
263
|
+
value: formatted_value,
|
|
264
|
+
key: `site-${idx}-${prop_key}`,
|
|
265
|
+
tooltip,
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (site_items.length > 0) {
|
|
274
|
+
sections.push({
|
|
275
|
+
title: atom_count >= min_threshold ? `` : `Sites`,
|
|
276
|
+
items: site_items,
|
|
277
|
+
})
|
|
278
|
+
}
|
|
217
279
|
}
|
|
280
|
+
|
|
218
281
|
// Usage Tips
|
|
219
282
|
sections.push({
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
|
|
283
|
+
title: `Usage Tips`,
|
|
284
|
+
items: [
|
|
285
|
+
{
|
|
286
|
+
label: `File Drop`,
|
|
287
|
+
value: `Drop POSCAR, XYZ, CIF or JSON files to load structures`,
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
label: `Atom Selection`,
|
|
291
|
+
value:
|
|
292
|
+
`Click atoms to select them, then pick distance or angle mode to measure all pairwise distances/angles`,
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
label: `Navigation`,
|
|
296
|
+
value: `Hold Shift/Cmd/Ctrl + drag to pan the scene`,
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
label: `Camera Reset`,
|
|
300
|
+
value: `Double-click anywhere to reset camera to default view`,
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
label: `Colors`,
|
|
304
|
+
value:
|
|
305
|
+
`Click legend labels to change colors, double-click to reset, right-click to remap elements`,
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
label: `Keyboard`,
|
|
309
|
+
value: `Press 'f' for fullscreen, 'i' to toggle this pane`,
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
return sections
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
// Compute Wyckoff positions from symmetry data
|
|
318
|
+
let wyckoff_positions = $derived(wyckoff_positions_from_moyo(sym_data))
|
|
252
319
|
</script>
|
|
253
320
|
|
|
254
321
|
<DraggablePane
|
|
@@ -275,8 +342,8 @@ let wyckoff_positions = $derived(wyckoff_positions_from_moyo(sym_data));
|
|
|
275
342
|
{@const { key, label, value, tooltip } = item}
|
|
276
343
|
{#if section.title === `Usage Tips`}
|
|
277
344
|
<div class="tips-item">
|
|
278
|
-
<span>{@html label}</span>
|
|
279
|
-
<span>{@html value}</span>
|
|
345
|
+
<span>{@html sanitize_html(label)}</span>
|
|
346
|
+
<span>{@html sanitize_html(value)}</span>
|
|
280
347
|
</div>
|
|
281
348
|
{:else}
|
|
282
349
|
<div
|
|
@@ -294,8 +361,8 @@ let wyckoff_positions = $derived(wyckoff_positions_from_moyo(sym_data));
|
|
|
294
361
|
}
|
|
295
362
|
}}
|
|
296
363
|
>
|
|
297
|
-
<span>{@html label}</span>
|
|
298
|
-
<span title={tooltip}>{@html value}</span>
|
|
364
|
+
<span>{@html sanitize_html(label)}</span>
|
|
365
|
+
<span title={tooltip}>{@html sanitize_html(value)}</span>
|
|
299
366
|
{#if key !== `sites-toggle` && key && copied_items.has(key)}
|
|
300
367
|
<Icon
|
|
301
368
|
icon="Check"
|