CoMD
A Mini-app for Co-Design of Classical Molecular Dynamics.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Verifying Correctness

Verifying the correctness of an MD simulation is challenging.

Because MD is Lyapunov unstable, any small errors, even harmless round-off errors, will lead to a long-term divergence in the atom trajectories. Hence, comparing atom positions at the end of a run is not always a useful verification technique. (Such divergences are not a problem for science applications of MD since they do not alter the statistical physics.) Small, single-particle errors can also be difficult to detect in system-wide quantities such as the kinetic or potential energy that are averaged over a large number of particles.

In spite of these challenges, there are several methods which are likely to catch significant errors.

Cohesive Energy

With a perfect lattice as the initial structure (this is the default), the potential energy per atom is the cohesive energy. This value should be computed correctly to many decimal places. Any variation beyond the last 1 or 2 decimal places is cause for investigation. The correct values for the cohesive energy are

Potential Cohesive Energy
Lennard-Jones -1.243619295058
EAM (Adams) -3.538079224691
EAM (Mishin) -3.539999969176

The command line options documentation explains the switches used to select the potential used in the simulation.

Note that the cohesive energy calculation is not sensitive to errors in forces. It is also performed on a highly symmetric structure so there are many errors this will not catch. Still, it is a good first check.

Energy Conservation

A correctly implemented force kernel, with an appropriate time step (the default value of 1 fs is conservative for temperatures under 10,000K) will conserve total energy over long times to 5 or more digits. Any long term systematic drift in the total energy is a cause for concern.

To facilitate checking energy conservation CoMD prints the final and initial values of the total energy. When comparing these values, pay careful attention to these details:

  • It is common to observe an initial transient change in the total energy. Differences in the total energy of 2-3% can be expected in the first 10-100 time steps.
  • The best way to check energy conservation is to run at least several thousand steps and look at the slope of the total energy ignoring at least the first one or two thousand steps. More steps are even better.
  • Set the temperature to at least several hundred K. This ensures that atoms will sample a large range of configurations and expose possible errors.
  • Fluctuations in the energy can make it difficult to tell if conservation is observed. Increasing the number of atoms will reduce the fluctuations.

Particle Conservation

The simulation should always end with the same number of particles it started with. Any change is a bug. CoMD checks the initial and final number of particles and prints a warning at the end of the simulation if they are not equal.

Reproducibility

The same simulation run repeatedly on the same hardware should produce the same result. Because parallel computing can add elements of non-determinism we do not expect perfect long term reproducibility, however over a few hundred to a few thousand time steps the energies should not exhibit run-to-run differences outside the last 1 or 2 decimal places. Larger differences are a sign of trouble and should be investigated. This kind of test is practically the only way to detect race conditions in shared memory parallelism.

Portability

In our experience, simulations that start from the same initial condition tend to produce very similar trajectories over short terms (100 to 1000 time step), even on different hardware platforms. Short term differences beyond the last 1 or 2 decimal places should likely be investigated.

General Principles

  • Simulations run at 0K are too trivial for verification, set the initial temperature to at least several hundred K.
  • Longer runs are better to check conservation. Compare energies after initial transients are damped out.
  • Larger runs are better to check conservation. Fluctuations in the energy are averaged out.
  • Short term (order 100 time steps) discrepancies from run-to-run or platform-to platform beyond the last one or two decimal places are reason for concern. Differences in 4th or 5th decimal place is almost certainly a bug.
  • Contact the CoMD developers (exmat.nosp@m.ex-c.nosp@m.omd@l.nosp@m.lnl..nosp@m.gov) if you have questions about validation.