This commit is contained in:
commit
568474d52f
1591 files changed
+528213
No files matched your search
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"tool": "godbolt",
|
||||
"compiler": "mojo_1_2_0",
|
||||
"mojoVersion": "1.2.0",
|
||||
"source_sha256": "6cc9da2b05065bbfb293aa17dd81dbbc91e091f91f5af3a878b944b17686bfda",
|
||||
"stdin": "3 1 0 1 0 1 0 78986244726619 -46 1 0 1 0 5 -1 535928355657089 -51 7656119366529843 -51 end\n",
|
||||
"args": "--target-cpu x86-64-v3 --fp-mode contract=off",
|
||||
"asked": "2026-11-12",
|
||||
"result": {
|
||||
"compiled": true,
|
||||
"buildStderr": "",
|
||||
"executed": true,
|
||||
"exitCode": 0,
|
||||
"stdout": "24.0\n-2.3738310467722616e-15\n168.49822326347663",
|
||||
"stderr": "",
|
||||
"timedOut": false,
|
||||
"asm": null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
def lennard_jones_force(r: Float64, epsilon: Float64, sigma: Float64) -> Float64:
|
||||
var s2 = (sigma / r) * (sigma / r)
|
||||
var s6 = s2 * s2 * s2
|
||||
return 24.0 * epsilon * (2.0 * s6 * s6 - s6) / r
|
||||
@@ -0,0 +1,4 @@
|
||||
def lennard_jones_force(r, epsilon, sigma):
|
||||
s2 = (sigma / r) * (sigma / r)
|
||||
s6 = s2 * s2 * s2
|
||||
return 24.0 * epsilon * (2.0 * s6 * s6 - s6) / r
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "LennardJonesForce",
|
||||
"summary": "The force between two particles at distance R under the Lennard-Jones potential: positive pushes them apart.",
|
||||
"tags": [
|
||||
"molecular dynamics",
|
||||
"force"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"title": "Allen and Tildesley, Computer Simulation of Liquids, 2nd edition (Oxford, 2017), section 1.3.2, Atomic systems: the potential whose derivative this is"
|
||||
},
|
||||
{
|
||||
"title": "Lennard-Jones, Cohesion, Proc. Phys. Soc. 43 (1931): the 12-6 form",
|
||||
"url": "https://doi.org/10.1088/0959-5309/43/5/301"
|
||||
}
|
||||
],
|
||||
"cases": [
|
||||
{
|
||||
"call": "LennardJonesForce(1.0, 1.0, 1.0)"
|
||||
},
|
||||
{
|
||||
"call": "LennardJonesForce(1.122462048309373, 1.0, 1.0)"
|
||||
},
|
||||
{
|
||||
"call": "LennardJonesForce(2.5, 0.238, 3.4)"
|
||||
}
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"lang": "python",
|
||||
"level": "multiply",
|
||||
"file": "ref/python/multiply.py",
|
||||
"note": "The same multiplications."
|
||||
},
|
||||
{
|
||||
"lang": "mojo",
|
||||
"level": "multiply",
|
||||
"file": "ref/mojo/multiply.mojo",
|
||||
"note": "The same multiplications in Mojo."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// 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
|
||||
Reference in new issue
Block a user