Skip to content

Standardize Potential Parameters to Align with dreid-kernel API Contract #15

@TKanX

Description

@TKanX

Description:

To ensure seamless future integration between dreid-forge (parameterization) and dreid-kernel (evaluation), all potential energy parameter structures must be standardized to match the kernel's mathematical conventions.

The kernel uses half-force constants (k_half, v_half, c_half) to eliminate redundant multiplications during SIMD-optimized evaluation. Additionally, several potentials store pre-computed values (e.g., cos0 instead of theta0, r0_sq instead of r0) to minimize runtime operations. Current dreid-forge definitions diverge from these conventions, requiring a systematic refactoring.

Critical: The Inversion potential uses fundamentally different physics — kernel implements $E \propto \cos^2\psi$ while forge uses $E \propto (\chi - \chi_0)^2$. This must be corrected.

Tasks:

  • Phase 1: Topology Structure Refactoring (src/model/topology.rs)

    • BondPotential::Harmonic: k_forcek_half (store $K/2$).
    • BondPotential::Morse: d0de (naming consistency).
    • AnglePotential::CosineHarmonic: (k_force, theta0)(k_half, cos0).
    • AnglePotential::ThetaHarmonic: k_forcek_half.
    • DihedralPotential: (v_barrier, phase_offset)(v_half, cos_n_phi0, sin_n_phi0).
    • ImproperPotential: Change formula from $(\chi-\chi_0)^2$ to $\cos^2\psi$ based, use c_half.
    • VdwPairPotential::LennardJones: (sigma, epsilon)(d0, r0_sq).
    • VdwPairPotential::Exponential6: Add r_fusion_sq field.
    • HBondPotential: r0r_hb_sq, add cos_power: u8.
  • Phase 2: Parameter Generation (src/forge/paramgen.rs)

    • Update generate_bond_potentials() to compute k_half = K/2.
    • Update generate_angle_potentials() to pre-compute cos0 = cos(θ₀).
    • Update generate_dihedral_potentials() to pre-compute (cos_n_φ₀, sin_n_φ₀).
    • Rewrite generate_improper_potentials() for cosine-based formula.
    • Update generate_vdw_potentials() to store squared distances.
    • Update generate_hbond_potentials() to store r_hb_sq and cos_power.
  • Phase 3: IO & Test Updates

    • Update BGF writer to reverse transformations for output compatibility.
    • Update all unit tests for new parameter semantics.
    • Add cross-validation tests against dreid-kernel expected values.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions