Jaro Camphuijsen & Rahiel Kasim
“If, in some cataclysm, all of scientific knowledge were to be destroyed, and only one sentence passed on to the next generation of creatures, what statement would contain the most information in the fewest words? I believe it is the atomic hypothesis (or the atomic fact, or whatever you wish to call it) that all things are made of atoms—little particles that move around in perpetual motion, attracting each other when they are a little distance apart, but repelling upon being squeezed into one another.”
—Richard Feynman
def main():
init()
t = 0
while (t < tmax): # MD loop
force(f, en) # determine forces
integrate(f, en) # integrate equations of motion
t = t + delt
sample() # sample averages
def force(f, en):
for i in range(npart - 1):
for j in range(i + 1, npart): # loop over all pairs
xr = x[i] - x[j]
xr = xr - box * round(xr / box)
r2 = xr ** 2
if (r2 < rc2): # test cutoff
r2i = 1 / r2
r6i = r2i ** 3
ff = 48 * r2i * r6i * (r6i - 0.5) # L-J potential
f[i] = f[i] + ff * xr
f[j] = f[j] - ff * xr
en = en + 4 * r6i * (r6i - 1) - ecut
return
Follow the course Understanding Molecular Simulation in Period 3