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

Implement Configurable, Role-Based Energy Weighting System #37

@TKanX

Description

@TKanX

Description:

The current energy model, while physically sound for vacuum calculations, exhibits a tendency to over-optimize for internal van der Waals packing. This often leads to conformations where side chains collapse into the protein core rather than forming crucial interactions with external molecules, such as ligands. This behavior stems from a limitation in the scoring function, which treats all non-bonded interactions with equal importance, failing to prioritize biologically critical interactions (e.g., protein-ligand hydrogen bonds) over general intramolecular packing.

To address this and provide users with greater control for specific scientific applications like drug design, a flexible energy weighting system is required. This system will allow for the selective amplification or dampening of specific energy terms (VDW, Coulomb, H-bond) based on the roles of the interacting atoms (Sidechain, Ligand, Backbone, etc.). This enhancement will transform the scoring function from a generic model into a targeted tool capable of producing more biologically relevant structures.

Tasks:

  • Phase 1: Define and Parse Weighting Configuration (scream-cli/src/config.rs)

    • In the config.toml format, design a new [forcefield.energy-weights] table that accepts a list of rules. Each rule should specify two AtomRole groups and the corresponding vdw, coulomb, and hbond weighting factors.
    • Implement the necessary structs (EnergyComponentWeights, WeightRule) with serde::Deserialize to parse this new configuration section.
    • Implement FromStr for AtomRole to allow direct parsing of role names (e.g., "Sidechain") from the configuration string.
    • Update PartialPlacementConfig and PlacementConfig to include the new energy weighting rules.
  • Phase 2: Enhance Scorer to Apply Energy Weights (scream-core/src/core/forcefield/scoring.rs)

    • Modify the Scorer struct to hold a pre-processed HashMap for efficient weight lookups. The key for this map should be a canonical (sorted) pair of AtomRoles.
    • Update Scorer::new to accept the parsed weighting rules. It should process these rules into the internal HashMap, ensuring that (RoleA, RoleB) and (RoleB, RoleA) map to the same weights.
    • In the core calculation loops of score_interaction and score_group_internal, for each pair of interacting atoms:
      • Determine the roles of the two atoms.
      • Look up the corresponding weighting factors from the HashMap. Use a default of 1.0 if no specific rule is found.
      • Apply the retrieved factors by multiplying them with the calculated vdw, coulomb, and hbond energy components before adding them to the total EnergyTerm.
  • Phase 3: Integrate Weight Configuration into Workflows (scream-core)

    • Update all instantiation points of the Scorer (primarily within the engine/tasks/*.rs modules) to pass the new energy weighting rules from the OptimizationContext.
    • Ensure that the new, weighted energy calculations are used consistently across all stages of the optimization, including el_energy, clash_detection, and doublet_optimization.

Metadata

Metadata

Assignees

Labels

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions