Files
pplus-library/modules/md/lennard-jones/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

12 lines
593 B
Plaintext

// LennardJones: the Lennard-Jones pair potential at distance R,
// V(R) = 4 Epsilon ((Sigma / R)^12 - (Sigma / R)^6). Epsilon is the depth of
// the well, reached at R = 2^(1/6) Sigma, and V is 0 at R = Sigma. The powers
// are built by multiplication from (Sigma / R)^2, as simulation codes do,
// instead of ^, which rounds a little differently.
FUNCTION LennardJones(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 4.0 * Epsilon * (S6 * S6 - S6)
ENDFUNCTION