I need to implement the molecular dynamics method to simulate a simple fluid that interacts through the Lennard-Jones potential in a 2D simulation. The idea is to explore how the total energy of the system (kinetic + potential) and the particle trajectories depend on the size of the chosen time step.

I took a piece of code that does part of the job(I will upload it here) but I would like a algorithm to helpe-me to finish. I will try to summarize what I understood until now:

  1. Initially it sets the physical parameters and parameters of simulation
  • temperature
  • density
  • number of particles
  • size of the box
  • Lennard-Jones cut-radius
  • Verlet-list radius
  1. It initializes the vectors and lattice
  • position and velocity vectors x,y and vx,vy
  • distributes the particles in a square centered lattice
  • Chooses velocities uniformly on a unit circle
  • Normalizes the velocities according to the energy equipartition theore
  • make the total momentum of the particles equal to zero
  1. Creates a verlet list to define neighbors

My doubts are:

How and when to use Lennard Jones potential and Verlet Velocities in the code ? Does someone have an example algorithm or can put it in a manner that I can follow the steps?

The code until now: MolecularDynamics_2DfluidSimulation

  • 4
    $\begingroup$ "Computer Simulation of Liquids" by Allen and Tildesley. The book contains FORTRAN and Python examples (github.com/Allen-Tildesley/examples/tree/master/python_examples) for various kinds of simulation exercises. This would be the best reference for your project. $\endgroup$ Oct 18, 2022 at 3:33
  • 2
    $\begingroup$ Hey that's my line @Magic_Number $\endgroup$
    – B. Kelly
    Oct 18, 2022 at 21:18

1 Answer 1


Based on the comment by Magic_Number and the comment by B. Kelly, and the lack of response, and the OP not signing in for the last 7 months, I'll assume that it's enough to say that this link provided by Magic_Number has the required code, and I'll say that this Community Wiki post can be deleted if someone wants to write a more detailed answer.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .