matterviz 0.1.12 → 0.1.13

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 (195) hide show
  1. package/dist/ContextMenu.svelte +1 -1
  2. package/dist/ContextMenu.svelte.d.ts +3 -3
  3. package/dist/DraggablePane.svelte +10 -5
  4. package/dist/DraggablePane.svelte.d.ts +3 -3
  5. package/dist/FilePicker.svelte.d.ts +3 -3
  6. package/dist/Icon.svelte.d.ts +3 -3
  7. package/dist/Nav.svelte +76 -31
  8. package/dist/SettingsSection.svelte.d.ts +3 -3
  9. package/dist/Spinner.svelte +18 -29
  10. package/dist/Spinner.svelte.d.ts +3 -3
  11. package/dist/app.css +4 -0
  12. package/dist/bands/Bands.svelte +216 -0
  13. package/dist/bands/Bands.svelte.d.ts +16 -0
  14. package/dist/bands/BandsAndDos.svelte +26 -0
  15. package/dist/bands/BandsAndDos.svelte.d.ts +16 -0
  16. package/dist/bands/Dos.svelte +124 -0
  17. package/dist/bands/Dos.svelte.d.ts +18 -0
  18. package/dist/bands/helpers.d.ts +11 -0
  19. package/dist/bands/helpers.js +195 -0
  20. package/dist/bands/index.d.ts +5 -0
  21. package/dist/bands/index.js +6 -0
  22. package/dist/bands/types.d.ts +54 -0
  23. package/dist/bands/types.js +2 -0
  24. package/dist/brillouin/BrillouinZone.svelte +373 -0
  25. package/dist/brillouin/BrillouinZone.svelte.d.ts +57 -0
  26. package/dist/brillouin/BrillouinZoneControls.svelte +88 -0
  27. package/dist/brillouin/BrillouinZoneControls.svelte.d.ts +14 -0
  28. package/dist/brillouin/BrillouinZoneExportPane.svelte +129 -0
  29. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +15 -0
  30. package/dist/brillouin/BrillouinZoneInfoPane.svelte +115 -0
  31. package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +13 -0
  32. package/dist/brillouin/BrillouinZoneScene.svelte +180 -0
  33. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +34 -0
  34. package/dist/brillouin/compute.d.ts +7 -0
  35. package/dist/brillouin/compute.js +215 -0
  36. package/dist/brillouin/index.d.ts +7 -0
  37. package/dist/brillouin/index.js +7 -0
  38. package/dist/brillouin/types.d.ts +23 -0
  39. package/dist/brillouin/types.js +1 -0
  40. package/dist/composition/BarChart.svelte.d.ts +3 -3
  41. package/dist/composition/BubbleChart.svelte +7 -6
  42. package/dist/composition/BubbleChart.svelte.d.ts +3 -3
  43. package/dist/composition/Composition.svelte.d.ts +3 -3
  44. package/dist/composition/PieChart.svelte +1 -1
  45. package/dist/composition/PieChart.svelte.d.ts +3 -3
  46. package/dist/composition/parse.d.ts +3 -3
  47. package/dist/coordination/CoordinationBarPlot.svelte +241 -0
  48. package/dist/coordination/CoordinationBarPlot.svelte.d.ts +29 -0
  49. package/dist/coordination/calc-coordination.d.ts +15 -0
  50. package/dist/coordination/calc-coordination.js +66 -0
  51. package/dist/coordination/index.d.ts +8 -0
  52. package/dist/coordination/index.js +7 -0
  53. package/dist/element/BohrAtom.svelte.d.ts +3 -3
  54. package/dist/element/ElementHeading.svelte.d.ts +3 -3
  55. package/dist/element/ElementPhoto.svelte.d.ts +3 -3
  56. package/dist/element/ElementStats.svelte.d.ts +3 -3
  57. package/dist/element/ElementTile.svelte +1 -1
  58. package/dist/element/ElementTile.svelte.d.ts +4 -4
  59. package/dist/element/Nucleus.svelte.d.ts +3 -3
  60. package/dist/icons.d.ts +4 -0
  61. package/dist/icons.js +4 -0
  62. package/dist/index.d.ts +5 -1
  63. package/dist/index.js +5 -1
  64. package/dist/io/export.d.ts +1 -6
  65. package/dist/io/export.js +12 -12
  66. package/dist/labels.d.ts +19 -0
  67. package/dist/labels.js +59 -0
  68. package/dist/math.d.ts +7 -2
  69. package/dist/math.js +24 -12
  70. package/dist/periodic-table/PeriodicTable.svelte.d.ts +3 -3
  71. package/dist/periodic-table/PeriodicTableControls.svelte.d.ts +3 -3
  72. package/dist/periodic-table/PropertySelect.svelte +1 -1
  73. package/dist/periodic-table/PropertySelect.svelte.d.ts +5 -4
  74. package/dist/periodic-table/TableInset.svelte.d.ts +3 -3
  75. package/dist/phase-diagram/PhaseDiagram2D.svelte +44 -107
  76. package/dist/phase-diagram/PhaseDiagram2D.svelte.d.ts +7 -27
  77. package/dist/phase-diagram/PhaseDiagram3D.svelte +67 -170
  78. package/dist/phase-diagram/PhaseDiagram3D.svelte.d.ts +7 -31
  79. package/dist/phase-diagram/PhaseDiagram4D.svelte +87 -145
  80. package/dist/phase-diagram/PhaseDiagram4D.svelte.d.ts +5 -28
  81. package/dist/phase-diagram/PhaseDiagramControls.svelte +9 -9
  82. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +6 -6
  83. package/dist/phase-diagram/PhaseDiagramInfoPane.svelte +4 -4
  84. package/dist/phase-diagram/PhaseDiagramInfoPane.svelte.d.ts +5 -5
  85. package/dist/phase-diagram/PhaseDiagramStats.svelte +9 -16
  86. package/dist/phase-diagram/PhaseDiagramStats.svelte.d.ts +3 -3
  87. package/dist/phase-diagram/StructurePopup.svelte.d.ts +3 -3
  88. package/dist/phase-diagram/barycentric-coords.js +13 -24
  89. package/dist/phase-diagram/helpers.d.ts +12 -14
  90. package/dist/phase-diagram/helpers.js +70 -23
  91. package/dist/phase-diagram/index.d.ts +58 -0
  92. package/dist/phase-diagram/index.js +44 -0
  93. package/dist/phase-diagram/thermodynamics.js +2 -3
  94. package/dist/phase-diagram/types.d.ts +3 -8
  95. package/dist/plot/BarPlot.svelte +474 -240
  96. package/dist/plot/BarPlot.svelte.d.ts +16 -37
  97. package/dist/plot/BarPlotControls.svelte +33 -201
  98. package/dist/plot/BarPlotControls.svelte.d.ts +11 -22
  99. package/dist/plot/ColorBar.svelte.d.ts +3 -3
  100. package/dist/plot/ColorScaleSelect.svelte +1 -1
  101. package/dist/plot/ColorScaleSelect.svelte.d.ts +3 -3
  102. package/dist/plot/ElementScatter.svelte +5 -5
  103. package/dist/plot/ElementScatter.svelte.d.ts +8 -8
  104. package/dist/plot/Histogram.svelte +318 -170
  105. package/dist/plot/Histogram.svelte.d.ts +21 -41
  106. package/dist/plot/HistogramControls.svelte +115 -347
  107. package/dist/plot/HistogramControls.svelte.d.ts +13 -28
  108. package/dist/plot/Line.svelte +1 -1
  109. package/dist/plot/Line.svelte.d.ts +4 -4
  110. package/dist/plot/PlotControls.svelte +280 -0
  111. package/dist/plot/PlotControls.svelte.d.ts +4 -0
  112. package/dist/plot/PlotLegend.svelte +9 -24
  113. package/dist/plot/PlotLegend.svelte.d.ts +3 -3
  114. package/dist/plot/ScatterPlot.svelte +536 -571
  115. package/dist/plot/ScatterPlot.svelte.d.ts +18 -90
  116. package/dist/plot/ScatterPlotControls.svelte +108 -316
  117. package/dist/plot/ScatterPlotControls.svelte.d.ts +11 -38
  118. package/dist/plot/ScatterPoint.svelte +1 -1
  119. package/dist/plot/ScatterPoint.svelte.d.ts +5 -5
  120. package/dist/plot/SpacegroupBarPlot.svelte +235 -0
  121. package/dist/plot/SpacegroupBarPlot.svelte.d.ts +9 -0
  122. package/dist/plot/data-transform.d.ts +2 -2
  123. package/dist/plot/data-transform.js +1 -5
  124. package/dist/plot/index.d.ts +12 -200
  125. package/dist/plot/index.js +14 -6
  126. package/dist/plot/layout.d.ts +10 -16
  127. package/dist/plot/layout.js +40 -25
  128. package/dist/plot/scales.d.ts +7 -8
  129. package/dist/plot/scales.js +22 -7
  130. package/dist/plot/types.d.ts +303 -0
  131. package/dist/plot/types.js +1 -0
  132. package/dist/rdf/RdfPlot.svelte +156 -0
  133. package/dist/rdf/RdfPlot.svelte.d.ts +20 -0
  134. package/dist/rdf/calc-rdf.d.ts +4 -0
  135. package/dist/rdf/calc-rdf.js +107 -0
  136. package/dist/rdf/index.d.ts +22 -0
  137. package/dist/rdf/index.js +2 -0
  138. package/dist/settings.d.ts +86 -75
  139. package/dist/settings.js +257 -155
  140. package/dist/structure/Bond.svelte +126 -110
  141. package/dist/structure/Bond.svelte.d.ts +7 -20
  142. package/dist/structure/CanvasTooltip.svelte.d.ts +4 -4
  143. package/dist/structure/Cylinder.svelte +29 -0
  144. package/dist/structure/Cylinder.svelte.d.ts +10 -0
  145. package/dist/structure/Lattice.svelte +1 -2
  146. package/dist/structure/Lattice.svelte.d.ts +3 -3
  147. package/dist/structure/Structure.svelte +23 -8
  148. package/dist/structure/Structure.svelte.d.ts +10 -7
  149. package/dist/structure/StructureControls.svelte +25 -134
  150. package/dist/structure/StructureControls.svelte.d.ts +4 -9
  151. package/dist/structure/StructureExportPane.svelte +188 -0
  152. package/dist/structure/StructureExportPane.svelte.d.ts +17 -0
  153. package/dist/structure/StructureInfoPane.svelte.d.ts +3 -3
  154. package/dist/structure/StructureLegend.svelte +91 -27
  155. package/dist/structure/StructureLegend.svelte.d.ts +5 -4
  156. package/dist/structure/StructureScene.svelte +93 -100
  157. package/dist/structure/StructureScene.svelte.d.ts +15 -12
  158. package/dist/structure/Vector.svelte +19 -25
  159. package/dist/structure/Vector.svelte.d.ts +3 -3
  160. package/dist/structure/bonding.d.ts +16 -14
  161. package/dist/structure/bonding.js +207 -216
  162. package/dist/structure/export.d.ts +3 -0
  163. package/dist/structure/export.js +120 -0
  164. package/dist/structure/index.d.ts +15 -1
  165. package/dist/structure/index.js +2 -0
  166. package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -3
  167. package/dist/symmetry/index.d.ts +1 -0
  168. package/dist/symmetry/index.js +1 -0
  169. package/dist/symmetry/spacegroups.d.ts +9 -0
  170. package/dist/symmetry/spacegroups.js +397 -0
  171. package/dist/theme/ThemeControl.svelte.d.ts +3 -3
  172. package/dist/theme/themes.js +2 -16
  173. package/dist/trajectory/Trajectory.svelte +52 -78
  174. package/dist/trajectory/Trajectory.svelte.d.ts +5 -5
  175. package/dist/trajectory/TrajectoryError.svelte.d.ts +3 -3
  176. package/dist/trajectory/TrajectoryExportPane.svelte +1 -1
  177. package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +5 -5
  178. package/dist/trajectory/TrajectoryInfoPane.svelte +1 -1
  179. package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -3
  180. package/dist/trajectory/extract.js +2 -1
  181. package/dist/trajectory/index.d.ts +1 -1
  182. package/dist/trajectory/index.js +1 -1
  183. package/dist/trajectory/parse.js +21 -14
  184. package/dist/utils.d.ts +1 -0
  185. package/dist/utils.js +17 -0
  186. package/dist/xrd/XrdPlot.svelte +14 -11
  187. package/dist/xrd/XrdPlot.svelte.d.ts +6 -5
  188. package/package.json +20 -12
  189. package/readme.md +1 -1
  190. package/dist/material/MaterialCard.svelte +0 -123
  191. package/dist/material/MaterialCard.svelte.d.ts +0 -9
  192. package/dist/material/index.d.ts +0 -1
  193. package/dist/material/index.js +0 -1
  194. package/dist/plot/formatting.d.ts +0 -7
  195. package/dist/plot/formatting.js +0 -53
