This Demonstration is only illustrative; therefore, naive techniques have been used in the code. For example, the velocities are rescaled at every step to give the desired temperature, which is not a good "thermostat" for real research using molecular dynamics. The Lennard–Jones potential has also been modified in order to avoid the huge forces that can arise when atoms are very close together. On the other hand, this naive implementation does show interesting behavior; at low temperatures particles cluster together in hexagonal arrangements, while at higher temperatures liquid-like behavior can be recognized. Normal modes of oscillation can also be observed in clusters.
The velocity Verlet algorithm is a method for calculating the trajectories of particles in a molecular dynamics simulation. It offers stability and efficient use of computer memory and time when the number of particles is large. This algorithm calculates the position of the
particle at step
from its position, velocity, and acceleration at step k
. Then velocities at the "half step"
are calculated. Accelerations at step
are obtained from the total force on each particle, and, finally, velocities at step
are obtained from velocities at the half step
and accelerations at step
are the position, velocity, acceleration, mass, and total force on the particle, and τ is the step size, the velocity Verlet algorithm is: