The interaction between simulation and scattering

Classical molecular dynamics (MD) is a common computational chemistry technique for studying complex systems, such as proteins, polymers, and energy materials [1-4]. Alongside the interest in these, and other applications, MD is also used to aid the analysis of data obtained from elastic scattering instruments.

This tutorial has been written to introduce users of elastic-scattering techniques, such as small angle scattering or diffraction, to classical MD simulation. We aim to provide an accessible route for experimentalists to better understand some of the complexities and subtleties of MD simulation, thereby aiding these researchers in extracting additional information from their experimental data via simulation.

This tutorial begins with an introduction to classical simulation methods, including a discussion of the development and parameterisation of classical interatomic potential models. We then provide an outline of traditional MD simulation methods and discuss a number of important considerations users of MD simulation should be aware of. We close this tutorial with an illustrative practical example, using the open-source Lennard-Jones simulation package pylj [5,6], and discuss how a radially averaged scattering profile may be obtained directly from simulation via the Debye equation [7].

We wish to emphasise that this tutorial is in no way a complete course on classical simulation or MD, and would direct the interested reader to one of the many detailed textbooks on this subject [8-12]. Rather, it is our hope that this tutorial provides a simple, practical, and a general introduction to new, or future, users of MD methods within the scattering community.


To get the most from this tutorial you will need:

  • Some basic understanding of the Python programming language (a great source for learning some Python is
  • Some knowledge of undergraduate chemistry or physics is required to fully appreciate the nature of classical potential models
  • A commensurate understanding of mathematics

Using this resource

This resource is designed to be interactive, which is achieved using Thebelab and BinderHub integration. Each page that contains interactive content will have the following two buttons at the top,

Selecting the “Interact” button will open a Jupyter Notebook version of the page running on the MyBinder resource in a new tab. The “Thebelab” button will make the code blocks in the webpage interactive, such that they can be run, edited, and re-run. The Thebelab integration is still in beta and therefore will not work perfectly every time (it is known not to work for the pylj examples). When the Thebelab integration fails, please use the Interact button.

If you use the “Interact” button, please be aware that we are since we are running on a free MyBinder resource, the launching of the Jupyter Notebook may be slow. We are investigating resources to run our own BinderHub in the future. Within the Jupyter Notebook in order to run a particular code block, select the cdoe button and click the “Run” button at the top of the page.

If you would prefer to run the resource locally, details of how this can be achieved can be found here.

Code (in)efficiency

Please be aware that the Python code in this tutorial has been written to prioritise understanding, above computational efficiency. Individual examples may therefore not be the most efficient implementation of particular algorithms. However, we have endeavoured to provide code examples that are authentic, and accurately represent the relevant aspects of real molecular dynamics methods.

Sharing this resource

This is an open educational resource, shared under a CC BY 4.0 license. This means that anyone is free to copy and redistribute the resource in any medium or format and welcome to remix, transform, and build upon the material for any purpose, even commercially. Basically, you can do whatever you want with it, although we would appreciate if you would reference the original resource if you use it. Please use the reference below, or download it as a BibTeX file.

McCluskey, A. R.; Grant, J.; Symington, A. R.; Snow, T.; Doutch, J.; Morgan, B. J.; Parker, S. C.; Edler, K. J. 10.5281/zenodo.2556824


This open educational resource was originally developed by Andrew R. McCluskey during his Ph.D. at the University of Bath and Diamond Light Source. The resource benefitted substantially from the hard work and input of the following people:


A. R. M. is grateful to the University of Bath and Diamond Light Source for co-funding a studentship (Studentship No. STU0149). B. J. M. acknowledges support from the Royal Society (Grant No. UF130329).


  1. Karplus, M.; McCammon, J. A. Nat. Struct. Biol. 2002, 9 (9), 7. 10.1038/nsb0902-646.
  2. Binder, K. Monte Carlo and Molecular Dynamics Simulations in Polymer Science; Oxford University Press: Oxford, 1995.
  3. Kim, S.-P.; van Duin, A. C. T.; Shenoy, V. B. J. Power Sources 2011, 196 (20), 8590–8597. 10.1016/j.jpowsour.2011.05.061.
  4. Burbano, M.; Carlier, D.; Boucher, F.; Morgan, B. J.; Salanne, M. Phys. Rev. Lett. 2016, 116 (13). 10.1103/PhysRevLett.116.135901.
  5. McCluskey, A. R.; Morgan, B. J.; Edler, K. J.; Parker, S. C. J. Open Source Educ. 2018, 1 (2), 19. 10.21105/jose.00019.
  6. McCluskey, A. R.; Symington, A. R. 10.5281/zenodo.2423866.
  7. Debye, P. Ann. Phys. 1915, 351 (6), 809–823. 10.1002/andp.19153510606.
  8. Harvey, J. Computational Chemistry; Oxford University Press: Oxford, 2018.
  9. Grant, G. H.; Richards, W. G. Computational Chemistry; Oxford University Press: Oxford, 1995.
  10. Leach, A. R. Molecular Modelling: Principles and Applications; Addison Wesley London Ltd: Harlow, 1996.
  11. Frenkel, D.; Smit, B. Understanding Molecular Simulation: From Algorithms to Applications; Academic Press: San Diego, 1996.
  12. Allen, M. P.; Tildesley, D. J. Computer Simulation of Liquids, 2nd ed.; Oxford University Press: Oxford, 2017.