matterviz 0.3.1 → 0.3.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/FilePicker.svelte +37 -20
- package/dist/Icon.svelte +2 -2
- package/dist/app.css +29 -0
- package/dist/brillouin/BrillouinZone.svelte +19 -61
- package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
- package/dist/brillouin/BrillouinZoneExportPane.svelte +12 -20
- package/dist/brillouin/BrillouinZoneScene.svelte +2 -2
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
- package/dist/chempot-diagram/ChemPotDiagram.svelte +192 -0
- package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +13 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte +677 -0
- package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte +2688 -0
- package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +16 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte +8 -0
- package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +7 -0
- package/dist/chempot-diagram/color.d.ts +10 -0
- package/dist/chempot-diagram/color.js +33 -0
- package/dist/chempot-diagram/compute.d.ts +38 -0
- package/dist/chempot-diagram/compute.js +650 -0
- package/dist/chempot-diagram/index.d.ts +5 -0
- package/dist/chempot-diagram/index.js +5 -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 +37 -0
- package/dist/chempot-diagram/types.d.ts +83 -0
- package/dist/chempot-diagram/types.js +27 -0
- package/dist/colors/index.d.ts +3 -1
- package/dist/colors/index.js +4 -0
- package/dist/composition/BarChart.svelte +13 -22
- package/dist/composition/BubbleChart.svelte +5 -3
- package/dist/composition/FormulaFilter.svelte +586 -94
- package/dist/composition/FormulaFilter.svelte.d.ts +35 -1
- package/dist/composition/PieChart.svelte +43 -18
- package/dist/composition/PieChart.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull.svelte +4 -2
- package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull2D.svelte +13 -44
- package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull3D.svelte +16 -7
- package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHull4D.svelte +17 -7
- package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullControls.svelte.d.ts +1 -1
- package/dist/convex-hull/ConvexHullStats.svelte +701 -226
- package/dist/convex-hull/ConvexHullStats.svelte.d.ts +6 -1
- package/dist/convex-hull/ConvexHullTooltip.svelte +1 -0
- package/dist/convex-hull/demo-temperature.d.ts +6 -0
- package/dist/convex-hull/demo-temperature.js +36 -0
- package/dist/convex-hull/helpers.d.ts +1 -1
- package/dist/convex-hull/helpers.js +2 -4
- 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 +106 -17
- package/dist/convex-hull/types.d.ts +5 -0
- package/dist/convex-hull/types.js +5 -0
- package/dist/coordination/CoordinationBarPlot.svelte +29 -46
- package/dist/element/BohrAtom.svelte +1 -1
- 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/fermi-surface/FermiSurface.svelte +20 -64
- package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte +1 -1
- package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
- package/dist/fermi-surface/parse.js +16 -22
- package/dist/heatmap-matrix/HeatmapMatrix.svelte +1273 -0
- package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +110 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +171 -0
- package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +31 -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 +111 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/io/export.js +15 -3
- 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/types.d.ts +1 -0
- package/dist/io/url-drop.d.ts +2 -0
- package/dist/io/url-drop.js +118 -0
- package/dist/isosurface/Isosurface.svelte +101 -45
- package/dist/isosurface/IsosurfaceControls.svelte +19 -0
- package/dist/isosurface/parse.js +73 -30
- package/dist/isosurface/slice.d.ts +2 -1
- package/dist/isosurface/slice.js +3 -3
- package/dist/isosurface/types.d.ts +13 -1
- package/dist/isosurface/types.js +98 -0
- package/dist/labels.d.ts +2 -1
- package/dist/labels.js +1 -0
- package/dist/layout/InfoTag.svelte +62 -62
- package/dist/layout/SubpageGrid.svelte +74 -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 +83 -85
- package/dist/layout/json-tree/JsonTree.svelte +20 -19
- package/dist/layout/json-tree/JsonTree.svelte.d.ts +1 -1
- package/dist/layout/json-tree/JsonValue.svelte +196 -116
- 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 +33 -0
- package/dist/math.d.ts +7 -0
- package/dist/math.js +358 -7
- package/dist/overlays/ContextMenu.svelte +3 -2
- package/dist/overlays/DraggablePane.svelte +163 -58
- package/dist/overlays/DraggablePane.svelte.d.ts +2 -0
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +232 -77
- package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -2
- package/dist/phase-diagram/PhaseDiagramControls.svelte +32 -11
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +3 -2
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +103 -0
- package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +15 -0
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte +102 -95
- package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +7 -0
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte +100 -26
- package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +6 -3
- package/dist/phase-diagram/index.d.ts +2 -0
- package/dist/phase-diagram/index.js +2 -0
- package/dist/phase-diagram/svg-to-diagram.d.ts +2 -0
- package/dist/phase-diagram/svg-to-diagram.js +865 -0
- package/dist/phase-diagram/types.d.ts +10 -0
- package/dist/phase-diagram/utils.d.ts +7 -4
- package/dist/phase-diagram/utils.js +149 -59
- package/dist/plot/AxisLabel.svelte +26 -0
- package/dist/plot/AxisLabel.svelte.d.ts +16 -0
- package/dist/plot/BarPlot.svelte +473 -228
- package/dist/plot/BarPlot.svelte.d.ts +3 -3
- package/dist/plot/BarPlotControls.svelte +3 -2
- package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ColorBar.svelte +54 -54
- package/dist/plot/ColorBar.svelte.d.ts +1 -1
- package/dist/plot/ColorScaleSelect.svelte +1 -1
- package/dist/plot/ElementScatter.svelte +3 -2
- package/dist/plot/FillArea.svelte +4 -1
- package/dist/plot/Histogram.svelte +320 -230
- package/dist/plot/Histogram.svelte.d.ts +2 -2
- package/dist/plot/HistogramControls.svelte +29 -10
- package/dist/plot/HistogramControls.svelte.d.ts +6 -2
- package/dist/plot/InteractiveAxisLabel.svelte.d.ts +2 -2
- package/dist/plot/PlotControls.svelte +109 -27
- package/dist/plot/PlotControls.svelte.d.ts +1 -1
- package/dist/plot/PlotLegend.svelte +1 -1
- package/dist/plot/PortalSelect.svelte +2 -1
- package/dist/plot/ReferenceLine.svelte +2 -1
- package/dist/plot/ReferenceLine.svelte.d.ts +1 -0
- package/dist/plot/ReferencePlane.svelte +1 -3
- package/dist/plot/ScatterPlot.svelte +343 -209
- package/dist/plot/ScatterPlot.svelte.d.ts +3 -3
- package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlot3DControls.svelte +203 -250
- package/dist/plot/ScatterPlot3DScene.svelte +4 -7
- package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
- package/dist/plot/ScatterPlotControls.svelte +95 -55
- package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
- package/dist/plot/ZeroLines.svelte +44 -0
- package/dist/plot/ZeroLines.svelte.d.ts +32 -0
- package/dist/plot/ZoomRect.svelte +21 -0
- package/dist/plot/ZoomRect.svelte.d.ts +8 -0
- package/dist/plot/axis-utils.d.ts +1 -1
- 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 +7 -1
- package/dist/plot/layout.js +12 -4
- package/dist/plot/reference-line.d.ts +4 -21
- package/dist/plot/reference-line.js +7 -81
- package/dist/plot/types.d.ts +42 -17
- package/dist/plot/types.js +10 -0
- package/dist/plot/utils/label-placement.js +13 -10
- package/dist/plot/utils.d.ts +1 -0
- package/dist/plot/utils.js +14 -0
- package/dist/rdf/RdfPlot.svelte +55 -66
- package/dist/settings.d.ts +3 -0
- package/dist/settings.js +17 -3
- package/dist/spectral/Bands.svelte +515 -143
- package/dist/spectral/Bands.svelte.d.ts +22 -2
- package/dist/spectral/helpers.d.ts +23 -1
- package/dist/spectral/helpers.js +65 -9
- package/dist/spectral/types.d.ts +2 -0
- package/dist/structure/AtomLegend.svelte +29 -8
- package/dist/structure/AtomLegend.svelte.d.ts +1 -1
- package/dist/structure/CellSelect.svelte +92 -22
- package/dist/structure/Structure.svelte +108 -118
- package/dist/structure/Structure.svelte.d.ts +1 -1
- package/dist/structure/StructureControls.svelte +25 -22
- package/dist/structure/StructureControls.svelte.d.ts +1 -1
- package/dist/structure/StructureInfoPane.svelte +7 -1
- package/dist/structure/StructureScene.svelte +104 -66
- package/dist/structure/StructureScene.svelte.d.ts +2 -1
- package/dist/structure/atom-properties.d.ts +6 -2
- package/dist/structure/atom-properties.js +38 -25
- package/dist/structure/export.js +10 -7
- 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 +1 -2
- package/dist/structure/index.d.ts +6 -0
- package/dist/structure/index.js +22 -0
- package/dist/structure/parse.js +19 -16
- package/dist/structure/partial-occupancy.d.ts +25 -0
- package/dist/structure/partial-occupancy.js +102 -0
- package/dist/structure/validation.js +6 -3
- package/dist/symmetry/SymmetryStats.svelte +18 -4
- package/dist/symmetry/WyckoffTable.svelte +18 -10
- package/dist/symmetry/index.d.ts +7 -4
- package/dist/symmetry/index.js +83 -18
- package/dist/table/HeatmapTable.svelte +425 -65
- package/dist/table/HeatmapTable.svelte.d.ts +12 -1
- package/dist/table/ToggleMenu.svelte +2 -0
- package/dist/table/index.d.ts +2 -0
- package/dist/trajectory/Trajectory.svelte +147 -145
- package/dist/trajectory/TrajectoryExportPane.svelte +13 -9
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +1 -1
- package/dist/trajectory/constants.d.ts +6 -0
- package/dist/trajectory/constants.js +7 -0
- package/dist/trajectory/extract.js +3 -5
- 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 +339 -0
- package/dist/trajectory/helpers.d.ts +15 -0
- package/dist/trajectory/helpers.js +187 -0
- package/dist/trajectory/index.d.ts +1 -0
- package/dist/trajectory/index.js +11 -4
- package/dist/trajectory/parse/ase.d.ts +2 -0
- package/dist/trajectory/parse/ase.js +76 -0
- package/dist/trajectory/parse/hdf5.d.ts +2 -0
- package/dist/trajectory/parse/hdf5.js +121 -0
- package/dist/trajectory/parse/index.d.ts +12 -0
- package/dist/trajectory/parse/index.js +304 -0
- package/dist/trajectory/parse/lammps.d.ts +5 -0
- package/dist/trajectory/parse/lammps.js +169 -0
- package/dist/trajectory/parse/vasp.d.ts +2 -0
- package/dist/trajectory/parse/vasp.js +65 -0
- package/dist/trajectory/parse/xyz.d.ts +2 -0
- package/dist/trajectory/parse/xyz.js +109 -0
- package/dist/trajectory/types.d.ts +11 -0
- package/dist/trajectory/types.js +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +4 -0
- package/dist/xrd/XrdPlot.svelte +6 -4
- package/dist/xrd/calc-xrd.js +0 -1
- package/package.json +30 -24
- 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
|
Binary file
|
package/dist/element/types.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<script lang="ts">import { compute_brillouin_zone, reciprocal_lattice } from '../brillouin';
|
|
2
2
|
import { normalize_show_controls } from '../controls';
|
|
3
3
|
import EmptyState from '../EmptyState.svelte';
|
|
4
|
+
import { StatusMessage } from '../feedback';
|
|
4
5
|
import Spinner from '../feedback/Spinner.svelte';
|
|
5
6
|
import Icon from '../Icon.svelte';
|
|
6
|
-
import {
|
|
7
|
+
import { create_file_drop_handler, load_from_url } from '../io';
|
|
7
8
|
import { set_fullscreen_bg, toggle_fullscreen } from '../layout';
|
|
8
|
-
import { DEFAULTS } from '../settings';
|
|
9
9
|
import { PlotTooltip } from '../plot';
|
|
10
|
+
import { DEFAULTS } from '../settings';
|
|
10
11
|
import { Canvas } from '@threlte/core';
|
|
11
12
|
import { untrack } from 'svelte';
|
|
12
13
|
import { tooltip } from 'svelte-multiselect/attachments';
|
|
@@ -176,39 +177,22 @@ $effect(() => {
|
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
179
|
});
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const file = event.dataTransfer?.files[0];
|
|
196
|
-
if (file) {
|
|
197
|
-
if (!url_filename)
|
|
198
|
-
on_file_drop?.(file.name); // notify if not already
|
|
199
|
-
const { content, filename } = await decompress_file(file);
|
|
200
|
-
if (content)
|
|
201
|
-
await safe_parse(content, filename);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch (err) {
|
|
205
|
-
error_msg = `File drop failed: ${err}`;
|
|
206
|
-
on_error?.({ error_msg });
|
|
207
|
-
}
|
|
208
|
-
finally {
|
|
209
|
-
loading = false;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
180
|
+
const handle_file_drop = create_file_drop_handler({
|
|
181
|
+
allow: () => allow_file_drop,
|
|
182
|
+
on_drop: async (content, filename) => {
|
|
183
|
+
on_file_drop?.(filename);
|
|
184
|
+
await safe_parse(content, filename);
|
|
185
|
+
},
|
|
186
|
+
on_error: (msg) => {
|
|
187
|
+
error_msg = msg;
|
|
188
|
+
on_error?.({ error_msg: msg });
|
|
189
|
+
},
|
|
190
|
+
set_loading: (val) => {
|
|
191
|
+
loading = val;
|
|
192
|
+
if (val)
|
|
193
|
+
[error_msg, dragover] = [undefined, false];
|
|
194
|
+
},
|
|
195
|
+
});
|
|
212
196
|
function handle_keydown(event) {
|
|
213
197
|
const target = event.target;
|
|
214
198
|
if ([`INPUT`, `TEXTAREA`].includes(target.tagName))
|
|
@@ -277,10 +261,7 @@ $effect(() => {
|
|
|
277
261
|
{...spinner_props}
|
|
278
262
|
/>
|
|
279
263
|
{:else if error_msg}
|
|
280
|
-
<
|
|
281
|
-
<p class="error">{error_msg}</p>
|
|
282
|
-
<button onclick={() => (error_msg = undefined)}>Dismiss</button>
|
|
283
|
-
</div>
|
|
264
|
+
<StatusMessage bind:message={error_msg} type="error" dismissible />
|
|
284
265
|
{:else if fermi_data || band_data}
|
|
285
266
|
<section
|
|
286
267
|
class="control-buttons {controls_config.class}"
|
|
@@ -472,29 +453,4 @@ $effect(() => {
|
|
|
472
453
|
text-overflow: ellipsis;
|
|
473
454
|
white-space: nowrap;
|
|
474
455
|
}
|
|
475
|
-
.error-state {
|
|
476
|
-
display: flex;
|
|
477
|
-
flex-direction: column;
|
|
478
|
-
align-items: center;
|
|
479
|
-
justify-content: center;
|
|
480
|
-
height: 100%;
|
|
481
|
-
padding: 2rem;
|
|
482
|
-
text-align: center;
|
|
483
|
-
box-sizing: border-box;
|
|
484
|
-
}
|
|
485
|
-
.error-state p {
|
|
486
|
-
color: var(--error-color, #ff6b6b);
|
|
487
|
-
margin: 0 0 1rem;
|
|
488
|
-
}
|
|
489
|
-
.error-state button {
|
|
490
|
-
padding: 0.5rem 1rem;
|
|
491
|
-
background: var(--error-color, #ff6b6b);
|
|
492
|
-
color: white;
|
|
493
|
-
border: none;
|
|
494
|
-
border-radius: 4px;
|
|
495
|
-
cursor: pointer;
|
|
496
|
-
}
|
|
497
|
-
.error-state button:hover {
|
|
498
|
-
background: var(--error-color-hover, #ff5252);
|
|
499
|
-
}
|
|
500
456
|
</style>
|
|
@@ -78,6 +78,6 @@ type $$ComponentProps = {
|
|
|
78
78
|
}]> | FermiTooltipConfig;
|
|
79
79
|
on_hover?: (data: FermiHoverData | null) => void;
|
|
80
80
|
} & HTMLAttributes<HTMLDivElement>;
|
|
81
|
-
declare const FermiSurface: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "dragover" | "
|
|
81
|
+
declare const FermiSurface: import("svelte").Component<$$ComponentProps, {}, "height" | "width" | "dragover" | "color_scale" | "controls_open" | "loading" | "fullscreen" | "hovered" | "camera_projection" | "wrapper" | "error_msg" | "surface_opacity" | "show_vectors" | "bz_data" | "mu" | "selected_bands" | "interpolation_factor" | "fermi_data" | "band_data" | "color_property" | "representation" | "show_bz" | "bz_opacity" | "tile_bz" | "clip_enabled" | "clip_axis" | "clip_position" | "clip_flip">;
|
|
82
82
|
type FermiSurface = ReturnType<typeof FermiSurface>;
|
|
83
83
|
export default FermiSurface;
|
|
@@ -30,6 +30,6 @@ type $$ComponentProps = {
|
|
|
30
30
|
band_data?: BandGridData;
|
|
31
31
|
}]>;
|
|
32
32
|
};
|
|
33
|
-
declare const FermiSurfaceControls: import("svelte").Component<$$ComponentProps, {}, "
|
|
33
|
+
declare const FermiSurfaceControls: import("svelte").Component<$$ComponentProps, {}, "color_scale" | "controls_open" | "camera_projection" | "surface_opacity" | "show_vectors" | "mu" | "selected_bands" | "interpolation_factor" | "color_property" | "representation" | "show_bz" | "bz_opacity" | "tile_bz" | "clip_enabled" | "clip_axis" | "clip_position" | "clip_flip">;
|
|
34
34
|
type FermiSurfaceControls = ReturnType<typeof FermiSurfaceControls>;
|
|
35
35
|
export default FermiSurfaceControls;
|
|
@@ -454,7 +454,7 @@ function handle_pointer_move(event, surface, surface_color, sym_idx, sym_matrix)
|
|
|
454
454
|
</T.Mesh>
|
|
455
455
|
|
|
456
456
|
<!-- BZ edges -->
|
|
457
|
-
{#each bz_data.edges as edge_segment (
|
|
457
|
+
{#each bz_data.edges as edge_segment, edge_idx (`bz-edge-${edge_idx}`)}
|
|
458
458
|
{@const [from, to] = edge_segment}
|
|
459
459
|
<Cylinder {from} {to} thickness={bz_edge_width} color={bz_edge_color} />
|
|
460
460
|
{/each}
|
|
@@ -45,6 +45,6 @@ type $$ComponentProps = {
|
|
|
45
45
|
camera?: Camera;
|
|
46
46
|
hover_data?: FermiHoverData | null;
|
|
47
47
|
};
|
|
48
|
-
declare const FermiSurfaceScene: import("svelte").Component<$$ComponentProps, {}, "camera_position" | "camera_projection" | "
|
|
48
|
+
declare const FermiSurfaceScene: import("svelte").Component<$$ComponentProps, {}, "camera_position" | "camera_projection" | "scene" | "camera" | "camera_is_moving" | "surface_opacity" | "bz_data" | "hover_data" | "fermi_data">;
|
|
49
49
|
type FermiSurfaceScene = ReturnType<typeof FermiSurfaceScene>;
|
|
50
50
|
export default FermiSurfaceScene;
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import * as constants from './constants';
|
|
2
2
|
import { compute_vertex_normals } from './marching-cubes';
|
|
3
|
+
function parse_number_tokens(line) {
|
|
4
|
+
return line.split(/\s+/).filter(Boolean);
|
|
5
|
+
}
|
|
3
6
|
// Parse whitespace-separated floats from a line (optimized with unary +)
|
|
4
7
|
function parse_floats(line) {
|
|
5
|
-
|
|
6
|
-
const result = [];
|
|
7
|
-
for (let idx = 0; idx < parts.length; idx++) {
|
|
8
|
-
if (parts[idx])
|
|
9
|
-
result.push(+parts[idx]);
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
8
|
+
return parse_number_tokens(line).map((part) => +part);
|
|
12
9
|
}
|
|
13
10
|
// Parse whitespace-separated integers from a line
|
|
14
11
|
function parse_ints(line) {
|
|
15
|
-
|
|
16
|
-
const result = [];
|
|
17
|
-
for (let idx = 0; idx < parts.length; idx++) {
|
|
18
|
-
if (parts[idx])
|
|
19
|
-
result.push(parseInt(parts[idx], 10));
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
12
|
+
return parse_number_tokens(line).map((part) => parseInt(part, 10));
|
|
22
13
|
}
|
|
23
14
|
// Parse BXSF (Band-XSF) format used by XCrySDen, Quantum ESPRESSO, etc.
|
|
24
15
|
// Format specification: http://www.xcrysden.org/doc/XSF.html
|
|
@@ -231,18 +222,21 @@ function parse_frmsf(content) {
|
|
|
231
222
|
function is_valid_isosurface(obj) {
|
|
232
223
|
if (!obj || typeof obj !== `object`)
|
|
233
224
|
return false;
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
225
|
+
const isosurface_obj = obj;
|
|
226
|
+
const vertices = isosurface_obj.vertices;
|
|
227
|
+
const faces = isosurface_obj.faces;
|
|
228
|
+
const normals = isosurface_obj.normals;
|
|
229
|
+
const band_index = isosurface_obj.band_index;
|
|
230
|
+
const spin = isosurface_obj.spin;
|
|
231
|
+
if (!Array.isArray(vertices) || vertices.length === 0)
|
|
237
232
|
return false;
|
|
238
|
-
if (!Array.isArray(
|
|
233
|
+
if (!Array.isArray(faces))
|
|
239
234
|
return false;
|
|
240
|
-
if (!Array.isArray(
|
|
235
|
+
if (!Array.isArray(normals))
|
|
241
236
|
return false;
|
|
242
|
-
|
|
243
|
-
if (typeof iso.band_index !== `number`)
|
|
237
|
+
if (typeof band_index !== `number` || !Number.isFinite(band_index))
|
|
244
238
|
return false;
|
|
245
|
-
if (
|
|
239
|
+
if (spin !== null && spin !== `up` && spin !== `down`)
|
|
246
240
|
return false;
|
|
247
241
|
return true;
|
|
248
242
|
}
|