@@ -5,10 +5,12 @@ import type { Pbc } from './pbc';
5
5
  export { default as Bond } from './Bond.svelte';
6
6
  export * as bonding_strategies from './bonding';
7
7
  export { default as CanvasTooltip } from './CanvasTooltip.svelte';
8
+ export { default as Cylinder } from './Cylinder.svelte';
8
9
  export { default as Lattice } from './Lattice.svelte';
9
10
  export * from './pbc';
10
11
  export { default as Structure } from './Structure.svelte';
11
12
  export { default as StructureControls } from './StructureControls.svelte';
13
+ export { default as StructureExportPane } from './StructureExportPane.svelte';
12
14
  export { default as StructureInfoPane } from './StructureInfoPane.svelte';
13
15
  export { default as StructureLegend } from './StructureLegend.svelte';
14
16
  export { default as StructureScene } from './StructureScene.svelte';
@@ -75,6 +77,7 @@ export type BondPair = {
75
77
  site_idx_2: number;
76
78
  bond_length: number;
77
79
  strength: number;
80
+ transform_matrix: Float32Array;
78
81
  };
79
82
  export type IdStructure = PymatgenStructure & {
80
83
  id: string;
@@ -86,7 +89,7 @@ export type AnyStructure = PymatgenStructure | PymatgenMolecule;
86
89
  export type AnyStructureGraph = AnyStructure & {
87
90
  graph: Graph;
88
91
  };
89
- export declare function get_elem_amounts(structure: AnyStructure): Partial<Record<"K" | "H" | "He" | "Li" | "Be" | "B" | "C" | "N" | "O" | "F" | "Ne" | "Na" | "Mg" | "Al" | "Si" | "P" | "S" | "Cl" | "Ar" | "Ca" | "Sc" | "Ti" | "V" | "Cr" | "Mn" | "Fe" | "Co" | "Ni" | "Cu" | "Zn" | "Ga" | "Ge" | "As" | "Se" | "Br" | "Kr" | "Rb" | "Sr" | "Y" | "Zr" | "Nb" | "Mo" | "Tc" | "Ru" | "Rh" | "Pd" | "Ag" | "Cd" | "In" | "Sn" | "Sb" | "Te" | "I" | "Xe" | "Cs" | "Ba" | "La" | "Ce" | "Pr" | "Nd" | "Pm" | "Sm" | "Eu" | "Gd" | "Tb" | "Dy" | "Ho" | "Er" | "Tm" | "Yb" | "Lu" | "Hf" | "Ta" | "W" | "Re" | "Os" | "Ir" | "Pt" | "Au" | "Hg" | "Tl" | "Pb" | "Bi" | "Po" | "At" | "Rn" | "Fr" | "Ra" | "Ac" | "Th" | "Pa" | "U" | "Np" | "Pu" | "Am" | "Cm" | "Bk" | "Cf" | "Es" | "Fm" | "Md" | "No" | "Lr" | "Rf" | "Db" | "Sg" | "Bh" | "Hs" | "Mt" | "Ds" | "Rg" | "Cn" | "Nh" | "Fl" | "Mc" | "Lv" | "Ts" | "Og", number>>;
92
+ export declare function get_elem_amounts(structure: AnyStructure): Partial<Record<"S" | "K" | "H" | "He" | "Li" | "Be" | "B" | "C" | "N" | "O" | "F" | "Ne" | "Na" | "Mg" | "Al" | "Si" | "P" | "Cl" | "Ar" | "Ca" | "Sc" | "Ti" | "V" | "Cr" | "Mn" | "Fe" | "Co" | "Ni" | "Cu" | "Zn" | "Ga" | "Ge" | "As" | "Se" | "Br" | "Kr" | "Rb" | "Sr" | "Y" | "Zr" | "Nb" | "Mo" | "Tc" | "Ru" | "Rh" | "Pd" | "Ag" | "Cd" | "In" | "Sn" | "Sb" | "Te" | "I" | "Xe" | "Cs" | "Ba" | "La" | "Ce" | "Pr" | "Nd" | "Pm" | "Sm" | "Eu" | "Gd" | "Tb" | "Dy" | "Ho" | "Er" | "Tm" | "Yb" | "Lu" | "Hf" | "Ta" | "W" | "Re" | "Os" | "Ir" | "Pt" | "Au" | "Hg" | "Tl" | "Pb" | "Bi" | "Po" | "At" | "Rn" | "Fr" | "Ra" | "Ac" | "Th" | "Pa" | "U" | "Np" | "Pu" | "Am" | "Cm" | "Bk" | "Cf" | "Es" | "Fm" | "Md" | "No" | "Lr" | "Rf" | "Db" | "Sg" | "Bh" | "Hs" | "Mt" | "Ds" | "Rg" | "Cn" | "Nh" | "Fl" | "Mc" | "Lv" | "Ts" | "Og", number>>;
90
93
  export declare function format_chemical_formula(structure: AnyStructure, sort_fn: (symbols: ElementSymbol[]) => ElementSymbol[]): string;
91
94
  export declare function alphabetical_formula(structure: AnyStructure): string;
92
95
  export declare function electro_neg_formula(structure: AnyStructure): string;
@@ -108,3 +111,14 @@ export interface StructureHandlerData {
108
111
  scene_props?: ComponentProps<typeof StructureScene>;
109
112
  lattice_props?: ComponentProps<typeof Lattice>;
110
113
  }
114
+ export interface BondInstance {
115
+ matrix: Float32Array;
116
+ color_start: string;
117
+ color_end: string;
118
+ }
119
+ export interface BondGroupWithGradients {
120
+ thickness: number;
121
+ instances: BondInstance[];
122
+ ambient_light?: number;
123
+ directional_light?: number;
124
+ }
@@ -4,10 +4,12 @@ import * as math from '../math';
4
4
  export { default as Bond } from './Bond.svelte';
5
5
  export * as bonding_strategies from './bonding';
6
6
  export { default as CanvasTooltip } from './CanvasTooltip.svelte';
7
+ export { default as Cylinder } from './Cylinder.svelte';
7
8
  export { default as Lattice } from './Lattice.svelte';
8
9
  export * from './pbc';
9
10
  export { default as Structure } from './Structure.svelte';
10
11
  export { default as StructureControls } from './StructureControls.svelte';
12
+ export { default as StructureExportPane } from './StructureExportPane.svelte';
11
13
  export { default as StructureInfoPane } from './StructureInfoPane.svelte';
12
14
  export { default as StructureLegend } from './StructureLegend.svelte';
13
15
  export { default as StructureScene } from './StructureScene.svelte';
@@ -1,11 +1,11 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
2
  import type { WyckoffPos } from '.';
3
- interface Props extends HTMLAttributes<HTMLTableElement> {
3
+ type $$ComponentProps = HTMLAttributes<HTMLTableElement> & {
4
4
  wyckoff_positions: WyckoffPos[];
5
5
  on_hover?: (site_indices: number[] | null) => void;
6
6
  on_click?: (site_indices: number[] | null) => void;
7
7
  active_color?: string;
8
- }
9
- declare const WyckoffTable: import("svelte").Component<Props, {}, "">;
8
+ };
9
+ declare const WyckoffTable: import("svelte").Component<$$ComponentProps, {}, "">;
10
10
  type WyckoffTable = ReturnType<typeof WyckoffTable>;
11
11
  export default WyckoffTable;
@@ -1,6 +1,7 @@
1
1
  import type { Vec3 } from '..';
2
2
  import type { AnyStructure, PymatgenStructure } from '../structure';
3
3
  import type { MoyoDataset } from '@spglib/moyo-wasm';
4
+ export * from './spacegroups';
4
5
  export { default as WyckoffTable } from './WyckoffTable.svelte';
5
6
  export type WyckoffPos = {
6
7
  wyckoff: string;
@@ -1,6 +1,7 @@
1
1
  import { atomic_number_to_symbol, symbol_to_atomic_number } from '../composition/parse';
2
2
  import init, { analyze_cell } from '@spglib/moyo-wasm';
3
3
  import moyo_wasm_url from '@spglib/moyo-wasm/moyo_wasm_bg.wasm?url';
4
+ export * from './spacegroups';
4
5
  export { default as WyckoffTable } from './WyckoffTable.svelte';
5
6
  let initialized = false;
6
7
  export async function ensure_moyo_wasm_ready() {
@@ -0,0 +1,9 @@
1
+ export declare const CRYSTAL_SYSTEM_RANGES: Record<CrystalSystem, [number, number]>;
2
+ export declare const CRYSTAL_SYSTEM_COLORS: Record<CrystalSystem, string>;
3
+ export declare const CRYSTAL_SYSTEMS: readonly ["triclinic", "monoclinic", "orthorhombic", "tetragonal", "trigonal", "hexagonal", "cubic"];
4
+ export type CrystalSystem = (typeof CRYSTAL_SYSTEMS)[number];
5
+ export declare function spacegroup_number_to_crystal_system(spacegroup: number): CrystalSystem | null;
6
+ export declare function spacegroup_to_crystal_system(spacegroup: number | string): CrystalSystem | null;
7
+ export declare function normalize_spacegroup(spacegroup: number | string): number | null;
8
+ export declare const SPACEGROUP_SYMBOL_TO_NUM: Record<string, number>;
9
+ export declare const SPACEGROUP_NUM_TO_SYMBOL: Record<number, string>;
@@ -0,0 +1,397 @@
1
+ // Space group to crystal system mappings and utilities
2
+ // Crystal system ranges: [min, max] space group numbers (inclusive)
3
+ export const CRYSTAL_SYSTEM_RANGES = {
4
+ triclinic: [1, 2],
5
+ monoclinic: [3, 15],
6
+ orthorhombic: [16, 74],
7
+ tetragonal: [75, 142],
8
+ trigonal: [143, 167],
9
+ hexagonal: [168, 194],
10
+ cubic: [195, 230],
11
+ };
12
+ // Colors matching pymatviz's spacegroup_bar
13
+ export const CRYSTAL_SYSTEM_COLORS = {
14
+ triclinic: `red`,
15
+ monoclinic: `teal`,
16
+ orthorhombic: `blue`,
17
+ tetragonal: `green`,
18
+ trigonal: `orange`,
19
+ hexagonal: `purple`,
20
+ cubic: `darkred`,
21
+ };
22
+ // Ordered list of crystal systems (by space group number range)
23
+ export const CRYSTAL_SYSTEMS = [
24
+ `triclinic`,
25
+ `monoclinic`,
26
+ `orthorhombic`,
27
+ `tetragonal`,
28
+ `trigonal`,
29
+ `hexagonal`,
30
+ `cubic`,
31
+ ];
32
+ // Convert space group number to crystal system
33
+ export function spacegroup_number_to_crystal_system(spacegroup) {
34
+ for (const [system, [min, max]] of Object.entries(CRYSTAL_SYSTEM_RANGES)) {
35
+ if (spacegroup >= min && spacegroup <= max) {
36
+ return system;
37
+ }
38
+ }
39
+ return null;
40
+ }
41
+ // Convert space group (number or symbol) to crystal system
42
+ export function spacegroup_to_crystal_system(spacegroup) {
43
+ if (typeof spacegroup === `number`) {
44
+ return spacegroup_number_to_crystal_system(spacegroup);
45
+ }
46
+ // Try to parse as symbol
47
+ const number = SPACEGROUP_SYMBOL_TO_NUM[spacegroup];
48
+ if (number !== undefined) {
49
+ return spacegroup_number_to_crystal_system(number);
50
+ }
51
+ // Try to parse string as number
52
+ const parsed = parseInt(spacegroup, 10);
53
+ if (!isNaN(parsed)) {
54
+ return spacegroup_number_to_crystal_system(parsed);
55
+ }
56
+ return null;
57
+ }
58
+ // Normalize space group input to number
59
+ export function normalize_spacegroup(spacegroup) {
60
+ if (typeof spacegroup === `number`) {
61
+ return spacegroup >= 1 && spacegroup <= 230 ? spacegroup : null;
62
+ }
63
+ return SPACEGROUP_SYMBOL_TO_NUM[spacegroup] ?? null;
64
+ }
65
+ export const SPACEGROUP_SYMBOL_TO_NUM = {
66
+ // Triclinic
67
+ 'P1': 1,
68
+ 'P-1': 2,
69
+ // Monoclinic
70
+ 'P2': 3,
71
+ 'P2_1': 4,
72
+ 'C2': 5,
73
+ 'Pm': 6,
74
+ 'Pc': 7,
75
+ 'Cm': 8,
76
+ 'Cc': 9,
77
+ 'P2/m': 10,
78
+ 'P2_1/m': 11,
79
+ 'C2/m': 12,
80
+ 'P2/c': 13,
81
+ 'P2_1/c': 14,
82
+ 'C2/c': 15,
83
+ // Orthorhombic
84
+ 'P222': 16,
85
+ 'P222_1': 17,
86
+ 'P2_12_12': 18,
87
+ 'P2_12_12_1': 19,
88
+ 'C222_1': 20,
89
+ 'C222': 21,
90
+ 'F222': 22,
91
+ 'I222': 23,
92
+ 'I2_12_12_1': 24,
93
+ 'Pmm2': 25,
94
+ 'Pmc2_1': 26,
95
+ 'Pcc2': 27,
96
+ 'Pma2': 28,
97
+ 'Pca2_1': 29,
98
+ 'Pnc2': 30,
99
+ 'Pmn2_1': 31,
100
+ 'Pba2': 32,
101
+ 'Pna2_1': 33,
102
+ 'Pnn2': 34,
103
+ 'Cmm2': 35,
104
+ 'Cmc2_1': 36,
105
+ 'Ccc2': 37,
106
+ 'Amm2': 38,
107
+ 'Aem2': 39,
108
+ 'Ama2': 40,
109
+ 'Aea2': 41,
110
+ 'Fmm2': 42,
111
+ 'Fdd2': 43,
112
+ 'Imm2': 44,
113
+ 'Iba2': 45,
114
+ 'Ima2': 46,
115
+ 'Pmmm': 47,
116
+ 'Pnnn': 48,
117
+ 'Pccm': 49,
118
+ 'Pban': 50,
119
+ 'Pmma': 51,
120
+ 'Pnna': 52,
121
+ 'Pmna': 53,
122
+ 'Pcca': 54,
123
+ 'Pbam': 55,
124
+ 'Pccn': 56,
125
+ 'Pbcm': 57,
126
+ 'Pnnm': 58,
127
+ 'Pmmn': 59,
128
+ 'Pbcn': 60,
129
+ 'Pbca': 61,
130
+ 'Pnma': 62,
131
+ 'Cmcm': 63,
132
+ 'Cmce': 64,
133
+ 'Cmmm': 65,
134
+ 'Cccm': 66,
135
+ 'Cmme': 67,
136
+ 'Ccce': 68,
137
+ 'Fmmm': 69,
138
+ 'Fddd': 70,
139
+ 'Immm': 71,
140
+ 'Ibam': 72,
141
+ 'Ibca': 73,
142
+ 'Imma': 74,
143
+ // Tetragonal
144
+ 'P4': 75,
145
+ 'P4_1': 76,
146
+ 'P4_2': 77,
147
+ 'P4_3': 78,
148
+ 'I4': 79,
149
+ 'I4_1': 80,
150
+ 'P-4': 81,
151
+ 'I-4': 82,
152
+ 'P4/m': 83,
153
+ 'P4_2/m': 84,
154
+ 'P4/n': 85,
155
+ 'P4_2/n': 86,
156
+ 'I4/m': 87,
157
+ 'I4_1/a': 88,
158
+ 'P422': 89,
159
+ 'P42_12': 90,
160
+ 'P4_122': 91,
161
+ 'P4_12_12': 92,
162
+ 'P4_222': 93,
163
+ 'P4_22_12': 94,
164
+ 'P4_322': 95,
165
+ 'P4_32_12': 96,
166
+ 'I422': 97,
167
+ 'I4_122': 98,
168
+ 'P4mm': 99,
169
+ 'P4bm': 100,
170
+ 'P4_2cm': 101,
171
+ 'P4_2nm': 102,
172
+ 'P4cc': 103,
173
+ 'P4nc': 104,
174
+ 'P4_2mc': 105,
175
+ 'P4_2bc': 106,
176
+ 'I4mm': 107,
177
+ 'I4cm': 108,
178
+ 'I4_1md': 109,
179
+ 'I4_1cd': 110,
180
+ 'P-42m': 111,
181
+ 'P-42c': 112,
182
+ 'P-42_1m': 113,
183
+ 'P-42_1c': 114,
184
+ 'P-4m2': 115,
185
+ 'P-4c2': 116,
186
+ 'P-4b2': 117,
187
+ 'P-4n2': 118,
188
+ 'I-4m2': 119,
189
+ 'I-4c2': 120,
190
+ 'I-42m': 121,
191
+ 'I-42d': 122,
192
+ 'P4/mmm': 123,
193
+ 'P4/mcc': 124,
194
+ 'P4/nbm': 125,
195
+ 'P4/nnc': 126,
196
+ 'P4/mbm': 127,
197
+ 'P4/mnc': 128,
198
+ 'P4/nmm': 129,
199
+ 'P4/ncc': 130,
200
+ 'P4_2/mmc': 131,
201
+ 'P4_2/mcm': 132,
202
+ 'P4_2/nbc': 133,
203
+ 'P4_2/nnm': 134,
204
+ 'P4_2/mbc': 135,
205
+ 'P4_2/mnm': 136,
206
+ 'P4_2/nmc': 137,
207
+ 'P4_2/ncm': 138,
208
+ 'I4/mmm': 139,
209
+ 'I4/mcm': 140,
210
+ 'I4_1/amd': 141,
211
+ 'I4_1/acd': 142,
212
+ 'P3': 143,
213
+ 'P3_1': 144,
214
+ 'P3_2': 145,
215
+ 'R3': 146,
216
+ 'P-3': 147,
217
+ 'R-3': 148,
218
+ // Trigonal
219
+ 'P312': 149,
220
+ 'P321': 150,
221
+ 'P3_112': 151,
222
+ 'P3_121': 152,
223
+ 'P3_212': 153,
224
+ 'P3_221': 154,
225
+ 'R32': 155,
226
+ 'P3m1': 156,
227
+ 'P31m': 157,
228
+ 'P3c1': 158,
229
+ 'P31c': 159,
230
+ 'R3m': 160,
231
+ 'R3c': 161,
232
+ 'P-31m': 162,
233
+ 'P-31c': 163,
234
+ 'P-3m1': 164,
235
+ 'P-3c1': 165,
236
+ 'R-3m': 166,
237
+ 'R-3c': 167,
238
+ // Hexagonal
239
+ 'P6': 168,
240
+ 'P6_1': 169,
241
+ 'P6_5': 170,
242
+ 'P6_2': 171,
243
+ 'P6_4': 172,
244
+ 'P6_3': 173,
245
+ 'P-6': 174,
246
+ 'P6/m': 175,
247
+ 'P6_3/m': 176,
248
+ 'P622': 177,
249
+ 'P6_122': 178,
250
+ 'P6_522': 179,
251
+ 'P6_222': 180,
252
+ 'P6_422': 181,
253
+ 'P6_322': 182,
254
+ 'P6mm': 183,
255
+ 'P6cc': 184,
256
+ 'P6_3cm': 185,
257
+ 'P6_3mc': 186,
258
+ 'P-6m2': 187,
259
+ 'P-6c2': 188,
260
+ 'P-62m': 189,
261
+ 'P-62c': 190,
262
+ 'P6/mmm': 191,
263
+ 'P6/mcc': 192,
264
+ 'P6_3/mcm': 193,
265
+ 'P6_3/mmc': 194,
266
+ // Cubic
267
+ 'P23': 195,
268
+ 'F23': 196,
269
+ 'I23': 197,
270
+ 'P2_13': 198,
271
+ 'I2_13': 199,
272
+ 'Pm-3': 200,
273
+ 'Pn-3': 201,
274
+ 'Fm-3': 202,
275
+ 'Fd-3': 203,
276
+ 'Im-3': 204,
277
+ 'Pa-3': 205,
278
+ 'Ia-3': 206,
279
+ 'P432': 207,
280
+ 'P4_232': 208,
281
+ 'F432': 209,
282
+ 'F4_132': 210,
283
+ 'I432': 211,
284
+ 'P4_332': 212,
285
+ 'P4_132': 213,
286
+ 'I4_132': 214,
287
+ 'P-43m': 215,
288
+ 'F-43m': 216,
289
+ 'I-43m': 217,
290
+ 'P-43n': 218,
291
+ 'F-43c': 219,
292
+ 'I-43d': 220,
293
+ 'Pm-3m': 221,
294
+ 'Pn-3n': 222,
295
+ 'Pm-3n': 223,
296
+ 'Pn-3m': 224,
297
+ 'Fm-3m': 225,
298
+ 'Fm-3c': 226,
299
+ 'Fd-3m': 227,
300
+ 'Fd-3c': 228,
301
+ 'Im-3m': 229,
302
+ 'Ia-3d': 230,
303
+ // Special cases
304
+ 'P121': 3,
305
+ 'P12_11': 4,
306
+ 'C121': 5,
307
+ 'P1m1': 6,
308
+ 'P1c1': 7,
309
+ 'C1m1': 8,
310
+ 'C1c1': 9,
311
+ 'P12/m1': 10,
312
+ 'P12_1/m1': 11,
313
+ 'C12/m1': 12,
314
+ 'P12/c1': 13,
315
+ 'P12_1/c1': 14,
316
+ 'C12/c1': 15,
317
+ 'P2/m2/m2/m': 47,
318
+ 'P2/n2/n2/n': 48,
319
+ 'P2/c2/c2/m': 49,
320
+ 'P2/b2/a2/n': 50,
321
+ 'P2_1/m2/m2/a': 51,
322
+ 'P2/n2_1/n2/a': 52,
323
+ 'P2/m2/n2_1/a': 53,
324
+ 'P2_1/c2/c2/a': 54,
325
+ 'P2_1/b2_1/a2/m': 55,
326
+ 'P2_1/c2_1/c2/n': 56,
327
+ 'P2/b2_1/c2_1/m': 57,
328
+ 'P2_1/n2_1/n2/m': 58,
329
+ 'P2_1/m2_1/m2/n': 59,
330
+ 'P2_1/b2/c2_1/n': 60,
331
+ 'P2_1/b2_1/c2_1/a': 61,
332
+ 'P2_1/n2_1/m2_1/a': 62,
333
+ 'C2/m2/c2_1/m': 63,
334
+ 'C2/m2/c2_1/e': 64,
335
+ 'C2/m2/m2/m': 65,
336
+ 'C2/c2/c2/m': 66,
337
+ 'C2/m2/m2/e': 67,
338
+ 'C2/c2/c2/e': 68,
339
+ 'F2/m2/m2/m': 69,
340
+ 'F2/d2/d2/d': 70,
341
+ 'I2/m2/m2/m': 71,
342
+ 'I2/b2/a2/m': 72,
343
+ 'I2/b2/c2/a': 73,
344
+ 'I2/m2/m2/a': 74,
345
+ 'P4/m2/m2/m': 123,
346
+ 'P4/m2/c2/c': 124,
347
+ 'P4/n2/b2/m': 125,
348
+ 'P4/n2/n2/c': 126,
349
+ 'P4/m2_1/bm': 127,
350
+ 'P4/m2_1/nc': 128,
351
+ 'P4/n2_1/mm': 129,
352
+ 'P4/n2_1/cc': 130,
353
+ 'P4_2/m2/m2/c': 131,
354
+ 'P4_2/m2/c2/m': 132,
355
+ 'P4_2/n2/b2/c': 133,
356
+ 'P4_2/n2/n2/m': 134,
357
+ 'P4_2/m2_1/b2/c': 135,
358
+ 'P4_2/m2_1/n2/m': 136,
359
+ 'P4_2/n2_1/m2/c': 137,
360
+ 'P4_2/n2_1/c2/m': 138,
361
+ 'I4/m2/m2/m': 139,
362
+ 'I4/m2/c2/m': 140,
363
+ 'I4_1/a2/m2/d': 141,
364
+ 'I4_1/a2/c2/d': 142,
365
+ 'P-312/m': 162,
366
+ 'P-312/c': 163,
367
+ 'P-32/m1': 164,
368
+ 'P-32/c1': 165,
369
+ 'R-32/m': 166,
370
+ 'R-32/c': 167,
371
+ 'P6/m2/m2/m': 191,
372
+ 'P6/m2/c2/c': 192,
373
+ 'P6_3/m2/c2/m': 193,
374
+ 'P6_3/m2/m2/c': 194,
375
+ 'P2/m-3': 200,
376
+ 'P2/n-3': 201,
377
+ 'F2/m-3': 202,
378
+ 'F2/d-3': 203,
379
+ 'I2/m-3': 204,
380
+ 'P2_1/a-3': 205,
381
+ 'I2_1/a-3': 206,
382
+ 'P4/m-32/m': 221,
383
+ 'P4/n-32/n': 222,
384
+ 'P4_2/m-32/n': 223,
385
+ 'P4_2/n-32/m': 224,
386
+ 'F4/m-32/m': 225,
387
+ 'F4/m-32/c': 226,
388
+ 'F4_1/d-32/m': 227,
389
+ 'F4_1/d-32/c': 228,
390
+ 'I4/m-32/m': 229,
391
+ 'I4_1/a-32/d': 230,
392
+ };
393
+ export const SPACEGROUP_NUM_TO_SYMBOL = Object.entries(SPACEGROUP_SYMBOL_TO_NUM).reduce((acc, [symbol, num]) => {
394
+ if (!acc[num])
395
+ acc[num] = symbol;
396
+ return acc;
397
+ }, {});
@@ -1,9 +1,9 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
2
  import type { ThemeMode } from './index';
3
- interface Props extends Omit<HTMLAttributes<HTMLSelectElement>, `onchange`> {
3
+ type $$ComponentProps = Omit<HTMLAttributes<HTMLSelectElement>, `onchange`> & {
4
4
  theme_mode?: ThemeMode;
5
5
  onchange?: (mode: ThemeMode) => void;
6
- }
7
- declare const ThemeControl: import("svelte").Component<Props, {}, "theme_mode">;
6
+ };
7
+ declare const ThemeControl: import("svelte").Component<$$ComponentProps, {}, "theme_mode">;
8
8
  type ThemeControl = ReturnType<typeof ThemeControl>;
9
9
  export default ThemeControl;
@@ -17,8 +17,8 @@ const page_bg_black = `#000000` // Pure black
17
17
  // Borders
18
18
  const border_light = `#d1d5db` // Gray border
19
19
  const border_dark = `#404040` // Dark gray border
20
- const border_white = `#f0f0f0` // Light border
21
- const border_black = `#202020` // Dark border
20
+ const border_white = `#d1d5db` // Light border
21
+ const border_black = `#404040` // Dark border
22
22
 
23
23
  // Accents
24
24
  const acc_light = `#4f46e5` // Indigo
@@ -246,20 +246,6 @@ const themes = {
246
246
  },
247
247
  'plot-legend-item-hover-bg-color': btn_bg(0.1, 0.1),
248
248
 
249
- // Svelte MultiSelect
250
- 'sms-options-bg': {
251
- light: `rgba(255, 255, 255, 0.95)`,
252
- dark: `rgb(20, 18, 36)`,
253
- white: `rgba(255, 255, 255, 0.98)`,
254
- black: `rgba(15, 15, 15, 0.95)`,
255
- },
256
- 'sms-active-color': {
257
- light: acc_light,
258
- dark: `cornflowerblue`,
259
- white: acc_white,
260
- black: acc_black,
261
- },
262
-
263
249
  'github-corner-color': {
264
250
  light: page_bg_light,
265
251
  dark: page_bg_dark,