matterviz 0.4.0 → 0.4.2
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 -4
- package/dist/FilePicker.svelte +12 -14
- package/dist/Icon.svelte +7 -4
- package/dist/MillerIndexInput.svelte +2 -2
- package/dist/app.css +53 -0
- package/dist/brillouin/BrillouinZone.svelte +132 -219
- package/dist/brillouin/BrillouinZone.svelte.d.ts +9 -20
- package/dist/brillouin/BrillouinZoneControls.svelte +3 -6
- package/dist/brillouin/BrillouinZoneExportPane.svelte +47 -96
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +15 -42
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +2 -3
- package/dist/brillouin/BrillouinZoneScene.svelte +63 -230
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +3 -23
- package/dist/brillouin/ReciprocalVectors.svelte +39 -0
- package/dist/brillouin/ReciprocalVectors.svelte.d.ts +9 -0
- package/dist/brillouin/compute.d.ts +2 -0
- package/dist/brillouin/compute.js +80 -77
- package/dist/brillouin/geometry.d.ts +8 -0
- package/dist/brillouin/geometry.js +57 -0
- package/dist/brillouin/index.d.ts +2 -0
- package/dist/brillouin/index.js +2 -0
- package/dist/brillouin/types.d.ts +2 -2
- package/dist/chempot-diagram/ChemPotDiagram.svelte +33 -38
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +143 -246
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +4 -1
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +652 -976
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +7 -1
- package/dist/chempot-diagram/async-compute.svelte.js +1 -1
- package/dist/chempot-diagram/color.d.ts +3 -6
- package/dist/chempot-diagram/color.js +5 -5
- package/dist/chempot-diagram/compute.d.ts +3 -3
- package/dist/chempot-diagram/compute.js +3 -1
- package/dist/chempot-diagram/controls-state.svelte.d.ts +10 -0
- package/dist/chempot-diagram/controls-state.svelte.js +42 -0
- package/dist/chempot-diagram/export.d.ts +47 -0
- package/dist/chempot-diagram/export.js +133 -0
- package/dist/chempot-diagram/index.d.ts +1 -0
- package/dist/chempot-diagram/index.js +1 -0
- package/dist/chempot-diagram/pointer.d.ts +0 -10
- package/dist/chempot-diagram/pointer.js +4 -4
- package/dist/chempot-diagram/types.d.ts +3 -3
- package/dist/colors/index.d.ts +0 -4
- package/dist/colors/index.js +21 -22
- package/dist/composition/BarChart.svelte +37 -31
- package/dist/composition/BubbleChart.svelte +17 -17
- package/dist/composition/Composition.svelte +7 -11
- package/dist/composition/Formula.svelte +18 -25
- package/dist/composition/FormulaFilter.svelte +96 -98
- package/dist/composition/PieChart.svelte +60 -46
- package/dist/composition/chem-sys.js +3 -2
- package/dist/composition/format.js +4 -3
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/parse.d.ts +2 -3
- package/dist/composition/parse.js +27 -28
- package/dist/constants.js +11 -9
- package/dist/controls.d.ts +1 -0
- package/dist/controls.js +0 -1
- package/dist/convex-hull/ConvexHull.svelte +20 -25
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -4
- package/dist/convex-hull/ConvexHull2D.svelte +176 -256
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +269 -804
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +236 -755
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullChrome.svelte +264 -0
- package/dist/convex-hull/ConvexHullChrome.svelte.d.ts +30 -0
- package/dist/convex-hull/ConvexHullControls.svelte +128 -49
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +7 -6
- package/dist/convex-hull/ConvexHullInfoPane.svelte +18 -5
- package/dist/convex-hull/ConvexHullInfoPane.svelte.d.ts +6 -5
- package/dist/convex-hull/ConvexHullStats.svelte +210 -351
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +3 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +16 -14
- package/dist/convex-hull/ConvexHullTooltip.svelte.d.ts +2 -1
- package/dist/convex-hull/GasPressureControls.svelte +5 -12
- package/dist/convex-hull/StructurePopup.svelte +17 -21
- package/dist/convex-hull/StructurePopup.svelte.d.ts +2 -0
- package/dist/convex-hull/TemperatureSlider.svelte +4 -10
- package/dist/convex-hull/barycentric-coords.d.ts +2 -4
- package/dist/convex-hull/barycentric-coords.js +6 -33
- package/dist/convex-hull/canvas-interactions.svelte.d.ts +79 -0
- package/dist/convex-hull/canvas-interactions.svelte.js +279 -0
- package/dist/convex-hull/helpers.d.ts +47 -17
- package/dist/convex-hull/helpers.js +186 -101
- package/dist/convex-hull/hull-state.svelte.d.ts +44 -0
- package/dist/convex-hull/hull-state.svelte.js +124 -0
- package/dist/convex-hull/index.d.ts +9 -7
- package/dist/convex-hull/index.js +7 -2
- package/dist/convex-hull/thermodynamics.js +109 -937
- package/dist/convex-hull/types.d.ts +12 -4
- package/dist/convex-hull/types.js +12 -0
- package/dist/coordination/CoordinationBarPlot.svelte +41 -43
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +1 -1
- package/dist/coordination/calc-coordination.d.ts +1 -1
- package/dist/coordination/calc-coordination.js +28 -25
- package/dist/element/BohrAtom.svelte +6 -8
- package/dist/element/ElementHeading.svelte +4 -1
- package/dist/element/ElementPhoto.svelte +11 -9
- package/dist/element/ElementStats.svelte +12 -10
- package/dist/element/ElementTile.svelte +24 -29
- package/dist/element/ElementTile.svelte.d.ts +1 -1
- package/dist/element/Nucleus.svelte +4 -2
- package/dist/element/data.d.ts +1 -2
- package/dist/element/helpers.d.ts +4 -0
- package/dist/element/helpers.js +18 -0
- package/dist/element/index.d.ts +1 -0
- package/dist/element/index.js +3 -0
- package/dist/feedback/DragOverlay.svelte +5 -3
- package/dist/feedback/DragOverlay.svelte.d.ts +2 -1
- package/dist/feedback/StatusMessage.svelte +20 -7
- package/dist/fermi-surface/FermiSlice.svelte +21 -18
- package/dist/fermi-surface/FermiSurface.svelte +78 -165
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +9 -20
- package/dist/fermi-surface/FermiSurfaceControls.svelte +6 -20
- package/dist/fermi-surface/FermiSurfaceScene.svelte +93 -272
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +3 -23
- package/dist/fermi-surface/FermiSurfaceTooltip.svelte +9 -6
- package/dist/fermi-surface/compute.js +14 -13
- package/dist/fermi-surface/export.js +4 -15
- package/dist/fermi-surface/index.d.ts +0 -1
- package/dist/fermi-surface/index.js +0 -1
- package/dist/fermi-surface/parse.d.ts +1 -1
- package/dist/fermi-surface/parse.js +84 -97
- package/dist/fermi-surface/types.d.ts +2 -2
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +161 -185
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +6 -5
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +12 -9
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +5 -5
- package/dist/heatmap-matrix/index.d.ts +8 -2
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/ExportPane.svelte +170 -0
- package/dist/io/ExportPane.svelte.d.ts +17 -0
- package/dist/io/decompress.d.ts +2 -1
- package/dist/io/decompress.js +22 -36
- package/dist/io/export.d.ts +9 -1
- package/dist/io/export.js +37 -29
- package/dist/io/fetch.d.ts +2 -4
- package/dist/io/fetch.js +0 -11
- package/dist/io/file-drop.d.ts +7 -0
- package/dist/io/file-drop.js +13 -0
- package/dist/io/index.d.ts +1 -0
- package/dist/io/index.js +3 -0
- package/dist/io/is-binary.d.ts +9 -0
- package/dist/io/is-binary.js +45 -1
- package/dist/io/types.d.ts +13 -0
- package/dist/io/url-drop.js +13 -25
- package/dist/isosurface/Isosurface.svelte +17 -23
- package/dist/isosurface/IsosurfaceControls.svelte +37 -42
- package/dist/isosurface/parse-vaspwave.d.ts +3 -0
- package/dist/isosurface/parse-vaspwave.js +138 -0
- package/dist/isosurface/parse.js +50 -48
- package/dist/labels.d.ts +6 -2
- package/dist/labels.js +44 -14
- package/dist/layout/FullscreenButton.svelte +34 -0
- package/dist/layout/FullscreenButton.svelte.d.ts +10 -0
- package/dist/layout/FullscreenToggle.svelte +12 -12
- package/dist/layout/InfoCard.svelte +7 -18
- package/dist/layout/InfoTag.svelte +1 -3
- package/dist/layout/NumberRangeInput.svelte +46 -0
- package/dist/layout/NumberRangeInput.svelte.d.ts +12 -0
- package/dist/layout/PropertyFilter.svelte +2 -6
- package/dist/layout/SettingsSection.svelte +21 -17
- package/dist/layout/SubpageGrid.svelte +3 -1
- package/dist/layout/ViewerChrome.svelte +115 -0
- package/dist/layout/ViewerChrome.svelte.d.ts +18 -0
- package/dist/layout/fullscreen.d.ts +4 -0
- package/dist/layout/fullscreen.js +3 -5
- package/dist/layout/fullscreen.svelte.d.ts +8 -0
- package/dist/layout/fullscreen.svelte.js +36 -0
- package/dist/layout/index.d.ts +4 -0
- package/dist/layout/index.js +4 -0
- package/dist/layout/json-tree/JsonNode.svelte +8 -11
- package/dist/layout/json-tree/JsonTree.svelte +53 -77
- package/dist/layout/json-tree/JsonValue.svelte +7 -15
- package/dist/layout/json-tree/utils.js +14 -23
- package/dist/math.d.ts +9 -3
- package/dist/math.js +37 -21
- package/dist/overlays/ContextMenu.svelte +4 -2
- package/dist/overlays/CopyButton.svelte +11 -5
- package/dist/overlays/DragControlTab.svelte +6 -1
- package/dist/overlays/DraggablePane.svelte +81 -26
- package/dist/overlays/DraggablePane.svelte.d.ts +1 -0
- package/dist/overlays/GlassChip.svelte +30 -0
- package/dist/overlays/GlassChip.svelte.d.ts +8 -0
- package/dist/overlays/InfoPaneCards.svelte +11 -23
- package/dist/overlays/index.d.ts +11 -0
- package/dist/overlays/index.js +26 -0
- package/dist/overlays/portal.d.ts +2 -0
- package/dist/overlays/portal.js +14 -0
- package/dist/periodic-table/PeriodicTable.svelte +115 -146
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +5 -3
- package/dist/periodic-table/PeriodicTableControls.svelte +11 -63
- package/dist/periodic-table/TableInset.svelte +9 -4
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +50 -71
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -8
- package/dist/phase-diagram/PhaseDiagramControls.svelte +73 -96
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +4 -3
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +4 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +2 -3
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +49 -134
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +3 -4
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +54 -58
- package/dist/phase-diagram/TdbInfoPanel.svelte +21 -15
- package/dist/phase-diagram/build-diagram.js +3 -3
- package/dist/phase-diagram/colors.js +1 -1
- package/dist/phase-diagram/diagram-input.d.ts +1 -2
- package/dist/phase-diagram/parse.d.ts +2 -1
- package/dist/phase-diagram/parse.js +15 -15
- package/dist/phase-diagram/svg-to-diagram.js +21 -15
- package/dist/phase-diagram/utils.js +2 -3
- package/dist/plot/bar/BarPlot.svelte +494 -692
- package/dist/plot/bar/BarPlot.svelte.d.ts +9 -15
- package/dist/plot/bar/BarPlotControls.svelte +1 -3
- package/dist/plot/bar/BarPlotControls.svelte.d.ts +5 -7
- package/dist/plot/bar/SpacegroupBarPlot.svelte +31 -37
- package/dist/plot/bar/data.d.ts +5 -4
- package/dist/plot/bar/data.js +2 -1
- package/dist/plot/box/BoxPlot.svelte +361 -439
- package/dist/plot/box/BoxPlot.svelte.d.ts +6 -3
- package/dist/plot/box/BoxPlotControls.svelte.d.ts +1 -1
- package/dist/plot/box/Violin.svelte.d.ts +2 -1
- package/dist/plot/box/box-plot.d.ts +3 -2
- package/dist/plot/box/box-plot.js +6 -3
- package/dist/plot/box/kde.d.ts +2 -1
- package/dist/plot/box/kde.js +4 -4
- package/dist/plot/core/auto-place.d.ts +1 -1
- package/dist/plot/core/auto-place.js +5 -2
- package/dist/plot/core/axis-utils.d.ts +12 -7
- package/dist/plot/core/axis-utils.js +48 -48
- package/dist/plot/core/components/AxisLabel.svelte +82 -20
- package/dist/plot/core/components/AxisLabel.svelte.d.ts +1 -0
- package/dist/plot/core/components/ColorBar.svelte +106 -111
- package/dist/plot/core/components/ColorBar.svelte.d.ts +5 -4
- package/dist/plot/core/components/ColorScaleSelect.svelte +1 -1
- package/dist/plot/core/components/FillArea.svelte +10 -17
- package/dist/plot/core/components/HierarchyControls.svelte +249 -0
- package/dist/plot/{sunburst/SunburstControls.svelte.d.ts → core/components/HierarchyControls.svelte.d.ts} +12 -8
- package/dist/plot/core/components/InteractiveAxisLabel.svelte +1 -1
- package/dist/plot/core/components/InteractiveAxisLabel.svelte.d.ts +1 -1
- package/dist/plot/core/components/Line.svelte +21 -11
- package/dist/plot/core/components/Line.svelte.d.ts +5 -2
- package/dist/plot/core/components/PlotAxis.svelte +42 -18
- package/dist/plot/core/components/PlotAxis.svelte.d.ts +2 -1
- package/dist/plot/core/components/PlotControls.svelte +65 -41
- package/dist/plot/core/components/PlotControls.svelte.d.ts +1 -1
- package/dist/plot/core/components/PlotLegend.svelte +31 -35
- package/dist/plot/core/components/PlotMarginals.svelte +616 -0
- package/dist/plot/core/components/PlotMarginals.svelte.d.ts +15 -0
- package/dist/plot/core/components/PlotTooltip.svelte +1 -1
- package/dist/plot/core/components/PortalSelect.svelte +4 -8
- package/dist/plot/core/components/ReferenceLine.svelte +27 -24
- package/dist/plot/core/components/ReferenceLine3D.svelte +56 -59
- package/dist/plot/core/components/ReferenceLine3D.svelte.d.ts +4 -4
- package/dist/plot/core/components/ReferencePlane.svelte +9 -10
- package/dist/plot/core/components/ReferencePlane.svelte.d.ts +4 -4
- package/dist/plot/core/components/ZeroLines.svelte +4 -8
- package/dist/plot/core/components/ZoomRect.svelte +1 -2
- package/dist/plot/core/components/index.d.ts +1 -0
- package/dist/plot/core/components/index.js +1 -0
- package/dist/plot/core/data-cleaning-signal.d.ts +46 -0
- package/dist/plot/core/data-cleaning-signal.js +467 -0
- package/dist/plot/core/data-cleaning.d.ts +2 -42
- package/dist/plot/core/data-cleaning.js +29 -476
- package/dist/plot/core/data-transform.js +9 -5
- package/dist/plot/core/fill-utils.d.ts +7 -4
- package/dist/plot/core/fill-utils.js +34 -9
- package/dist/plot/core/index.d.ts +1 -0
- package/dist/plot/core/index.js +1 -0
- package/dist/plot/core/interactions.d.ts +5 -1
- package/dist/plot/core/interactions.js +14 -2
- package/dist/plot/core/layout.d.ts +3 -1
- package/dist/plot/core/layout.js +22 -13
- package/dist/plot/core/marginals.d.ts +170 -0
- package/dist/plot/core/marginals.js +436 -0
- package/dist/plot/core/pan-zoom.svelte.d.ts +35 -0
- package/dist/plot/core/pan-zoom.svelte.js +221 -0
- package/dist/plot/core/placed-tween.svelte.d.ts +21 -0
- package/dist/plot/core/placed-tween.svelte.js +68 -0
- package/dist/plot/core/reference-line.d.ts +10 -10
- package/dist/plot/core/reference-line.js +7 -7
- package/dist/plot/core/scales.d.ts +40 -25
- package/dist/plot/core/scales.js +49 -21
- package/dist/plot/core/svg.d.ts +2 -1
- package/dist/plot/core/types/fills.d.ts +101 -0
- package/dist/plot/core/types/fills.js +15 -0
- package/dist/plot/core/types/plot-3d.d.ts +87 -0
- package/dist/plot/core/types/plot-3d.js +4 -0
- package/dist/plot/core/types/reference-lines.d.ts +140 -0
- package/dist/plot/core/types/reference-lines.js +9 -0
- package/dist/plot/core/types.d.ts +47 -331
- package/dist/plot/core/types.js +23 -20
- package/dist/plot/core/utils/hierarchy-chart.d.ts +51 -0
- package/dist/plot/core/utils/hierarchy-chart.js +179 -0
- package/dist/plot/core/utils/hierarchy-labels.d.ts +20 -0
- package/dist/plot/core/utils/hierarchy-labels.js +99 -0
- package/dist/plot/core/utils/label-placement.d.ts +1 -1
- package/dist/plot/core/utils/label-placement.js +5 -5
- package/dist/plot/core/utils.d.ts +2 -1
- package/dist/plot/histogram/Histogram.svelte +373 -631
- package/dist/plot/histogram/Histogram.svelte.d.ts +7 -7
- package/dist/plot/histogram/HistogramControls.svelte +30 -28
- package/dist/plot/histogram/HistogramControls.svelte.d.ts +1 -1
- package/dist/plot/histogram/histogram.d.ts +31 -0
- package/dist/plot/histogram/histogram.js +70 -0
- package/dist/plot/histogram/index.d.ts +1 -0
- package/dist/plot/histogram/index.js +1 -0
- package/dist/plot/index.d.ts +1 -0
- package/dist/plot/index.js +1 -0
- package/dist/plot/sankey/Sankey.svelte +79 -73
- package/dist/plot/sankey/Sankey.svelte.d.ts +3 -3
- package/dist/plot/sankey/SankeyControls.svelte +22 -16
- package/dist/plot/sankey/sankey.js +3 -1
- package/dist/plot/scatter/BinnedScatterPlot.svelte +264 -112
- package/dist/plot/scatter/BinnedScatterPlot.svelte.d.ts +11 -4
- package/dist/plot/scatter/ElementScatter.svelte +4 -1
- package/dist/plot/scatter/ScatterPlot.svelte +623 -821
- package/dist/plot/scatter/ScatterPlot.svelte.d.ts +9 -15
- package/dist/plot/scatter/ScatterPlotControls.svelte +18 -19
- package/dist/plot/scatter/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/scatter/ScatterPoint.svelte +16 -9
- package/dist/plot/scatter/binned-scatter-types.d.ts +6 -12
- package/dist/plot/scatter/binned-scatter-types.js +6 -1
- package/dist/plot/scatter/index.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.d.ts +1 -1
- package/dist/plot/scatter/scatter-data.js +8 -7
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte +40 -60
- package/dist/plot/scatter-3d/ScatterPlot3D.svelte.d.ts +6 -14
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte +17 -15
- package/dist/plot/scatter-3d/ScatterPlot3DControls.svelte.d.ts +5 -5
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte +232 -234
- package/dist/plot/scatter-3d/ScatterPlot3DScene.svelte.d.ts +5 -14
- package/dist/plot/scatter-3d/Surface3D.svelte +9 -17
- package/dist/plot/scatter-3d/Surface3D.svelte.d.ts +4 -3
- package/dist/plot/sunburst/Sunburst.svelte +256 -338
- package/dist/plot/sunburst/Sunburst.svelte.d.ts +4 -3
- package/dist/plot/sunburst/index.d.ts +1 -1
- package/dist/plot/sunburst/index.js +2 -1
- package/dist/plot/sunburst/render.d.ts +2 -2
- package/dist/plot/sunburst/render.js +47 -22
- package/dist/plot/sunburst/sunburst.d.ts +5 -1
- package/dist/plot/sunburst/sunburst.js +14 -4
- package/dist/plot/treemap/Treemap.svelte +907 -0
- package/dist/plot/treemap/Treemap.svelte.d.ts +84 -0
- package/dist/plot/treemap/index.d.ts +3 -0
- package/dist/plot/treemap/index.js +4 -0
- package/dist/plot/treemap/treemap.d.ts +26 -0
- package/dist/plot/treemap/treemap.js +99 -0
- package/dist/rdf/RdfPlot.svelte +22 -26
- package/dist/rdf/RdfPlot.svelte.d.ts +1 -1
- package/dist/rdf/calc-rdf.js +4 -8
- package/dist/sanitize.js +14 -3
- package/dist/scene/SceneCamera.svelte +62 -0
- package/dist/scene/SceneCamera.svelte.d.ts +19 -0
- package/dist/scene/bind-renderer.svelte.d.ts +2 -0
- package/dist/scene/bind-renderer.svelte.js +22 -0
- package/dist/scene/index.d.ts +4 -0
- package/dist/scene/index.js +5 -0
- package/dist/scene/props.js +52 -0
- package/dist/scene/types.d.ts +26 -0
- package/dist/scene/types.js +1 -0
- package/dist/settings.d.ts +33 -11
- package/dist/settings.js +136 -51
- package/dist/spectral/Bands.svelte +231 -237
- package/dist/spectral/Bands.svelte.d.ts +3 -2
- package/dist/spectral/BandsAndDos.svelte +29 -29
- package/dist/spectral/BrillouinBandsDos.svelte +21 -29
- package/dist/spectral/Dos.svelte +75 -77
- package/dist/spectral/Dos.svelte.d.ts +2 -1
- package/dist/spectral/helpers.d.ts +9 -9
- package/dist/spectral/helpers.js +66 -70
- package/dist/state.svelte.d.ts +0 -7
- package/dist/state.svelte.js +5 -24
- package/dist/structure/Arrow.svelte +6 -21
- package/dist/structure/ArrowInstances.svelte +160 -0
- package/dist/structure/ArrowInstances.svelte.d.ts +16 -0
- package/dist/structure/AtomLegend.svelte +115 -75
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/Bond.svelte +31 -23
- package/dist/structure/CanvasTooltip.svelte +16 -3
- package/dist/structure/CellSelect.svelte +22 -29
- package/dist/structure/CellSelect.svelte.d.ts +2 -1
- package/dist/structure/Cylinder.svelte +24 -40
- package/dist/structure/InstancedAtoms.svelte +114 -0
- package/dist/structure/InstancedAtoms.svelte.d.ts +15 -0
- package/dist/structure/Lattice.svelte +85 -149
- package/dist/structure/SiteLabels.svelte +122 -0
- package/dist/structure/SiteLabels.svelte.d.ts +18 -0
- package/dist/structure/Structure.svelte +725 -735
- package/dist/structure/Structure.svelte.d.ts +8 -16
- package/dist/structure/StructureCarousel.svelte +630 -0
- package/dist/structure/StructureCarousel.svelte.d.ts +19 -0
- package/dist/structure/StructureControls.svelte +298 -325
- package/dist/structure/StructureControls.svelte.d.ts +5 -3
- package/dist/structure/StructureExportPane.svelte +62 -168
- package/dist/structure/StructureExportPane.svelte.d.ts +4 -5
- package/dist/structure/StructureInfoPane.svelte +77 -69
- package/dist/structure/StructureInfoPane.svelte.d.ts +6 -6
- package/dist/structure/StructureScene.svelte +758 -600
- package/dist/structure/StructureScene.svelte.d.ts +24 -20
- package/dist/structure/StructureViewport.svelte +386 -0
- package/dist/structure/StructureViewport.svelte.d.ts +63 -0
- package/dist/structure/atom-label-placement.d.ts +18 -0
- package/dist/structure/atom-label-placement.js +115 -0
- package/dist/structure/atom-properties.d.ts +3 -1
- package/dist/structure/atom-properties.js +115 -54
- package/dist/structure/bond-order-perception.js +2 -4
- package/dist/structure/bonding.d.ts +12 -2
- package/dist/structure/bonding.js +172 -73
- package/dist/structure/edit-history.d.ts +6 -0
- package/dist/structure/edit-history.js +27 -0
- package/dist/structure/export.d.ts +25 -4
- package/dist/structure/export.js +103 -153
- package/dist/structure/format-detect.d.ts +1 -0
- package/dist/structure/format-detect.js +22 -0
- package/dist/structure/geometry.d.ts +9 -0
- package/dist/structure/geometry.js +27 -0
- package/dist/structure/index.d.ts +18 -1
- package/dist/structure/index.js +15 -2
- package/dist/structure/measure.d.ts +1 -1
- package/dist/structure/measure.js +6 -12
- package/dist/structure/parse.d.ts +5 -3
- package/dist/structure/parse.js +551 -567
- package/dist/structure/partial-occupancy.d.ts +0 -1
- package/dist/structure/partial-occupancy.js +5 -3
- package/dist/structure/pbc.d.ts +1 -1
- package/dist/structure/pbc.js +204 -51
- package/dist/structure/polyhedra.d.ts +40 -0
- package/dist/structure/polyhedra.js +587 -0
- package/dist/structure/site.d.ts +4 -0
- package/dist/structure/site.js +1 -0
- package/dist/structure/supercell.d.ts +1 -2
- package/dist/structure/supercell.js +10 -15
- package/dist/structure/validation.js +5 -6
- package/dist/symmetry/SymmetryElementControls.svelte +69 -0
- package/dist/symmetry/SymmetryElementControls.svelte.d.ts +9 -0
- package/dist/symmetry/SymmetryElements.svelte +350 -0
- package/dist/symmetry/SymmetryElements.svelte.d.ts +24 -0
- package/dist/symmetry/SymmetryStats.svelte +142 -49
- package/dist/symmetry/WyckoffTable.svelte +58 -16
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -0
- package/dist/symmetry/cell-transform.js +8 -14
- package/dist/symmetry/index.d.ts +15 -4
- package/dist/symmetry/index.js +308 -81
- package/dist/symmetry/spacegroups.d.ts +5 -1
- package/dist/symmetry/spacegroups.js +18 -3
- package/dist/symmetry/symmetry-elements.d.ts +33 -0
- package/dist/symmetry/symmetry-elements.js +521 -0
- package/dist/symmetry/wyckoff-db.d.ts +9 -0
- package/dist/symmetry/wyckoff-db.js +87 -0
- package/dist/table/HeatmapTable.svelte +1104 -378
- package/dist/table/HeatmapTable.svelte.d.ts +12 -2
- package/dist/table/ToggleMenu.svelte +5 -12
- package/dist/table/index.d.ts +21 -6
- package/dist/table/index.js +34 -21
- package/dist/theme/ThemeControl.svelte +16 -8
- package/dist/theme/index.d.ts +1 -5
- package/dist/theme/index.js +4 -10
- package/dist/theme/themes.mjs +14 -7
- package/dist/tooltip/KCoords.svelte +4 -1
- package/dist/tooltip/TooltipContent.svelte +2 -5
- package/dist/trajectory/Trajectory.svelte +556 -352
- package/dist/trajectory/Trajectory.svelte.d.ts +10 -22
- package/dist/trajectory/TrajectoryError.svelte +11 -8
- package/dist/trajectory/TrajectoryExportPane.svelte +28 -54
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +4 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +88 -99
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -2
- package/dist/trajectory/constants.js +6 -2
- package/dist/trajectory/extract.js +73 -71
- package/dist/trajectory/format-detect.d.ts +0 -1
- package/dist/trajectory/format-detect.js +13 -17
- package/dist/trajectory/frame-reader.d.ts +2 -1
- package/dist/trajectory/frame-reader.js +74 -136
- package/dist/trajectory/helpers.d.ts +12 -2
- package/dist/trajectory/helpers.js +68 -37
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +3 -0
- package/dist/trajectory/parse/ase.d.ts +9 -1
- package/dist/trajectory/parse/ase.js +47 -32
- package/dist/trajectory/parse/diagnostics.d.ts +3 -0
- package/dist/trajectory/parse/diagnostics.js +14 -0
- package/dist/trajectory/parse/h5-utils.d.ts +13 -0
- package/dist/trajectory/parse/h5-utils.js +109 -0
- package/dist/trajectory/parse/hdf5.d.ts +1 -1
- package/dist/trajectory/parse/hdf5.js +116 -106
- package/dist/trajectory/parse/index.d.ts +3 -4
- package/dist/trajectory/parse/index.js +68 -119
- package/dist/trajectory/parse/lammps.d.ts +0 -2
- package/dist/trajectory/parse/lammps.js +14 -16
- package/dist/trajectory/parse/pymatgen.d.ts +2 -0
- package/dist/trajectory/parse/pymatgen.js +74 -0
- package/dist/trajectory/parse/vasp.js +13 -9
- package/dist/trajectory/parse/vaspout-electronic.d.ts +13 -0
- package/dist/trajectory/parse/vaspout-electronic.js +207 -0
- package/dist/trajectory/parse/vaspout-h5.d.ts +5 -0
- package/dist/trajectory/parse/vaspout-h5.js +284 -0
- package/dist/trajectory/parse/xyz.d.ts +9 -21
- package/dist/trajectory/parse/xyz.js +38 -39
- package/dist/trajectory/plotting.d.ts +8 -10
- package/dist/trajectory/plotting.js +102 -127
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +8 -1
- package/dist/xrd/XrdPlot.svelte +56 -85
- package/dist/xrd/broadening.d.ts +2 -1
- package/dist/xrd/broadening.js +2 -1
- package/dist/xrd/calc-xrd.js +8 -15
- package/dist/xrd/index.d.ts +2 -2
- package/dist/xrd/parse.d.ts +0 -1
- package/dist/xrd/parse.js +56 -73
- package/package.json +77 -36
- package/dist/api/mp.d.ts +0 -6
- package/dist/api/mp.js +0 -22
- package/dist/element/data.json +0 -11864
- package/dist/fermi-surface/marching-cubes.d.ts +0 -2
- package/dist/fermi-surface/marching-cubes.js +0 -2
- package/dist/plot/core/hover-lock.svelte.d.ts +0 -14
- package/dist/plot/core/hover-lock.svelte.js +0 -45
- package/dist/plot/sunburst/SunburstControls.svelte +0 -200
- package/dist/structure/label-placement.d.ts +0 -14
- package/dist/structure/label-placement.js +0 -72
package/dist/structure/export.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { get_electro_neg_formula } from '../composition';
|
|
2
2
|
import { download } from '../io/fetch';
|
|
3
3
|
import * as math from '../math';
|
|
4
|
+
import { is_plain_object } from '../utils';
|
|
4
5
|
import { Color, Group, Matrix4, Mesh, MeshStandardMaterial, ShaderMaterial } from 'three';
|
|
5
6
|
import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js';
|
|
6
7
|
import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter.js';
|
|
7
|
-
//
|
|
8
|
-
//
|
|
8
|
+
// @internal exported only for tests - not part of the public API.
|
|
9
|
+
// Type guard to check if a material has a color property (duck typing for bundler
|
|
10
|
+
// compatibility across different Three.js instances - Threlte vs vanilla Three.js).
|
|
9
11
|
export function has_color_property(mat) {
|
|
10
12
|
if (!(`color` in mat))
|
|
11
13
|
return false;
|
|
@@ -47,8 +49,9 @@ function convert_shader_to_standard(shader_mat) {
|
|
|
47
49
|
standard_mat.name = shader_mat.name || `converted_shader_material`;
|
|
48
50
|
return standard_mat;
|
|
49
51
|
}
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
+
// @internal exported only for tests - not part of the public API.
|
|
53
|
+
// Extract bond gradient colors from geometry attributes for a specific instance.
|
|
54
|
+
// Returns midpoint color between start and end colors for the bond.
|
|
52
55
|
export function extract_bond_color_for_instance(geometry, instance_idx) {
|
|
53
56
|
const color_start_attr = geometry.getAttribute(`instanceColorStart`);
|
|
54
57
|
const color_end_attr = geometry.getAttribute(`instanceColorEnd`);
|
|
@@ -70,8 +73,10 @@ export function extract_bond_color_for_instance(geometry, instance_idx) {
|
|
|
70
73
|
const [mid_r, mid_g, mid_b] = math.scale(math.add(start_rgb, end_rgb), 0.5);
|
|
71
74
|
return new Color(mid_r, mid_g, mid_b);
|
|
72
75
|
}
|
|
73
|
-
//
|
|
74
|
-
//
|
|
76
|
+
// @internal exported only for tests - not part of the public API.
|
|
77
|
+
// Remove custom/non-standard attributes from geometry that cause export issues.
|
|
78
|
+
// Standard GLTF attributes: position, normal, tangent, texcoord_N, color_N, joints_N,
|
|
79
|
+
// weights_N.
|
|
75
80
|
export function clean_geometry_for_export(geometry) {
|
|
76
81
|
const standard_attrs = new Set([
|
|
77
82
|
`position`,
|
|
@@ -98,7 +103,8 @@ export function clean_geometry_for_export(geometry) {
|
|
|
98
103
|
geometry.deleteAttribute(attr_name);
|
|
99
104
|
}
|
|
100
105
|
}
|
|
101
|
-
//
|
|
106
|
+
// @internal exported only for tests - not part of the public API.
|
|
107
|
+
// Generate MTL (Wavefront Material) content from scene materials.
|
|
102
108
|
export function generate_mtl_content(scene) {
|
|
103
109
|
const lines = [`# MTL file generated by MatterViz`, ``];
|
|
104
110
|
const processed_materials = new Set();
|
|
@@ -117,9 +123,10 @@ export function generate_mtl_content(scene) {
|
|
|
117
123
|
// Get diffuse color (main color)
|
|
118
124
|
if (has_color_property(mat)) {
|
|
119
125
|
const color = mat.color;
|
|
120
|
-
|
|
126
|
+
const fmt = (val) => val.toFixed(6);
|
|
127
|
+
lines.push(`Kd ${fmt(color.r)} ${fmt(color.g)} ${fmt(color.b)}`);
|
|
121
128
|
// Ambient is typically a fraction of diffuse
|
|
122
|
-
lines.push(`Ka ${(color.r * 0.2)
|
|
129
|
+
lines.push(`Ka ${fmt(color.r * 0.2)} ${fmt(color.g * 0.2)} ${fmt(color.b * 0.2)}`);
|
|
123
130
|
}
|
|
124
131
|
else {
|
|
125
132
|
// Default white if no color
|
|
@@ -151,7 +158,28 @@ function extract_material_color(mat) {
|
|
|
151
158
|
// Note: Threlte's InstancedMesh sets isInstancedMesh=true but type remains "Mesh"
|
|
152
159
|
// Type guard for InstancedMesh (Three.js uses isInstancedMesh property, not exposed in Object3D type)
|
|
153
160
|
const is_instanced_mesh = (obj) => obj.isInstancedMesh || obj.type === `InstancedMesh`;
|
|
154
|
-
|
|
161
|
+
// Resolve the export color for one instance of an InstancedMesh. Precedence:
|
|
162
|
+
// gradient bond midpoints (shader bonds), then per-instance colors on meshes
|
|
163
|
+
// flagged userData.per_instance_color (atoms/arrows keep a white base material
|
|
164
|
+
// and store real colors in the instanceColor buffer), then the shared material
|
|
165
|
+
// color (legacy threlte-instanced meshes carry an all-white instanceColor that
|
|
166
|
+
// must NOT win), then instanceColor as a last resort. null = keep default.
|
|
167
|
+
function resolve_instance_material_color(instanced_mesh, instance_idx, bond_colors, stored_color) {
|
|
168
|
+
const bond_color = bond_colors?.get(instance_idx);
|
|
169
|
+
if (bond_color)
|
|
170
|
+
return bond_color;
|
|
171
|
+
const { instanceColor } = instanced_mesh;
|
|
172
|
+
const per_instance = instanceColor
|
|
173
|
+
? new Color(instanceColor.getX(instance_idx), instanceColor.getY(instance_idx), instanceColor.getZ(instance_idx))
|
|
174
|
+
: null;
|
|
175
|
+
if (instanced_mesh.userData.per_instance_color && per_instance)
|
|
176
|
+
return per_instance;
|
|
177
|
+
if (stored_color)
|
|
178
|
+
return new Color(stored_color.r, stored_color.g, stored_color.b);
|
|
179
|
+
return per_instance;
|
|
180
|
+
}
|
|
181
|
+
// @internal exported only for tests - not part of the public API.
|
|
182
|
+
export function convert_instanced_meshes_to_regular(scene) {
|
|
155
183
|
// STEP 1: Collect material colors from ORIGINAL scene BEFORE cloning
|
|
156
184
|
// This is crucial because scene.clone() may not properly preserve Threlte's material colors
|
|
157
185
|
const material_colors = new Map();
|
|
@@ -238,24 +266,10 @@ function convert_instanced_meshes_to_regular(scene) {
|
|
|
238
266
|
roughness: 0.5,
|
|
239
267
|
});
|
|
240
268
|
new_material.name = `material_${mesh_idx}_${idx}`;
|
|
241
|
-
// Apply the correct color
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
new_material.color.copy(bond_color);
|
|
246
|
-
}
|
|
247
|
-
else if (stored_color) {
|
|
248
|
-
// Atom with shared material color
|
|
249
|
-
new_material.color.setRGB(stored_color.r, stored_color.g, stored_color.b);
|
|
250
|
-
}
|
|
251
|
-
else if (instanced_mesh.instanceColor) {
|
|
252
|
-
// Fallback: per-instance colors from instanceColor attribute
|
|
253
|
-
const color_r = instanced_mesh.instanceColor.getX(idx);
|
|
254
|
-
const color_g = instanced_mesh.instanceColor.getY(idx);
|
|
255
|
-
const color_b = instanced_mesh.instanceColor.getZ(idx);
|
|
256
|
-
new_material.color.setRGB(color_r, color_g, color_b);
|
|
257
|
-
}
|
|
258
|
-
// If no color found, material stays default white
|
|
269
|
+
// Apply the correct color (null = no color found, material stays default white)
|
|
270
|
+
const resolved_color = resolve_instance_material_color(instanced_mesh, idx, stored_bond_colors, stored_color);
|
|
271
|
+
if (resolved_color)
|
|
272
|
+
new_material.color.copy(resolved_color);
|
|
259
273
|
const mesh = new Mesh(cloned_geometry, new_material);
|
|
260
274
|
// Combine base transform with instance transform
|
|
261
275
|
const combined_matrix = new Matrix4();
|
|
@@ -341,6 +355,17 @@ export function create_structure_filename(structure, extension) {
|
|
|
341
355
|
const base_name = parts.length > 0 ? parts.join(`-`) : `structure`;
|
|
342
356
|
return `${base_name}.${extension}`;
|
|
343
357
|
}
|
|
358
|
+
// First species' element of a site, or `X` when the site has no species
|
|
359
|
+
const site_element = (site) => site.species?.[0]?.element || `X`;
|
|
360
|
+
// Fractional coordinates from abc, falling back to converting xyz; throws when neither
|
|
361
|
+
// is available. idx (when given) is included in the error message.
|
|
362
|
+
function get_frac_coords(site, cart_to_frac, idx) {
|
|
363
|
+
if (Array.isArray(site.abc) && site.abc.length >= 3)
|
|
364
|
+
return site.abc.slice(0, 3);
|
|
365
|
+
if (site.xyz?.length >= 3 && cart_to_frac)
|
|
366
|
+
return cart_to_frac(site.xyz.slice(0, 3));
|
|
367
|
+
throw new Error(`No valid coordinates found for site${idx === undefined ? `` : ` ${idx}`}`);
|
|
368
|
+
}
|
|
344
369
|
// Generate XYZ content string without saving
|
|
345
370
|
export function structure_to_xyz_str(structure) {
|
|
346
371
|
if (!structure?.sites)
|
|
@@ -355,30 +380,23 @@ export function structure_to_xyz_str(structure) {
|
|
|
355
380
|
const formula = get_electro_neg_formula(structure, true);
|
|
356
381
|
if (formula && formula !== `Unknown`)
|
|
357
382
|
comment_parts.push(formula);
|
|
383
|
+
const lattice_matrix = `lattice` in structure && structure.lattice?.matrix?.length === 3
|
|
384
|
+
? structure.lattice.matrix
|
|
385
|
+
: null;
|
|
358
386
|
// Include extended XYZ lattice information when available so round-trips preserve lattice
|
|
359
|
-
if (
|
|
360
|
-
const lattice_values =
|
|
361
|
-
.
|
|
362
|
-
.map((value) => (Number.isFinite(value) ? value : 0).toFixed(8))
|
|
387
|
+
if (lattice_matrix) {
|
|
388
|
+
const lattice_values = lattice_matrix
|
|
389
|
+
.flatMap((row) => row.map((value) => (Number.isFinite(value) ? value : 0).toFixed(8)))
|
|
363
390
|
.join(` `);
|
|
364
391
|
comment_parts.push(`Lattice="${lattice_values}"`);
|
|
365
392
|
}
|
|
366
393
|
const comment = comment_parts.length > 0 ? comment_parts.join(` `) : `Generated from structure`;
|
|
367
394
|
lines.push(comment);
|
|
368
395
|
// Cache converter for fractional→Cartesian (if lattice available)
|
|
369
|
-
const frac_to_cart =
|
|
370
|
-
? math.create_frac_to_cart(structure.lattice.matrix)
|
|
371
|
-
: null;
|
|
396
|
+
const frac_to_cart = lattice_matrix ? math.create_frac_to_cart(lattice_matrix) : null;
|
|
372
397
|
// Atom lines: element symbol followed by x, y, z coordinates
|
|
373
398
|
for (const site of structure.sites) {
|
|
374
|
-
|
|
375
|
-
let element_symbol = `X`; // default fallback
|
|
376
|
-
if (site.species && Array.isArray(site.species) && site.species.length > 0) {
|
|
377
|
-
// species is an array of Species objects with element property
|
|
378
|
-
const first_species = site.species[0];
|
|
379
|
-
if (first_species && `element` in first_species && first_species.element)
|
|
380
|
-
element_symbol = first_species.element;
|
|
381
|
-
}
|
|
399
|
+
const element_symbol = site_element(site);
|
|
382
400
|
// Get coordinates - prefer xyz; fallback to abc (converted to cartesian if lattice available)
|
|
383
401
|
let coords;
|
|
384
402
|
if (site.xyz && Array.isArray(site.xyz) && site.xyz.length >= 3) {
|
|
@@ -464,11 +482,8 @@ export function structure_to_cif_str(structure) {
|
|
|
464
482
|
lines.push(`_cell_angle_gamma ${lattice.gamma.toFixed(6)}`);
|
|
465
483
|
}
|
|
466
484
|
// Space group information
|
|
467
|
-
if (`symmetry` in structure &&
|
|
468
|
-
structure.symmetry
|
|
469
|
-
typeof structure.symmetry === `object`) {
|
|
470
|
-
const symmetry = structure.symmetry;
|
|
471
|
-
const { space_group_number, space_group_symbol } = symmetry;
|
|
485
|
+
if (`symmetry` in structure && is_plain_object(structure.symmetry)) {
|
|
486
|
+
const { space_group_number, space_group_symbol } = structure.symmetry;
|
|
472
487
|
if (typeof space_group_symbol === `string` && space_group_symbol) {
|
|
473
488
|
// Quote H-M symbols: their spaces (e.g. 'F m -3 m') would break CIF tokenization
|
|
474
489
|
lines.push(`_space_group_name_H-M_alt '${space_group_symbol}'`);
|
|
@@ -498,16 +513,7 @@ export function structure_to_cif_str(structure) {
|
|
|
498
513
|
const site = structure.sites[idx];
|
|
499
514
|
if (!site)
|
|
500
515
|
continue; // Skip if site is undefined
|
|
501
|
-
|
|
502
|
-
let frac_coords;
|
|
503
|
-
if (Array.isArray(site.abc) && site.abc.length >= 3) {
|
|
504
|
-
frac_coords = site.abc.slice(0, 3);
|
|
505
|
-
}
|
|
506
|
-
else if (site.xyz?.length >= 3 && cart_to_frac) {
|
|
507
|
-
frac_coords = cart_to_frac(site.xyz);
|
|
508
|
-
}
|
|
509
|
-
else
|
|
510
|
-
throw new Error(`No valid coordinates found for site ${idx}`);
|
|
516
|
+
const frac_coords = get_frac_coords(site, cart_to_frac, idx);
|
|
511
517
|
const coords_str = frac_coords.map((coord) => coord.toFixed(8)).join(` `);
|
|
512
518
|
const species_list = site.species?.length ? site.species : [{ element: `X`, occu: 1 }];
|
|
513
519
|
for (const [spec_idx, species] of species_list.entries()) {
|
|
@@ -539,36 +545,28 @@ export function structure_to_poscar_str(structure) {
|
|
|
539
545
|
lines.push(`1.0`); // Scale factor (1.0 for direct coordinates)
|
|
540
546
|
const lattice = structure.lattice;
|
|
541
547
|
if (lattice.matrix && Array.isArray(lattice.matrix) && lattice.matrix.length >= 3) {
|
|
542
|
-
//
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
lines.push(`${matrix[2][0].toFixed(8)} ${matrix[2][1].toFixed(8)} ${matrix[2][2].toFixed(8)}`);
|
|
548
|
+
// One line per lattice vector, exactly 3 components at 8-decimal fixed precision
|
|
549
|
+
for (const vec of lattice.matrix.slice(0, 3)) {
|
|
550
|
+
lines.push([vec[0], vec[1], vec[2]].map((coord) => coord.toFixed(8)).join(` `));
|
|
551
|
+
}
|
|
547
552
|
}
|
|
548
553
|
else {
|
|
549
554
|
throw new Error(`No valid lattice matrix for POSCAR export`);
|
|
550
555
|
}
|
|
551
|
-
//
|
|
552
|
-
const
|
|
553
|
-
const element_symbols = [];
|
|
556
|
+
// Group sites by element in one pass, preserving first-appearance element order
|
|
557
|
+
const sites_by_element = new Map();
|
|
554
558
|
for (const site of structure.sites) {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
-
if (!element_counts.has(element_symbol)) {
|
|
563
|
-
element_counts.set(element_symbol, 0);
|
|
564
|
-
element_symbols.push(element_symbol);
|
|
565
|
-
}
|
|
566
|
-
element_counts.set(element_symbol, Number(element_counts.get(element_symbol)) + 1);
|
|
559
|
+
const element_symbol = site_element(site);
|
|
560
|
+
const group = sites_by_element.get(element_symbol);
|
|
561
|
+
if (group)
|
|
562
|
+
group.push(site);
|
|
563
|
+
else
|
|
564
|
+
sites_by_element.set(element_symbol, [site]);
|
|
567
565
|
}
|
|
568
566
|
// Element symbols line
|
|
569
|
-
lines.push(
|
|
567
|
+
lines.push([...sites_by_element.keys()].join(` `));
|
|
570
568
|
// Atom counts line
|
|
571
|
-
lines.push(
|
|
569
|
+
lines.push([...sites_by_element.values()].map((group) => group.length).join(` `));
|
|
572
570
|
// Check if any site has selective dynamics
|
|
573
571
|
const has_selective_dynamics = structure.sites.some((site) => site.properties?.selective_dynamics);
|
|
574
572
|
if (has_selective_dynamics) {
|
|
@@ -579,38 +577,19 @@ export function structure_to_poscar_str(structure) {
|
|
|
579
577
|
// Cache inverse transpose for Cartesian→fractional conversion (avoids recomputing per site)
|
|
580
578
|
const cart_to_frac = lattice.matrix?.length === 3 ? math.create_cart_to_frac(lattice.matrix) : null;
|
|
581
579
|
// Atom coordinates grouped by element
|
|
582
|
-
for (const
|
|
583
|
-
for (const site of
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
let frac_coords;
|
|
594
|
-
if (site.abc && Array.isArray(site.abc) && site.abc.length >= 3) {
|
|
595
|
-
frac_coords = site.abc.slice(0, 3);
|
|
596
|
-
}
|
|
597
|
-
else if (site.xyz?.length >= 3 && cart_to_frac) {
|
|
598
|
-
frac_coords = cart_to_frac(site.xyz.slice(0, 3));
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
throw new Error(`No valid coordinates found for site`);
|
|
602
|
-
}
|
|
603
|
-
let selective_dynamics_str = ``;
|
|
604
|
-
if (has_selective_dynamics) {
|
|
605
|
-
const sel_dyn = (site.properties?.selective_dynamics ?? [
|
|
606
|
-
true,
|
|
607
|
-
true,
|
|
608
|
-
true,
|
|
609
|
-
]);
|
|
610
|
-
selective_dynamics_str = ` ${sel_dyn[0] ? `T` : `F`} ${sel_dyn[1] ? `T` : `F`} ${sel_dyn[2] ? `T` : `F`}`;
|
|
611
|
-
}
|
|
612
|
-
lines.push(`${frac_coords[0].toFixed(8)} ${frac_coords[1].toFixed(8)} ${frac_coords[2].toFixed(8)}${selective_dynamics_str}`);
|
|
580
|
+
for (const group of sites_by_element.values()) {
|
|
581
|
+
for (const site of group) {
|
|
582
|
+
const frac_coords = get_frac_coords(site, cart_to_frac);
|
|
583
|
+
let selective_dynamics_str = ``;
|
|
584
|
+
if (has_selective_dynamics) {
|
|
585
|
+
const sel_dyn = (site.properties?.selective_dynamics ?? [
|
|
586
|
+
true,
|
|
587
|
+
true,
|
|
588
|
+
true,
|
|
589
|
+
]);
|
|
590
|
+
selective_dynamics_str = ` ${sel_dyn[0] ? `T` : `F`} ${sel_dyn[1] ? `T` : `F`} ${sel_dyn[2] ? `T` : `F`}`;
|
|
613
591
|
}
|
|
592
|
+
lines.push(`${frac_coords[0].toFixed(8)} ${frac_coords[1].toFixed(8)} ${frac_coords[2].toFixed(8)}${selective_dynamics_str}`);
|
|
614
593
|
}
|
|
615
594
|
}
|
|
616
595
|
return lines.join(`\n`);
|
|
@@ -621,51 +600,22 @@ export function structure_to_json_str(structure) {
|
|
|
621
600
|
throw new Error(`No structure to export`);
|
|
622
601
|
return JSON.stringify(structure, null, 2);
|
|
623
602
|
}
|
|
624
|
-
//
|
|
625
|
-
export
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
// Export structure as VASP POSCAR format
|
|
636
|
-
export function export_structure_as_poscar(structure) {
|
|
637
|
-
try {
|
|
638
|
-
const content = structure_to_poscar_str(structure);
|
|
639
|
-
const filename = create_structure_filename(structure, `poscar`);
|
|
640
|
-
download(content, filename, `text/plain`);
|
|
641
|
-
}
|
|
642
|
-
catch (error) {
|
|
643
|
-
console.error(`Failed to export POSCAR:`, error);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
// Export structure as XYZ format. Format specification:
|
|
647
|
-
// - Line 1: Number of atoms
|
|
648
|
-
// - Line 2: Comment line (structure ID, formula, etc.)
|
|
649
|
-
// - Remaining lines: Element symbol followed by x, y, z coordinates (in Angstrom)
|
|
650
|
-
export function export_structure_as_xyz(structure) {
|
|
651
|
-
try {
|
|
652
|
-
const xyz_content = structure_to_xyz_str(structure);
|
|
653
|
-
const filename = create_structure_filename(structure, `xyz`);
|
|
654
|
-
download(xyz_content, filename, `text/plain`);
|
|
655
|
-
}
|
|
656
|
-
catch (error) {
|
|
657
|
-
console.error(`Error exporting XYZ:`, error);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
// Export structure in pymatgen JSON format
|
|
661
|
-
export function export_structure_as_json(structure) {
|
|
603
|
+
// Text export formats: serializer + file extension + MIME type per format
|
|
604
|
+
export const STRUCT_TEXT_FORMATS = {
|
|
605
|
+
json: { to_str: structure_to_json_str, ext: `json`, mime: `application/json` },
|
|
606
|
+
xyz: { to_str: structure_to_xyz_str, ext: `xyz`, mime: `text/plain` },
|
|
607
|
+
cif: { to_str: structure_to_cif_str, ext: `cif`, mime: `chemical/x-cif` },
|
|
608
|
+
poscar: { to_str: structure_to_poscar_str, ext: `poscar`, mime: `text/plain` },
|
|
609
|
+
};
|
|
610
|
+
// Serialize structure in the given text format and trigger a browser download
|
|
611
|
+
export function export_structure_as(fmt, structure) {
|
|
612
|
+
const { to_str, ext, mime } = STRUCT_TEXT_FORMATS[fmt];
|
|
662
613
|
try {
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
download(data, filename, `application/json`);
|
|
614
|
+
const content = to_str(structure);
|
|
615
|
+
download(content, create_structure_filename(structure, ext), mime);
|
|
666
616
|
}
|
|
667
617
|
catch (error) {
|
|
668
|
-
console.error(`
|
|
618
|
+
console.error(`Failed to export ${fmt.toUpperCase()}:`, error);
|
|
669
619
|
}
|
|
670
620
|
}
|
|
671
621
|
// Export Three.js scene as GLB (binary GLTF) file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function is_structure_file(filename: string): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CONFIG_DIRS_REGEX, STRUCT_KEYWORDS_REGEX, STRUCT_KEYWORDS_STRICT_REGEX, STRUCTURE_EXTENSIONS_REGEX, TRAJ_KEYWORDS_REGEX, VASP_FILES_REGEX, } from '../constants';
|
|
2
|
+
import { strip_compression_extensions } from '../io/decompress';
|
|
3
|
+
// Filename-only detection lives apart from the parsers so lightweight callers
|
|
4
|
+
// (desktop recents, file pickers) do not load YAML, structure math, and element
|
|
5
|
+
// data just to choose an icon.
|
|
6
|
+
export function is_structure_file(filename) {
|
|
7
|
+
const name = strip_compression_extensions(filename);
|
|
8
|
+
if (/\.(?:traj|xtc|h5|hdf5)$/i.test(name) || /xdatcar/i.test(name))
|
|
9
|
+
return false;
|
|
10
|
+
if (STRUCTURE_EXTENSIONS_REGEX.test(name) || VASP_FILES_REGEX.test(name))
|
|
11
|
+
return true;
|
|
12
|
+
if (/\.(?:xyz|extxyz)$/i.test(name))
|
|
13
|
+
return !TRAJ_KEYWORDS_REGEX.test(name);
|
|
14
|
+
if (/\.(?:yaml|yml|xml)$/i.test(name) && STRUCT_KEYWORDS_REGEX.test(name))
|
|
15
|
+
return true;
|
|
16
|
+
if (/\.json$/i.test(name) &&
|
|
17
|
+
STRUCT_KEYWORDS_STRICT_REGEX.test(name) &&
|
|
18
|
+
!TRAJ_KEYWORDS_REGEX.test(name) &&
|
|
19
|
+
!CONFIG_DIRS_REGEX.test(name))
|
|
20
|
+
return true;
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Vec3 } from '../math';
|
|
2
|
+
import { Quaternion } from 'three';
|
|
3
|
+
export declare function quaternion_from_direction(direction: Vec3): Quaternion;
|
|
4
|
+
export declare function rotation_from_direction(direction: Vec3): Vec3;
|
|
5
|
+
export declare function cylinder_between(start: Vec3, end: Vec3): {
|
|
6
|
+
position: Vec3;
|
|
7
|
+
rotation: Vec3;
|
|
8
|
+
length: number;
|
|
9
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Three.js orientation helpers shared by 3D components (Arrow, Cylinder, Lattice,
|
|
2
|
+
// SymmetryElements). Kept out of $lib/math, which is pure TS with no three.js dependency.
|
|
3
|
+
import { add, EPS, scale, subtract } from '../math';
|
|
4
|
+
import { Euler, Quaternion, Vector3 } from 'three';
|
|
5
|
+
const UP = new Vector3(0, 1, 0);
|
|
6
|
+
// Quaternion rotating the +Y axis onto `direction` (zero-length → identity). Cylinder and
|
|
7
|
+
// cone geometries run along +Y, so this orients them toward an arbitrary direction.
|
|
8
|
+
export function quaternion_from_direction(direction) {
|
|
9
|
+
const vec = new Vector3(...direction);
|
|
10
|
+
if (vec.lengthSq() < EPS * EPS)
|
|
11
|
+
return new Quaternion(); // ~zero length → no rotation
|
|
12
|
+
return new Quaternion().setFromUnitVectors(UP, vec.normalize());
|
|
13
|
+
}
|
|
14
|
+
// Same orientation as an Euler rotation tuple, for Threlte `rotation` props
|
|
15
|
+
export function rotation_from_direction(direction) {
|
|
16
|
+
const { x, y, z } = new Euler().setFromQuaternion(quaternion_from_direction(direction));
|
|
17
|
+
return [x, y, z];
|
|
18
|
+
}
|
|
19
|
+
// Transform placing a +Y-aligned cylinder so it spans start→end: midpoint position,
|
|
20
|
+
// orientation, and length (coincident points → length 0, identity rotation).
|
|
21
|
+
export function cylinder_between(start, end) {
|
|
22
|
+
const delta = subtract(end, start);
|
|
23
|
+
const position = add(start, scale(delta, 0.5));
|
|
24
|
+
const rotation = rotation_from_direction(delta);
|
|
25
|
+
const length = Math.hypot(...delta);
|
|
26
|
+
return { position, rotation, length };
|
|
27
|
+
}
|
|
@@ -2,6 +2,7 @@ import type { CompositionType } from '../composition';
|
|
|
2
2
|
import type { ElementSymbol } from '../element';
|
|
3
3
|
import type { Vec3 } from '../math';
|
|
4
4
|
import * as math from '../math';
|
|
5
|
+
import type { CameraProjection } from '../settings';
|
|
5
6
|
import type { ComponentProps } from 'svelte';
|
|
6
7
|
import type LatticeComponent from './Lattice.svelte';
|
|
7
8
|
import type { Pbc } from './pbc';
|
|
@@ -15,14 +16,30 @@ export { default as CanvasTooltip } from './CanvasTooltip.svelte';
|
|
|
15
16
|
export { default as Cylinder } from './Cylinder.svelte';
|
|
16
17
|
export { default as Lattice } from './Lattice.svelte';
|
|
17
18
|
export * from './pbc';
|
|
19
|
+
export * from './polyhedra';
|
|
20
|
+
export * from './site';
|
|
18
21
|
export { default as Structure } from './Structure.svelte';
|
|
22
|
+
export { default as StructureCarousel } from './StructureCarousel.svelte';
|
|
23
|
+
export type StructureCarouselItem = {
|
|
24
|
+
id: string;
|
|
25
|
+
label: string;
|
|
26
|
+
subtitle?: string;
|
|
27
|
+
structure: AnyStructure;
|
|
28
|
+
};
|
|
19
29
|
export { default as StructureControls } from './StructureControls.svelte';
|
|
20
30
|
export { default as StructureExportPane } from './StructureExportPane.svelte';
|
|
21
31
|
export { default as StructureInfoPane } from './StructureInfoPane.svelte';
|
|
22
32
|
export { default as StructureScene } from './StructureScene.svelte';
|
|
33
|
+
export { default as StructureViewport } from './StructureViewport.svelte';
|
|
23
34
|
export * from './supercell';
|
|
24
35
|
export type MeasureMode = `distance` | `angle` | `edit-bonds` | `edit-atoms`;
|
|
25
36
|
export type BondEditMode = `add` | `delete`;
|
|
37
|
+
export type StructureView = {
|
|
38
|
+
label?: string;
|
|
39
|
+
projection?: CameraProjection;
|
|
40
|
+
direction?: Vec3;
|
|
41
|
+
};
|
|
42
|
+
export declare const DEFAULT_STRUCTURE_VIEWS: StructureView[];
|
|
26
43
|
export type Species = {
|
|
27
44
|
element: ElementSymbol;
|
|
28
45
|
occu: number;
|
|
@@ -75,7 +92,7 @@ export type BondPair = {
|
|
|
75
92
|
};
|
|
76
93
|
export type { PerceivedBond, PerceptionOptions } from './bond-order-perception';
|
|
77
94
|
export { compose_perceived_bonds, perceive_bond_orders, } from './bond-order-perception';
|
|
78
|
-
export declare function get_element_counts(structure: AnyStructure): Partial<Record<"
|
|
95
|
+
export declare function get_element_counts(structure: AnyStructure): Partial<Record<"Ac" | "Ag" | "Al" | "Am" | "Ar" | "As" | "At" | "Au" | "B" | "Ba" | "Be" | "Bh" | "Bi" | "Bk" | "Br" | "C" | "Ca" | "Cd" | "Ce" | "Cf" | "Cl" | "Cm" | "Co" | "Cr" | "Cs" | "Cu" | "Db" | "Dy" | "Er" | "Es" | "Eu" | "F" | "Fe" | "Fm" | "Fr" | "Ga" | "Gd" | "Ge" | "H" | "He" | "Hf" | "Hg" | "Ho" | "Hs" | "I" | "In" | "Ir" | "K" | "Kr" | "La" | "Li" | "Lr" | "Lu" | "Md" | "Mg" | "Mn" | "Mo" | "Mt" | "N" | "Na" | "Nb" | "Nd" | "Ne" | "Ni" | "No" | "Np" | "O" | "Os" | "P" | "Pa" | "Pb" | "Pd" | "Pm" | "Po" | "Pr" | "Pt" | "Pu" | "Ra" | "Rb" | "Re" | "Rf" | "Rh" | "Rn" | "Ru" | "S" | "Sb" | "Sc" | "Se" | "Sg" | "Si" | "Sm" | "Sn" | "Sr" | "Ta" | "Tb" | "Tc" | "Te" | "Th" | "Ti" | "Tl" | "Tm" | "U" | "V" | "W" | "Xe" | "Y" | "Yb" | "Zn" | "Zr" | "Ds" | "Rg" | "Cn" | "Nh" | "Fl" | "Mc" | "Lv" | "Ts" | "Og", number>>;
|
|
79
96
|
export declare function format_chemical_formula(structure: AnyStructure, sort_fn: (symbols: ElementSymbol[]) => ElementSymbol[]): string;
|
|
80
97
|
export declare function format_formula_by_electronegativity(structure: AnyStructure): string;
|
|
81
98
|
export declare const atomic_radii: CompositionType;
|
package/dist/structure/index.js
CHANGED
|
@@ -10,12 +10,23 @@ export { default as CanvasTooltip } from './CanvasTooltip.svelte';
|
|
|
10
10
|
export { default as Cylinder } from './Cylinder.svelte';
|
|
11
11
|
export { default as Lattice } from './Lattice.svelte';
|
|
12
12
|
export * from './pbc';
|
|
13
|
+
export * from './polyhedra';
|
|
14
|
+
export * from './site';
|
|
13
15
|
export { default as Structure } from './Structure.svelte';
|
|
16
|
+
export { default as StructureCarousel } from './StructureCarousel.svelte';
|
|
14
17
|
export { default as StructureControls } from './StructureControls.svelte';
|
|
15
18
|
export { default as StructureExportPane } from './StructureExportPane.svelte';
|
|
16
19
|
export { default as StructureInfoPane } from './StructureInfoPane.svelte';
|
|
17
20
|
export { default as StructureScene } from './StructureScene.svelte';
|
|
21
|
+
export { default as StructureViewport } from './StructureViewport.svelte';
|
|
18
22
|
export * from './supercell';
|
|
23
|
+
// Ovito-like default 2x2 view set: one perspective + three orthographic axis views.
|
|
24
|
+
export const DEFAULT_STRUCTURE_VIEWS = [
|
|
25
|
+
{ label: `Perspective`, projection: `perspective`, direction: [1, 0.3, 0.8] },
|
|
26
|
+
{ label: `Front`, projection: `orthographic`, direction: [0, 0, 1] },
|
|
27
|
+
{ label: `Top`, projection: `orthographic`, direction: [0, 1, 0] },
|
|
28
|
+
{ label: `Right`, projection: `orthographic`, direction: [1, 0, 0] },
|
|
29
|
+
];
|
|
19
30
|
export const LATTICE_PARAM_KEYS = [`a`, `b`, `c`, `alpha`, `beta`, `gamma`];
|
|
20
31
|
export { compose_perceived_bonds, perceive_bond_orders, } from './bond-order-perception';
|
|
21
32
|
export function get_element_counts(structure) {
|
|
@@ -41,11 +52,13 @@ export function format_chemical_formula(structure, sort_fn) {
|
|
|
41
52
|
}
|
|
42
53
|
return formula.join(` `);
|
|
43
54
|
}
|
|
55
|
+
// Electronegativity by element symbol (0 when missing), for O(1) sort comparisons
|
|
56
|
+
const electronegativity_by_symbol = new Map(element_data.map((el) => [el.symbol, el.electronegativity ?? 0]));
|
|
44
57
|
export function format_formula_by_electronegativity(structure) {
|
|
45
58
|
// concatenate elements in a structure followed by their amount sorted by electronegativity
|
|
46
59
|
return format_chemical_formula(structure, (symbols) => symbols.sort((el1, el2) => {
|
|
47
|
-
const elec_neg1 =
|
|
48
|
-
const elec_neg2 =
|
|
60
|
+
const elec_neg1 = electronegativity_by_symbol.get(el1) ?? 0;
|
|
61
|
+
const elec_neg2 = electronegativity_by_symbol.get(el2) ?? 0;
|
|
49
62
|
// Sort by electronegativity (ascending), then alphabetically for ties
|
|
50
63
|
if (elec_neg1 !== elec_neg2)
|
|
51
64
|
return elec_neg1 - elec_neg2;
|
|
@@ -3,5 +3,5 @@ import type { Pbc } from './pbc';
|
|
|
3
3
|
export type AngleMode = `degrees` | `radians`;
|
|
4
4
|
export declare const MAX_SELECTED_SITES = 8;
|
|
5
5
|
export declare function displacement_pbc(from: Vec3, to: Vec3, lattice_matrix: Matrix3x3 | null | undefined, converters?: LatticeConverters, pbc?: Pbc): Vec3;
|
|
6
|
-
export
|
|
6
|
+
export { pbc_dist as distance_pbc } from '../math';
|
|
7
7
|
export declare function angle_between_vectors(v1: Vec3, v2: Vec3, mode?: AngleMode): number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// functions for measuring distances and angles between structure sites
|
|
2
|
-
import { min_image_displacement, subtract } from '../math';
|
|
2
|
+
import { dot, min_image_displacement, subtract, to_degrees } from '../math';
|
|
3
3
|
export const MAX_SELECTED_SITES = 8;
|
|
4
4
|
// Calculate minimum image displacement between two points under PBC
|
|
5
5
|
// If lattice_matrix is null/undefined, returns Euclidean displacement.
|
|
@@ -9,22 +9,16 @@ export function displacement_pbc(from, to, lattice_matrix, converters, pbc) {
|
|
|
9
9
|
return subtract(to, from);
|
|
10
10
|
return min_image_displacement(from, to, lattice_matrix, converters, pbc);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return Math.hypot(dx, dy, dz);
|
|
15
|
-
}
|
|
12
|
+
// Minimum-image distance between two Cartesian points
|
|
13
|
+
export { pbc_dist as distance_pbc } from '../math';
|
|
16
14
|
export function angle_between_vectors(v1, v2, mode = `degrees`) {
|
|
17
15
|
const n1 = Math.hypot(v1[0], v1[1], v1[2]);
|
|
18
16
|
const n2 = Math.hypot(v2[0], v2[1], v2[2]);
|
|
19
17
|
if (n1 === 0 || n2 === 0)
|
|
20
18
|
return 0;
|
|
21
|
-
//
|
|
22
|
-
const
|
|
23
|
-
// Normalize dot product to get cosine
|
|
24
|
-
const cos_angle = dot / (n1 * n2);
|
|
25
|
-
// Clamp to [-1, 1] to avoid numerical errors with acos
|
|
19
|
+
// Normalize dot product to get cosine, clamped to [-1, 1] to avoid acos NaN
|
|
20
|
+
const cos_angle = dot(v1, v2) / (n1 * n2);
|
|
26
21
|
const clamped = Math.max(-1, Math.min(1, cos_angle));
|
|
27
|
-
// Compute angle using arccos
|
|
28
22
|
const ang = Math.acos(clamped);
|
|
29
|
-
return mode === `degrees` ? (ang
|
|
23
|
+
return mode === `degrees` ? to_degrees(ang) : ang;
|
|
30
24
|
}
|
|
@@ -2,6 +2,7 @@ import type { OptimadeStructure } from '../api/optimade';
|
|
|
2
2
|
import * as math from '../math';
|
|
3
3
|
import type { AnyStructure, Crystal, Site, StructureProperties } from './';
|
|
4
4
|
import type { Pbc } from './pbc';
|
|
5
|
+
export { is_structure_file } from './format-detect';
|
|
5
6
|
export interface ParsedStructure {
|
|
6
7
|
sites: Site[];
|
|
7
8
|
properties?: StructureProperties;
|
|
@@ -54,13 +55,14 @@ export declare function parse_xyz(content: string): ParsedStructure | null;
|
|
|
54
55
|
export declare function parse_cif(content: string, wrap_fractional_coords?: boolean, strict?: boolean): ParsedStructure | null;
|
|
55
56
|
export type CellType = `primitive_cell` | `unit_cell` | `supercell` | `phonon_primitive_cell` | `phonon_supercell` | `auto`;
|
|
56
57
|
export declare function parse_phonopy_yaml(content: string, cell_type?: CellType): ParsedStructure | null;
|
|
58
|
+
export declare function is_parsed_structure(obj: unknown): obj is ParsedStructure;
|
|
59
|
+
export declare function ensure_lattice_params(structure: ParsedStructure): ParsedStructure;
|
|
57
60
|
export declare function normalize_fractional_coords(structure: ParsedStructure): ParsedStructure;
|
|
58
|
-
export declare function parse_structure_file(content: string, filename?: string): ParsedStructure
|
|
59
|
-
export declare function parse_any_structure(content: string, filename: string): AnyStructure
|
|
61
|
+
export declare function parse_structure_file(content: string, filename?: string): ParsedStructure;
|
|
62
|
+
export declare function parse_any_structure(content: string, filename: string): AnyStructure;
|
|
60
63
|
export declare function parse_optimade_json(content: string): ParsedStructure | null;
|
|
61
64
|
export declare function parse_optimade_from_raw(raw: unknown): ParsedStructure | null;
|
|
62
65
|
export declare function is_optimade_json(content: string): boolean;
|
|
63
66
|
export declare const is_optimade_raw: (raw: unknown) => boolean;
|
|
64
67
|
export declare function optimade_to_crystal(optimade_structure: OptimadeStructure): Crystal | null;
|
|
65
|
-
export declare function is_structure_file(filename: string): boolean;
|
|
66
68
|
export declare const detect_structure_type: (filename: string, content: string) => `crystal` | `molecule` | `unknown`;
|