This commit is contained in:
commit
568474d52f
1591 files changed
+528213
No files matched your search
@@ -0,0 +1,11 @@
|
||||
// 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
|
||||
Reference in new issue
Block a user