Skip to content

Week 2

Units

When you start coding the simulation of the motion of the Argon atoms, you soon find that the normal SI units (kg, m, s, etc) lead to numbers of quite different magnitude in the simulations: e.g. mass of the Argon atoms or distances of order Angstrom .

Working with these different orders of magnitude is cumbersome, and prone to round-off errors. It is hence useful to identify some natural units in the simulation.

From the Lennard-Jones potential we can already find two natural units: for position, and for the energy. Let us thus define (and hence also ). We can then define a dimensionless Lennard-Jones potential as

So starting from Newton's second law for particle :

We rewrite it in terms of the dimensionless position:

   

Note that from we get . The only variable that still has a dimension is time . If we also define a dimensionless time , the whole Newton equation becomes very simple:

In practice, one usually leaves away all the tildes over the units. Then, you just say: length is in units of , energy in units of and time in units of .

The advantages of this approach are:

  • Less cumbersome numbers/constants/units to take care of in the program (less error prone)
  • Simpler equations (easier to code)
  • Insight into what are the expected length/time scales in our system

The last point is especially important. If is a natural scale of length in our system, we expect a typical distance (such as inter-atom spacing) to be of order . If we put in the numbers for Argon to calculate our new unit of time, we arrive at . So if we know what a typical distance and a typical time will be in our system, we can double check with the expected velocities.

From the equipartition theorem we have . The natural unit of velocity in our units is . So, in dimensionless units

Hence, the particle will move a typical distance of order in time . For our dimensionless units, this thus means that the time step should be smaller than 1, and of order . If your time step is too large, a particle can end up where it should not be. More specifically, extremely close to another atom, resulting in a huge repulsion for the next time step.

Some hints on the minimal image convention

We discussed earlier that our periodic boundary conditions also influence how the forces are calculated. In particular, we chose the convention that we will take only the force due to the nearest image of other particles. Note that this does not mean that an atom is only influenced by its nearest neighbouring atom. Instead, we just consider the closest of all 'image partners' (plus the original) of every atom for calculating interaction. The animation below highlights the image partners of the two red atoms that are closest to the green atom.

week1gif

The blue arrows in the animation continuously point from the green atom to the closest mirror partners of the 2 red atoms. Naively, it would seem that thus to compute the force on particle due to particle , we have to consider all the images of in 3D. This would give us 27 possibilities to check in total. To arrive at this number, extend the above animation to 3D and consider the amount of intern-atom distances to compute for the middle cell. However, since we are working with a orthogonal coordinate system, there is a significant simplification:

We need to minimize the distance , where are the coordinates of the original particle or an image, i.e. for example , , or ,. However, since we can shift each of the coordinates individually, we can minimize by minimizing each coordinate direction separately! Instead of 27 possibilities we thus just need to check 9.

The problem simplifies even more, since now we are effectively dealing with 3 seperate 1D problems. In particular we know that for a box of length :

where is now the closest image. Conditions like this are easily evaluated with numpy arrays. Another, even more compact formulation of the same is to write:

(xi - xj + L/2) % L - L/2

If you want to use this formulation, contemplate on why this does work (and check if we made a mistake ;) ). Use the formula that you are comfortable with!

Milestones

  • Derive the expression of the kinetic energy in dimensionless units
  • Change your existing molecular dynamics simulation to now use dimensionless units
  • Implement the minimal image convention
  • Simulate 2 atoms in 3D space. Choose their initial positions close to the boundary. This way, you can clearly see if the periodic boundary conditions work. Plot their inter-atom distance over time. Furthermore, also plot the kinetic and potential energy, as well as their sum, over time.