Skip to content

feat(pack): Implement Core Sidechain Packing Algorithm#6

Merged
TKanX merged 64 commits intomainfrom
feature/5-implement-core-packing-algorithm-pack-module
Mar 28, 2026
Merged

feat(pack): Implement Core Sidechain Packing Algorithm#6
TKanX merged 64 commits intomainfrom
feature/5-implement-core-packing-algorithm-pack-module

Conversation

@TKanX
Copy link
Copy Markdown
Member

@TKanX TKanX commented Mar 27, 2026

Summary:

Implemented the complete high-performance sidechain packing pipeline to resolve the Global Minimum Energy Conformation (GMEC). The system introduces a highly parallelized 6-phase workflow (Sample, Graph, Prune, Pair, DEE, DP), integrating rayon for concurrency, spatial hashing for interaction graphs, and dreid-kernel for physical energy evaluations. Flexible packing scopes (Pocket, Interface, List) were also added for targeted region repacking.

Changes:

  • Packing Pipeline (phase/): Developed the core pack orchestrator executing 6 parallelized phases: sample, graph, prune (self-energy), pair (pair-energy), dee, and dp.
  • GMEC Algorithms: Implemented Dead-End Elimination (dee.rs with Goldstein and Split criteria) and Tree-Decomposition Dynamic Programming (dp.rs with rank-1 edge decomposition) to exactly or near-exactly solve for the GMEC.
  • Conformer Sampling (sample.rs): Integrated the Dunbrack rotamer library (via rotamer crate) with support for backbone $\omega$ angles and hybridization-aware polar hydrogen sampling (polar_h_period).
  • Energy Kernels (energy.rs): Integrated dreid-kernel for vectorized evaluation of VdW (Lennard-Jones/Buckingham), Hydrogen Bonds, and distance-dependent Coulomb electrostatics.
  • Packing Scoping (config.rs, convert.rs): Added PackingScope (Full, Pocket, Interface, List) utilizing $O(1)$ cell-list spatial queries to filter mobile residues efficiently.
  • Parallelization & Concurrency: Added rayon dependency. Upgraded SpatialGrid construction (using AtomicU32) and energy/graph calculations to leverage multi-threading.

TKanX added 30 commits March 24, 2026 11:23
TKanX added 21 commits March 26, 2026 22:39
@TKanX TKanX self-assigned this Mar 27, 2026
Copilot AI review requested due to automatic review settings March 27, 2026 21:12
@TKanX TKanX added the enhancement ✨ New feature or request label Mar 27, 2026
@TKanX TKanX linked an issue Mar 27, 2026 that may be closed by this pull request
7 tasks
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the core sidechain packing pipeline to solve for a GMEC using a multi-phase workflow (sampling → graph → pruning → pair energies → DEE → DP), with Rayon-based parallelization and new packing-scope selection during IO conversion.

Changes:

  • Added rotamer sampling (Dunbrack + polar-H sampling) and contact-graph construction, plus self/pair energy computation and pruning.
  • Implemented DEE (Goldstein + Split) and a tree-decomposition DP solver with edge decomposition fallback.
  • Introduced parallel spatial indexing and IO-level PackingScope (Full/Pocket/Interface/List), plus new pack configuration and constants.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/pack/phase/sample.rs Rotamer/polar-H conformation sampling (parallel).
src/pack/phase/graph.rs Builds contact graph using spatial grid queries.
src/pack/phase/prune.rs Computes self energies vs fixed atoms and threshold-prunes candidates.
src/pack/phase/pair.rs Computes pairwise SC–SC energy matrices for contact edges.
src/pack/phase/dee.rs Dead-End Elimination (Goldstein + Split) with absorption of fixed slots.
src/pack/phase/dp.rs Tree-decomposition dynamic programming GMEC solver with edge decomposition fallback.
src/pack/phase/mod.rs Orchestrates the 6-phase pack pipeline and writes back best conformers.
src/pack/model/spatial.rs Parallel SpatialGrid build (AtomicU32) + query iterator changes.
src/pack/model/graph.rs ContactGraph now tracks edge indices; adds neighbor_edges() iterator.
src/pack/model/energy.rs Introduces PRUNED sentinel; adjusts energy table APIs/tests.
src/pack/model/conformation.rs Removes n_atoms() accessor; tests updated to use coords_of().len().
src/pack/model/mod.rs Removes junction module export.
src/pack/model/junction.rs Deleted junction tree implementation (superseded by DP code in phase).
src/pack/energy.rs Adds VdW/HBond/Coulomb kernels and helpers (dreid-kernel integration).
src/pack/constant.rs Adds cutoffs/constants and max_interaction_cutoff().
src/pack/config.rs Adds PackConfig defaults and parameters.
src/pack/mod.rs Exposes PackConfig and pack(); internalizes pack submodules.
src/model/system.rs Adds residue ω angle and plumbs it through Residue::new() and accessors.
src/model/residue.rs Updates is_packable() and adds polar_h_period() used by sampling.
src/io/config.rs Adds PackingScope to ReadConfig.
src/io/convert.rs Applies packing scope selection; computes φ/ψ/ω; builds mobile residues accordingly.
src/io/error.rs Adds Error::Scope for packing-scope configuration failures.
src/io/mod.rs Re-exports PackingScope and updates module docs.
Cargo.toml Bumps/sets kernel + rotamer versions and adds rayon.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pack/phase/sample.rs
Comment thread src/pack/energy.rs
Comment thread src/io/convert.rs
Comment thread src/pack/energy.rs
@TKanX TKanX merged commit 11195ff into main Mar 28, 2026
2 checks passed
@TKanX TKanX deleted the feature/5-implement-core-packing-algorithm-pack-module branch March 28, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Core Packing Algorithm (pack Module)

2 participants