matterviz 0.3.1 → 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 +154 -96
- package/dist/Icon.svelte +20 -14
- package/dist/MillerIndexInput.svelte +27 -21
- package/dist/api/optimade.js +6 -6
- package/dist/app.css +216 -178
- package/dist/brillouin/BrillouinZone.svelte +299 -198
- package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneControls.svelte +32 -5
- package/dist/brillouin/BrillouinZoneExportPane.svelte +74 -55
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +99 -68
- package/dist/brillouin/BrillouinZoneScene.svelte +277 -165
- 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 +327 -0
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +13 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +847 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +3194 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte +11 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +7 -0
- 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.d.ts +10 -0
- package/dist/chempot-diagram/color.js +32 -0
- package/dist/chempot-diagram/compute.d.ts +48 -0
- package/dist/chempot-diagram/compute.js +812 -0
- package/dist/chempot-diagram/index.d.ts +6 -0
- package/dist/chempot-diagram/index.js +6 -0
- package/dist/chempot-diagram/pointer.d.ts +16 -0
- package/dist/chempot-diagram/pointer.js +40 -0
- package/dist/chempot-diagram/temperature.d.ts +15 -0
- package/dist/chempot-diagram/temperature.js +36 -0
- package/dist/chempot-diagram/types.d.ts +86 -0
- package/dist/chempot-diagram/types.js +28 -0
- package/dist/colors/index.d.ts +3 -1
- package/dist/colors/index.js +9 -3
- package/dist/composition/BarChart.svelte +141 -77
- package/dist/composition/BubbleChart.svelte +107 -52
- package/dist/composition/Composition.svelte +100 -79
- package/dist/composition/Formula.svelte +108 -62
- package/dist/composition/FormulaFilter.svelte +973 -353
- package/dist/composition/FormulaFilter.svelte.d.ts +35 -1
- package/dist/composition/PieChart.svelte +199 -99
- package/dist/composition/PieChart.svelte.d.ts +1 -1
- 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 -38
- package/dist/convex-hull/ConvexHull2D.svelte +551 -393
- package/dist/convex-hull/ConvexHull3D.svelte +1303 -825
- package/dist/convex-hull/ConvexHull4D.svelte +1012 -686
- package/dist/convex-hull/ConvexHullControls.svelte +115 -28
- package/dist/convex-hull/ConvexHullInfoPane.svelte +29 -3
- package/dist/convex-hull/ConvexHullStats.svelte +821 -249
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +6 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +41 -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.d.ts +6 -0
- package/dist/convex-hull/demo-temperature.js +40 -0
- package/dist/convex-hull/gas-thermodynamics.js +17 -12
- package/dist/convex-hull/helpers.d.ts +10 -1
- package/dist/convex-hull/helpers.js +79 -38
- package/dist/convex-hull/index.d.ts +1 -0
- package/dist/convex-hull/index.js +1 -0
- package/dist/convex-hull/thermodynamics.d.ts +8 -21
- package/dist/convex-hull/thermodynamics.js +163 -69
- package/dist/convex-hull/types.d.ts +12 -12
- package/dist/convex-hull/types.js +0 -12
- package/dist/coordination/CoordinationBarPlot.svelte +232 -176
- package/dist/element/BohrAtom.svelte +56 -13
- 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/element/data.js +2 -14
- package/dist/element/data.json.gz +0 -0
- package/dist/element/types.d.ts +1 -0
- 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 +336 -239
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte +113 -46
- package/dist/fermi-surface/FermiSurfaceScene.svelte +536 -343
- 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 +37 -33
- package/dist/fermi-surface/symmetry.js +2 -7
- package/dist/fermi-surface/types.d.ts +3 -5
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +1527 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +110 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +225 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +30 -0
- package/dist/heatmap-matrix/index.d.ts +53 -0
- package/dist/heatmap-matrix/index.js +100 -0
- package/dist/heatmap-matrix/shared.d.ts +2 -0
- package/dist/heatmap-matrix/shared.js +4 -0
- package/dist/icons.d.ts +111 -0
- package/dist/icons.js +158 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/io/decompress.js +1 -1
- package/dist/io/export.d.ts +3 -0
- package/dist/io/export.js +138 -140
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +43 -0
- package/dist/io/index.d.ts +2 -2
- package/dist/io/index.js +2 -112
- package/dist/io/is-binary.js +2 -3
- package/dist/io/types.d.ts +1 -0
- package/dist/io/url-drop.d.ts +2 -0
- package/dist/io/url-drop.js +117 -0
- package/dist/isosurface/Isosurface.svelte +220 -110
- package/dist/isosurface/IsosurfaceControls.svelte +65 -28
- package/dist/isosurface/parse.js +104 -56
- package/dist/isosurface/slice.d.ts +2 -1
- package/dist/isosurface/slice.js +8 -13
- package/dist/isosurface/types.d.ts +14 -1
- package/dist/isosurface/types.js +152 -5
- package/dist/labels.d.ts +2 -1
- package/dist/labels.js +12 -8
- package/dist/layout/FullscreenToggle.svelte +11 -2
- package/dist/layout/InfoCard.svelte +38 -6
- package/dist/layout/InfoTag.svelte +125 -94
- package/dist/layout/PropertyFilter.svelte +82 -37
- package/dist/layout/SettingsSection.svelte +85 -55
- package/dist/layout/SubpageGrid.svelte +82 -0
- package/dist/layout/SubpageGrid.svelte.d.ts +14 -0
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +1 -0
- package/dist/layout/json-tree/JsonNode.svelte +266 -223
- package/dist/layout/json-tree/JsonTree.svelte +516 -429
- package/dist/layout/json-tree/JsonTree.svelte.d.ts +1 -1
- package/dist/layout/json-tree/JsonValue.svelte +281 -173
- package/dist/layout/json-tree/types.d.ts +10 -2
- package/dist/layout/json-tree/utils.d.ts +2 -0
- package/dist/layout/json-tree/utils.js +37 -2
- package/dist/marching-cubes.js +25 -2
- package/dist/math.d.ts +20 -17
- package/dist/math.js +474 -57
- package/dist/overlays/ContextMenu.svelte +66 -40
- package/dist/overlays/DraggablePane.svelte +331 -154
- package/dist/overlays/DraggablePane.svelte.d.ts +2 -0
- 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 +559 -267
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte +131 -51
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +3 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +126 -0
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +15 -0
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +160 -110
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +8 -1
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +217 -86
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +6 -3
- 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/index.d.ts +2 -0
- package/dist/phase-diagram/index.js +2 -0
- package/dist/phase-diagram/parse.js +10 -9
- package/dist/phase-diagram/svg-to-diagram.d.ts +2 -0
- package/dist/phase-diagram/svg-to-diagram.js +869 -0
- package/dist/phase-diagram/types.d.ts +10 -0
- package/dist/phase-diagram/utils.d.ts +8 -4
- package/dist/phase-diagram/utils.js +219 -74
- package/dist/plot/AxisLabel.svelte +51 -0
- package/dist/plot/AxisLabel.svelte.d.ts +16 -0
- package/dist/plot/BarPlot.svelte +1461 -768
- package/dist/plot/BarPlot.svelte.d.ts +3 -3
- package/dist/plot/BarPlotControls.svelte +33 -6
- package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ColorBar.svelte +533 -383
- package/dist/plot/ColorBar.svelte.d.ts +1 -1
- package/dist/plot/ColorScaleSelect.svelte +28 -7
- package/dist/plot/ElementScatter.svelte +38 -16
- package/dist/plot/FillArea.svelte +152 -92
- package/dist/plot/Histogram.svelte +1162 -709
- package/dist/plot/Histogram.svelte.d.ts +1 -1
- package/dist/plot/HistogramControls.svelte +81 -18
- package/dist/plot/HistogramControls.svelte.d.ts +6 -2
- 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 +221 -96
- 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 -146
- package/dist/plot/ReferenceLine.svelte +77 -22
- package/dist/plot/ReferenceLine.svelte.d.ts +1 -0
- package/dist/plot/ReferenceLine3D.svelte +132 -107
- package/dist/plot/ReferencePlane.svelte +146 -123
- package/dist/plot/ScatterPlot.svelte +1880 -1156
- package/dist/plot/ScatterPlot.svelte.d.ts +3 -3
- package/dist/plot/ScatterPlot3D.svelte +256 -131
- package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlot3DControls.svelte +300 -297
- package/dist/plot/ScatterPlot3DControls.svelte.d.ts +2 -1
- package/dist/plot/ScatterPlot3DScene.svelte +608 -406
- package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlotControls.svelte +150 -70
- 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 +96 -0
- package/dist/plot/ZeroLines.svelte.d.ts +32 -0
- package/dist/plot/ZoomRect.svelte +23 -0
- package/dist/plot/ZoomRect.svelte.d.ts +8 -0
- package/dist/plot/axis-utils.d.ts +1 -1
- 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/index.d.ts +6 -2
- package/dist/plot/index.js +6 -2
- package/dist/plot/interactions.d.ts +8 -10
- package/dist/plot/interactions.js +2 -3
- package/dist/plot/layout.d.ts +11 -2
- package/dist/plot/layout.js +44 -17
- package/dist/plot/reference-line.d.ts +5 -22
- package/dist/plot/reference-line.js +12 -84
- package/dist/plot/scales.js +24 -36
- package/dist/plot/types.d.ts +53 -40
- package/dist/plot/types.js +12 -7
- package/dist/plot/utils/label-placement.d.ts +32 -15
- package/dist/plot/utils/label-placement.js +227 -63
- package/dist/plot/utils/series-visibility.js +2 -3
- package/dist/plot/utils.d.ts +1 -0
- package/dist/plot/utils.js +14 -0
- package/dist/rdf/RdfPlot.svelte +173 -132
- 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 +21 -6
- package/dist/settings.js +63 -19
- package/dist/spectral/Bands.svelte +963 -412
- package/dist/spectral/Bands.svelte.d.ts +22 -2
- 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.d.ts +23 -1
- package/dist/spectral/helpers.js +119 -51
- package/dist/spectral/types.d.ts +2 -0
- 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 +231 -129
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +73 -47
- package/dist/structure/CanvasTooltip.svelte +10 -2
- package/dist/structure/CellSelect.svelte +148 -51
- package/dist/structure/Cylinder.svelte +33 -17
- package/dist/structure/Lattice.svelte +88 -33
- package/dist/structure/Structure.svelte +1077 -821
- package/dist/structure/Structure.svelte.d.ts +1 -1
- package/dist/structure/StructureControls.svelte +373 -139
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureExportPane.svelte +124 -89
- package/dist/structure/StructureExportPane.svelte.d.ts +1 -1
- package/dist/structure/StructureInfoPane.svelte +304 -231
- package/dist/structure/StructureScene.svelte +919 -445
- package/dist/structure/StructureScene.svelte.d.ts +16 -7
- package/dist/structure/atom-properties.d.ts +6 -2
- package/dist/structure/atom-properties.js +42 -29
- package/dist/structure/bonding.js +6 -7
- package/dist/structure/export.js +22 -34
- package/dist/structure/ferrox-wasm-types.d.ts +3 -2
- package/dist/structure/ferrox-wasm-types.js +0 -3
- package/dist/structure/ferrox-wasm.d.ts +3 -2
- package/dist/structure/ferrox-wasm.js +2 -3
- package/dist/structure/index.d.ts +16 -0
- package/dist/structure/index.js +88 -6
- package/dist/structure/measure.d.ts +2 -2
- package/dist/structure/measure.js +4 -44
- package/dist/structure/parse.js +130 -155
- package/dist/structure/partial-occupancy.d.ts +25 -0
- package/dist/structure/partial-occupancy.js +99 -0
- 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 +5 -3
- package/dist/symmetry/SymmetryStats.svelte +94 -37
- package/dist/symmetry/WyckoffTable.svelte +42 -14
- package/dist/symmetry/cell-transform.js +5 -3
- package/dist/symmetry/index.d.ts +7 -4
- package/dist/symmetry/index.js +87 -21
- package/dist/symmetry/spacegroups.js +148 -148
- package/dist/table/HeatmapTable.svelte +1112 -516
- package/dist/table/HeatmapTable.svelte.d.ts +12 -1
- package/dist/table/ToggleMenu.svelte +125 -90
- package/dist/table/index.d.ts +2 -0
- 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 +889 -687
- package/dist/trajectory/TrajectoryError.svelte +14 -3
- package/dist/trajectory/TrajectoryExportPane.svelte +148 -90
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +1 -1
- package/dist/trajectory/TrajectoryInfoPane.svelte +272 -143
- package/dist/trajectory/constants.d.ts +6 -0
- package/dist/trajectory/constants.js +7 -0
- package/dist/trajectory/extract.js +13 -31
- package/dist/trajectory/format-detect.d.ts +9 -0
- package/dist/trajectory/format-detect.js +76 -0
- package/dist/trajectory/frame-reader.d.ts +17 -0
- package/dist/trajectory/frame-reader.js +332 -0
- package/dist/trajectory/helpers.d.ts +14 -0
- package/dist/trajectory/helpers.js +172 -0
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +23 -14
- package/dist/trajectory/parse/ase.d.ts +2 -0
- package/dist/trajectory/parse/ase.js +77 -0
- package/dist/trajectory/parse/hdf5.d.ts +2 -0
- package/dist/trajectory/parse/hdf5.js +129 -0
- package/dist/trajectory/parse/index.d.ts +12 -0
- package/dist/trajectory/parse/index.js +299 -0
- package/dist/trajectory/parse/lammps.d.ts +5 -0
- package/dist/trajectory/parse/lammps.js +179 -0
- package/dist/trajectory/parse/vasp.d.ts +2 -0
- package/dist/trajectory/parse/vasp.js +68 -0
- package/dist/trajectory/parse/xyz.d.ts +2 -0
- package/dist/trajectory/parse/xyz.js +110 -0
- package/dist/trajectory/plotting.js +13 -8
- package/dist/trajectory/types.d.ts +11 -0
- package/dist/trajectory/types.js +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +17 -0
- package/dist/xrd/XrdPlot.svelte +337 -245
- package/dist/xrd/broadening.js +14 -9
- package/dist/xrd/calc-xrd.js +12 -19
- package/dist/xrd/parse.d.ts +1 -1
- package/dist/xrd/parse.js +17 -17
- package/package.json +103 -101
- package/readme.md +4 -4
- package/dist/trajectory/parse.d.ts +0 -42
- package/dist/trajectory/parse.js +0 -1267
- /package/dist/element/{data.json.d.ts → data.json.gz.d.ts} +0 -0
- /package/dist/theme/{themes.js → themes.mjs} +0 -0
|
@@ -1,80 +1,172 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ATOMIC_WEIGHTS } from '../composition/parse'
|
|
3
|
+
import type { ElementSymbol } from '../element'
|
|
4
|
+
import { format_num } from '../labels'
|
|
5
|
+
import { sanitize_formula, sanitize_html } from '../sanitize'
|
|
6
|
+
import { TooltipContent } from '../tooltip'
|
|
7
|
+
import type {
|
|
8
|
+
CompUnit,
|
|
9
|
+
LeverRuleMode,
|
|
10
|
+
PhaseBoundary,
|
|
11
|
+
PhaseDiagramTooltipProp,
|
|
12
|
+
PhaseHoverInfo,
|
|
13
|
+
TempUnit,
|
|
14
|
+
} from './types'
|
|
15
|
+
import {
|
|
16
|
+
convert_temp,
|
|
17
|
+
format_composition,
|
|
18
|
+
format_label_html,
|
|
19
|
+
format_temperature,
|
|
20
|
+
get_phase_stability_range,
|
|
21
|
+
} from './utils'
|
|
22
|
+
|
|
23
|
+
let {
|
|
24
|
+
hover_info,
|
|
25
|
+
temperature_unit = `K`,
|
|
26
|
+
data_temperature_unit,
|
|
27
|
+
composition_unit = `at%`,
|
|
28
|
+
component_a = `A`,
|
|
29
|
+
component_b = `B`,
|
|
30
|
+
boundaries = [],
|
|
31
|
+
lever_rule_mode = `horizontal`,
|
|
32
|
+
use_subscripts = true,
|
|
33
|
+
tooltip,
|
|
34
|
+
}: {
|
|
35
|
+
hover_info: PhaseHoverInfo
|
|
36
|
+
temperature_unit?: TempUnit
|
|
37
|
+
// Original unit of hover_info.temperature (defaults to temperature_unit)
|
|
38
|
+
data_temperature_unit?: TempUnit
|
|
39
|
+
composition_unit?: CompUnit
|
|
40
|
+
component_a?: string
|
|
41
|
+
component_b?: string
|
|
42
|
+
boundaries?: PhaseBoundary[]
|
|
43
|
+
lever_rule_mode?: LeverRuleMode
|
|
44
|
+
use_subscripts?: boolean
|
|
45
|
+
tooltip?: PhaseDiagramTooltipProp
|
|
46
|
+
} = $props()
|
|
47
|
+
|
|
48
|
+
// The unit that hover_info.temperature is actually in
|
|
49
|
+
const data_unit = $derived(data_temperature_unit ?? temperature_unit)
|
|
50
|
+
|
|
51
|
+
const safe_formula = (comp: string) => sanitize_formula(comp, use_subscripts)
|
|
52
|
+
|
|
53
|
+
// Convert a temperature from data unit to display unit
|
|
54
|
+
function to_display(temp: number): number {
|
|
55
|
+
return convert_temp(temp, data_unit, temperature_unit)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Convert atomic fraction to weight fraction: wt_B = (x_B * M_B) / (x_A * M_A + x_B * M_B)
|
|
59
|
+
const wt_fraction_b = $derived.by(() => {
|
|
60
|
+
const mass_a = ATOMIC_WEIGHTS.get(component_a as ElementSymbol)
|
|
61
|
+
const mass_b = ATOMIC_WEIGHTS.get(component_b as ElementSymbol)
|
|
62
|
+
if (!mass_a || !mass_b) return null
|
|
63
|
+
const { composition: x_b } = hover_info
|
|
64
|
+
const denom = (1 - x_b) * mass_a + x_b * mass_b
|
|
65
|
+
return denom > 0 ? (x_b * mass_b) / denom : null
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const stability = $derived(get_phase_stability_range(hover_info.region))
|
|
69
|
+
|
|
70
|
+
// Format special point type for display (e.g., "peritectic" → "Peritectic")
|
|
71
|
+
// For melting points and congruent points at composition edges, show element-specific info
|
|
72
|
+
const special_point_info = $derived.by(() => {
|
|
73
|
+
const point = hover_info.special_point
|
|
74
|
+
if (!point) return null
|
|
75
|
+
|
|
76
|
+
const type = point.type
|
|
77
|
+
const position = point.position
|
|
78
|
+
const temp = format_temperature(to_display(position[1]), temperature_unit)
|
|
79
|
+
|
|
26
80
|
// Check if this is a melting point (at composition edge)
|
|
27
|
-
const is_at_edge = position[0] <= 0.01 || position[0] >= 0.99
|
|
28
|
-
const is_melting = type === `melting_point` || type === `congruent
|
|
81
|
+
const is_at_edge = position[0] <= 0.01 || position[0] >= 0.99
|
|
82
|
+
const is_melting = type === `melting_point` || type === `congruent`
|
|
83
|
+
|
|
29
84
|
if (is_melting && is_at_edge) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
85
|
+
const element = position[0] <= 0.01 ? component_a : component_b
|
|
86
|
+
return {
|
|
87
|
+
badge: `Melting Point`,
|
|
88
|
+
description: `${element} melts at ${temp}`,
|
|
89
|
+
}
|
|
35
90
|
}
|
|
91
|
+
|
|
36
92
|
// Handle other special point types with descriptive info
|
|
37
|
-
const type_descriptions = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
93
|
+
const type_descriptions: Record<string, string> = {
|
|
94
|
+
eutectic: `Liquid → two solid phases at ${temp}`,
|
|
95
|
+
peritectic: `Liquid + solid → different solid at ${temp}`,
|
|
96
|
+
eutectoid: `Solid → two solid phases at ${temp}`,
|
|
97
|
+
peritectoid: `Two solids → different solid at ${temp}`,
|
|
98
|
+
congruent: `Congruent phase change at ${temp}`,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const badge = type.charAt(0).toUpperCase() + type.slice(1).replaceAll(`_`, ` `)
|
|
45
102
|
return {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const { composition, temperature } = hover_info
|
|
55
|
-
let min_dist = null
|
|
103
|
+
badge,
|
|
104
|
+
description: type_descriptions[type] ?? null,
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
// Calculate distance to nearest phase boundary (liquidus/solidus)
|
|
109
|
+
const boundary_distance = $derived.by(() => {
|
|
110
|
+
if (!boundaries.length) return null
|
|
111
|
+
const { composition, temperature } = hover_info
|
|
112
|
+
let min_dist: { type: string; delta_t: number } | null = null
|
|
113
|
+
|
|
56
114
|
for (const boundary of boundaries) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
}
|
|
115
|
+
if (![`liquidus`, `solidus`, `solvus`].includes(boundary.type)) continue
|
|
116
|
+
// Find the boundary point closest in composition
|
|
117
|
+
for (const [bx, bt] of boundary.points) {
|
|
118
|
+
if (Math.abs(bx - composition) < 0.02) {
|
|
119
|
+
// Within 2% composition
|
|
120
|
+
const delta = temperature - bt
|
|
121
|
+
if (!min_dist || Math.abs(delta) < Math.abs(min_dist.delta_t)) {
|
|
122
|
+
min_dist = { type: boundary.type, delta_t: delta }
|
|
123
|
+
}
|
|
68
124
|
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return min_dist
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
// Normalized lever rule display data (unifies horizontal and vertical modes)
|
|
131
|
+
const lever_display = $derived.by(() => {
|
|
132
|
+
if (lever_rule_mode === `vertical` && hover_info.vertical_lever_rule) {
|
|
133
|
+
const vlr = hover_info.vertical_lever_rule
|
|
134
|
+
return {
|
|
135
|
+
label: `Lever Rule (vertical)`,
|
|
136
|
+
phase_a: vlr.bottom_phase,
|
|
137
|
+
phase_b: vlr.top_phase,
|
|
138
|
+
fraction_a: vlr.fraction_bottom,
|
|
139
|
+
fraction_b: vlr.fraction_top,
|
|
140
|
+
detail_a: format_temperature(
|
|
141
|
+
to_display(vlr.bottom_temperature),
|
|
142
|
+
temperature_unit,
|
|
143
|
+
),
|
|
144
|
+
detail_b: format_temperature(
|
|
145
|
+
to_display(vlr.top_temperature),
|
|
146
|
+
temperature_unit,
|
|
147
|
+
),
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (lever_rule_mode === `horizontal` && hover_info.lever_rule) {
|
|
151
|
+
const lr = hover_info.lever_rule
|
|
152
|
+
return {
|
|
153
|
+
label: `Lever Rule`,
|
|
154
|
+
phase_a: lr.left_phase,
|
|
155
|
+
phase_b: lr.right_phase,
|
|
156
|
+
fraction_a: lr.fraction_left,
|
|
157
|
+
fraction_b: lr.fraction_right,
|
|
158
|
+
detail_a: format_composition(lr.left_composition, composition_unit),
|
|
159
|
+
detail_b: format_composition(lr.right_composition, composition_unit),
|
|
160
|
+
}
|
|
69
161
|
}
|
|
70
|
-
return
|
|
71
|
-
})
|
|
162
|
+
return null
|
|
163
|
+
})
|
|
72
164
|
</script>
|
|
73
165
|
|
|
74
166
|
<TooltipContent data={hover_info} snippet_arg={hover_info} {tooltip}>
|
|
75
167
|
<div class="phase-diagram-tooltip">
|
|
76
168
|
<header>
|
|
77
|
-
<strong>{hover_info.region.name}</strong>
|
|
169
|
+
<strong>{@html sanitize_html(format_label_html(hover_info.region.name, use_subscripts))}</strong>
|
|
78
170
|
{#if special_point_info}<span class="special-point-badge">{
|
|
79
171
|
special_point_info.badge
|
|
80
172
|
}</span>{/if}
|
|
@@ -86,49 +178,84 @@ const boundary_distance = $derived.by(() => {
|
|
|
86
178
|
|
|
87
179
|
<dl>
|
|
88
180
|
<dt>Temperature</dt>
|
|
89
|
-
<dd>
|
|
181
|
+
<dd>
|
|
182
|
+
{
|
|
183
|
+
format_temperature(
|
|
184
|
+
to_display(hover_info.temperature),
|
|
185
|
+
temperature_unit,
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
{#if temperature_unit !== `°C`}
|
|
189
|
+
<small>({
|
|
190
|
+
format_temperature(
|
|
191
|
+
convert_temp(hover_info.temperature, data_unit, `°C`),
|
|
192
|
+
`°C`,
|
|
193
|
+
)
|
|
194
|
+
})</small>
|
|
195
|
+
{/if}
|
|
196
|
+
</dd>
|
|
90
197
|
<dt>Composition</dt>
|
|
91
198
|
<dd>
|
|
92
|
-
{format_composition(hover_info.composition, composition_unit)}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
})</small>
|
|
199
|
+
{format_composition(hover_info.composition, composition_unit)}
|
|
200
|
+
{@html safe_formula(component_b)}
|
|
201
|
+
<small>({format_composition(1 - hover_info.composition, composition_unit)}
|
|
202
|
+
{@html safe_formula(component_a)})</small>
|
|
96
203
|
</dd>
|
|
97
204
|
{#if wt_fraction_b !== null}
|
|
98
205
|
<dt>Weight</dt>
|
|
99
206
|
<dd>
|
|
100
|
-
{format_num(wt_fraction_b * 100, `.1f`)}%
|
|
101
|
-
|
|
207
|
+
{format_num(wt_fraction_b * 100, `.1f`)}%
|
|
208
|
+
{@html safe_formula(component_b)}
|
|
209
|
+
<small>({format_num((1 - wt_fraction_b) * 100, `.1f`)}%
|
|
210
|
+
{@html safe_formula(component_a)})</small>
|
|
102
211
|
</dd>
|
|
103
212
|
{/if}
|
|
104
213
|
{#if stability}
|
|
105
|
-
<dt>Stable</dt><dd>
|
|
214
|
+
<dt>Stable</dt><dd>
|
|
215
|
+
{format_num(to_display(stability.t_min), `.0f`)} – {
|
|
216
|
+
format_num(to_display(stability.t_max), `.0f`)
|
|
217
|
+
} {temperature_unit}
|
|
218
|
+
{#if temperature_unit !== `°C`}
|
|
219
|
+
<small>({
|
|
220
|
+
format_num(
|
|
221
|
+
convert_temp(stability.t_min, data_unit, `°C`),
|
|
222
|
+
`.0f`,
|
|
223
|
+
)
|
|
224
|
+
} – {
|
|
225
|
+
format_num(
|
|
226
|
+
convert_temp(stability.t_max, data_unit, `°C`),
|
|
227
|
+
`.0f`,
|
|
228
|
+
)
|
|
229
|
+
} °C)</small>
|
|
230
|
+
{/if}
|
|
231
|
+
</dd>
|
|
106
232
|
{/if}
|
|
107
233
|
</dl>
|
|
108
234
|
|
|
109
|
-
{#if
|
|
110
|
-
{@const
|
|
235
|
+
{#if lever_display}
|
|
236
|
+
{@const ld = lever_display}
|
|
111
237
|
<div class="lever">
|
|
112
|
-
<span>
|
|
238
|
+
<span>{ld.label}</span>
|
|
113
239
|
<div class="bar">
|
|
114
240
|
<div
|
|
115
|
-
style:width="{
|
|
116
|
-
title="{
|
|
241
|
+
style:width="{ld.fraction_a * 100}%"
|
|
242
|
+
title="{ld.phase_a}: {format_num(ld.fraction_a * 100, `.1f`)}%"
|
|
117
243
|
>
|
|
118
244
|
</div>
|
|
119
245
|
<div
|
|
120
|
-
style:width="{
|
|
121
|
-
title="{
|
|
246
|
+
style:width="{ld.fraction_b * 100}%"
|
|
247
|
+
title="{ld.phase_b}: {format_num(ld.fraction_b * 100, `.1f`)}%"
|
|
122
248
|
>
|
|
123
249
|
</div>
|
|
124
|
-
<i style:left="{
|
|
250
|
+
<i style:left="{ld.fraction_a * 100}%"></i>
|
|
125
251
|
</div>
|
|
126
252
|
<div class="phase-info">
|
|
127
|
-
<span>{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<span>{
|
|
131
|
-
|
|
253
|
+
<span>{@html safe_formula(ld.phase_a)}: {
|
|
254
|
+
format_num(ld.fraction_a * 100, `.0f`)
|
|
255
|
+
}% <small>at {ld.detail_a}</small></span>
|
|
256
|
+
<span>{@html safe_formula(ld.phase_b)}: {
|
|
257
|
+
format_num(ld.fraction_b * 100, `.0f`)
|
|
258
|
+
}% <small>at {ld.detail_b}</small></span>
|
|
132
259
|
</div>
|
|
133
260
|
</div>
|
|
134
261
|
{/if}
|
|
@@ -136,8 +263,12 @@ const boundary_distance = $derived.by(() => {
|
|
|
136
263
|
{#if boundary_distance}
|
|
137
264
|
{@const { type, delta_t } = boundary_distance}
|
|
138
265
|
{@const label = delta_t > 0 ? `above` : `below`}
|
|
266
|
+
{@const display_delta = Math.abs(
|
|
267
|
+
to_display(hover_info.temperature) -
|
|
268
|
+
to_display(hover_info.temperature - delta_t),
|
|
269
|
+
)}
|
|
139
270
|
<div class="boundary-info">
|
|
140
|
-
{Math.round(
|
|
271
|
+
{Math.round(display_delta)} {temperature_unit} {label} {type}
|
|
141
272
|
</div>
|
|
142
273
|
{/if}
|
|
143
274
|
</div>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import type { PhaseBoundary, PhaseDiagramTooltipProp, PhaseHoverInfo } from './types';
|
|
1
|
+
import type { CompUnit, LeverRuleMode, PhaseBoundary, PhaseDiagramTooltipProp, PhaseHoverInfo, TempUnit } from './types';
|
|
2
2
|
type $$ComponentProps = {
|
|
3
3
|
hover_info: PhaseHoverInfo;
|
|
4
|
-
temperature_unit?:
|
|
5
|
-
|
|
4
|
+
temperature_unit?: TempUnit;
|
|
5
|
+
data_temperature_unit?: TempUnit;
|
|
6
|
+
composition_unit?: CompUnit;
|
|
6
7
|
component_a?: string;
|
|
7
8
|
component_b?: string;
|
|
8
9
|
boundaries?: PhaseBoundary[];
|
|
10
|
+
lever_rule_mode?: LeverRuleMode;
|
|
11
|
+
use_subscripts?: boolean;
|
|
9
12
|
tooltip?: PhaseDiagramTooltipProp;
|
|
10
13
|
};
|
|
11
14
|
declare const PhaseDiagramTooltip: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TdbParseResult } from './parse'
|
|
3
|
+
import { extract_tdb_reference, summarize_models } from './utils'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
result: TdbParseResult
|
|
7
|
+
system_name?: string
|
|
8
|
+
has_precomputed?: boolean
|
|
9
|
+
is_precomputed_loaded?: boolean
|
|
10
|
+
on_load_precomputed?: () => void
|
|
11
|
+
style?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
result,
|
|
16
|
+
system_name = ``,
|
|
17
|
+
has_precomputed = false,
|
|
18
|
+
is_precomputed_loaded = false,
|
|
19
|
+
on_load_precomputed,
|
|
20
|
+
style = ``,
|
|
21
|
+
}: Props = $props()
|
|
22
|
+
|
|
23
|
+
const reference = $derived(
|
|
24
|
+
result.data ? extract_tdb_reference(result.data.comments) : null,
|
|
25
|
+
)
|
|
26
|
+
const model_summary = $derived(
|
|
27
|
+
result.data ? summarize_models(result.data.phases) : null,
|
|
28
|
+
)
|
|
5
29
|
</script>
|
|
6
30
|
|
|
7
31
|
<div class="tdb-info-panel" {style}>
|
|
@@ -19,7 +19,7 @@ export function parse_curve_ref(ref) {
|
|
|
19
19
|
name = name.slice(1);
|
|
20
20
|
}
|
|
21
21
|
// Check for slice suffix [start:end]
|
|
22
|
-
const slice_match =
|
|
22
|
+
const slice_match = /^(.+)\[(-?\d*):(-?\d*)\]$/.exec(name);
|
|
23
23
|
if (slice_match) {
|
|
24
24
|
name = slice_match[1];
|
|
25
25
|
start = slice_match[2] ? parseInt(slice_match[2]) : null;
|
|
@@ -30,14 +30,14 @@ export function parse_curve_ref(ref) {
|
|
|
30
30
|
// Apply slicing to array (Python-style negative indices supported)
|
|
31
31
|
export function apply_slice(arr, start, end) {
|
|
32
32
|
const len = arr.length;
|
|
33
|
-
let
|
|
34
|
-
let
|
|
33
|
+
let start_idx = start ?? 0;
|
|
34
|
+
let end_idx = end ?? len;
|
|
35
35
|
// Handle negative indices
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
return arr.slice(
|
|
36
|
+
if (start_idx < 0)
|
|
37
|
+
start_idx = Math.max(0, len + start_idx);
|
|
38
|
+
if (end_idx < 0)
|
|
39
|
+
end_idx = Math.max(0, len + end_idx);
|
|
40
|
+
return arr.slice(start_idx, end_idx);
|
|
41
41
|
}
|
|
42
42
|
// Expand bounds to vertex list
|
|
43
43
|
function expand_bounds(bounds, curves) {
|
|
@@ -57,7 +57,7 @@ function expand_bounds(bounds, curves) {
|
|
|
57
57
|
}
|
|
58
58
|
// Apply reverse first (to match Python's `reversed(curve)[1:]` pattern)
|
|
59
59
|
if (ref.reverse) {
|
|
60
|
-
points =
|
|
60
|
+
points = points.toReversed();
|
|
61
61
|
}
|
|
62
62
|
// Then apply slice
|
|
63
63
|
points = apply_slice(points, ref.start, ref.end);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Phase diagram color palette
|
|
2
2
|
// Keys can be referenced in diagram JSON files
|
|
3
|
-
|
|
4
|
-
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
5
|
-
}
|
|
3
|
+
const rgba = (r, g, b, a = 0.6) => `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
6
4
|
// Color palette for diagram JSON files - keyed colors that can be referenced by name
|
|
7
5
|
export const DIAGRAM_COLORS = {
|
|
8
6
|
// Single-phase regions (alpha=0.6)
|
|
@@ -4,8 +4,10 @@ export * from './diagram-input';
|
|
|
4
4
|
export { default as IsobaricBinaryPhaseDiagram } from './IsobaricBinaryPhaseDiagram.svelte';
|
|
5
5
|
export * from './parse';
|
|
6
6
|
export { default as PhaseDiagramControls } from './PhaseDiagramControls.svelte';
|
|
7
|
+
export { default as PhaseDiagramEditorPane } from './PhaseDiagramEditorPane.svelte';
|
|
7
8
|
export { default as PhaseDiagramExportPane } from './PhaseDiagramExportPane.svelte';
|
|
8
9
|
export { default as PhaseDiagramTooltip } from './PhaseDiagramTooltip.svelte';
|
|
10
|
+
export { parse_phase_diagram_svg } from './svg-to-diagram';
|
|
9
11
|
export { default as TdbInfoPanel } from './TdbInfoPanel.svelte';
|
|
10
12
|
export * from './types';
|
|
11
13
|
export * from './utils';
|
|
@@ -4,8 +4,10 @@ export * from './diagram-input';
|
|
|
4
4
|
export { default as IsobaricBinaryPhaseDiagram } from './IsobaricBinaryPhaseDiagram.svelte';
|
|
5
5
|
export * from './parse';
|
|
6
6
|
export { default as PhaseDiagramControls } from './PhaseDiagramControls.svelte';
|
|
7
|
+
export { default as PhaseDiagramEditorPane } from './PhaseDiagramEditorPane.svelte';
|
|
7
8
|
export { default as PhaseDiagramExportPane } from './PhaseDiagramExportPane.svelte';
|
|
8
9
|
export { default as PhaseDiagramTooltip } from './PhaseDiagramTooltip.svelte';
|
|
10
|
+
export { parse_phase_diagram_svg } from './svg-to-diagram';
|
|
9
11
|
export { default as TdbInfoPanel } from './TdbInfoPanel.svelte';
|
|
10
12
|
export * from './types';
|
|
11
13
|
export * from './utils';
|
|
@@ -44,13 +44,10 @@ export function parse_tdb(content) {
|
|
|
44
44
|
}
|
|
45
45
|
// Derive binary system from elements (excluding VA)
|
|
46
46
|
const real_elements = data.elements.map((el) => el.symbol).filter(is_real_element);
|
|
47
|
-
const binary_system = real_elements.length === 2
|
|
48
|
-
? [real_elements[0], real_elements[1]]
|
|
49
|
-
: undefined;
|
|
47
|
+
const binary_system = real_elements.length === 2 ? [real_elements[0], real_elements[1]] : undefined;
|
|
50
48
|
// Extract temperature range from functions/parameters
|
|
51
49
|
// Find the actual min and max temperatures across all ranges
|
|
52
|
-
let min_temp = Infinity;
|
|
53
|
-
let max_temp = -Infinity;
|
|
50
|
+
let [min_temp, max_temp] = [Infinity, -Infinity];
|
|
54
51
|
for (const func of data.functions) {
|
|
55
52
|
for (const range of func.temperature_ranges) {
|
|
56
53
|
if (range.min < min_temp)
|
|
@@ -152,7 +149,7 @@ const LINE_PARSERS = [
|
|
|
152
149
|
prefix: `PARAMETER `,
|
|
153
150
|
pattern: /PARAMETER\s+(\w+)\(([^)]+)\)\s+(.+?)!/i,
|
|
154
151
|
handler: (match, data) => {
|
|
155
|
-
const spec_match =
|
|
152
|
+
const spec_match = /([^,]+),([^;]+);(\d+)/.exec(match[2]);
|
|
156
153
|
if (spec_match) {
|
|
157
154
|
data.parameters.push({
|
|
158
155
|
type: match[1],
|
|
@@ -172,7 +169,7 @@ function parse_temperature_ranges(body) {
|
|
|
172
169
|
const trimmed = segment.trim();
|
|
173
170
|
if (!trimmed)
|
|
174
171
|
continue;
|
|
175
|
-
const temp_match =
|
|
172
|
+
const temp_match = /^([\d.E+-]+)\s+(.+)/i.exec(trimmed);
|
|
176
173
|
if (temp_match) {
|
|
177
174
|
const next_temp = parseFloat(temp_match[1]);
|
|
178
175
|
const expr = temp_match[2].replace(/\s+[YN]\s*$/, ``).trim();
|
|
@@ -193,7 +190,7 @@ function parse_tdb_line(line, data) {
|
|
|
193
190
|
parser.handler(match, data);
|
|
194
191
|
else if (parser.prefix === `ELEMENT `) {
|
|
195
192
|
// Fallback for simpler ELEMENT format: ELEMENT AL FCC_A1!
|
|
196
|
-
const simple_match =
|
|
193
|
+
const simple_match = /ELEMENT\s+(\S+)\s+(\S+)/i.exec(line);
|
|
197
194
|
if (simple_match) {
|
|
198
195
|
data.elements.push({
|
|
199
196
|
symbol: simple_match[1].toUpperCase(),
|
|
@@ -211,7 +208,11 @@ function parse_tdb_line(line, data) {
|
|
|
211
208
|
}
|
|
212
209
|
// Get a normalized system name from elements (e.g., "AL-ZN" always alphabetically sorted)
|
|
213
210
|
export function get_system_name(elements) {
|
|
214
|
-
return elements
|
|
211
|
+
return elements
|
|
212
|
+
.filter(is_real_element)
|
|
213
|
+
.map((el) => el.toUpperCase())
|
|
214
|
+
.sort()
|
|
215
|
+
.join(`-`);
|
|
215
216
|
}
|
|
216
217
|
// Check if a TDB file represents a binary system
|
|
217
218
|
export function is_binary_system(tdb_data) {
|