Skip to content

feat(forge): Implement Core Force Field Parameterization Engine#6

Merged
TKanX merged 41 commits intomainfrom
feature/5-implement-the-core-forge-engine-for-dreiding-force-field-parameterization
Dec 12, 2025
Merged

feat(forge): Implement Core Force Field Parameterization Engine#6
TKanX merged 41 commits intomainfrom
feature/5-implement-the-core-forge-engine-for-dreiding-force-field-parameterization

Conversation

@TKanX
Copy link
Copy Markdown
Member

@TKanX TKanX commented Dec 11, 2025

Summary:

Implemented the central "Forge" engine responsible for transforming a raw molecular system into a parameterized, simulation-ready topology. This engine orchestrates atom typing (via dreid-typer), charge assignment (via cheq's QEq solver), and the rigorous mapping of DREIDING force field parameters to bonds, angles, dihedrals, impropers, and non-bonded interactions. Establishes the core computational pipeline for molecular mechanics preparation.

Changes:

  • Implemented Forge Pipeline:

    • Created src/forge/mod.rs as the main entry point, exposing the forge() function that drives the parameterization workflow.
    • Developed ForgeConfig to control simulation settings, including potential types (Harmonic/Morse, Cosine/Theta), charge methods, and custom parameters.
  • Integrated Atom Typing:

    • Implemented src/forge/typer.rs to bridge IntermediateSystem with the dreid-typer library.
    • Added support for both automatic topological analysis and custom SMARTS-based typing rules.
    • Mapped chemical hybridization states and bond orders to force field atom types.
  • Implemented Charge Assignment:

    • Created src/forge/charge.rs to integrate the cheq library for electronegativity equalization (QEq).
    • Configured charge equilibration solvers with support for total system charge constraints and hydrogen SCF options.
  • Developed Parameter Generator:

    • Implemented src/forge/paramgen.rs to systematically assign physics parameters based on atom types.
    • Bonds: Calculates equilibrium lengths and force constants based on atomic radii and bond orders.
    • Angles: Generates angle potentials using type-specific equilibrium angles.
    • Dihedrals: Implemented complex logic for torsion barriers based on hybridization states (SP3/SP2/Resonant) and special cases (e.g., oxygen columns).
    • Impropers: Added inversion potentials for planar centers.
    • Non-bonded: Generates Lennard-Jones or Exponential-6 (Buckingham) pair potentials using geometric mean mixing rules.
    • Hydrogen Bonds: Identifies donor-acceptor pairs and assigns explicit hydrogen bond potentials.
  • Defined Force Field Parameters:

    • Added src/forge/params.rs and resources/default.params.toml containing the official DREIDING force field specification (masses, radii, angles, vdW parameters).
    • Implemented a parameter loader that supports both embedded defaults and user-provided TOML overrides.
  • Created Intermediate Representation:

    • Defined IntermediateSystem to hold transient data required during the forging process (e.g., neighbors, partial charges, graph connectivity) without polluting the core System model.
    • Implemented conversion logic to initialize this intermediate state from a raw System.
  • Updated BGF Writer:

    • Refined src/io/bgf/writer.rs to include atomic mass in the output and ensure strict fixed-width formatting, fixing column alignment issues and ensuring compatibility with legacy tools.

TKanX added 28 commits December 9, 2025 21:38
@TKanX TKanX self-assigned this Dec 11, 2025
Copilot AI review requested due to automatic review settings December 11, 2025 09:04
@TKanX TKanX added the enhancement ✨ New feature or request label Dec 11, 2025
@TKanX TKanX linked an issue Dec 11, 2025 that may be closed by this pull request
38 tasks
Copy link
Copy Markdown
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 the core "Forge" engine for DREIDING force field parameterization, establishing a complete pipeline that transforms raw molecular systems into simulation-ready topologies with assigned atom types, charges, and force field parameters. The implementation integrates external libraries for atom typing (dreid-typer) and charge calculation (cheq), and includes comprehensive test coverage across all modules.

Key Changes:

  • Implemented complete force field parameterization pipeline with configurable potential types (Harmonic/Morse bonds, ThetaHarmonic/CosineHarmonic angles, LennardJones/Exponential6 VdW)
  • Integrated atom typing via dreid-typer and charge assignment via cheq's QEq solver
  • Generated systematic parameter assignment for bonds, angles, dihedrals, impropers, VdW pairs, and hydrogen bonds
  • Updated BGF writer with fixed-width formatting and atomic mass output
  • Added comprehensive unit tests for all forge modules

Reviewed changes

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

Show a summary per file
File Description
src/lib.rs Exports new forge module to public API
src/io/bgf/writer.rs Updates FORMAT_ATOM to include mass field (f10.5), changes residue_name alignment to left, adds atomic mass output, improves test assertions with column-based validation
src/forge/mod.rs Main forge module exposing forge() function and configuration types; orchestrates typing, charge assignment, and parameter generation
src/forge/typer.rs Bridges IntermediateSystem with dreid-typer library for atom typing and topology analysis
src/forge/params.rs Defines force field parameter structures, loads from embedded TOML or custom overrides, provides torsion parameter lookup
src/forge/paramgen.rs Generates all force field potentials (bonds, angles, dihedrals, impropers, VdW, H-bonds) based on atom types and configuration
src/forge/intermediate.rs Defines IntermediateSystem holding transient data during parameterization (neighbors, charges, hybridization)
src/forge/error.rs Defines forge-specific error types with conversions from external libraries (dreid-typer, cheq)
src/forge/config.rs Defines ForgeConfig with charge methods and potential type selections
src/forge/charge.rs Integrates cheq library for QEq charge assignment with configurable solver options
resources/default.params.toml Official DREIDING force field parameters including atom types, global constants, and H-bond settings
Cargo.toml Updates dependency versions for bio-forge (0.2.1), dreid-typer (0.4.0), and cheq (0.3.0)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/forge/params.rs Outdated
Comment thread src/forge/paramgen.rs Outdated
Comment thread src/forge/paramgen.rs
Comment thread src/forge/paramgen.rs
Comment thread src/forge/paramgen.rs
Copy link
Copy Markdown
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

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TKanX TKanX merged commit c09fcfa into main Dec 12, 2025
8 checks passed
@TKanX TKanX deleted the feature/5-implement-the-core-forge-engine-for-dreiding-force-field-parameterization branch December 12, 2025 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the Core Forge Engine for DREIDING Force Field Parameterization

2 participants