Repository navigation
Releases: elkins-lab/diff-biophys
Release list
diff-biophys v0.2.1
Changed
- Test Infrastructure: Enabled parallel testing via
pytest-xdist, isolated slow interactive notebook tests with@pytest.mark.slow, and correctly configured the JAX compilation cache. - Linting & Typing: Fixed minor docstring formatting issues in
diff_biophys/nmr/chemical_shifts.pyfor MkDocs strict builds, and resolvedmypytyping errors fortests/andexamples/directories.
v0.2.0: The Structural Refinement & Benchmarking Milestone
Added
- Benchmarking Suite: Validated
diff-biophysagainst experimental NMR data for proteins 2KZV and GmR58A (Li et al. 2023). - Refinement Factories: New high-level APIs
make_rdc_refinement_fnsandmake_ca_shift_lossto simplify experimental data integration. - Robust Backbone I/O: Direct support for loading PDB models and extracting N–CA–C coordinates into JAX arrays via
biotite. - Edge Case Test Suite: Comprehensive tests for numerical singularities (CD), collinearity (Kabsch), and empty input handling.
Fixed
- RDC Overfitting: Implemented fixed-tensor refinement (periodically updated) to prevent trivial Q-factor minimization.
- NH Bond Reconstruction: Improved peptide-plane bisector method for more accurate NH vector orientations from backbone coordinates.
- Test Coverage: Achieved 100% coverage across all core biophysical modules.
v0.1.6 — Scientific test suite & notebook fix
What's changed
Fixed
- Syntax error in Tutorial 3 (
03_cd_spectroscopy.ipynb): a stray backslash continuation in the notebook generator fused the docstring ofcd_at_222nmwith its function body, causing aSyntaxErrorwhen the cell was executed in Colab. Fixed in both the notebook and the generator source.
Added
- Regression tests for four scientific-review findings:
- NeRF geometry (Issue 1):
test_nerf_dihedral_roundtrip— parametrized over 13 angles, verifiesposition_atom_3d → compute_dihedralsroundtrip to < 0.01°.test_nerf_alpha_helix_is_right_handed— confirms φ=−57.8°/ψ=−47° builds a right-handed spiral. - Karplus offset (Issue 2):
test_karplus_requires_phi_offset_not_raw_phi— quantifies the >1 Hz error that results from passing raw φ instead of θ = φ − 60° tocalculate_karplus_j. - Chemical shift cap (Issue 3):
test_ca_shift_max_helix_offset_is_half_of_offset_helix— pins the ~50% effective-weight cap intrinsic to the softmax coil prior. - SAXS excluded volume (Issue 4):
test_saxs_excluded_volume_fraser.py— validates the Fraser (1978) 4π Gaussian denominator via q→0 limit, q→∞ limit, 1/e decay point, and Gaussian slope recovery.
- NeRF geometry (Issue 1):
- Expanded
calculate_karplus_jdocstring with an explicit.. important::block documenting the θ = φ − 60° offset requirement. - Inline
NOTEcomment inchemical_shifts.pyexplaining the 50% maximum helical weight and compensation strategies for SPARTA+ parity.
Removed
examples/interactive_tutorials/generate_notebooks.pyremoved from version control. The.ipynbfiles are the authoritative source; the generator was the root cause of the Tutorial 3 syntax error.
Refactored
__version__indiff_biophys/__init__.pyis now derived fromimportlib.metadatarather than a hardcoded string, sopyproject.tomlis the single source of truth for the version number.
Full changelog: https://github.com/elkins-lab/diff-biophys/blob/main/CHANGELOG.md
v0.1.5 — Critical Fixes: Autodiff Test Suite & URL Migration
What's Changed
🔴 Critical Fixes
Repository URLs migrated to elkins-lab org
All references in README.md and pyproject.toml updated from github.com/elkins/ to github.com/elkins-lab/:
- CI badge and codecov badge (were showing as broken/stale)
- Both Colab notebook launch links (were returning 404)
- Contributing link, Related Projects section, BibTeX citation URL
Missing autodiff test coverage — now added
The library's core promise is JAX auto-differentiability, but there were previously zero tests verifying that jax.grad works on any kernel. This release adds 68 new tests across 4 new files.
🆕 New Test Files
tests/conftest.py — Shared fixtures
Canonical biophysically-meaningful geometries (ideal α-helix, β-strand, Fibonacci N–H vectors, Gaussian density maps) shared across all test files.
tests/test_autodiff.py — 46 differentiability tests
Every kernel tested for: gradient exists, is finite (no NaN/Inf), is non-zero, has correct shape, and works inside jax.jit. Plus physics-correctness assertions:
- SAXS Debye: grad + JIT + solvent subtraction + Hessian (
jacfwd∘grad) - Karplus:
dJ/dθsign check at θ=5° - RDC: grad w.r.t. bond vectors and Saupe tensor; RDC = 0 at the magic angle (54.74°)
- Chemical shifts:
dδ/dφ,dδ/dψ; helix mean shift > sheet mean shift - Ring currents: shielding above ring (δ < 0), deshielding in-plane (δ > 0)
- Rg: translation invariance, mass-weighted, single-atom edge case
- NeRF: grad w.r.t. all four internal coordinates
- Torsions, Kabsch RMSD, CD matrix method, FSC
tests/test_geometry_roundtrip.py — 11 round-trip tests
NeRF ↔ torsion round-trip is near-identity for helix, strand, and random geometries. Includes sign-convention and 2π-periodicity checks.
tests/test_e2e_gradient_descent.py — 10 integration tests
Real Adam gradient descent loops verifying the full pipeline works end-to-end: SAXS χ² refinement, NMR φ/ψ torsion refinement, Rg compaction/expansion, composite multi-observable joint loss.
🔧 Other
pyproject.toml: addedoptax>=0.1.0todevextras;mypyoverride for test files
Full Changelog: v0.1.4...v0.1.5
Version 0.1.4
Added
- Comprehensive property-based testing using
hypothesisto verify Kabsch alignment and NeRF kinematics geometry. - New numerical stability checks testing edge cases (e.g.
sinclimits in Debye scattering and overlaps in CD matrix method). - Added
hypothesistopyproject.tomldevoptional-dependencies. - Added an Interdisciplinary "Concepts & Context" guide to documentation to clarify jargon for ML researchers and biologists.
Fixed
- Fixed notebook integrity test relying on strict directory structure by recursively globbing for notebooks (
rglob). - RDC Q-factor edge case when experimental data is strictly zero.
v0.1.2: PyPI Readiness
Release v0.1.2: Added MIT license and enhanced PyPI metadata.
v0.1.1 - PyPI Automated Launch
🚀 Release v0.1.1 - PyPI Automated Launch
This release triggers the automated publication to PyPI and includes fixes for package discovery.
Enhancements:
- PyPI Readiness: Fixed
pyproject.tomlto correctly include all sub-packages (geometry,nmr,saxs,cd). - Automation: Added GitHub Actions workflow for automated PyPI publication via Trusted Publishing.
Core Features (carried from v0.1.0):
- Differentiable Geometry: NeRF reconstruction, torsions, and Kabsch superposition.
- Differentiable NMR: RDCs, Karplus J-couplings, Chemical Shifts (CA), and Ring Currents.
- Differentiable SAXS: Debye formula with Hydration Shell correction.
- Ensemble Support: Population-weighted averages in JAX.
v0.1.0 - Initial Differentiable Biophysics Release
🚀 Initial Release of DiffBiophys
DiffBiophys is a high-performance Python library for differentiable biophysical modeling in JAX.
Key Features:
- Differentiable Geometry: Chain reconstruction via NeRF, backbone torsions, and Kabsch superposition.
- Differentiable NMR:
- RDC calculation and Saupe tensor fitting.
- Karplus 3J-couplings.
- Secondary structure-dependent Chemical Shifts (CA).
- Johnson-Bovey Ring Current shifts.
- Differentiable SAXS: Hardware-accelerated Debye formula with Hydration Shell (solvent subtraction) correction.
- Ensemble Support: Native support for population-weighted averages across conformational ensembles.
Showcase:
Check out the examples/diff_biophys_showcase.ipynb for a complete demonstration of gradient-based structure refinement against multiple biophysical objectives.