Skip to content

Spectroscopy & Electronic Structure

X-ray diffraction patterns, radial distribution functions, band structures, density of states, and Brillouin zone visualization.

Source: src/lib/xrd/, src/lib/rdf/, src/lib/bands/, src/lib/brillouin/

X-Ray Diffraction (XRD)

Compute powder XRD patterns from crystal structures.

Key Functions

typescript
// Calculate XRD pattern for a structure
calculate_xrd_pattern(structure, radiation?): XrdPattern

// Compare XRD patterns across multiple structures
calculate_xrd_structure(structures, radiation?): XrdComparison

Radiation Sources

SourceWavelength (A)
Cu Ka1.5406
Mo Ka0.7107
Ag Ka0.5609
W La1.4764

Component

XrdPlot.svelte — Interactive XRD pattern display with peak labels, 2-theta range selection, and multi-structure overlay.


Radial Distribution Function (RDF)

Calculate pair correlation functions g(r) for structural analysis.

Key Functions

typescript
// RDF for a specific element pair
calculate_rdf(structure, options): RdfResult

// All pair RDFs at once
calculate_all_pair_rdfs(structure, options): Map<string, RdfResult>

Options

typescript
interface RdfOptions {
  cutoff: number          // Maximum distance (A)
  bins: number            // Number of histogram bins
  center_species?: string // Central element filter
  neighbor_species?: string // Neighbor element filter
  use_pbc: boolean        // Apply periodic boundary conditions
}

Component

RdfPlot.svelte — Line plot of g(r) vs distance with pair selection and smoothing.


Band Structure

Visualize electronic band structure E(k) along high-symmetry paths.

Components

ComponentDescription
Bands.svelteBand structure E(k) line plot
Dos.svelteDensity of states plot
BandsAndDos.svelteCombined side-by-side bands + DOS
BrillouinBandsDos.svelteBrillouin zone + bands + DOS together

Data Format

typescript
interface BandData {
  kpoints: number[][]      // k-point coordinates
  eigenvalues: number[][]  // Energy values per band per k-point
  efermi: number           // Fermi energy (eV)
  labels: string[]         // High-symmetry point labels (Gamma, X, M, etc.)
  label_positions: number[] // x-coordinates of labels
}

interface DosData {
  energies: number[]       // Energy grid (eV)
  densities: number[]      // DOS values
  efermi: number           // Fermi energy (eV)
}

Brillouin Zone

Interactive 3D visualization of the first Brillouin zone with high-symmetry points and k-paths.

Key Functions

typescript
// Compute reciprocal lattice vectors
compute_reciprocal_lattice(lattice_matrix): number[][]

// Compute Brillouin zone polyhedron
compute_brillouin_zone(reciprocal_lattice): BrillouinZone

// Identify high-symmetry k-points
compute_high_symmetry_points(lattice_type): HighSymmetryPoints

// Get k-path coordinates for band structure
get_path_coords(bz, path_labels): PathCoords

Components

ComponentDescription
BrillouinZone.svelteMain 3D viewer
BrillouinZoneScene.svelteThree.js scene with zone faces, edges, and k-points
BrillouinZoneControls.svelteToggle faces, edges, labels, paths
BrillouinZoneInfoPane.svelteReciprocal lattice parameters
BrillouinZoneExportPane.svelteExport visualization

Features

  • Transparent polyhedron rendering
  • High-symmetry point labels (Gamma, X, M, R, K, L, etc.)
  • k-path visualization along the zone
  • Interactive rotation and zoom
  • Combined view with band structure and DOS

Released under the MIT License.