-
Notifications
You must be signed in to change notification settings - Fork 0
Implement forcefield Module for Energy Calculation and Parameterization #11
Description
Description:
Focuses on building the entire forcefield module for the scream-core crate. This module is the computational heart of SCREAM, responsible for translating physicochemical principles into a quantitative scoring function. The primary goal is to create a modular, data-driven, and high-performance system that separates force field parameters, pure potential energy functions, and the high-level scoring logic. This will replace the tightly-coupled and hard-coded energy calculation logic from the original C++ codebase. The final module will be capable of loading all necessary parameters from configuration files and calculating all required energy terms, including the "flat-bottom" potential, for any given molecular system.
Tasks:
-
Parameterization (
forcefield/params.rs)- Design Parameter File Format: Convert the parameter data hard-coded in C++ and scattered across
.par/.rtffiles into a set of structured TOML files (e.g.,vdw.toml,hbond.toml,charges.toml,delta.toml,topology.toml). - Define Parameter Structs: Create a comprehensive set of Rust structs (
ForceFieldParams,VdwParam,ResidueTopology, etc.) that mirror the structure of the new TOML files. - Implement Parameter Loader: Using the
serdeandtomlcrates, implement a robust loader (ForceFieldParams::load(...)) that can parse all parameter files into theForceFieldParamsstruct. - Write Unit Tests for Loading: Create tests to ensure all parameter types (VDW, HBond, charges, delta, topology) are loaded correctly from sample TOML files.
- Design Parameter File Format: Convert the parameter data hard-coded in C++ and scattered across
-
Pure Potential Functions (
forcefield/potentials.rs)- Implement VDW Potentials: Create pure functions like
lj_12_6andflat_bottom_lj_12_6that take numerical inputs (distance, radius, depth, delta) and return an energy value. - Implement Coulomb Potential: Create a
coulombfunction that calculates electrostatic energy based on charges, distance, and a dielectric constant. - Implement HBond Potential: Implement the DREIDING 12-10 hydrogen bond potential,
dreiding_hbond, which takes distance and angle as inputs. Implement its flat-bottom variant as well. - Write Comprehensive Math-Level Unit Tests: For each potential function, write unit tests that verify its correctness against known values at various distances and a ngles, especially at edge cases (e.g., at the equilibrium distance, within the flat-bottom region).
- Implement VDW Potentials: Create pure functions like
-
Scoring Engine (
forcefield/engine.rs)- Define
ScoringEngineStruct: Create theScoringEnginestruct, which will hold an instance of the loadedForceFieldParams. - Implement System Pre-processing: Create a method
ScoringEngine::prepare_system(&self, system: &mut MolecularSystem)that:- Assigns correct
force_field_typeandpartial_chargeto each atom based on topology and charge scheme. - Caches frequently needed parameters (like
vdw_radius,hbond_type_id,delta) onto eachAtomstruct to accelerate subsequent calculations.
- Assigns correct
- Implement
empty_lattice_energyMethod: This core method will calculate the interaction energy of a target residue's sidechain with the fixed molecular environment. It must correctly:- Identify target and environment atoms based on
AtomFlags. - Handle 1-2, 1-3, and 1-4 intramolecular exclusions.
- Call the appropriate pure functions from the
potentialsmodule. - Return a structured result (
EnergyTerms { vdw, coulomb, ... }).
- Identify target and environment atoms based on
- Implement
interaction_energyMethod: Similar to the above, but calculates the energy between two specified (and variable) residues.
- Define