Skip to main content

Module pair_potential

Module pair_potential 

Source
Expand description

Pair potentials between point particles: Lennard-Jones 12-6, Morse, Coulomb and screened Coulomb (Yukawa), with cutoff / shift and the Lorentz–Berthelot mixing rule.

§Laws

Lennard-Jones   U = 4ε[(σ/r)¹² − (σ/r)⁶]          F = 24ε[2(σ/r)¹² − (σ/r)⁶] / r
Morse           U = D(1 − e)² − D,  e = e^{−a(r − r_e)}   F = −2 D a e (1 − e)
Coulomb         U = k q_i q_j / r                  F = k q_i q_j / r²
Yukawa          U = k q_i q_j e^{−r/λ} / r         F = k q_i q_j e^{−r/λ} (1/r² + 1/(λ r))

F = −dU/dr is the radial force: positive is repulsive. The force on particle i from j is F(r) r̂ with r̂ = (x_i − x_j)/r (PairPotential::force_on_first); j receives the negative.

  • Lennard-Jones: minimum U = −ε at r_min = 2^{1/6} σ, U(σ) = 0, curvature U''(r_min) = 72 ε / r_min² ≈ 57.146 ε/σ².
  • Morse is written with its minimum at −D (U(r_e) = −D, U → 0 as r → ∞), so it has the same zero at infinity as the others and can be truncated the same way. The harmonic force constant at r_e is 2 D a².
  • Coulomb uses COULOMB_CONSTANT k = 8.99e9 V·m/C, the same constant and sign convention as crate::electromagnetic::EmSource::PointCharge: the force on i equals q_i E_j(x_i) with E_j the field of charge j. Coulomb::with_constant takes k explicitly (reduced units).
  • Yukawa is the Debye–Hückel screened Coulomb interaction of charges in an electrolyte or plasma with screening length λ; λ → ∞ recovers Coulomb. It is included because it is a law of the same form (parameterised by λ alone) and its long-range part decays exponentially, which makes a cutoff meaningful; the bare Coulomb sum with a cutoff is not convergent in a periodic system (Ewald / PPPM summation is not provided).

§Cutoff and shift

Truncated cuts a potential at r_c (zero for r ≥ r_c) with an explicit ShiftMode:

None         U(r)                                F(r)            (U jumps at r_c)
EnergyShift  U(r) − U(r_c)                       F(r)            (F jumps at r_c)
ForceShift   U(r) − U(r_c) + (r − r_c) F(r_c)    F(r) − F(r_c)   (both vanish at r_c)

(ForceShift is the shifted-force potential, U'(r_c) = −F(r_c).)

§Degenerate input

Every evaluation takes r > 0; r ≤ 0 (coincident particles) is PairPotentialError::NonPositiveDistance: the direction of the force is undefined there and Lennard-Jones / Coulomb diverge. A value outside the Fix128 range (|x| ≥ 2⁶³, e.g. (σ/r)¹² for r < σ/1500) is PairPotentialError::Overflow instead of a wrapped number. Parameters are validated by the constructors (σ > 0, ε ≥ 0, D ≥ 0, a > 0, r_e > 0, k > 0, λ > 0, r_c > 0); ε = 0 / D = 0 / zero charges give a potential that is zero everywhere.

§Determinism

Fix128 throughout (no std needed). exp is crate::math_util::exp_fix, extended above its saturation at 20 by halving the argument and squaring the result (the same steps exp_fix itself takes, so the extension is continuous at 20).

Specific molecules’ ε, σ, charges or force-field tables are not part of this module: every parameter is passed in.

Structs§

Coulomb
Coulomb interaction U = k q_i q_j / r of two point charges.
LennardJones
Lennard-Jones 12-6 potential U = 4ε[(σ/r)¹² − (σ/r)⁶].
Morse
Morse potential U = D(1 − e^{−a(r − r_e)})² − D (minimum −D at r_e).
Truncated
A pair potential cut at r_c: zero for r ≥ r_c, shifted inside by ShiftMode.
Yukawa
Screened Coulomb (Yukawa / Debye–Hückel) interaction U = k q_i q_j e^{−r/λ} / r.

Enums§

PairPotentialError
Why a pair potential could not be built or evaluated.
ShiftMode
How a Truncated potential is made to vanish at the cutoff.

Constants§

COULOMB_CONSTANT
Coulomb constant k = 1/(4π ε₀) ≈ 8.99e9 V·m/C, the value used by crate::electromagnetic::EmSource::PointCharge.

Traits§

PairPotential
A central pair potential U(r) and its radial force F(r) = −dU/dr.

Functions§

lorentz_berthelot
Lorentz–Berthelot mixing rule for Lennard-Jones parameters of unlike species: σ_ij = (σ_i + σ_j)/2, ε_ij = √(ε_i ε_j).