Files
pplus-library/modules/md/lennard-jones-force/routine.pseudo
T
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

11 lines
511 B
Plaintext

// LennardJonesForce: the force between two particles at distance R under
// the Lennard-Jones potential, F(R) = -dV/dR
// = 24 Epsilon / R (2 (Sigma / R)^12 - (Sigma / R)^6).
// Positive pushes the particles apart; it is 0 at the bottom of the well.
FUNCTION LennardJonesForce(R : FLOAT, Epsilon : FLOAT, Sigma : FLOAT) RETURNS FLOAT
REQUIRE R > 0.0
DECLARE S2 : FLOAT <- (Sigma / R) * (Sigma / R)
DECLARE S6 : FLOAT <- S2 * S2 * S2
RETURN 24.0 * Epsilon * (2.0 * S6 * S6 - S6) / R
ENDFUNCTION