matterviz 0.3.2 → 0.3.4

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.
Files changed (281) hide show
  1. package/dist/EmptyState.svelte +10 -2
  2. package/dist/FilePicker.svelte +123 -82
  3. package/dist/Icon.svelte +18 -12
  4. package/dist/MillerIndexInput.svelte +27 -21
  5. package/dist/api/optimade.js +6 -6
  6. package/dist/app.css +216 -207
  7. package/dist/brillouin/BrillouinZone.svelte +292 -149
  8. package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
  9. package/dist/brillouin/BrillouinZoneControls.svelte +32 -5
  10. package/dist/brillouin/BrillouinZoneExportPane.svelte +69 -42
  11. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
  12. package/dist/brillouin/BrillouinZoneInfoPane.svelte +99 -68
  13. package/dist/brillouin/BrillouinZoneScene.svelte +275 -163
  14. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
  15. package/dist/brillouin/BrillouinZoneTooltip.svelte +17 -7
  16. package/dist/brillouin/compute.js +11 -6
  17. package/dist/chempot-diagram/ChemPotDiagram.svelte +162 -27
  18. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +451 -281
  19. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +2148 -1642
  20. package/dist/chempot-diagram/ChemPotScene3D.svelte +8 -5
  21. package/dist/chempot-diagram/async-compute.svelte.d.ts +3 -0
  22. package/dist/chempot-diagram/async-compute.svelte.js +77 -0
  23. package/dist/chempot-diagram/chempot-worker.d.ts +1 -0
  24. package/dist/chempot-diagram/chempot-worker.js +11 -0
  25. package/dist/chempot-diagram/color.js +1 -2
  26. package/dist/chempot-diagram/compute.d.ts +10 -0
  27. package/dist/chempot-diagram/compute.js +250 -88
  28. package/dist/chempot-diagram/index.d.ts +2 -1
  29. package/dist/chempot-diagram/index.js +2 -1
  30. package/dist/chempot-diagram/temperature.js +8 -9
  31. package/dist/chempot-diagram/types.d.ts +3 -0
  32. package/dist/chempot-diagram/types.js +1 -0
  33. package/dist/colors/index.d.ts +1 -1
  34. package/dist/colors/index.js +5 -3
  35. package/dist/composition/BarChart.svelte +128 -55
  36. package/dist/composition/BubbleChart.svelte +102 -49
  37. package/dist/composition/Composition.svelte +100 -79
  38. package/dist/composition/Formula.svelte +108 -62
  39. package/dist/composition/FormulaFilter.svelte +665 -537
  40. package/dist/composition/PieChart.svelte +183 -108
  41. package/dist/composition/format.d.ts +5 -0
  42. package/dist/composition/format.js +20 -3
  43. package/dist/composition/parse.js +14 -9
  44. package/dist/convex-hull/ConvexHull.svelte +93 -40
  45. package/dist/convex-hull/ConvexHull.svelte.d.ts +1 -1
  46. package/dist/convex-hull/ConvexHull2D.svelte +549 -360
  47. package/dist/convex-hull/ConvexHull2D.svelte.d.ts +1 -1
  48. package/dist/convex-hull/ConvexHull3D.svelte +1296 -827
  49. package/dist/convex-hull/ConvexHull3D.svelte.d.ts +1 -1
  50. package/dist/convex-hull/ConvexHull4D.svelte +1004 -688
  51. package/dist/convex-hull/ConvexHull4D.svelte.d.ts +1 -1
  52. package/dist/convex-hull/ConvexHullControls.svelte +115 -28
  53. package/dist/convex-hull/ConvexHullControls.svelte.d.ts +1 -1
  54. package/dist/convex-hull/ConvexHullInfoPane.svelte +29 -3
  55. package/dist/convex-hull/ConvexHullStats.svelte +425 -328
  56. package/dist/convex-hull/ConvexHullTooltip.svelte +40 -16
  57. package/dist/convex-hull/GasPressureControls.svelte +104 -61
  58. package/dist/convex-hull/StructurePopup.svelte +25 -4
  59. package/dist/convex-hull/TemperatureSlider.svelte +45 -25
  60. package/dist/convex-hull/barycentric-coords.js +13 -7
  61. package/dist/convex-hull/demo-temperature.js +8 -4
  62. package/dist/convex-hull/gas-thermodynamics.js +17 -12
  63. package/dist/convex-hull/helpers.d.ts +9 -0
  64. package/dist/convex-hull/helpers.js +77 -34
  65. package/dist/convex-hull/thermodynamics.js +61 -56
  66. package/dist/convex-hull/types.d.ts +9 -14
  67. package/dist/convex-hull/types.js +0 -17
  68. package/dist/coordination/CoordinationBarPlot.svelte +227 -154
  69. package/dist/element/BohrAtom.svelte +55 -12
  70. package/dist/element/ElementHeading.svelte +7 -2
  71. package/dist/element/ElementPhoto.svelte +15 -9
  72. package/dist/element/ElementStats.svelte +10 -4
  73. package/dist/element/ElementTile.svelte +137 -73
  74. package/dist/element/Nucleus.svelte +39 -11
  75. package/dist/element/data.js +1 -1
  76. package/dist/feedback/ClickFeedback.svelte +16 -5
  77. package/dist/feedback/DragOverlay.svelte +10 -2
  78. package/dist/feedback/Spinner.svelte +4 -2
  79. package/dist/feedback/StatusMessage.svelte +8 -2
  80. package/dist/fermi-surface/FermiSlice.svelte +118 -88
  81. package/dist/fermi-surface/FermiSurface.svelte +328 -187
  82. package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
  83. package/dist/fermi-surface/FermiSurfaceControls.svelte +113 -46
  84. package/dist/fermi-surface/FermiSurfaceControls.svelte.d.ts +1 -1
  85. package/dist/fermi-surface/FermiSurfaceScene.svelte +535 -342
  86. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
  87. package/dist/fermi-surface/FermiSurfaceTooltip.svelte +14 -5
  88. package/dist/fermi-surface/compute.js +16 -20
  89. package/dist/fermi-surface/parse.js +24 -14
  90. package/dist/fermi-surface/symmetry.js +2 -7
  91. package/dist/fermi-surface/types.d.ts +3 -5
  92. package/dist/heatmap-matrix/HeatmapMatrix.svelte +1019 -765
  93. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +1 -1
  94. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +76 -22
  95. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +2 -3
  96. package/dist/icons.js +47 -0
  97. package/dist/index.d.ts +2 -1
  98. package/dist/index.js +2 -1
  99. package/dist/io/decompress.js +1 -1
  100. package/dist/io/export.d.ts +3 -0
  101. package/dist/io/export.js +129 -143
  102. package/dist/io/is-binary.js +2 -3
  103. package/dist/io/url-drop.js +1 -2
  104. package/dist/isosurface/Isosurface.svelte +202 -148
  105. package/dist/isosurface/IsosurfaceControls.svelte +46 -28
  106. package/dist/isosurface/parse.js +34 -29
  107. package/dist/isosurface/slice.js +5 -10
  108. package/dist/isosurface/types.d.ts +2 -1
  109. package/dist/isosurface/types.js +61 -12
  110. package/dist/labels.js +11 -8
  111. package/dist/layout/FullscreenToggle.svelte +11 -2
  112. package/dist/layout/InfoCard.svelte +38 -6
  113. package/dist/layout/InfoTag.svelte +63 -32
  114. package/dist/layout/PropertyFilter.svelte +82 -37
  115. package/dist/layout/SettingsSection.svelte +85 -55
  116. package/dist/layout/SubpageGrid.svelte +10 -2
  117. package/dist/layout/json-tree/JsonNode.svelte +183 -138
  118. package/dist/layout/json-tree/JsonTree.svelte +499 -413
  119. package/dist/layout/json-tree/JsonValue.svelte +127 -99
  120. package/dist/layout/json-tree/utils.js +4 -2
  121. package/dist/marching-cubes.js +25 -2
  122. package/dist/math.d.ts +13 -17
  123. package/dist/math.js +133 -67
  124. package/dist/overlays/ContextMenu.svelte +65 -40
  125. package/dist/overlays/DraggablePane.svelte +211 -139
  126. package/dist/periodic-table/PeriodicTable.svelte +278 -145
  127. package/dist/periodic-table/PeriodicTableControls.svelte +178 -128
  128. package/dist/periodic-table/PropertySelect.svelte +25 -7
  129. package/dist/periodic-table/TableInset.svelte +8 -3
  130. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +446 -309
  131. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +1 -1
  132. package/dist/phase-diagram/PhaseDiagramControls.svelte +102 -43
  133. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +1 -1
  134. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +63 -40
  135. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +71 -28
  136. package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +1 -1
  137. package/dist/phase-diagram/PhaseDiagramTooltip.svelte +158 -101
  138. package/dist/phase-diagram/TdbInfoPanel.svelte +28 -4
  139. package/dist/phase-diagram/build-diagram.js +9 -9
  140. package/dist/phase-diagram/colors.js +1 -3
  141. package/dist/phase-diagram/parse.js +10 -9
  142. package/dist/phase-diagram/svg-to-diagram.js +53 -49
  143. package/dist/phase-diagram/utils.d.ts +1 -0
  144. package/dist/phase-diagram/utils.js +80 -25
  145. package/dist/plot/AxisLabel.svelte +28 -3
  146. package/dist/plot/BarPlot.svelte +1182 -734
  147. package/dist/plot/BarPlot.svelte.d.ts +2 -2
  148. package/dist/plot/BarPlotControls.svelte +31 -5
  149. package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
  150. package/dist/plot/ColorBar.svelte +479 -329
  151. package/dist/plot/ColorScaleSelect.svelte +27 -6
  152. package/dist/plot/ElementScatter.svelte +36 -15
  153. package/dist/plot/FillArea.svelte +152 -95
  154. package/dist/plot/Histogram.svelte +934 -571
  155. package/dist/plot/Histogram.svelte.d.ts +1 -1
  156. package/dist/plot/HistogramControls.svelte +53 -9
  157. package/dist/plot/HistogramControls.svelte.d.ts +1 -1
  158. package/dist/plot/InteractiveAxisLabel.svelte +34 -11
  159. package/dist/plot/InteractiveAxisLabel.svelte.d.ts +1 -1
  160. package/dist/plot/Line.svelte +63 -28
  161. package/dist/plot/PlotControls.svelte +157 -114
  162. package/dist/plot/PlotControls.svelte.d.ts +1 -1
  163. package/dist/plot/PlotLegend.svelte +174 -91
  164. package/dist/plot/PlotTooltip.svelte +45 -6
  165. package/dist/plot/PortalSelect.svelte +175 -147
  166. package/dist/plot/ReferenceLine.svelte +76 -22
  167. package/dist/plot/ReferenceLine3D.svelte +132 -107
  168. package/dist/plot/ReferencePlane.svelte +146 -121
  169. package/dist/plot/ScatterPlot.svelte +1681 -1091
  170. package/dist/plot/ScatterPlot.svelte.d.ts +2 -2
  171. package/dist/plot/ScatterPlot3D.svelte +256 -131
  172. package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
  173. package/dist/plot/ScatterPlot3DControls.svelte +113 -63
  174. package/dist/plot/ScatterPlot3DControls.svelte.d.ts +2 -1
  175. package/dist/plot/ScatterPlot3DScene.svelte +608 -403
  176. package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
  177. package/dist/plot/ScatterPlotControls.svelte +65 -25
  178. package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
  179. package/dist/plot/ScatterPoint.svelte +98 -26
  180. package/dist/plot/ScatterPoint.svelte.d.ts +1 -0
  181. package/dist/plot/SpacegroupBarPlot.svelte +142 -85
  182. package/dist/plot/Surface3D.svelte +159 -108
  183. package/dist/plot/ZeroLines.svelte +55 -3
  184. package/dist/plot/ZoomRect.svelte +4 -2
  185. package/dist/plot/axis-utils.js +1 -3
  186. package/dist/plot/data-cleaning.js +12 -28
  187. package/dist/plot/data-transform.js +2 -1
  188. package/dist/plot/fill-utils.js +2 -0
  189. package/dist/plot/layout.d.ts +4 -1
  190. package/dist/plot/layout.js +33 -14
  191. package/dist/plot/reference-line.d.ts +2 -2
  192. package/dist/plot/reference-line.js +7 -5
  193. package/dist/plot/scales.js +24 -36
  194. package/dist/plot/types.d.ts +11 -23
  195. package/dist/plot/types.js +6 -11
  196. package/dist/plot/utils/label-placement.d.ts +32 -15
  197. package/dist/plot/utils/label-placement.js +227 -66
  198. package/dist/plot/utils/series-visibility.js +2 -3
  199. package/dist/rdf/RdfPlot.svelte +143 -91
  200. package/dist/rdf/calc-rdf.js +4 -5
  201. package/dist/sanitize.d.ts +4 -0
  202. package/dist/sanitize.js +107 -0
  203. package/dist/settings.d.ts +18 -6
  204. package/dist/settings.js +46 -16
  205. package/dist/spectral/Bands.svelte +632 -453
  206. package/dist/spectral/BandsAndDos.svelte +90 -49
  207. package/dist/spectral/BrillouinBandsDos.svelte +151 -93
  208. package/dist/spectral/Dos.svelte +389 -258
  209. package/dist/spectral/helpers.js +55 -43
  210. package/dist/state.svelte.d.ts +1 -1
  211. package/dist/state.svelte.js +3 -2
  212. package/dist/structure/Arrow.svelte +59 -20
  213. package/dist/structure/AtomLegend.svelte +215 -134
  214. package/dist/structure/Bond.svelte +73 -47
  215. package/dist/structure/CanvasTooltip.svelte +10 -2
  216. package/dist/structure/CellSelect.svelte +72 -45
  217. package/dist/structure/Cylinder.svelte +33 -17
  218. package/dist/structure/Lattice.svelte +88 -33
  219. package/dist/structure/Structure.svelte +1063 -797
  220. package/dist/structure/Structure.svelte.d.ts +1 -1
  221. package/dist/structure/StructureControls.svelte +349 -118
  222. package/dist/structure/StructureExportPane.svelte +124 -89
  223. package/dist/structure/StructureExportPane.svelte.d.ts +1 -1
  224. package/dist/structure/StructureInfoPane.svelte +304 -237
  225. package/dist/structure/StructureScene.svelte +879 -443
  226. package/dist/structure/StructureScene.svelte.d.ts +15 -7
  227. package/dist/structure/atom-properties.js +8 -8
  228. package/dist/structure/bonding.js +6 -7
  229. package/dist/structure/export.js +14 -29
  230. package/dist/structure/ferrox-wasm.js +1 -1
  231. package/dist/structure/index.d.ts +13 -3
  232. package/dist/structure/index.js +83 -23
  233. package/dist/structure/measure.d.ts +2 -2
  234. package/dist/structure/measure.js +4 -44
  235. package/dist/structure/parse.js +113 -141
  236. package/dist/structure/partial-occupancy.js +7 -10
  237. package/dist/structure/pbc.d.ts +1 -0
  238. package/dist/structure/pbc.js +16 -6
  239. package/dist/structure/supercell.d.ts +2 -2
  240. package/dist/structure/supercell.js +12 -22
  241. package/dist/structure/validation.js +1 -2
  242. package/dist/symmetry/SymmetryStats.svelte +84 -41
  243. package/dist/symmetry/WyckoffTable.svelte +26 -6
  244. package/dist/symmetry/cell-transform.js +5 -3
  245. package/dist/symmetry/index.js +8 -7
  246. package/dist/symmetry/spacegroups.js +148 -148
  247. package/dist/table/HeatmapTable.svelte +790 -554
  248. package/dist/table/HeatmapTable.svelte.d.ts +1 -1
  249. package/dist/table/ToggleMenu.svelte +125 -92
  250. package/dist/table/index.js +2 -4
  251. package/dist/theme/ThemeControl.svelte +21 -12
  252. package/dist/time.js +4 -1
  253. package/dist/tooltip/TooltipContent.svelte +33 -8
  254. package/dist/trajectory/Trajectory.svelte +758 -558
  255. package/dist/trajectory/TrajectoryError.svelte +14 -3
  256. package/dist/trajectory/TrajectoryExportPane.svelte +137 -83
  257. package/dist/trajectory/TrajectoryInfoPane.svelte +272 -143
  258. package/dist/trajectory/extract.js +10 -26
  259. package/dist/trajectory/format-detect.js +5 -5
  260. package/dist/trajectory/frame-reader.d.ts +1 -1
  261. package/dist/trajectory/frame-reader.js +5 -12
  262. package/dist/trajectory/helpers.d.ts +0 -1
  263. package/dist/trajectory/helpers.js +2 -17
  264. package/dist/trajectory/index.js +14 -12
  265. package/dist/trajectory/parse/ase.js +5 -4
  266. package/dist/trajectory/parse/hdf5.js +26 -18
  267. package/dist/trajectory/parse/index.js +13 -18
  268. package/dist/trajectory/parse/lammps.js +17 -7
  269. package/dist/trajectory/parse/vasp.js +5 -2
  270. package/dist/trajectory/parse/xyz.js +8 -7
  271. package/dist/trajectory/plotting.js +13 -8
  272. package/dist/utils.d.ts +1 -0
  273. package/dist/utils.js +13 -0
  274. package/dist/xrd/XrdPlot.svelte +337 -247
  275. package/dist/xrd/broadening.js +14 -9
  276. package/dist/xrd/calc-xrd.js +12 -18
  277. package/dist/xrd/parse.d.ts +1 -1
  278. package/dist/xrd/parse.js +17 -17
  279. package/package.json +99 -103
  280. package/readme.md +1 -1
  281. /package/dist/theme/{themes.js → themes.mjs} +0 -0
