Skip to main content

Differentiable ARPES simulations in JAX

Project description

diffpes

PyPI Downloads PyPI version Documentation Status tests codecov DOI Ruff ty jax_badge

JAX-based ARPES simulation toolkit with Python-native APIs.

Expanded-input workflows

The package includes expanded-input wrappers that let you call the simulator with plain arrays/scalars while still running JAX kernels.

Function mapping

  • ARPES_simulation_Novice -> diffpes.simul.simulate_novice_expanded
  • ARPES_simulation_Basic -> diffpes.simul.simulate_basic_expanded
  • ARPES_simulation_Basicplus -> diffpes.simul.simulate_basicplus_expanded
  • ARPES_simulation_Advanced -> diffpes.simul.simulate_advanced_expanded
  • ARPES_simulation_Expert -> diffpes.simul.simulate_expert_expanded
  • ARPES_simulation_SOC -> diffpes.simul.simulate_soc_expanded
  • Dynamic dispatch by level -> diffpes.simul.simulate_expanded (use level="soc" with surface_spin for SOC)

Notes

  • Default energy-axis padding behavior: min(eigenbands)-1 to max(eigenbands)+1.
  • Incident angles for expanded wrappers are interpreted in degrees.
  • Wrappers return the standard ArpesSpectrum PyTree.

Python indexing conventions

Use standard Python/NumPy indexing everywhere (zero-based, end-exclusive).

  • Non-s orbitals: slice(1, 9) -> indices 1..8
  • p orbitals: slice(1, 4) -> indices 1..3
  • d orbitals: slice(4, 9) -> indices 4..8

Do not use MATLAB-style indexing notation in Python code.

Example

import jax.numpy as jnp

from diffpes.simul import simulate_expanded

# [nkpt, nband]
eigenbands = jnp.linspace(-2.0, 0.5, 100).reshape(20, 5)
# [nkpt, nband, natom, 9]
surface_orb = jnp.ones((20, 5, 2, 9)) * 0.1

spectrum = simulate_expanded(
    level="advanced",
    eigenbands=eigenbands,
    surface_orb=surface_orb,
    ef=0.0,
    sigma=0.04,
    fidelity=2500,
    temperature=15.0,
    photon_energy=11.0,
    polarization="unpolarized",
    incident_theta=45.0,
    incident_phi=0.0,
    polarization_angle=0.0,
)

Test coverage

Test coverage measures which lines of source code are executed during tests. Run it with:

source .venv/bin/activate
pytest tests/ --cov=src/diffpes --cov-report=term-missing

To get as close to 100% as possible:

  1. Simul and types — Already well covered. Any new branch (e.g. new polarization or dispatch level) should have a corresponding test.
  2. Expanded dispatch — Test every simulate_expanded(level=...) branch (novice, basic, basicplus, advanced, expert, soc) and the unknown-level ValueError.
  3. HDF5 — Round-trip all PyTree types; test error paths (unknown type on load, missing group, unsupported type on save).
  4. VASP file readers (read_doscar, read_eigenval, read_kpoints, read_poscar, read_procar) — Add tests that call each reader on minimal in-repo fixture files (e.g. under tests/fixtures/) so the parsing code paths are executed.
  5. Plotting — Exercise the public plotting API in tests (or accept lower coverage for GUI-oriented code).
  6. Edge branches — Cover optional arguments (e.g. make_band_structure(..., kpoint_weights=...)) and error messages so one-off branches are hit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffpes-2026.6.1.tar.gz (132.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diffpes-2026.6.1-py3-none-any.whl (169.3 kB view details)

Uploaded Python 3

File details

Details for the file diffpes-2026.6.1.tar.gz.

File metadata

  • Download URL: diffpes-2026.6.1.tar.gz
  • Upload date:
  • Size: 132.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.9

File hashes

Hashes for diffpes-2026.6.1.tar.gz
Algorithm Hash digest
SHA256 3b4296c6fc15d502653ce68d1a09929ec7b9dfa60828825976bc69de3f9a1cf6
MD5 61ba7a21d0bec7b232087bf2e07b9a9d
BLAKE2b-256 1f8e6e7a6897e960e5baacb87402bee1d584989cf1f0a2a51aa44207ed1dcada

See more details on using hashes here.

File details

Details for the file diffpes-2026.6.1-py3-none-any.whl.

File metadata

  • Download URL: diffpes-2026.6.1-py3-none-any.whl
  • Upload date:
  • Size: 169.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.9

File hashes

Hashes for diffpes-2026.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0ae52e1cd191b9492c6c042290ad0fffce1bf8181b300ddc38a21b33896aa73
MD5 2173a8a3cb43f2d30b9c6a9e953c7128
BLAKE2b-256 78bf0a41de7f3546d5781de28f33563e24b267a8c226495dfb599e67a10b1dc5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page