Skip to main content

compute_lj_force

Function compute_lj_force 

Source
pub fn compute_lj_force(r: f64, lj: &LjPotential) -> (f64, f64)
Expand description

Compute the Lennard-Jones potential energy and scalar force magnitude at separation r.

Returns (energy, force_magnitude) where:

  • energy = 4·ε·[(σ/r)^12 − (σ/r)^6]
  • force_magnitude = 24·ε·[2(σ/r)^12 − (σ/r)^6] / r (positive = repulsive)

The caller is responsible for applying the cutoff.