@@ -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" | "scene" | "camera" | "camera_is_moving" | "surface_opacity" | "bz_data" | "hover_data" | "fermi_data">;
48
+ declare const FermiSurfaceScene: import("svelte").Component<$$ComponentProps, {}, "camera_position" | "camera_projection" | "camera" | "scene" | "camera_is_moving" | "surface_opacity" | "bz_data" | "hover_data" | "fermi_data">;
49
49
  type FermiSurfaceScene = ReturnType<typeof FermiSurfaceScene>;
50
50
  export default FermiSurfaceScene;
@@ -1,8 +1,17 @@
1
- <script lang="ts">// Tooltip component for Fermi surface hover information
2
- // Displays band index, spin, k-coordinates, and optional property values
3
- import { format_num, format_vec3 } from '../labels';
4
- import { TooltipContent } from '../tooltip';
5
- let { hover_data, tooltip, } = $props();
1
+ <script lang="ts">
2
+ // Tooltip component for Fermi surface hover information
3
+ // Displays band index, spin, k-coordinates, and optional property values
4
+ import { format_num, format_vec3 } from '../labels'
5
+ import { TooltipContent } from '../tooltip'
6
+ import type { FermiHoverData, FermiTooltipProp } from './types'
7
+
8
+ let {
9
+ hover_data,
10
+ tooltip,
11
+ }: {
12
+ hover_data: FermiHoverData
13
+ tooltip?: FermiTooltipProp
14
+ } = $props()
6
15
  </script>
