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

feat(engine): Implement Core engine Module for Algorithm Execution and State Management#16

Merged
TKanX merged 119 commits intomainfrom
feature/15-implement-core-engine-module-for-algorithm-execution-and-state-management
Jul 20, 2025
Merged

feat(engine): Implement Core engine Module for Algorithm Execution and State Management#16
TKanX merged 119 commits intomainfrom
feature/15-implement-core-engine-module-for-algorithm-execution-and-state-management

Conversation

@TKanX
Copy link
Member

@TKanX TKanX commented Jul 20, 2025

Summary:

Introduces the core engine module, a comprehensive framework for executing complex molecular modeling algorithms like sidechain placement and protein design. The engine is built around a configurable, stateful, and observable architecture. It includes a flexible configuration system with fluent builders, a state manager for tracking optimal solutions, task-based execution logic for modularity, and performance optimizations such as an Empty Lattice (EL) energy cache and optional parallelism via rayon. This work also refactors the forcefield module, decoupling topology and charge parameterization from the main runtime flow, as these are now handled during the pre-processing of input structures and rotamer libraries.

Changes:

  • Implemented Core Engine Framework:

    • config.rs: Introduced configuration structs (PlacementConfig, DesignConfig, AnalyzeConfig) with fluent builders for type-safe and ergonomic setup of computational tasks.
    • state.rs: Developed OptimizationState and Solution structs. It uses a BinaryHeap to efficiently manage and track the top N solutions during an optimization run.
    • context.rs: Created a Context struct to centralize access to the system, configuration, and libraries. It includes a robust residue selection resolver that can handle lists, ligand binding sites (using a kiddo k-d tree for fast spatial lookups), and exclusions.
    • progress.rs: Implemented a callback-based ProgressReporter to provide feedback on long-running operations.
    • error.rs: Defined a comprehensive EngineError enum for structured error handling across the engine.
  • Developed Algorithmic Tasks (tasks/):

    • el_energy.rs: Implemented the Empty Lattice (EL) energy calculation task to pre-compute and cache the interaction energy of each rotamer with the static protein backbone and environment.
    • doublet_optimization.rs: Implemented a pairwise rotamer optimization task, which is a key component of many sidechain packing algorithms.
    • clash_detection.rs: Provided a task to identify sterically clashing residue pairs based on a user-defined energy threshold.
    • total_energy.rs: Implemented a task to compute the total energy of a given system state by combining cached EL energies and pairwise interaction energies.
  • Created Rotamer Placement Logic (placement.rs):

    • Implemented place_rotamer_on_system, which uses the Kabsch algorithm (via SVD) to perform a rigid-body alignment of a rotamer onto the backbone anchor atoms of a target residue.
  • Refactored Forcefield Parameterization:

    • Simplified the Forcefield struct and Parameterizer by removing topology and charge assignment logic. This responsibility is now shifted to pre-processing steps (e.g., rotamer library loading), making the runtime parameterization focused on applying delta values and VDW properties.
  • Enhanced Performance and Added Dependencies:

    • Added rayon under a parallel feature flag to enable parallel execution of computationally intensive tasks like EL energy calculation and clash detection.
    • Added kiddo for efficient k-d tree based nearest-neighbor searches, used in ligand binding site selection.
    • Added itertools for more complex iteration patterns.
  • Minor Enhancements:

    • RotamerLibrary: Added include_system_conformations to allow including the initial sidechain conformation in the set of rotamers to be sampled.
    • EnergyTerm: Introduced a dedicated struct for energy components (vdw, coulomb, hbond) with Add and AddAssign implementations for cleaner energy arithmetic.

TKanX added 30 commits July 10, 2025 11:54
…c for molecular system, forcefield, and placement registry
TKanX added 23 commits July 16, 2025 23:11
@TKanX TKanX self-assigned this Jul 20, 2025
Copilot AI review requested due to automatic review settings July 20, 2025 16:32
@TKanX TKanX added the enhancement ✨ New feature or request label Jul 20, 2025
@TKanX TKanX linked an issue Jul 20, 2025 that may be closed by this pull request
26 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 a comprehensive molecular modeling engine and significantly refactors the forcefield system. The engine provides a configurable framework for executing sidechain placement and protein design algorithms with performance optimizations including energy caching and optional parallelism. The forcefield refactoring shifts topology and charge parameterization to pre-processing stages and introduces new DREIDING forcefield versions (0.3 and 0.4) with updated parameter sets.

  • Implements core engine framework with configuration builders, state management, and algorithmic tasks
  • Refactors forcefield system by removing topology/charge files and simplifying runtime parameterization
  • Adds new DREIDING 0.3 and 0.4 forcefield parameter files with comprehensive VDW and hydrogen bonding definitions

Reviewed Changes

Copilot reviewed 37 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
data/topology/topology.toml Removes comprehensive amino acid topology definitions (2425 lines)
data/forcefield/dreiding-lennard-jones-12-6.toml Removes original DREIDING LJ parameters
data/forcefield/dreiding-buckingham-exp-6.toml Removes original DREIDING Buckingham parameters
data/forcefield/dreiding-0.4-lj-12-6.toml Adds DREIDING 0.4 LJ parameters with extensive hydrogen bonding definitions
data/forcefield/dreiding-0.4-exp-6.toml Adds DREIDING 0.4 Buckingham parameters with scale factors
data/forcefield/dreiding-0.3-lj-12-6.toml Adds DREIDING 0.3 LJ parameters with detailed atom type definitions
data/forcefield/dreiding-0.3-exp-6.toml Adds DREIDING 0.3 Buckingham parameters with comprehensive coverage
data/charges/qeq.csv Removes QEq charge parameter database (460 entries)

@TKanX TKanX merged commit 38b25c7 into main Jul 20, 2025
2 checks passed
@TKanX TKanX deleted the feature/15-implement-core-engine-module-for-algorithm-execution-and-state-management branch July 20, 2025 16:38
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 Core engine Module for Algorithm Execution and State Management

2 participants