Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

feat(engine): Implement Absolute Energy Model and Streamline Parameterization#26

Merged
TKanX merged 129 commits intomainfrom
feature/24-implement-foundational-absolute-energy-model
Aug 12, 2025
Merged

feat(engine): Implement Absolute Energy Model and Streamline Parameterization#26
TKanX merged 129 commits intomainfrom
feature/24-implement-foundational-absolute-energy-model

Conversation

@TKanX
Copy link
Member

@TKanX TKanX commented Aug 12, 2025

Summary:

Refactors the core energy model to calculate absolute total system energy, moving away from a relative optimization score. This is achieved by introducing a new fixed_energy task that computes a constant energy offset from all non-optimizable parts of the system (e.g., static backbone, environment, fixed sidechains). The final energy of any solution is now the sum of this fixed offset, the pre-computed EL energy, and the pairwise interaction energy. This change provides more physically meaningful energy values.

This refactoring also significantly streamlines the parameterization and data loading pipeline. Topology information is now managed by a dedicated TopologyRegistry, loaded from a single file, which decouples rotamer placement logic from the rotamer library itself. Consequently, the forcefield and rotamer libraries are now simpler and more focused.

Changes:

  • Implemented Absolute Energy Model:

    • fixed_energy.rs: A new task that calculates the interaction energy of all static parts of the system (backbone, fixed sidechains, water, ligands) to establish a constant energy offset.
    • total_energy.rs: Removed this task and integrated its logic into the main workflow, which now combines the fixed energy offset, EL energy, and interaction energy to report an absolute total energy for each solution.
    • Solution: The Solution struct in the engine::state module was updated to store both total_energy and optimization_score.
  • Introduced Topology Registry:

    • topology/registry.rs: Created a TopologyRegistry to load and manage residue topology definitions (anchor and sidechain atoms) from a single TOML file (registry.toml).
    • The RotamerLibrary no longer loads placement info; instead, it and the placement functions consume the TopologyRegistry.
    • The CLI and configuration system were updated to accept a --topology-registry path.
  • Streamlined forcefield and rotamer Modules:

    • forcefield/parameterization.rs: The Parameterizer is now responsible for assigning atom roles (Backbone, Sidechain, etc.) based on the TopologyRegistry. It was simplified by removing the logic for building bonds and assigning charges, which are now defined in the rotamer library.
    • rotamer/library.rs: The rotamer library loader now also loads intra-rotamer bond information from the TOML file, making rotamers self-contained topological units.
    • Atom struct now includes an AtomRole enum to clearly define its function.
  • Enhanced I/O and CLI:

    • io/sorting.rs: Introduced a canonical atom sorter for generating deterministic and clean BGF output. The old utils::identifiers module was removed in favor of this more comprehensive system.
    • io/bgf.rs: The BGF writer was completely refactored to use the new canonical sorter, renumbering all atoms sequentially and producing clean, standard-compliant files.
    • cli.rs: The CLI help text for output files was improved to detail the available placeholders ({energy}, {score}, etc.).
  • Performance and Reliability Improvements:

    • The Scorer now correctly excludes 1-2 and 1-3 bonded interactions from non-bonded calculations.
    • VDW parameters are now cached directly on the Atom struct as CachedVdwParam, improving performance by avoiding repeated string-based lookups.

TKanX added 30 commits August 6, 2025 12:00
TKanX added 23 commits August 11, 2025 09:08
…final refinement with improved iteration handling
@TKanX TKanX requested a review from Copilot August 12, 2025 07:15
@TKanX TKanX self-assigned this Aug 12, 2025
@TKanX TKanX added the enhancement ✨ New feature or request label Aug 12, 2025
@TKanX TKanX linked an issue Aug 12, 2025 that may be closed by this pull request
29 tasks
Copy link
Contributor

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

This PR implements an absolute energy model that calculates physically meaningful total system energy values by introducing a fixed energy offset from static system components. The refactor streamlines parameterization through a new TopologyRegistry and separates rotamer placement logic from the rotamer library.

Key changes include:

  • Implementation of absolute energy calculation via fixed_energy task and updated scoring workflow
  • Introduction of TopologyRegistry for centralized topology management
  • Streamlined forcefield parameterization and rotamer library structure

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
data/topology/registry.toml Simplified topology registry by removing unused fields (exact_match_atoms, connection_points)
crates/scream-core/src/workflows/place.rs Major refactor implementing absolute energy workflow and streamlined optimization phases
crates/scream-core/src/engine/tasks/total_energy.rs Removed entire file as functionality moved to main workflow
crates/scream-core/src/engine/tasks/mod.rs Updated module exports to reflect new task structure
crates/scream-core/src/engine/tasks/interaction_energy.rs New task for calculating pairwise interactions between active residue sidechains
crates/scream-core/src/engine/tasks/fixed_energy.rs New task for calculating constant energy offset from fixed system components
crates/scream-core/src/engine/tasks/el_energy.rs Enhanced EL energy calculation with current energy computation capability
crates/scream-core/src/engine/tasks/doublet_optimization.rs Updated to use TopologyRegistry instead of placement info
crates/scream-core/src/engine/state.rs Enhanced Solution struct to track both total energy and optimization score

@TKanX TKanX merged commit cbf6699 into main Aug 12, 2025
2 checks passed
@TKanX TKanX deleted the feature/24-implement-foundational-absolute-energy-model branch August 12, 2025 07:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Foundational Absolute Energy Model

2 participants