7
16
 
8
17
  <TooltipContent data={hover_data} snippet_arg={{ hover_data }} {tooltip}>
@@ -42,8 +42,9 @@ function tricubic_interpolate(grid, fx, fy, fz, nx, ny, nz) {
42
42
  for (let yi = 0; yi < 4; yi++) {
43
43
  const col = row[wy[yi]];
44
44
  // Inline z interpolation
45
- y_sum += cy[yi] * (cz[0] * col[wz[0]] + cz[1] * col[wz[1]] +
46
- cz[2] * col[wz[2]] + cz[3] * col[wz[3]]);
45
+ y_sum +=
46
+ cy[yi] *
47
+ (cz[0] * col[wz[0]] + cz[1] * col[wz[1]] + cz[2] * col[wz[2]] + cz[3] * col[wz[3]]);
47
48
  }
48
49
  result += cx[xi] * y_sum;
49
50
  }
@@ -95,9 +96,7 @@ export function extract_fermi_surface(band_data, options = {}) {
95
96
  let total_area = 0;
96
97
  // Process each spin channel and band
97
98
  for (let spin_idx = 0; spin_idx < band_data.n_spins; spin_idx++) {
98
- const spin = band_data.n_spins === 2
99
- ? (spin_idx === 0 ? `up` : `down`)
100
- : null;
99
+ const spin = band_data.n_spins === 2 ? (spin_idx === 0 ? `up` : `down`) : null;
101
100
  // Skip if spin not selected
102
101
  if (selected_spins && !selected_spins.includes(spin))
103
102
  continue;
@@ -138,8 +137,8 @@ export function extract_fermi_surface(band_data, options = {}) {
138
137
  // Compute Fermi velocities if requested
139
138
  if (compute_velocities && band_data.velocities) {
140
139
  isosurface.properties = compute_fermi_velocities(isosurface, band_data.velocities[spin_idx][band_idx], band_data.k_lattice, band_data.k_grid);
141
- isosurface.avg_velocity = isosurface.properties.reduce((s, v) => s + v, 0) /
142
- isosurface.properties.length;
140
+ isosurface.avg_velocity =
141
+ isosurface.properties.reduce((s, v) => s + v, 0) / isosurface.properties.length;
143
142
  }
144
143
  // Compute dimensionality if requested
145
144
  if (compute_dimensionality) {
@@ -309,7 +308,7 @@ function analyze_surface_topology(surface, bz_data) {
309
308
  }
310
309
  // Compute 2D Fermi slice along a specified plane
311
310
  export function compute_fermi_slice(fermi_data, options = {}) {
312
- const { miller_indices = [0, 0, 1], distance = 0, } = options;
311
+ const { miller_indices = [0, 0, 1], distance = 0 } = options;
313
312
  // Validate miller indices are not all zero
314
313
  if (miller_indices[0] === 0 && miller_indices[1] === 0 && miller_indices[2] === 0) {
315
314
  throw new Error(`Invalid miller indices [0, 0, 0]: at least one index must be non-zero to define a plane`);
@@ -336,7 +335,7 @@ export function compute_fermi_slice(fermi_data, options = {}) {
336
335
  k_lattice_2d: [in_plane_u, in_plane_v],
337
336
  metadata: {
338
337
  n_lines: isolines.length,
339
- has_properties: isolines.some((l) => l.properties !== undefined),
338
+ has_properties: isolines.some((line) => line.properties !== undefined),
340
339
  },
341
340
  };
342
341
  }
@@ -359,8 +358,9 @@ function compute_edge_intersection(surface, vertex_distances, v0_idx, v1_idx) {
359
358
  ];
360
359
  let property;
361
360
  if (surface.properties) {
362
- property = surface.properties[v0_idx] +
363
- t * (surface.properties[v1_idx] - surface.properties[v0_idx]);
361
+ property =
362
+ surface.properties[v0_idx] +
363
+ t * (surface.properties[v1_idx] - surface.properties[v0_idx]);
364
364
  }
365
365
  return { point, property };
366
366
  }
@@ -397,10 +397,7 @@ function slice_surface_with_plane(surface, plane_normal, plane_distance, in_plan
397
397
  face_segments.push({
398
398
  face_idx,
399
399
  edge_keys: [crossing_edges[0].edge_key, crossing_edges[1].edge_key],
400
- points: [
401
- crossing_edges[0].intersection.point,
402
- crossing_edges[1].intersection.point,
403
- ],
400
+ points: [crossing_edges[0].intersection.point, crossing_edges[1].intersection.point],
404
401
  properties: surface.properties
405
402
  ? [
406
403
  crossing_edges[0].intersection.property ?? 0,
@@ -487,8 +484,7 @@ function slice_surface_with_plane(surface, plane_normal, plane_distance, in_plan
487
484
  start_segment.points[0],
488
485
  ...forward_points,
489
486
  ];
490
- const contour_props = backward_props && forward_props &&
491
- start_segment.properties
487
+ const contour_props = backward_props && forward_props && start_segment.properties
492
488
  ? [...backward_props, start_segment.properties[0], ...forward_props]
493
489
  : undefined;
494
490
  // Check if contour is closed
@@ -498,10 +494,10 @@ function slice_surface_with_plane(surface, plane_normal, plane_distance, in_plan
498
494
  // Project to 2D (inlined dot product for speed)
499
495
  const points_2d = new Array(contour_points.length);
500
496
  for (let idx = 0; idx < contour_points.length; idx++) {
501
- const p = contour_points[idx];
497
+ const point = contour_points[idx];
502
498
  points_2d[idx] = [
503
- p[0] * ux + p[1] * uy + p[2] * uz,
504
- p[0] * vx + p[1] * vy + p[2] * vz,
499
+ point[0] * ux + point[1] * uy + point[2] * uz,
500
+ point[0] * vx + point[1] * vy + point[2] * vz,
505
501
  ];
506
502
  }
507
503
  isolines.push({
@@ -1,8 +1,6 @@
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
+ const parse_number_tokens = (line) => line.split(/\s+/).filter(Boolean);
6
4
  // Parse whitespace-separated floats from a line (optimized with unary +)
7
5
  function parse_floats(line) {
8
6
  return parse_number_tokens(line).map((part) => +part);
@@ -118,7 +116,7 @@ function parse_bxsf(content) {
118
116
  const lower = line.toLowerCase();
119
117
  if (lower.includes(`fermi`) && lower.includes(`energy`)) {
120
118
  // Match patterns like "Fermi Energy = 5.123" or "fermi_energy: -0.5"
121
- const match = line.match(/(?:=|:)\s*([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/i);
119
+ const match = /(?:=|:)\s*([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/i.exec(line);
122
120
  if (match) {
123
121
  fermi_energy = parseFloat(match[1]);
124
122
  break;
@@ -138,7 +136,10 @@ function parse_bxsf(content) {
138
136
  // Parse FRMSF format used by FermiSurfer
139
137
  // Format: https://mitsuaki1987.github.io/fermisurfer/en/_build/html/ops.html
140
138
  function parse_frmsf(content) {
141
- const lines = content.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
139
+ const lines = content
140
+ .split(/\r?\n/)
141
+ .map((line) => line.trim())
142
+ .filter(Boolean);
142
143
  let line_idx = 0;
143
144
  // Line 1: grid dimensions (ng[0] ng[1] ng[2])
144
145
  const grid_dims = parse_ints(lines[line_idx++]);
@@ -164,9 +165,15 @@ function parse_frmsf(content) {
164
165
  // Lines 4-6: reciprocal lattice vectors (in Bohr^-1, convert to Å^-1)
165
166
  const inv_bohr = 1 / constants.BOHR_TO_ANGSTROM;
166
167
  const k_lattice = [
167
- parse_floats(lines[line_idx++]).slice(0, 3).map((val) => val * inv_bohr),
168
- parse_floats(lines[line_idx++]).slice(0, 3).map((val) => val * inv_bohr),
169
- parse_floats(lines[line_idx++]).slice(0, 3).map((val) => val * inv_bohr),
168
+ parse_floats(lines[line_idx++])
169
+ .slice(0, 3)
170
+ .map((val) => val * inv_bohr),
171
+ parse_floats(lines[line_idx++])
172
+ .slice(0, 3)
173
+ .map((val) => val * inv_bohr),
174
+ parse_floats(lines[line_idx++])
175
+ .slice(0, 3)
176
+ .map((val) => val * inv_bohr),
170
177
  ];
171
178
  const [nx, ny, nz] = k_grid;
172
179
  const total_points = nx * ny * nz;
@@ -276,7 +283,8 @@ function parse_fermi_json(content) {
276
283
  throw new Error(`Invalid FermiSurfaceData JSON: isosurfaces array present but missing required fields`);
277
284
  }
278
285
  // Check if it's IFermi format (isosurfaces is an object keyed by band index)
279
- if (data[`@class`] === `FermiSurface` && data.isosurfaces &&
286
+ if (data[`@class`] === `FermiSurface` &&
287
+ data.isosurfaces &&
280
288
  typeof data.isosurfaces === `object`) {
281
289
  return parse_ifermi_surface(data);
282
290
  }
@@ -322,7 +330,11 @@ function parse_ifermi_surface(data) {
322
330
  // Extract reciprocal lattice
323
331
  const k_lattice = reciprocal_space?.reciprocal_lattice
324
332
  ? reciprocal_space.reciprocal_lattice
325
- : [[1, 0, 0], [0, 1, 0], [0, 0, 1]];
333
+ : [
334
+ [1, 0, 0],
335
+ [0, 1, 0],
336
+ [0, 0, 1],
337
+ ];
326
338
  // Convert IFermi isosurfaces to our format
327
339
  const isosurfaces = [];
328
340
  const band_indices = new Set();
@@ -450,8 +462,7 @@ export function parse_fermi_file(content, filename) {
450
462
  // Try auto-detection based on content
451
463
  const trimmed = content.trim();
452
464
  // BXSF format detection
453
- if (trimmed.includes(`BEGIN_BLOCK_BANDGRID_3D`) ||
454
- trimmed.includes(`BEGIN_BANDGRID_3D`)) {
465
+ if (trimmed.includes(`BEGIN_BLOCK_BANDGRID_3D`) || trimmed.includes(`BEGIN_BANDGRID_3D`)) {
455
466
  try {
456
467
  return parse_bxsf(content);
457
468
  }
@@ -471,8 +482,7 @@ export function parse_fermi_file(content, filename) {
471
482
  // FRMSF format detection (starts with grid dimensions)
472
483
  const first_line = trimmed.split(/\r?\n/)[0];
473
484
  const first_tokens = first_line.split(/\s+/).filter(Boolean);
474
- if (first_tokens.length === 3 &&
475
- first_tokens.every((t) => /^\d+$/.test(t))) {
485
+ if (first_tokens.length === 3 && first_tokens.every((t) => /^\d+$/.test(t))) {
476
486
  try {
477
487
  return parse_frmsf(content);
478
488
  }
@@ -1,11 +1,6 @@
1
1
  // Identity 4x4 matrix (column-major for Three.js)
2
- // deno-fmt-ignore
3
- export const IDENTITY_4x4 = [
4
- 1, 0, 0, 0,
5
- 0, 1, 0, 0,
6
- 0, 0, 1, 0,
7
- 0, 0, 0, 1,
8
- ];
2
+ // oxfmt-ignore
3
+ export const IDENTITY_4x4 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
9
4
  // All permutations of (0, 1, 2) for axis swaps
10
5
  const AXIS_PERMUTATIONS = [
11
6
  [0, 1, 2],
@@ -106,10 +106,8 @@ export interface FermiHoverData {
106
106
  symmetry_index?: number;
107
107
  }
108
108
  export type FermiTooltipConfig = TooltipConfig<FermiHoverData>;
109
- export type FermiTooltipProp = TooltipProp<FermiHoverData, [
110
- {
111
- hover_data: FermiHoverData;
112
- }
113
- ]>;
109
+ export type FermiTooltipProp = TooltipProp<FermiHoverData, [{
110
+ hover_data: FermiHoverData;
111
+ }]>;
114
112
  export declare const is_fermi_surface_data: (data: BandGridData | FermiSurfaceData | null) => data is FermiSurfaceData;
115
113
  export declare const is_band_grid_data: (data: BandGridData | FermiSurfaceData | null) => data is BandGridData;