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

fix(core): Correct Hydrogen Bond Energy Calculation and Parameter Handling#28

Merged
TKanX merged 17 commits intomainfrom
bugfix/27-hydrogen-bond-energy-calculation-is-non-functional-or-incorrect
Aug 13, 2025
Merged

fix(core): Correct Hydrogen Bond Energy Calculation and Parameter Handling#28
TKanX merged 17 commits intomainfrom
bugfix/27-hydrogen-bond-energy-calculation-is-non-functional-or-incorrect

Conversation

@TKanX
Copy link
Member

@TKanX TKanX commented Aug 13, 2025

Summary:

Corrects a critical issue in the hydrogen bond energy calculation and refines the overall parameterization logic for increased accuracy and robustness. The hydrogen bond function signature was updated to the canonical donor-hydrogen-acceptor order, and the Scorer now correctly identifies donor/acceptor pairs based on pre-computed sets in the Forcefield parameters. Additionally, this fix includes corrections to the H-bond parameter files, ensuring that well_depth is always a positive value as expected by the potential function.

Changes:

  • Corrected Hydrogen Bond Calculation Logic:

    • Updated the EnergyCalculator::calculate_hbond function signature to the standard (donor, hydrogen, acceptor) order for clarity and correctness.
    • Refactored the Scorer to correctly identify hydrogen bond donor/acceptor pairs based on forcefield type and connectivity.
    • The Forcefield parameter loader now pre-computes sets of H-bond donor and acceptor atom types for efficient lookup during scoring.
  • Fixed H-Bond Forcefield Parameters:

    • Corrected the well_depth values in all dreiding forcefield TOML files to be positive, aligning them with the physical definition of a potential well depth.
  • Refined Parameterization and Atom Roles:

    • The Parameterizer now uses a more robust two-pass process: first assigning atom roles (Backbone, Sidechain, etc.) across the entire system, and then applying physicochemical parameters.
    • This ensures that H-bond roles can be determined correctly based on both an atom's type and its topological context (i.e., its bonded neighbors).

TKanX added 17 commits August 13, 2025 06:23
@TKanX TKanX self-assigned this Aug 13, 2025
Copilot AI review requested due to automatic review settings August 13, 2025 19:21
@TKanX TKanX added the bug 🐛 Something isn't working label Aug 13, 2025
@TKanX TKanX linked an issue Aug 13, 2025 that may be closed by this pull request
17 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 corrects critical issues in hydrogen bond energy calculation and parameter handling in the forcefield implementation. It standardizes the hydrogen bond function signature to the canonical donor-hydrogen-acceptor order and fixes the well_depth values in DREIDING forcefield parameters to be positive values as expected by the potential function.

  • Updated hydrogen bond calculation to use proper donor-hydrogen-acceptor ordering
  • Fixed hydrogen bond parameter files to use positive well_depth values
  • Enhanced parameterization logic with improved donor/acceptor detection based on forcefield types

Reviewed Changes

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

Show a summary per file
File Description
data/forcefield/*.toml Changed well_depth values from negative to positive in hydrogen bond parameters
crates/scream-core/src/core/forcefield/energy.rs Updated calculate_hbond function signature to donor-hydrogen-acceptor order
crates/scream-core/src/core/forcefield/scoring.rs Fixed hydrogen bond key format and function call order
crates/scream-core/src/core/forcefield/params.rs Added donor/acceptor sets and parsing logic for hydrogen bond parameters
crates/scream-core/src/core/forcefield/parameterization.rs Enhanced parameterization with improved hydrogen bond role detection

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@TKanX TKanX merged commit 00938b7 into main Aug 13, 2025
2 checks passed
@TKanX TKanX deleted the bugfix/27-hydrogen-bond-energy-calculation-is-non-functional-or-incorrect branch August 13, 2025 19:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hydrogen Bond Energy Calculation is Non-functional or Incorrect

2 participants