This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Conversation
… energy calculations
…to compute_energies_for_unit
…acing and restructuring energy calculation
…ironment atoms based on active residues
… selection handling
… residue selection handling
…ctive sidechain atom collection
…direct query call
…eamline atom selection process
…update usage in existing tests
…on and clean up imports
…eamline clash resolution
…parallel processing
… topology retrieval and enhancing parallel evaluation
…aluation and thread-local state management
…lculations for rotamer selection
…t energy retrieval
…processing and energy calculations
31 tasks
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a major architectural enhancement to the core engine by introducing an EnergyGrid for high-performance, incremental energy updates. The new system pre-calculates pairwise sidechain interaction energies and allows rapid calculation of energy changes (ΔE) for single rotamer moves without re-calculating the entire system's energy, dramatically improving performance by virtually eliminating expensive system cloning during optimization loops.
- Introduced
EnergyGridandSystemViewfor incremental energy calculations and transactional operations - Refactored optimization workflows to use the new energy grid system
- Reorganized utility functions into dedicated query module for better code organization
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/scream-core/src/workflows/place.rs | Refactored main placement workflow to use EnergyGrid and SystemView for optimization phases |
| crates/scream-core/src/engine/energy_grid.rs | New EnergyGrid implementation for incremental energy calculations |
| crates/scream-core/src/engine/transaction.rs | New SystemView for transactional rotamer operations |
| crates/scream-core/src/engine/utils/query.rs | Moved and enhanced residue selection and atom query functions |
| crates/scream-core/src/engine/tasks/doublet_optimization.rs | Updated to use SystemView with performance optimizations |
| crates/scream-core/src/engine/tasks/el_energy.rs | Updated to work with reorganized utility functions |
| crates/scream-core/src/engine/tasks/interaction_energy.rs | Removed duplicated utility function, now uses shared implementation |
| crates/scream-core/src/engine/tasks/clash_detection.rs | Simplified interface by removing progress reporting parameter |
| crates/scream-core/src/engine/context.rs | Removed duplicated functions, now delegates to query module |
| crates/scream-core/src/engine/mod.rs | Added new modules to engine module exports |
| crates/scream-core/Cargo.toml | Added wide crate dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
TKanX
added a commit
that referenced
this pull request
Sep 28, 2025
…ormance-incremental-energy-engine-with-zero-clone-optimization feat(engine): Implement Incremental Energy Grid for High-Performance Optimization
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary:
Introduces a major architectural enhancement to the core engine: a new
EnergyGridfor high-performance, incremental energy updates. Previously, energy calculations required cloning the entire molecular system for each proposed rotamer change, which was computationally expensive. The newEnergyGridpre-calculates and stores all pairwise sidechain interaction energies and allows for the rapid calculation of the energy change (ΔE) of a single rotamer move without re-calculating the entire system's energy. This is managed through aSystemViewand transactional system state updates, virtually eliminating system cloning during the optimization loops and dramatically improving performance.Changes:
Implemented
EnergyGridfor Incremental Updates:energy_grid.rs: Created theEnergyGridstruct, which maintains a complete matrix of pairwise interaction energies between all active residues.calculate_delta_for_move: A new key function that computes the change in energy (ΔE) for a proposed rotamer move by looking up pre-calculated energies and calculating only the interactions involving the moved sidechain.apply_move: Efficiently updates the grid's state by applying the pre-calculatedΔE, avoiding a full energy recalculation.Introduced
SystemViewfor Transactional Operations:transaction.rs: ImplementedSystemView, a temporary mutable view of the system state.transactionandtransaction_doublet) that allow for speculative rotamer placements. The system is automatically reverted to its original state after the transaction, ensuring the main optimization loop operates on a consistent state.Refactored Optimization Tasks to use
EnergyGrid:place.rs: The main placement workflow was refactored to build theEnergyGridonce and then usecalculate_delta_for_moveandapply_movewithin its optimization loops (clash resolution, SA, refinement).doublet_optimization.rs: The task now usesSystemViewand its transactional capabilities to evaluate pairs without expensive system clones.Streamlined Energy Calculation and Parameterization:
total_energytask was removed, as its functionality is now encapsulated within theEnergyGrid.Parameterizerwas further refined, separating core parameter calculation from the final application step to improve logic flow.engine::utils::querymodule for better organization.