// 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