chematic-ff 0.4.7

DREIDING force field atom typing and parameters for chematic — pure-Rust cheminformatics
Documentation

chematic-ff — DREIDING + MMFF94 Force Fields

Pure-Rust implementation of the DREIDING and MMFF94 (full 7-term stack) force fields for molecular dynamics, geometry optimization, and energy calculations. Zero external FFI dependencies, full WASM support.

Features

DREIDING Atom Type Assignment

  • 20 atom types covering C, N, O, S, P, halogens, and H
  • Automatic type assignment based on element and hybridization state
  • Support for aromatic, double, triple, and single bonds
use chematic_ff::assign_dreiding_types;

let dreiding_types = assign_dreiding_types(&mol);
// → Vec<DREIDINGType> with one type per atom

Force Field Parameters

  • Bond lengths: 40+ element-pair combinations with bond-order dependence
  • Bond angles: Hybridization-aware ideal angles (sp³=109.47°, sp²=120°, sp=180°)
  • VDW parameters: Lennard-Jones radius and well depth for each atom type
  • Torsion barriers: Dihedral angle rotation barriers
use chematic_ff::{dreiding_bond_len, dreiding_angle, dreiding_vdw};

let r0 = dreiding_bond_len(C_3, C_2, BondOrder::Single);  // 1.540 Å
let θ0 = dreiding_angle(C_3);                             // 109.47° (≈1.911 rad)
let (r_vdw, well) = dreiding_vdw(C_3);                    // VDW radius & depth

DREIDING Type Mapping

Type Description Geometry Hybridization
C_3, C_2, C_1, C_R Carbon: sp³, sp², sp, aromatic tetrahedral / trigonal / linear / planar
N_3, N_2, N_1, N_R Nitrogen: sp³, sp², sp, aromatic trigonal pyramid / trigonal / linear / planar
O_3, O_2, O_R Oxygen: sp³, sp², aromatic bent / linear / planar
S_3, S_R Sulfur: sp³, aromatic similar to N
P_3 Phosphorus: sp³ trigonal pyramid
H_ Hydrogen linear
F_, Cl, Br, I_ Halogens linear
X_ Unknown/fallback

Integration with chematic-3d

The DREIDING force field is integrated into geometry minimization:

use chematic_3d::{minimize_dreiding, minimize_dreiding_with_config, MinimizeConfig};

let optimized = minimize_dreiding(&mol, coords);
// Or with custom config
let config = MinimizeConfig { max_steps: 500, step_size: 0.1, convergence: 1e-5 };
let optimized = minimize_dreiding_with_config(&mol, coords, &config);

Energy Components

  • Bond stretching: k=700 kcal/mol/Ų × (r - r₀)²
  • Angle bending: k=100 kcal/mol/rad² × (θ - θ₀)²
  • VDW repulsion: Lennard-Jones 12-6 potential with Lorentz-Berthelot combining rules

MMFF94

Full Merck Molecular Force Field 94 implementation with PBCI/BCI partial charges.

Atom Typing & Charges

use chematic_ff::{assign_mmff94_type, mmff94_charges_bci};

let types   = assign_mmff94_type(&mol);           // → Vec<Mmff94Type>
let charges = mmff94_charges_bci(&mol, &types);   // PBCI/BCI partial charges → Vec<f64>

Energy Terms (7-term stack)

Term Description
Bond (cubic) Cubic stretch with quadratic + cubic force constants
Angle Angle bending with ideal angles per type pair
Stretch-bend Coupling between adjacent bond and angle distortions
Out-of-plane (OOP) Improper torsion for sp² centres
Torsion 3-term Fourier dihedral expansion
VdW (buffered-14-7) Halgren buffered 14-7 potential
Electrostatic Coulombic with distance-dependent dielectric (ε = r)

Minimization

use chematic_ff::{mmff94_total_energy, minimize_mmff94_lbfgs, EnergyBreakdown};

let e: EnergyBreakdown = mmff94_total_energy(&mol, &coords);
// e.bond / e.angle / e.torsion / e.vdw / e.electrostatic / e.stretch_bend / e.oop / e.total

let optimized = minimize_mmff94_lbfgs(&mol, &coords, 500);  // L-BFGS, max 500 iters

EnergyBreakdown fields: bond, angle, torsion, vdw, electrostatic, stretch_bend, oop, total (all in kcal/mol).

WASM Support

All functions are WASM-compatible with zero unsafe code:

// JavaScript/TypeScript
const mol = parse_smiles("CCO");
const pdb = chemWasm.minimize_dreiding_json(mol);
// → PDB string with optimized coordinates

Accuracy Notes

  • Parameters derived from the original DREIDING papers (Mayo, Ulmschneider, et al.)
  • Tested against DREIDING.cpp reference implementation
  • Typical geometry errors < 0.05 Å in well-defined regions
  • Accurate for sp³ and sp² carbons; use with caution for transition metals or exotic bonding

Performance

  • Type assignment: O(N) per molecule
  • Parameter lookups: O(1) constant time
  • Minimal memory overhead (types are u8 enums)
  • Suitable for N up to ~10,000 atoms with CPU minimize
  • WASM performance: N ≤ 50 atoms for interactive use

References

  • Mayo, S. L., Olfson, B. D., & Goddard III, W. A. (1990). DREIDING: A Generic Force Field for Molecular Simulations. J. Phys. Chem., 94(26), 8897–8909.
  • Ulmschneider, M. B., & Ulmschneider, J. P. (2009). Molecular Dynamics Simulations are Relevant to Simulations of Irreversible Processes. Eur. Biophys. J., 38(3), 235–246.

License

MIT OR Apache-2.0