Skip to main content

❄️ diff-em: Differentiable Cryo-EM Fitting in JAX

Tests License: MIT JAX

diff-em provides high-performance, auto-differentiable kernels for fitting atomic structures into Cryo-EM density maps. Built on JAX, it enables gradient-based optimization of coordinates directly against 3D experimental data.


🎯 Features

  • Gaussian Mixture Volumes: Represent atomic models as differentiable 3D density maps using sum-of-Gaussians (electrostatic potential approximation).
  • Cross-Correlation Kernels: Differentiable computation of map-to-model correlation coefficients (CC) for structural refinement (Rossmann, 2000).
  • Optimization Strategy: Compatible with multi-resolution fitting and neural density fields (Zhong et al., 2021).
  • Hardware Acceleration: Optimized for GPU/TPU execution via XLA, enabling the fitting of large complexes in seconds.

📚 Tutorials

Experience diff-em directly in your browser:

  • Open In Colab Cryo-EM Density Fitting — Learn how to optimize atomic coordinates directly against 3D density maps using cross-correlation.

🏗️ Technical Architecture

  • Backend: JAX (XLA-compiled).
  • Physics: 3D Gaussian placement with B-factor smoothing.
  • Optimization: Pure JAX implementation compatible with optax for high-dimensional gradient descent.

🧪 Scientific Validation

  • Density Parity: Simulated densities are verified against standard EM map generation tools (e.g., gemmi or ChimeraX).
  • CC Gradient Stability: Verified numerically stable gradients for structural refinement in the presence of noise.
  • Resolution Limits: Benchmarked against known high-resolution and low-resolution experimental maps.

🚀 Roadmap

  • Differentiable 3D Gaussian density kernels.
  • Cross-correlation (CC) loss functions.
  • Integration with MRC map loaders.
  • Automated multi-resolution refinement schedules.

diff-em is part of the differentiable biophysics ecosystem:


📖 Citation

@software{diff_em,
  author  = {Elkins, George},
  title   = {diff-em: Differentiable Cryo-EM map fitting in JAX},
  year    = {2026},
  url     = {https://github.com/elkins-lab/diff-em},
  version = {0.1.2}
}

⚖️ License

MIT

Metadata

Release files for diff-em 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diff-em 0.1.2
File Size Uploaded Provenance Actions
diff_em-0.1.2.tar.gz 7.1 kB With provenance Details for diff_em-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for diff-em 0.1.2
File Interpreter ABI Platform Actions
diff_em-0.1.2-py3-none-any.whl Python 3 none any Details for diff_em-0.1.2-py3-none-any.whl

Total release size: 12.1 kB

Release files / diff_em-0.1.2.tar.gz

Download URL diff_em-0.1.2.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e1503960b5a5adcf4b52aebb1608c558da3d3283a5dedb7c3bd5d5c0ef9e5b36
BLAKE2b-256 checksum
How to use checksums
70ea3d5c5e43143ceaa58788489b15df81040c8611bb9467c0e5f559e0f3a102
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 30, 2026.

Transparency log

Release files / diff_em-0.1.2-py3-none-any.whl

Download URL diff_em-0.1.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e19c338d804e11661fdaa10b84fdbac1e4f4fd07de4ea77b53e6089f541b0fef
BLAKE2b-256 checksum
How to use checksums
b20a22fef75026907c031146967e26b5592cad78d69818a568492d8569968f05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 30, 2026.

Transparency log

Security for diff-em 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for diff_em-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page