Skip to main content

Differentiable biophysical modeling in JAX

Project description

🧬 DiffBiophys: Differentiable Biophysics for the AI Era

DiffBiophys is a high-performance Python library for differentiable biophysical modeling. Built on JAX, it re-implements core structural biology and spectroscopy observables (SAXS, NMR, CD) as hardware-accelerated, auto-differentiable kernels.

Documentation Website | Use Cases


🎯 Vision

To bridge the gap between static structural models and experimental solution-state data by providing a "differentiable bridge." This allows researchers to:

  1. Optimize protein structures directly against experimental spectra via gradient descent.
  2. Train machine learning models using physics-informed loss functions.
  3. Accelerate large-scale biophysical simulations on GPUs and TPUs.

🏗️ Core Components

1. diff_biophys.geometry (Differentiable Structural Engine)

  • NeRF (Natural Extension Reference Frame): Differentiable conversion from internal coordinates ($\phi, \psi, \omega$, bond lengths/angles) to Cartesian XYZ.
  • Kabsch Alignment: Differentiable optimal superposition using SVD.
  • Torsion Analysis: Vectorized calculation of all backbone and side-chain dihedrals.

2. diff_biophys.saxs (Differentiable Scattering)

  • Debye Formula: $O(N^2)$ inter-atomic interference summation.
  • Hardware Acceleration: GPU-optimized pairwise distance kernels.
  • Use Case: Fitting structure "compactness" and "radius of gyration" to solution-state X-ray scattering curves.

3. diff_biophys.nmr (Differentiable Spectroscopy)

  • Residual Dipolar Couplings (RDCs): Differentiable Saupe tensor alignment and coupling calculation.
  • Chemical Shifts: Differentiable Ring-Current (Johnson-Bovey) shielding and Karplus J-coupling kernels.
  • Use Case: Refining side-chain packing and domain orientations against high-resolution NMR data.

4. diff_biophys.cd (Differentiable Dichroism)

  • Matrix-Method Simulation: Differentiable simulation of peptide bond transition dipole coupling.
  • Use Case: Predicting secondary structure content and verifying fold stability.

⚡ Technical Architecture

  • Backend: JAX (XLA-compiled).
  • Parallelism: Native support for vmap (vectorization across ensembles/trajectories) and pmap (multi-device execution).
  • Differentiability: Support for both Forward and Reverse-mode autodiff.
  • Interoperability: Seamless integration with PyTorch/TensorFlow (via DLPack) and standard structural formats (mmCIF/BCIF).

🚀 Roadmap

Phase 1: Foundations (Alpha)

  • Differentiable NeRF and Kabsch alignment.
  • GPU-accelerated Debye formula for SAXS.
  • Unit tests verifying parity with synth-pdb NumPy implementations.

Phase 2: NMR & Spectroscopy (Beta)

  • Differentiable RDC and Karplus kernels.
  • Differentiable Johnson-Bovey ring current model.
  • Integration with synth-nmr parameter libraries.

Phase 3: Integration & Optimization (v1.0)

  • Example notebooks for structure refinement via gradient descent.
  • Plugin for torch-based AI models to use biophysical loss functions.
  • Full support for BinaryCIF streaming.

📂 Repository Structure (Proposed)

diff-biophys/
├── diff_biophys/          # Core package
│   ├── geometry/          # NeRF, Kabsch, Torsions
│   ├── saxs/              # Debye kernels, form factors
│   ├── nmr/               # RDCs, Karplus, Ring Currents
│   ├── cd/                # CD simulation
│   └── utils/             # Constants, JAX-NumPy shims
├── tests/                 # Parity and gradient checks
├── examples/              # Jupyter notebooks (Refinement Lab)
├── docs/                  # API and Theory
├── pyproject.toml         # Modern build config
└── README.md

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

diff_biophys-0.1.2.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

diff_biophys-0.1.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file diff_biophys-0.1.2.tar.gz.

File metadata

  • Download URL: diff_biophys-0.1.2.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for diff_biophys-0.1.2.tar.gz
Algorithm Hash digest
SHA256 821deab431dde3fd5ca4e43461c6bb826606cff322053288c238e42f06cbd3f3
MD5 f65a49d6126891b1ab126454c96ae0c4
BLAKE2b-256 c604360b0ef6d67037263fe1a8b61216c52722e6a8a43fa74bb7249707f5789e

See more details on using hashes here.

Provenance

The following attestation bundles were made for diff_biophys-0.1.2.tar.gz:

Publisher: publish.yml on elkins/diff-biophys

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diff_biophys-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: diff_biophys-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for diff_biophys-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8c72d5273717ff613eee5ec0cd4006393ca7b101387cad9a8ef1ba731110bb6c
MD5 a3814b91eef23dea6d105d039539faba
BLAKE2b-256 a80ae6a9856d68d67ce2770e704e7c5160ffad8ce1a859c26543ccc6f759a441

See more details on using hashes here.

Provenance

The following attestation bundles were made for diff_biophys-0.1.2-py3-none-any.whl:

Publisher: publish.yml on elkins/diff-biophys

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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