Feature/Add JAX-accelerated interaction fingerprinting - #353
Open
Peter-obi wants to merge 6 commits into
Open
Conversation
Adds prolif/interactions/_jax/ with: - primitives.py: vectorized geometric primitives (distances, angles, ring normals) - integration.py: JAX-accelerated drop-in for ProLIF interaction classes - framebatch.py: frame-batched trajectory analysis (vmap over frames, SMARTS once) - api.py: public analyze_trajectory() entry point - __init__.py: JAX availability check and public exports Key properties: - 100% accuracy vs ProLIF on all 9 interaction types - ~39x speedup vs Fingerprint.run(n_jobs=1) on CPU (250-frame test trajectory) - SMARTS matching done once per structure; JAX vmaps geometry over all frames - Gracefully degrades when JAX is not installed - residue_mode='all' default captures contacts from drifting ligands
- Use ligand Residue (not full Molecule) for pi-ring SMARTS matching in build_ring_cation_indices to match ProLIF's internal behaviour. The full Molecule and its Residue can disagree on SSSR ring assignments for fused aromatic systems, causing wrong ring indices for pi-stacking. - Add vicinity_cutoff parameter to has_interactions_frames; applies a per-frame min atom-atom distance mask matching ProLIF's default 6.0 Å get_residues_near_ligand filter. - Add tests/test_jax.py: 19 tests verifying 100% accuracy vs ProLIF for all 9 interaction types across all frames.
Type-checking reportDifference in type-hints coverage: OverviewRemaining errors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a JAX-backed path for computing ProLIF interaction fingerprints over single frames and MDAnalysis trajectories.
The main goal is to speed up repeated frame/residue interaction checks by using JAX batching and JIT compilation, while keeping the results easy to compare with the existing
Fingerprint.run()workflow. In my own trajectory workloads, this has been a large practical speedup on CPU after the initial JIT compile.The new code lives under
prolif.interactions._jaxfor now, so it is available for testing and iteration without changing the default ProLIF API.What's different:
analyze_frameandanalyze_trajectoryhelpers