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

feat(core): Implement Forcefield for Energy Calculation and Parameterization#12

Merged
TKanX merged 84 commits intomainfrom
feature/11-implement-forcefield-module-for-energy-calculation-and-parameterization
Jul 9, 2025
Merged

feat(core): Implement Forcefield for Energy Calculation and Parameterization#12
TKanX merged 84 commits intomainfrom
feature/11-implement-forcefield-module-for-energy-calculation-and-parameterization

Conversation

@TKanX
Copy link
Member

@TKanX TKanX commented Jul 9, 2025

Summary:

Introduces a complete forcefield module designed for molecular energy calculation and system parameterization. It includes a robust system for loading forcefield parameters from data files, a Parameterizer to apply these settings to a MolecularSystem, and a Scorer to calculate non-bonded interaction energies. This module establishes the core functionality for evaluating molecular interactions, enabling scoring, minimization, and future simulation tasks. It also includes the necessary parameter data files for a baseline forcefield implementation.

Changes:

  • Created a Comprehensive Parameter System (params.rs):

    • Defined structs (VdwParam, HBondParam, ChargeParam, DeltaParam) to represent forcefield parameters, using serde for deserialization.
    • Implemented Forcefield::load to parse parameters from TOML (for non-bonded) and CSV (for charges, deltas, etc.) files.
    • Provided robust error handling (ParamLoadError) for file I/O and parsing issues.
    • Added a data/ directory containing CSV files for charges, deltas, and other parameters.
  • Implemented Core Energy Potentials (potentials.rs):

    • Provided implementations for standard potential energy functions:
      • Lennard-Jones (12-6) and Buckingham (exp-6) for van der Waals interactions.
      • Coulomb's law for electrostatic interactions.
      • Dreiding-style (12-10) for hydrogen bond interactions.
    • Implemented logic for "flat-bottom" potentials (apply_flat_bottom_vdw, apply_flat_bottom_hbond) to handle the delta parameter.
  • Developed an Energy Calculation Engine (energy.rs):

    • Created a stateless EnergyCalculator to compute specific interaction energies (VDW, Coulomb, H-bond).
    • The calculator correctly handles the mixing of different VDW parameter types (e.g., Lennard-Jones with Buckingham) between two atoms.
  • Introduced a Parameterizer for System Setup (parameterization.rs):

    • Developed a Parameterizer to apply a loaded Forcefield to a MolecularSystem.
    • It assigns forcefield types, partial charges, delta values, and cached VDW parameters to each atom.
    • It automatically builds both intra-residue bonds based on topology definitions and inter-residue peptide bonds.
  • Provided a High-Level Scorer API (scoring.rs):

    • Implemented a Scorer to calculate the total interaction energy (VDW, Coulomb, H-bond) between two distinct groups of atoms (e.g., a query and its environment).
    • The Scorer correctly handles exclusion rules, such as ignoring intra-residue interactions.
    • It intelligently identifies and scores hydrogen bonds by looking for donor-hydrogen-acceptor triplets.
  • Enhanced Core Models and Utilities:

    • Removed the AtomFlags bitflags from the Atom model, simplifying its structure.
    • Added get_bonded_neighbors to MolecularSystem for efficient topology lookups.
    • Added a bond_angle utility function to the geometry module.

TKanX added 30 commits July 5, 2025 13:30
TKanX added 23 commits July 8, 2025 10:14
@TKanX TKanX self-assigned this Jul 9, 2025
Copilot AI review requested due to automatic review settings July 9, 2025 07:24
@TKanX TKanX added the enhancement ✨ New feature or request label Jul 9, 2025
@TKanX TKanX linked an issue Jul 9, 2025 that may be closed by this pull request
21 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 adds a new forcefield module and associated data files to support molecular energy calculation and parameter assignment.

  • Introduces residue topology definitions for all standard amino acids in topology.toml.
  • Adds two forcefield profiles (Lennard-Jones 12-6 and Buckingham exp-6) in TOML under data/forcefield/.
  • Includes a series of delta-rmsd-*.csv files for per-atom delta parameters across multiple RMSD cutoffs.

Reviewed Changes

Copilot reviewed 71 out of 72 changed files in this pull request and generated 1 comment.

File Description
data/topology/topology.toml New residue atom/bond definitions for molecular system topology.
data/forcefield/dreiding-lennard-jones-12-6.toml Lennard-Jones forcefield parameters and H-bond entries.
data/forcefield/dreiding-buckingham-exp-6.toml Buckingham-exp-6 forcefield parameters and H-bond entries.
data/delta/delta-rmsd-*.csv Multiple CSVs providing delta μ/σ for each atom at various cutoffs.
Comments suppressed due to low confidence (1)

data/forcefield/dreiding-lennard-jones-12-6.toml:38

  • The hydrogen type key 'H___b' uses a lowercase 'b' while other hydrogen types use uppercase letters (e.g., 'H___A'). Consider normalizing case to maintain consistency across ff_type naming.
H___b = { radius = 1.5975, well_depth = 0.0152 }

@TKanX TKanX merged commit 0c97e64 into main Jul 9, 2025
2 checks passed
@TKanX TKanX deleted the feature/11-implement-forcefield-module-for-energy-calculation-and-parameterization branch July 9, 2025 07:29
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 forcefield Module for Energy Calculation and Parameterization

2 participants