Advertisement

ChemTexts

, 4:2 | Cite as

The Hitchhiker’s guide to molecular dynamics

A lecture companion, mostly for master’s and PhD students interested in using molecular dynamics simulations
  • Philippe A. Bopp
  • Ewa Hawlicka
  • Siegfried Fritzsche
Lecture Text

Abstract

This lecture aims at advanced (master’s, PhD) students in physics, chemistry, physical chemistry, biochemistry, engineering (and possibly biology) who use, or plan to use, molecular dynamics (MD) computer simulations in the course of their research work. This lecture is, however, neither (or only in a very limited way) a course on the scientific background of this method (quantum mechanics, statistical mechanics, computational methods), nor is it a pragmatics tutorial (‘how-to’ guide) which button to click on some graphical interface or other. We rather aim at pointing out to the aspiring user of any kind of simulation software some of the important choices that must be made as well as some of the problems and pitfalls that he or she may encounter on the way to reliable and meaningful scientific results. This includes a few reminders what not to forget to avoid such mistakes and possibly where to look to correct them if they have, unavoidably, been made.

Keywords

Computational chemistry Molecular simulations Molecular dynamics (MD) Statistical mechanics 

Introduction

‘The Hitchhiker’s Guide to the Galaxy’ [1] is a famous multi-media series (radio, TV, books) that started in the late 1970ies. It relates, through many comical and surrealistic episodes, the space travels of a man in some far future. It is heavily interwoven with allusions to computers and computations, something that was quite new at the time it was written. Like the Hitchhiker, researchers starting with molecular dynamics simulations (abbreviated MD) will encounter many mostly unwelcome surprises, oddities and dead-ends, and many a green monster will lurk in dark corners.

The (not-so-young-anymore) authors of this lecture were, now almost 50 years ago, among the first ones to use MD simulations. We have written (and still write) simulation and evaluation programs (see “Purpose of an MD simulation” and “Writing your own programs”). We have supervised many students; they, and before them we, have made all the mistakes and misjudgments that we will discuss. We thus hope to be able to help beginners in this field to avoid common errors and if errors have (unavoidably) been made, to identify the causes and to get things right.

The most difficult part in the assessment of ones work is indeed to know a pitfall when one sees one. How does one know that some numbers the program prints, or plots, are in some way ‘wrong’. All too often one hears the argument: “it agrees (very well, of course) with (some) experiment”. Yet this means very little, as we shall see.

This lecture is thus aimed at students having already some knowledge of ‘modeling’ and statistical mechanics as these subjects are usually taught at the master’s level in good curricula. A background in quantum mechanics (or quantum chemistry) is also advantageous. Many textbooks, see e.g. Refs. [2, 3, 4] (and innumerous others) as well as rich web resources [5, 6] can be used to brush up these subjects. In the next section “Background in a nutshell”, we will just summarize, in the shortest-possible way, the basic concepts underlying MD simulations.

Hint: we have sprinkled throughout the text explanations and asides in italics; they can be skipped for an easier reading. For the same reason, some discussion of details has been moved to the figure captions. References have been (severely) limited to general texts (and web-sites) and a few pointed examples. Keywords important to remember are in bold (and can be GOOGLE d).

Background in a nutshell

MD simulations are based on Ludwig Boltzmann’s fundamental ideas that led to the development of classical (i.e. based on classical, or Newtonian, mechanics) statistical mechanics (also called Boltzmann statistics). The fundamental assumption is that for a system (e.g. some quantity of water at some pressure and temperature), which can be characterized macroscopically by only very few ‘state variables’ (Gibbs’ phase rule says how many such independent variables there are), there is an enormously large number of microscopic ‘states’ (and enormously means indeed enormous, something like the number of atoms in the universe). For ‘state’ in classical mechanics, we can loosely say: ‘arrangement of molecules’, more precisely: ‘the positions of all particles and their velocities, at some given time’.

Consequently, it is, and always will be, impossible to obtain all these microscopic states or ‘microstates’, in any finite time. The best one can do is to construct a representative sample of all the ‘states’ that are compatible with a macroscopic state of the system. For this construction, the simulation, we consider here exclusively the case that the inter- (and intra-)molecular interactions can be derived from a Potential Energy Surface (PES), see Ref. [5] for alternatives. This PES represents, in the Born-Oppenheimer approximation [7], the electronic ground-state energy of the system. At the temperatures relevant for chemistry (say \(T \ge 300\) K or so), the de Broglie thermal wavelength (see [8]) is much smaller than any interparticle distance for masses larger than the mass of the hydrogen atom. Classical Newtonian mechanics, governed by the PES, is thus usually a good approximation (to quantum dynamics) to describe the motions of atoms (except, in some cases, in intramolecular vibrations of molecules). This is the approach exclusively discussed here.

In MD simulations, one thus has, by construction (see below): N molecules occupying a fixed volume, V, with some constant total energy of the system, E. Such MD simulations are thus known as (NVE) MD. With some “tricks”, see “More advanced work”, one can also have constant temperature, T, (instead of energy) or constant pressure, p, (instead of constant volume), consequently called (NVT) or (NpT) MD, thus generating samples of the corresponding ensembles of statistical mechanics (and indeed only corresponding: e.g. the (NVE)-MD-generated sample is a sample of the micro-canonic ensemble not only in the sense that it contains a finite number of states, it also contains only states with one value for the total momentum, \(\mathbf {p}\), which is not required for the micro-canonic ensemble. This is also true, mutatis mutandis, for the other ensembles). Always remember (and also see below, “More advanced work”) that (often sophisticated) tricks are used to construct these ensembles (except(NVE)), and tricks are tricky! You must know exactly what you are doing!

The construction of the (NVE) sample is based on the fact that it can be shown (see e.g. textbooks on classical mechanics) that the ‘trajectory’ obtained by solving (here numerically) Newton’s equations of motion (or the equivalent Lagrange or Hamilton equations) for the N interacting particles (which one keeps in a finite volume with so-called periodic boundaries 5) is, just such a sample of states under (NVE) conditions. The (NVE) sample is thus the ‘natural’ one for MD simulations. However, one needs suitable initial conditions to start the trajectory, This will be discussed in “Controlling the simulation”.

We note in passing that if the PES can be approximated by ‘harmonic’ functions (more precisely: bilinear forms in atomic displacements), and if one restricts oneself to (infinitesimally) small atomic displacements, it is not necessary to do MD since solutions can be obtained analytically (normal modes [9]).

Observables (i.e. measurable quantities) are computed from these samples, \(\{q,p\}\), (in MD ordered by increasing time) as:
$$\begin{aligned} \langle \ A \ \rangle = \frac{1}{M} \sum _i^M A\bigl ( q(t=t_i), \quad p(t=t_i)\bigr ) \end{aligned}$$
where \(\{q,p\}\) is the sample (trajectory = all positions, q, and momenta (velocities multiplied by masses), p, of all particles for the time \(t_1, t_2,t_3,...,t_M\)). \(A\bigl ( q(t=t_i),p(t=t_i)\bigr )\) is the property of interest (e.g. some energy) that can be computed from the positions, \(q(t=t_i)\), and momenta, \(p(t=t_i)\), at time \(t_i\). \(\langle \ A \ \rangle\) is the thermodynamic average of A at the conditions (temperature, pressure, density, etc.) at which the simulation was run.

The equation above does not make use of the fact that MD generates time-ordered samples, i.e. that we know that (as an example) some positions \(q(t=t_j)\) occur some time \(\varDelta t = t_j - t_i\) later than the positions \(q(t=t_i)\). We can take the sum in the equation above in any order and obtain the same result.

To take advantage of the time-evolution of the simulated system, one needs to compute (in systems at equilibrium!) a different kind of average, the correlation function:
$$\begin{aligned} C_{AB}(\tau ) = \frac{1}{M_j} \sum _{j=1}^{M_j} A\bigl ( q(t=t_j),p(t=t_j) \bigr ) \otimes B\bigl ( q(t=t_j + \tau ),p(t=t_j + \tau ) \bigr ) \end{aligned}$$
which links, via some operator \(\otimes\) (very often a scalar product), the property A at times \(t_j\) with the property B at later times \(t_j+\tau\). The function \(C_{AA}(t)\) is called autocorrelation. In some instances, a constant term must be subtracted, see [4].

These correlation functions are very powerful tools of statistical mechanics. Their Fourier–Laplace transforms, \(C_{AA}(\omega )\), are called spectra. Furthermore, they are linked to the so-called ‘transport coefficients’ and generally allow, via the ‘fluctuation–dissipation theorem’ [4], to get access to non-equilibrium properties (in the linear regime) of the system, see [4]. We shall not enter into this here, see however [10] (and references therein) for recent work in this field.

Purpose of an MD simulation

We restrict ourselves in this lecture to classical MD simulation of unconstrained equilibrium ensembles. We will thus not discuss the many types of non-equilibrium MD (NEMD) and the methods that use constraints (biases) to force the simulation to sample particular configurations that may be of interest (so-called rare event, e.g. around transition states). But let us first define a few terms, see Figs. 1 and 2.
  • We use the term model to designate the (mathematical) description of all intermolecular and intramolecular interactions in our system. This includes the molecular topologies in flexible but un-dissociable molecules (usually called flexible molecules) and the unchangeable geometries of ‘rigid’ molecules. Contrary to other definitions of ‘model’ [11], we do not include in this definition the programs to which our models are input. We discuss only simulations where these interactions are described by a potential energy surface (PES).

  • We use the term simulation program or simulation code to designate the computer program that takes the model as input (and many other things, see “Controlling the simulation”).

  • We use the term evaluation program or evaluation code to designate the computer programs that take the trajectory (sample of ensemble, configurations, history) as input and compute averages according to statistical mechanics, see “Background in a nutshell”. For practical reasons (computer time), several such averages are usually already computed ‘on the fly’ during the simulation run(s).

In an MD simulation, one thus constructs, (time-)step by (time-)step by solving Newton’s equations of motion (or slightly modified versions thereof [12]), a representative sample of the microscopic states of the systems, compatible with given external conditions (Example: a sample of states for a system at high temperature will contain certain states that will (most likely) not appear in the sample for a lower temperature). The sample will, of course be limited in size, but must be large enough if reliable results are to be derived. This is an important point to consider before starting any simulation study, see “Statistics”.

MD simulations thus open only a limited space-time window (see Fig. 4) in which the system of interest can be studied. This window is mostly due to computational limits, but it is easy to convince oneself that it will always remain limited, even with the largest conceivable computer [1]. Roughly speaking, the 6N coupled first-order differential equations of motion for N point masses can be solved for N=(a few thousand particles) and or a few million (\(10^6\))steps of numerical integration, which leads, depending on the density of the system and the masses of the particles, to volumes of, at best, \((100~\AA )^3\) and times of a few hundreds of nanoseconds \((10^{-9}\) s). In most cases, smaller systems are studied. It is not reasonable to attempt to study phenomena which occur on much larger time and length scales with MD simulations, see “Choice of questions to study”.

Ideally, a simulation yields, within statistical uncertainties (this is why it is called ‘statistical’ mechanics!), the exact answer for a system consisting of particles (molecules) under the specified conditions (temperature, density, etc.), interacting via the given model. This is what we have to strive for. That this is indeed an idealization, neglecting many sources of error, has been recently demonstrated in the most convincing way by a benchmarking experiment [13]. The fact that a simulation ‘technically’ works does not say anything about the model itself, whether it is (in any sense) ‘good’ or ‘bad’, realistic or not, suitable or not suitable, useful or not.

Figures 1 and 2 explain the principles of an MD simulation; some problems that may arise at various points are discussed in the next sections. Figure 2 can be seen as being (mostly) inside the ‘MD simulation’ box of Fig. 1, and both boxes often sit (see “The interaction model”) inside another big feedback loop. If everything is OK with the simulation itself, this big loop essentially entails variations (refinements!) of the interaction model. We discuss this in “The interaction model”.

Broadly speaking, MD simulations are performed for two different (but not mutually exclusive) purposes: analytical and predictive. In the first instance, the focus is on giving an interpretation, at the molecular level, of some experimental observation, or, as we shall see below (and which is much more challenging), of several such observations. In the second instance, we would like to use the model to make predictions (e.g. how the structure changes when the pressure is increased, or how the self-diffusion changes when the temperature is increased). Since it is (in contrast to experiment) easy to increase to high values these external conditions in MD simulation, making such predictions can be useful (e.g. in geology).

We shall not consider here the problems that may arise from the fundamental assumptions of MD (classical mechanics etc., see “Background in a nutshell”), very little the problems related to the simulation itself (“time steps”. “cut-offs”, etc.), but focus mostly on the implications of the model (as defined above) and the choice of certain parameters inherent to the MD method. This is the topic of the next two sections.

Choice of questions to study

Simulations are often started in the same way as Christopher Columbus started his travels: “There may be something out there, may be India, let’s see what we find”. While this approach, as Columbus demonstrated, sometimes leads to epoch-making breakthroughs, it probably is not what is needed in normal scientific research.

Figure 3 shows, schematically, how one can think about the relation between a ‘Model’ (in general), a ‘model’ (used in MD) and an observation (an experiment, a measurement). This is something to keep in mind in the discussion of models (stricto sensu) in the next section. Furthermore, Fig. 4 shows the space-time window accessible to MD simulations and Fig.  5 a typical setup with periodic boundary conditions (PBC) in three dimensions (only x and y shown, of course). We simulate an infinite system, but only N particles are truly independent, the other “all do the same thing”. This is why we have the space-limit of our window.

So, essentially, three questions must always be asked before any work is started, from simple to difficult:
  1. 1.

    Does the ‘thing’ I want to study occur within the accessible time window?

     
  2. 2.

    Is the ‘thing’ I want to study limited to the size (volume) of the system I can simulate?

     
  3. 3.

    Can I find, or construct, a satisfying model?

    And what does satisfying mean here?

     
While questions 1 and 2 refer to previous knowledge and expectations about the system to be studied (and shall thus not be discussed here), question 3 is a most difficult one, which is why section “The Interaction Model” is entirely devoted to this question. In any case, it is the interplay between these various aspects that will govern the final choices.

Controlling the simulation

Setting up the system

Once the problem to be studied has been defined, the first task is to ‘invent’ (or guess) positions and velocities for all particles (so that the numerical integrations can start). To keep the time for the equilibration (i.e. the construction of the real initial conditions compatible with the conditions under which the system is going to be simulated), see “The ‘Equilibration’ process, ensembles” and Fig.  8, as short as possible, one strives to make a guess as educated as possible, especially for the particles positions. This is why a purely random positioning of the particles is not advisable, at least a minimum distance between particles must be kept, see Ref. [14]. Often, a (more or less) random positioning is combined with positions taken from crystal structures, e.g. [15]. In this case, it is advisable to verify that the aggregate state of the system after equilibration is as desired (i.e. that the lattice has melted if one expects a liquid, or that it has not melted if one wants to study the crystal). Many tools, graphical or otherwise, are available to help in this task, which can be a major one for crystalline or biochemical systems.

The determination of initial velocities is less critical, since in most cases the velocities will be manipulated during the equilibration process. One usually chooses the velocities randomly from Gaussian distributions (in xy and z directions) or Maxwell–Boltzmann distributions for the corresponding masses (or moments of inertia for rigid molecules) at the desired temperature. It eases the evaluation of time-dependent quantities (dynamics) to set the total momentum equal zero, \(\mathbf {p} = 0\), (or separately the momenta of e.g. a large solute and the solvent) at the beginning of the simulation.

The interaction model

We start from the consideration that the PES is just a representation of the electronic ground state energy of our system as a function of the particle positions (and possibly other things, which we will not consider here). As such, the PES can be obtained, in principle, from quantum chemistry.

In practice, for larger (more than 100 particles, say) systems that need to be followed for times longer than a few 10 picoseconds, this cannot be done ‘on the fly’ during the simulation. Thus there is necessity to pre-establish an interaction model to represent the PES.

The choice of interaction model (or briefly ‘model’, see “Purpose of an MD simulation”) is the central decision to make before one starts any such simulation work. (As seen elsewhere (see again “ Purpose of an MD simulation ”) a successful simulation will yield the ‘exact’ result for a given model). We cannot possibly discuss here all the facets of this complex question. This complexity is illustrated, e.g. by Ref. [16], which discusses the vast choice of interaction models for one of the simplest (yet most ubiquitous) molecules, \(\hbox {H}_2\hbox {O}\); and since the publication of this review article, research has not stopped and many more models have been proposed.

Two approaches to models can be broadly distinguished: in the first one (let’s call it ‘fundamental’), one strives to represent as accurately as possible the interaction energies obtained, e.g. for quantum mechanical calculations. This is a real ‘coarse-graining’ procedure. In the other approach (may be: ‘pragmatic’ or ‘tuning’), one selects an ansatz (a template, e.g. a Lennard-Jones (LJ) 12-6 and a Coulomb term) and adjusts the parameters (two for the LJ plus partial charges) until one gets the desired values from the simulations.

Concerning the simulation itself, Hasse [17] calls the first approach “theoretical model, computer, or numerical experiments”, i.e. the models are taken as an absolute and explored rigorously; the second one is described as analog to “the classical experiment”. i.e. one tries to construct a specific representation of an experiment finding that does not conflict with the known laws of nature. In many cases, a mix of both approaches is necessary (which may sometimes confuse the issue), we discuss this in more detail below.

This brings us back to section “Choice of questions to study” and the question that must always be asked: what do we want to learn from the simulation, see Fig.  3 and “Generating meaningful results”. Depending on how this question is answered, we will approach our choice of the model and its parameters differently.

Let us start with the first, the fundamental approach. Here, the model is constructed, within well-defined approximations, from quantum chemical energies for small fragments (usually only two molecules) of the system. Ansatz functions are written and their parameters determined by (usually non-linear) fits. The fitting procedure is often difficult: many (some 10 or 100) parameters must be determined and have physically reasonable values. Furthermore, the energies must be well represented not only at the minimum/minima, not only in the vicinity of these points (where the particles stay most of the times), but also up to quite high energies above the minimum such as the mountains in Fig. 7 if they must be crossed. Such events occur infrequently, but not that infrequently: for an energy of, say, \(\varDelta E = 7.5 \, k_{\mathrm{B}} T \ , \ T\approx 300\)K, above the minimum, we have a probability to get there of the order of something like \(p = \exp ({-7.5}) \approx 0.0006\) or 6 in 10,000, which means it will almost certainly occur many times in a simulation of a few 1000 particles and a few 100,000 time steps. The high-energy regions (mountains, resulting from the repulsions between particles) of the PES which govern these events often have a strong influence on some properties (e.g. the self-diffusion).

We shall not discuss here the various types of function that one may try to describe the PES as efficiently as possible, “Classes of models” lists a few keywords that point to some of the approaches that have been tried; “Often made trivial mistakes” mentions as an example the often used Lennard–Jones (LJ) 12-6 function, but there are many other ones. The electrostatic (or Coulomb) interactions between partial charges assumed to be located in various places (mostly on atoms) are often treated separately, for physical as well as mathematical reasons (convergence problems in the periodic system, see Fig. 5). As discussed in the next section, the so-called combination rules must also be used with utmost care.

In the alternative option, ansatz functions are written down as previously (often the same functions). The difference is that their parameters are determined, and refined, in simulations until a certain desired result is obtained. Most often this is done manually, but automated procedures have been devised [18]. Sometimes, this is coupled with coarse-graining approaches [19], e.g. writing potential functions between groups of atoms rather than between individual atoms (the so-called united-atom method). In any case, as soon as more than one quantities is to be reproduced (as in the right panel for Fig. 3), compromises will be required (see e.g. [20]).

Figure 3 (already mentioned in several instances ( “Choice of questions to study”, “The interaction model”)) contrasts what can be achieved by simulation work with more conventional approaches. It is certainly useful to establish that some physically reasonable interaction model can be devised that reproduces a given observation in a rigorous statistical-mechanical treatment (the simulation). This is certainly not a given fact; such a model may not exist at all, which may be due to an experimental problem or to a lack of understanding of the experiment (if not a mistake of the many other kinds discussed here). An MD simulation conducted under these premises may thus be a useful tool for analysis, its predictive power is very limited.

Again adjusting parameters in a model only to obtain a particular agreement for one particular property does not contribute much to the understanding of the system. However, if other properties are also reproduced with the so-parameterized model (i.e. the parameters (or model) are transferable) much more is to be gained (Fig. 3, right panel). We stress here that when doing systematic studies (variations of temperature, concentration, density, etc.) one should strive to reproduce (and understand) trends, not absolute values. All too often, when agreement of a particular computed value (or function) with ‘experiment’ is achieved (for the observable of interest: thermodynamic observable, structural observable, etc.) one is tempted to stop working and to conclude, like the famous Dr. Pangloss, that “everything is all for the best in the best of all worlds” [21]. It is, as discussed, unfortunately not so. A much deeper understanding arises when one is able to demonstrate that an array of different properties (explored by different experiments) can be obtained from a single model, and even more so if this model is not adjusted, but has its origin in a fundamental equation of Nature (the Schrödinger Equation).

Out of necessity, the two approaches (fundamental and fitting to desired results) must often be combined if complex systems are to be simulated. In multicomponent systems models of different origins are thus combined, and adjustments may be required. The difficulty there is that adjusting a (or some) parameter(s) for a property will affect not only this property, but all the other ones as well. It is a balancing act; the resulting uncertainties have been documented in many instances; the refs. [22, 23] thus show how minor modifications of parameters (in LJ-potentials, as it happens) can lead to physically (in one case biologically) different results.

Hasse and Lenhard [17] sum this dilemma very well: “A critical discussion of how adjustable parameters function shows that they are boon and bane of simulation. They help to enlarge the scope of simulation far beyond what can be determined by theoretical knowledge, but at the same time undercut the epistemic value of simulation models”. Many references in [17] discuss similar points.

The next section “Classes of models” gives a brief classification of available models, each category comes in many kinds and shapes and can be applied in both philosophies described above. This multiplicity of choices may not always simplify the selection of a model suitable to study one’s problem.

Classes of models

There is an almost infinite variety of models, this is not our topic here; it would be the subject of a separate lecture. We will just review, without discussion nor references (it would be too many, check Wikipedia!) a few keywords that may help to relate various classes of models to each other.

The simplest and most often used approximation is pairwise additivity: the total potential energy of N particles is the sum of \(N\cdot (N-1)/2\) terms, called pair potentials, each term depending only on the positions of two particles (thus pair). This is almost generally assumed for intermolecular interactions. These pair potentials, also called central force potentials, are furthermore termed effective potentials when they have been tuned to include (in an average fashion in the spirit of a mean-field approximation) the main neglected effect, namely the mutual polarization of particles in a dense medium. (Effective potentials are thus, in principle, density and temperature dependent. This is usually neglected.). Be that as it may, a recent systematic exploration [24] of virtually all pairwise additive \(\hbox {Li}^+\hbox {-water}\) interaction models that have been proposed comes to the conclusion that none is satisfactory for all the tested quantities.

The neglected many-body effects can also be included in form of explicit polarizabilities (polarizable models) (this makes the computation of the interactions computationally more expensive since self-consistency must be achieved.) or in form of three-body and higher potential terms (cluster expansion). Another improvement can be achieved using pair functionals instead of pair potentials. One replaces sums of pair terms of type
$$\begin{aligned} \sum _{i < j} \left( \frac{C}{r_{ij}} \right) ^m \text { by terms of the type } \sum _{i} \rho _i^{1/2} \text { with } \rho _i = \sum _j \left( \frac{D}{r_{ij}} \right) ^n \end{aligned}$$
(CDmn are some constants). This is computationally not more expensive than pair potentials. The Sutton–Chen [25] model, used for metal surfaces, is an example.

We distinguish furthermore between all-atoms and united atom models (already mentioned in section “The interaction model”), depending on whether groups of atoms (e.g. \(\hbox {CH}_2\) or \(\hbox {CH}_3\)), and in some cases simple molecules (e.g. \(\hbox {CCl}_4\)), are represented as several or as one entity. Another distinction is between rigid, flexible and semi-flexible models, depending on whether molecules, or parts of molecules, or crystal lattices, are represented as rigid bodies, as flexible topologies, or as combinations thereof.

Bond-order potentials attempt to mimic the directionality of chemical bonds. The so-called reactive potentials go one step further in that the topology of molecules is no longer assumed to be permanent: molecules can dissociate and more generally react with each other. This is an active field of research, such models are to be used with the utmost care and tested very extensively.

Models are called transferable if it is believed that they can be freely combined with each other (e.g. to study mixtures). However, this must be tested in every case (e.g. the miscibility gap), see the comments about the combination rules in “The interaction model”.

We note (see also “Purpose of an MD simulation”) that for practical reasons potentials sometimes need to be modified for the calculations. The main modification is the truncation: in the pair-potential approximation, terms for interparticle distances larger than a cut-off radius \(r_{\mathrm{cut}}\) (typically 10 to 15 Å) are neglected (i.e. set = 0), which leads to an artifact (the derivative of the potential at \(r_{\mathrm{cut}}\) is a \(\delta\)-function). The shifted potentials remove this discontinuity in the potential, however at the cost of a small (constant) modification of the potential in the entire range \(r < r_{\mathrm{cut}}\). The shifted-force potentials remove the remaining discontinuity in the forces, modifying (slightly if one does it right) the shape of the potential. For non-pair potentials, all this is more difficult and various dampening or switching functions are used to minimize the artifacts.

Finally we should mention the existence of various types of ab-initio MD (), where one computes the interactions on the fly directly from quantum mechanics during the simulation (and not via a pre-established PES, the model). These methods are computationally expensive and thus span a rather small space-time window (see Fig. 4). For this reason, there have been many attempts to combine such approaches with the classical model-based one. This is often called QM/MM (quantum mechanics / molecular mechanics). This is not to be confused with approaches where the dynamics itself is treated quantum-mechanically, which may be important for certain processes, e.g. proton transfer, see e.g. [26].

Often made trivial mistakes

One of the most frequently made mistakes, even though it is a very trivial one, is confusing the units in which the program requires parameter values (such as the two constants for the LJ potential, see below) to be entered. Units may be erg, Joule (J), (kilo)Joule/mole (kJ/mol), and many others. Lengths can be in picometer \((1 \hbox {pm} = 10^{-9} \hbox {m}\)), Ångström units \(( 1 {\AA } = 10^{-10} \hbox {m})\), or atomic units (1 a.u. = 0.529177 Å, the first Bohr radius, which appears in the equation for the radial part of the \(^1\hbox {s}\) wavefunction of the Hydrogen atom).

It is always a good idea to check this carefully, remember that the ‘typical’ energy to compare with in simulations is the thermal energy, \(k_{\mathrm{B}}T\) with \(T \approx 300\)K, thus of the order of 26 meV, 2.5 kJ/mol, or 0.6 kcal/mol (or \(210 \,\hbox{cm}^{-1}\)) [27]. The potential energy minima are typically at \(r \approx 1\) Å for intramolecular interactions and \(r \approx 2 \text { to } 3\) Å for intermolecular ones.

Also be aware that potentials can be written in different ways, e.g. the LJ potential as
$$\begin{aligned} V^{\mathrm{LJ}}(r) = 4 \cdot \epsilon \cdot \left( \left( \frac{\sigma }{r} \right) ^{12} - \left( \frac{\sigma }{r} \right) ^{6} \right) \quad \text {or} \quad V^{\mathrm{LJ}}(r) = \frac{A}{r^{12}} - \frac{B}{r^{6 }} \end{aligned}$$
with either the two constants \(\epsilon\) (in units of energy) and \(\sigma\) (in units of length), or the two constants A (units: energy\(\cdot\)length\(^{12}\)) and B (units: energy\(\cdot\)length\(^{6}\)). Different simulation programs may do it differently (not only for LJ potentials).

The co-called ‘mixing- (or ‘combining’) rules [28] for LJ (and other) potentials are another source of uncertainty, however, they are usually not given much thought and one uses whatever rule happens to be implemented in a given program. (These rules are empirically used to obtain the parameters for unlike particles (\(i-j\)) from the ones for the like (\(i-i\) and \(j-j\)) particles. The influence of these mixing rules has recently been demonstrated e.g. by [23].

The integration time step \(\delta t\)

In MD, one of the main choices to make is the magnitude of the integration time step \(\delta t\). On one hand, it should be as large as possible to get as long (in terms of system time covered) trajectories (i.e. hopefully as representative samples) as possible. The computational costs (the CPU time) are proportions to the number, M, of integration steps, \(t^\mathrm{simulation} = M\cdot \varDelta t\), where \(\varDelta t\) is the CPU time (of the order tenth to hundredth of a second) needed to advance the simulation by \(\delta t\) (of the order fs or ps).

On the other hand, \(\delta t\) should be ‘small’ since numerical integration rests on series developments (something like: \(r(t+\delta t) = r(t) + a\cdot \partial r / \partial t \cdot \delta t + \cdots\)), which work the better the smaller \(\delta t\). Figure 6 shows a cartoon of the situation. One sees that the ‘difficult’ parts for the integration are where the trajectory turns around. If these bents are sharp, one needs a smaller time step.

In real systems, the measure for the time step is the period \(T = 1/\nu = 2\pi /\omega\) of the fastest oscillatory motion in the system (in a solid e.g. the Debye frequency, in a molecule a fast C-H or O-H stretching vibration). Depending on the details of the system and of the integration scheme: \(\delta t\) should roughly be
$$\begin{aligned} T/10> \delta t> T/25 \end{aligned}$$
The best way to check whether the integration works with an acceptable accuracy, and whether the forces are computed correctly, is to run a simulation under NVE conditions. In this case, the (unmodified) Newton’s equations are integrated, and the total energy of the system (and the total momentum \(\mathbf {p} = ( p_x, p_y. p_z)\)) must be constant. Of course, in a numerical scheme, these quantities will never be exactly constant. But they should at least not drift (at equilibrium) and their fluctuations should be small compared, e.g., to the ‘natural’ fluctuations in the system (such as the (opposite) fluctuations of the total kinetic and potential energies).

Not doing such tests and simulating exclusively under the (for some reason) more popular NVT, NpT (or other) condition may leave errors in the force calculation (or in the integration) undiscovered. The thermostats and barostats, if (too) strongly coupled (which is often the case), can cover this up. One should thus always try to use the smallest possible coupling, or longest relaxation time.

Finally, it should be stressed here that MD simulations should always be run with the highest possible precision of the numeric representation for real (floating point) numbers, i.e. double precision, REAL*8, 64 bit, etc. Many operations in such programs are accumulations, e.g. of the forces: \(\mathbf {F} = \sum \mathbf {f}_{ij}\), with thousands, ten thousands or more terms. Using less precise representations (such as 32 bit) will lead to faulty results.

Short simulations of large systems vs. long simulations of small systems

A question one may ask oneself is: given a certain amount of computational resources, is it better (more efficient) to simulate many particles for a short time or fewer particles for a longer time? A first element of the answer is that the CPU time required increases (for not very big systems) as the square, \(N^2\), of the number of particles N (since every particle interacts with every other one). Some codes use tricks to speed up the calculation of the forces (which is the bottleneck), however, this is not without danger, as seen in [29]. On the other hand, the CPU time increases only linearly with the number of time steps, M.

There are, however, other considerations. For instance, in simulations of quantities (like self-diffusion), in which long time fluctuations can occur (e.g. in particular cases such as confined media), a single long simulation run may not be the best (or most economical (in terms of computational efficiency)) choice; an extended run may still be within the same fluctuation. In such cases many independent shorter runs (long enough though (e.g. to reach the linear part of the Mean Square Displacements (MSD) vs. time plots)) may be more effective. To start a new (statistically) independent run, create a new initial situation. Simply changing the seed of the random number generator that may be used to create the initial positions and/or velocities will do the trick. Note, however, that each new run needs an equilibration at its beginning. This is some additional work.

Overcoming problems

The first piece of advice to anybody working on a computer is to be careful, to hedge your bets. This means in the first place: backup. Backup frequently, and in such a way that you can easily recover what you may have lost. Turn on the backup features of text editors and other programs you may use. Remember that just typing gfortran -o program.f program instead of gfortran -o program program.f will destroy your program (the source file program.f), in which you may have invested a lot of work. The number of mistakes and mistyping (and mis-clicks on graphical user interfaces) as well as hard- and software failures is infinite, and sooner or later such a mishap will occur. You should strive to minimize the consequences.

The errors that are, overall, probably the easiest ones to fix is when your program (also called code) either does not work in the first place or stops working at some point and crashes, usually leaving behind an error message coming either from the code itself or from the operating system under which you run (most likely Linux). As the old saying goes: ‘if nothing helps, read the manual’. Of course, your scientific and computational background must be good enough for you to understand these manuals, which are, it must be admitted, not always very pedagogical (it is not their purpose!).

The most likely cause for such an error condition is an inconsistent input, e.g. inconsistent numbers of particles, bonds (constraints), angles, interaction potentials and their parameters, integration time step, and, as the case may be, parameters associated with thermostats and barostats. Some programs may contain a certain number of tests, telling the user about such problems. However, this is not always the case, and an error message may just indicate that some array is out of bounds or that some subroutine or function returns a too large or too small number, see “Writing your own programs”.

These were the easy errors. More challenges arise when it comes to evaluating the output (results) of a simulation

The ‘Equilibration’ process, ensembles

In most cases, (and this is what we had in mind in all discussions above) one is interested in simulating a system at equilibrium (as specified by (NVE), (NpT) etc.). At equilibrium, the system trajectory is, most of the time (i.e. not always, see e.g. Fig. 7), in the vicinity of the lowest minimum, or minima, of the PES. (and never exactly at the minimum, the kinetic energy prevents this),

Figure 7 shows, schematically, one of the reasons why a system may take a very long time to ‘find’ the lowest minimum (minima) in the PES. Assume our system sits in the vicinity of minimum A, which is not the lowest one. According to its kinetic energy, it moves around the minimum. At some point, it may acquire enough kinetic energy to go, assuming it is moving in the right direction, in a motion similar to the green line over the lowest energy barrier in the ‘mountains’ surrounding A. However, it will most likely not go into the minimum B, but fall into some other (supposedly shallower) minimum C, D, or E. On the other hand, crossing directly from A to B, the red arrow, needs a much higher kinetic energy (one has to go over the mountain, not around it).

The time needed to find the lowest minimum thus depends very much on the multi-dimensional structure of the PES. The system has not only kinetic (and potential) energy, but also momentum. This momentum, \(\mathbf {p}\), keeps it from going around ‘curves’. In some cases, the minimum energy path (called ‘Talweg’) connecting two minima may also be so ‘narrow’ (its N-dimensional volume so small) that the probability for the trajectory to find it is very small.

Another reason for a system not to find a minimum is that the system trajectory never goes there. Such systems are called non-ergodic. In such systems, certain regions of the energetically accessible phase space (the space spanned by the particle positions and momenta) are never visited. The most un-ergodic systems are the ones with “harmonic” interactions between particles (e.g. Hooke’s law \(V(x) \propto (x-x_0)^2\)) and the motions are described by so-called “normal modes” [9] already mentioned. Thus, systems where some (usually intramolecular) interactions are described by harmonic potentials are often difficult to equilibrate, and artifacts may arise [30, 31], see also below.

One is most often interested only in sampling equilibrium states. Trying to understand the equilibration process itself is a different thing, it can be done by non-equilibrium MD (NEMD) simulations, which we shall not discuss here.

Figure 8 shows, very schematically, how the ‘equilibration’, i.e. pushing the system toward equilibrium states, can be done. Some details are given in the caption. Certain “tricks” (which many programs try to do more or less automatically) can be used to speed up this process, such as manipulating the volume (periodicity, Fig. 5), and modifying the masses. Similar, however much more sophisticated considerations [31, 32, 33, 34] have lead to the more rigorous algorithms (e.g. modified equations of motion, see below and section “Background in a nutshell”) to generate the (NVT), (NpT) and other ensembles.

(NVT) simulations (to have ‘constant’ temperature) are most often used not only to prepare the initial situation, but also in the ‘real’ part of the MD runs (i.e. in the accumulation of the sample). The methods that scale all velocities by a given factor [32, 33] (see caption of Fig. 8) are the most popular ones. However, this may lead to errors, as demonstrated, among others, in refs. [34] and [35]. One reason is that scaling all velocities by the same factor in spite of different energy couplings (i.e. the possibility to leak excess energy to neighbors or acquire it from them), leads to local non-equilibrium situations. Hence, it may occur that (e.g.) vibrational degrees of freedom have a different temperature from the translations (while both must to be equal as required by the equipartition theorem (see e.g. [4]).

Note that since the equilibration (toward whichever state one desires) is not part of the simulation itself (i.e the accumulation of the sample), the ‘configurations’ generated during equilibration are to be discarded. Since this is so, to some extent it is during equilibration: ‘anything goes’, and advantage can be taken of that will speed up the process. However, too brutal manipulations of the system may also destroy it! Good judgment must be exercised.

We note here an additional difficulty: there are only necessary, but no sufficient conditions for equilibrium. This means: if there is equilibrium, then certain conditions are fulfilled, however, one cannot conclude (strictly) from the fact that the conditions are fulfilled that the system is at equilibrium. It may be trapped in a metastable state (like state A in Fig. 7) and take a very long time (much longer than any accessible simulation time) to relax away from this state.

Generating meaningful results

This is why the simulations are done in the first place, aren’t they? As already mentioned, agreement ‘with experiment’ does not mean your simulation is in any way ‘correct’. We need to follow a two-step process. First make sure that the simulation software works correctly, i.e. that it generates the sample of states associated with the interaction model correctly. The second, much more interesting, step will then involve a critical evaluation of the model, this will depend on the goals of your study. As see in “The interaction model”, this process may involve iterations, sometimes even back to the questions discussed in “Choice of questions to study”.

Point one involves making suitable choices for the time step, the truncation schemes for the interactions (used to save CPU time), the approximations for the evaluation of the (long range) electrostatic interaction, the estimations of system-size effects (box-size the size of the sample)), the length of the simulation, and many other things.

How sensitive this is, is exemplified, e.g. by reference [29], where different choices (not obvious to the end-user!) made in different versions of a well-known simulation program lead to markedly different results.

Once one has made reasonably sure that the results are truly (and only) the consequences of the model, and not of artifacts in the simulation, as sketched in Fig. 3, the real chemical, physical, biological, geological, etc. work can start. At the end, the reliability of the conclusion will rest on satisfying both the simulation and modeling criteria. To be trusted as physically sound, results should furthermore be robust with respect to small variations in the models [22, 23]. If possible, results for the same, or similar, systems with different models should be compared (and differences explained in terms of the models, but this is often very difficult).

Statistics

“There are lies, damned lies, and statistics”, this saying is usually ascribed to the great British Prime Minister Benjamin Disraeli (1804–1881), and politicians are often “very creative” in getting statistics to say what they would like to hear and what fits their prejudices and political programs. This is exactly what we do not want to do. This means that any numerical value (or graph) that is extracted from a simulation must come with an (estimate of its) uncertainty (error bar).

Obtaining honest and useful error bars from simulations is not easy, there are many kinds of errors: human errors, systematic errors, statistical errors [13]. We have up to now tried to deal with the first two kinds. This leaves the statistical errors, which are inherent to statistical methods. This is, of course, a point statisticians have worried about a lot, and one finds in the mathematical literature many procedures how to estimate uncertainties. Beware, however, that many of these methods assume ‘statistically independent events’, however, subsequent configurations (i.e. the configuration at \(t=t_1\) and the one at \(t=t_1 + \delta t\) ) are not, they resemble each other a lot.

So one would take only every \(L^{\mathrm{th}}\) time-step for the analysis (nothing wrong with taking all, this just does not contribute new information). The problem is that L will be different depending on the property that is being studied. As an example, looking at what we said about the time step \(\delta t\) (see “The integration time step δt”, if it is set as recommended, the fastest particles ‘turn around’ every 20 time steps or so, so after a few turnarounds the velocities (not the positions!) should start to become statistically independent: \(L\approx 100 ... 1000\). The correlation functions (see “Background in a nutshell”) study this ‘loss of correlation’ ( = increase in randomness). Molecular orientations de-correlate more slowly (depending e.g. on the moments of inertia), positions even more slowly, etc. This makes the estimation of uncertainties difficult, and differently difficult for different properties. This does not mean that one should not try hard, see e.g. [36], which gives nice examples.

Figures 9 and 10 illustrate some of the problems one may encounter. Figure 9 gives an impression of the limited particles displacements that one obtains in a finite simulation time (typically a few 100 ps or ns) in dense condensed matter, here liquid water. The molecules do not ‘zip’ through space, as often seen in illustrations of the motions in gases (notion of mean free path), they rather ‘rattle around’ in extremely windy paths. It is thus generally a good idea to simply check visually with a molecular graphics tool how different the first and last configurations of a sample are.

Statistical mechanics has the postulate that in an infinite ensemble of states (see “Background in a nutshell”) (from which MD samples), “time average = ensemble average”, (i.e. that averaging over one (or a few) particles for a very long time should yield the same result as averaging over all particles for a very short time). In a finite sample, this is not necessarily the case, which provides a part of the answer to the question raised in “Short simulations of large systems vs. long simulations of small system”: we generally have to average over space (particles) and time.

Figure 10, right panel, shows an example, where we have averaged over only one particle pair (since the RDFs is a two-particle property) and all time steps and (like in the left panel) over all pairs and time.steps; see the figure caption for details.

The technique used to generate functions (like the g(r) in Fig. 10) is using histograms, or binning. A histogram is an array of counters (or bins); the functions are constructed point by point from these bins. Binning some quantity Q (e.g. for the RDF the distance between two particles i and j: \(Q = | r_i - r_j|\)) means that the corresponding counter is incremented by 1 every time an event with a value between Q and \(Q+\varDelta Q\) is computed.

One thus needs to chose the resolution, i.e the width \(\varDelta Q\) of the histogram boxes. Figure 10, left panel, illustrates this: if one chooses too fine a resolution, the curve will be noisy (there are not enough events in each bin), if too big a \(\varDelta Q\) is selected, the resulting function will have steps. So again, compromises must sometimes be made. Remember that you cannot extract from your simulated sample more (i.e. more detailed) information than it contains. And do not report numerical values (e.g. peak positions in the RDF) with uncertainties (error bars) smaller than the resolution of your histogram.

More advanced work

As Donald Rumsfeld, Secretary of Defense in the Administrations of Presidents Gerald Ford and George W. Bush once famously put it: “(there are) the known unknowns and the unknown unknowns”, i.e. things that we know we do not know, and other things that we do not even know that we do not know. Commercial or otherwise available general MD packages (or more fancily: program suites, see [37] for a definitely incomplete list) usually provide programs to determine (some of the) known unknowns, i.e. quantities that are routinely computed from MD simulations, e.g. energies, some spatial- and time-correlations.

If, however, a questions comes up that was not thought of before, an unknown unknown, then one must write a new program.

Writing your own programs

The first thing to understand when writing a computer program to analyze simulation data (in MD the ‘trajectory’, i.e. the positions (and velocities) of all particles for all times (practically: at regular time intervals during the simulation) is to understand in which form your simulation program provides this data (unformatted? formatted? and if so, how) and to learn how to enter (read) this data (Mbytes or Gbytes!) into your own program (the red arrows under the “trajectory box in Fig. 1). In periodic systems, the origin of the coordinate system for the particles (the point \(x=0,y=0,z=0\)) can thus be assumed to be at the center of the periodic box (with coordinate values between “-box/2” and “box/2”) or at its lower left corner (with values between 0 and “box”).

Furthermore, in some instances the particle coordinates are always kept inside the box (via the PBC construct, fig 5), in other cases, when the PBC construct is applied to groups of atoms (e.g. electrically neutral ones), particle coordinates may be (slightly) outside of the box. These ways of storing the coordinates is sometimes called the ‘wrapped’ trajectory. The ‘unwrapped’ trajectory, in which the particle box-shifts (used exclusively for the calculation of the interactions (forces)!), is also stored in some instances (since it is needed e.g. for the computation of the mean square displacements (MSD)). Some programs, e.g. VMD [38] can wrap and unwrap trajectories from plausibility arguments if they are stored with sufficiently small time increments.

The first decision to make is which programming language to use. The first choice will probably be the language one knows best. Another consideration is the efficiency of a particular language for a particular problem: how much coding does it take, how fast will it execute. Can parts of existing programs be re-used? Another choice is whether one wants a ‘quick&dirty’ solution for a particular (chemical, physical, biological, etc.) question, or whether one wants to write a (more or less) general program that can be used later for other cases and problems. Chemists tend to go for the first choice, physicist for the second: both have their dangers. In the first case, one may have to do and redo the same thing later (which costs time and usually leads to new mistakes). In the second case, one may get stuck in programming considerations and never get down to answer the question that was initially asked. We have seen this happen several times.

The next piece of advice is never to take anything for granted and to test any piece of code as extensively as possible, first at the level of the programming, then at the level of the scientific idea it is supposed to express. Are the ‘answers’ that one gets when parameters are varied reasonable; do they make physical sense?

For testing your code: compile it, if possible, with different compilers (hopefully without error, a few ‘warnings’ may be OK) and check whether you get the same answer, in particular if you use ‘optimization’ options of your compiler (to make the execution faster) or you want to run ‘in parallel’. Use (but only for tests since it makes the execution slow) the options provided by your compiler to check for ‘uninitiated variables’, ‘array boundary problems’, etc.

Software

Simulation software

We strongly recommend to prefer simulation software where the source code (FORTRAN, c, Python, etc.) is available, can be consulted and possibly modified (Open-Source [39, 40]). This is extremely helpful in case of problems and saves a lot of the guesswork one has otherwise to put in to try to understand what an unknown (and possibly ill-documented) code is actually doing.

Other software

For the analysis, a meaningful representation and publication of your simulation results, you will probably need to use various general purpose graphics software. As an example, the graphs for this lecture were prepared with the free software packages VMD [38] (Fig. 9), gnuplot [41] (Figs. 7 and 10), xfig [42] (Figs. 1, 4, 6, 7, and 8) and LibreOffce (StarOffice, OpenOffice) [43] (Figs. 2 and 5), or combinations thereof. A flexible plotting software is essential for the analysis and interpretation of the large quantities of data produced by simulations. Especially gnuplot [41] is almost indispensable to quickly generate meaningful graphical representations of results, e.g. for comparative plots of quantities obtained from several simulation runs.
Fig. 1

Scheme of the flows (in red) of information (data) in an MD study. There are essentially three types of input: The (interaction) model, the most important part, see “The interaction model”, the parameters of the simulation, see e.g. “The integration time step δt”, and the initial conditions, “Setting up the system”. While running, the simulation keeps adding new configurations to the end of the trajectory. By taking the last configuration of the trajectory as the initial one a further run, the trajectory can always be extended (e.g. if it is found in the evaluations, see  “Statistics”, that the statistical quality of the results is not sufficient). Black boxes symbolize programs, the “MD simulation box is explained in Fig.  2, “evaluation” is a (home-made or other) evaluation program, “gnuplot” [41] stands for any software that allows to generate \(x-y\) or \(x-y-z\) graphs of data, “VMD” [38] stands for any molecular graphics software, molden [44] or RASMOL [45] are other popular choices

Fig. 2

Scheme of a typical MD simulation. The “creation of an initial situation” is often done with a separate tool (see e.g. [14]), the on-the-fly-“evaluations” are usually restricted to a few quantities needed to monitor the system, more evaluations are done in subsequent steps, see Fig. 1. The various input- and output data streams were omitted here for clarity

Fig. 3

The epistemic value of models, or how much do we learn? red panel: the conventional approach: a specific model (in a more general sense that an MD model) is elaborated to analyze a specific experimental observation (termed here observable) (e.g. physicist often write specific ‘effective Hamiltonians’ to analyze a given observation) green panel: the simulation approach. Several observations, such as the structure (e.g. the g(r)-functions) and the dynamics (e.g. the self-diffusion, molecular re-orientations etc.) of a liquid are described by a single model

Fig. 4

Space-time window accessible to MD simulations and a few experiments that reveal properties associated with particular regions. Coarse-grained methods can extend this range. The red line delimits the domain accessible about 30 years ago to classical MD simulations (our topic) and accessible today to various so-called ab-initio MD (see Ref. [5]) methods

Fig. 5

Periodic boundary conditions (PBC). Since only a very limited number of independent particles can be simulated, this construct is used to avoid surface effects. See also “Writing your own programs” for some computational considerations. Left: the quasi-infinite (artificial) system that is considered; right: middle: the simulation box with the truly independent particles that need to be simulated), some interactions (within a certain sphere), and around this box eight (of the infinite number) of replica boxes. The PBC approximation may lead to systematic deviations of certain computed quantities e.g. of the self-diffusion coefficients, \(D^{\mathrm{s}}\), and the viscosities, \(\eta\), in liquids [46]. In crystalline solids, the low-k part of the phonon spectrum will be altered. PBCs need not be orthorhombic, as shown here, and in crystalline system, the box needs to be a multiple of the elementary cell

Fig. 6

Schematically: in blue: the ‘real’ trajectory; in green: numerical integration with a ‘short’ (actually still much too big) time step; in red: integration with a twice as big integration time step

Fig. 7

Schematic two-dimensional PES. Assume that the system is in the vicinity (at some temperature) of the minimum A, which is not the absolute minimum, B is lower. The system can either try to go straight from A to B over a high barrier, the red dashed arrow (as one would expect if one thinks in 1D), or follow a lower energy path, in green. However, this path is curved, and the system has a high probability to go to C, D, or E instead of B

Fig. 8

Sketch of the ‘equilibration’ process: the simulation is started from an arbitrary (yet as reasonable as possible) configuration. It has thus some kinetic energy (T) and some potential energy (V). Since the initial configuration is almost always too high in potential energy (mostly because particles are too close), the dynamics will lower the potential energy and increase the kinetic energy, while the total energy (blue) remains constant, (NVE) conditions. After some time (which depends mostly on characteristics of the interaction potentials) this conversion of potential into kinetic energy will slow down. However, the kinetic energy will be much too high (corresponding to, say, a few thousand Kelvin). One now plays something like Maxwell’s Daemon: one manipulates the system, here by scaling the particles velocities, e.g. \(\mathbf {v}_i = \alpha \cdot \mathbf {v}_i \ \text {with} \ \alpha < 1\). Since the virial theorem says that there is a relation between the (average) kinetic and potential energies in such systems, the manipulation of the kinetic energy will lead to a further relaxation. This scaling/relaxing procedure is iterated as often as needed, until the kinetic energy has the desired value and its ratio to the potential energy remains roughly constant. This point (green line) is the real beginning, \(t = 0\), of the (NVE) (or any other) MD simulation. Note that we do not start immediately after the drifts in the energies have stopped, at this point the kinetic energies (per degree of freedom, DOF) may still not be quite equi-distributed (i.e. \(\langle E_{\mathrm{kin}}^{\mathrm{DOF}} \rangle = 1/2 k_{\mathrm{B}}T\) ). The configurations computed before \(T = 0\) (green) do not belong to the sample and are discarded

Fig. 9

Configurations of a simulation of liquid water at T=300K and ambient pressure [47], 1000 molecules (only he oxygen atoms are shown), the box edge (in blue) is \(\approx 31.14\) Å. The periodic box in x and \(-x\) direction (cf. Fig.  5) are drawn, not the ones in the other directions.Molecules 594 and 1536 (as it happens) are colored blue. It is seen that after 1 ps (top row) the molecules have not moved very much, and even after 100 ps and 0.5 ns they have still not moved very far

Fig. 10

Oxygen–oxygen radial pair distribution function (RDF, g-function, \(g_{\mathrm{OO}}(r)\), see e.g. [4]) computed (with VMD [38]) with various bin-widths and numbers of particles from the configurations shown in Fig. 9.Left panel: green curve: computed with a bin-width of 0.25 Å (too coarse); red curve: of 0.10 Å (more or less standard, could be a bit smaller); and (pink curve) of 0.0001 Å (definitely too small, noisy curve). The curves are up-shifted by 1 unit in y-direction for better visibility. The insert shows a comparison of the peak maxima.Right panel: \(g_{\mathrm{OO}}(r)\) computed formally for only the two particles shown in blue in Fig. 9 and red curve from left panel for comparison. Since we selected two atoms (594 and 1536, as mentioned) that stay close to each other for a long time (can happen!), short distances are overrepresented

Summary

There is often no single ‘best’ way how to study a problem by MD simulation. Many choices must be made, and most of them will result from compromises between often conflicting goals: reliability, accuracy, speed, costs, the duration of a PhD thesis, etc., and some tailoring of the problem on hand is often essential. This requires considerable knowledge about the system to be simulated.

In a first step one must always first make sure that the simulation itself works correctly, i.e. that it generates the sample of states over which the statistical mechanical averages will be taken, correctly, and that this sample is sufficiently big to obtain statistically unassailable results. The most critical choice is, however, the choice of interaction model. Depending on the decisions made here, epistemic questions may arise (what do we want to learn, and what do we really learn, from the simulations). There will certainly be an evolution of the underlying philosophy in the course of doing the actual simulation work (learning by doing), but it is certainly useful to think (at least a little bit) about these things already before one starts.

In summary: molecular dynamics simulations are by no means black boxes, nor magic wands, and it takes some effort to obtain useful results. If one invests these efforts, the reward can be extremely rich, as an ever increasing number of publications calling upon this technique bear witness to.

Notes

Acknowledgements

This lecture is the result of many years’ work, making errors and fixing them, together with (present and former) students. We thank in particular Andreas, Christian, Gabriel, Godehard, Guillaume, Holger, Ildiko, Jörn, Kai, Liem, Markus, Michael, Norbert, Patrick, Philipp, Pia, Pooneh, Rungroj(Shaw), Samuel, Siwarut(Jeff), Tanin(Bom), Willi, and several others, and also far too many colleagues to enumerate.

References

  1. 1.
    Web-page. The Hitchhiker’s Guide to the Galaxy. https://en.wikipedia.org/wiki/The_Hitchhiker’s_Guide_to_the_Galaxy. Accessed 5 July 2017
  2. 2.
    Allen MP, Tildesley D (1987) Computer simulations of liquids, Reprint edn. Oxford Science Publications, OxfordGoogle Scholar
  3. 3.
    Frenkel D, Smit B (2002) Understanding molecular simulation, from algorithms to applications. Elsevier, AmsterdamGoogle Scholar
  4. 4.
    McQuarrie DA (1991) Stastical mechanics. Harper & Row, New YorkGoogle Scholar
  5. 5.
    Web-page. Molecular dynamics. https://en.wikipedia.org/wiki/Molecular_dynamics. Accessed 19 July 2017
  6. 6.
    Web-page. Comparison of software for molecular mechanics modeling. https://en.wikipedia.org/wiki/Comparison_of_software_for_molecular_mechanics_modeling. Accessed 5 July 2017
  7. 7.
    Web-page. Born-Oppenheimer approximation. https://en.wikipedia.org/wiki/Born-Oppenheimer approximation. Accessed 20 July 2017
  8. 8.
    Web-page. Thermal de Broglie wavelength. https://en.wikipedia.org/wiki/Thermal_de_Broglie_wavelength. Accessed 6 Jan 2018
  9. 9.
    Web-page. Normal mode. https://en.wikipedia.org/wiki/Normal_mode. Accessed 17 Jan 2018
  10. 10.
    Morawietz T, Marsalek O, Pattenaude SR, Streacker LM, Ben-Amotz D, Markland TE (2017) The interplay of structure and dynamics in the raman spectrum of liquid water over the full frequency and temperature range. arXiv:1711.08563vl, 23 Nov 2017
  11. 11.
    Web-page. European Materials Modelling Council (EMMC) focused workshop Uppsala June 2017. https://drive.google.com/file/d/0B8NBUmVWdMcmTlRmR0dnc2JDUTA/view. Accessed 5 July 2017
  12. 12.
    Hoover WG (1991) Computational statistical mechanics. Elsevier Science, AmsterdamGoogle Scholar
  13. 13.
    Hasse H (2017) The human error, the systematic error and the statistical error. Lecture given at the Focussed Workshop on Modelling Quality & Accuracy, Uppsala June 15–16, 2017Google Scholar
  14. 14.
    Web-page. PACKMOL Initial configurations for Molecular Dynamics Simulations. http://www.ime.unicamp.br/~martinez/packmol/home.shtml. Accessed 15 July 2017
  15. 15.
    Web-page. RSCB PDB, Protein Data Bank. https://www.rcsb.org/pdb/home/home.do. Accessed 20 July 2017
  16. 16.
    Guillot B (2002) A reappraisal of what we have learnt during three decades of computer simulations on water. J Mol Liq 101(1–3):219–260CrossRefGoogle Scholar
  17. 17.
    Hasse H, Lenhard J (2017) Boon and bane: On the role of adjustable parameters in simulation models. In: Lenhard J, Carrier M (eds) Mathematics as a tool. Boston Studies in the Philosophy and History of Science. (reprint requsts to: http://thermo.mv.uni-kl.de/publications/publications/?L=1%2Findex.php%3Fid), 327, Springer 2017
  18. 18.
    Faller R, Schmitz H, Biermann O, Müller-Plathe F (1999) Automatic parameterization of force fields for liquids by simplex optimization. J Comput Chem 20(10):1009–1017CrossRefGoogle Scholar
  19. 19.
    Reith D, Pütz M, Müller-Plathe F (2003) Deriving effective mesoscale potentials from atomistic simulations. J Comput Chem 24(13):1624–1636CrossRefGoogle Scholar
  20. 20.
    Baranyai A, Kiss PT (2010) A transferable classical potential for the water molecule. J Chem Phys 133:144109CrossRefGoogle Scholar
  21. 21.
    Voltaire (François-Marie Arouet). Candide, ou l’Optimisme 1759Google Scholar
  22. 22.
    Marchand G, Soetens J-C, Bopp PA, Jacquemin D (2015) Effect of the cation model on the equilibrium structure of poly-l-glutamate in aqueous sodium chloride solution. J Chem Phys 143:224505CrossRefGoogle Scholar
  23. 23.
    Kanta-Giri A, Spohr E (2017) Cluster formation of NaCl in bulk solutions: Arithmetic vs. geometric combination rules. J Mol Liq 228:63–70CrossRefGoogle Scholar
  24. 24.
    Pethes I (2017) A comparison of classical interatomic potentials applied to highly concentrated aqueous lithium chloride solutions. J Mol Liq 242:845–858CrossRefGoogle Scholar
  25. 25.
    Sutton AP, Chen J (1990) Long-range Finnis-Sinclair potentials. Phil Mag Let 61(1):139–146CrossRefGoogle Scholar
  26. 26.
    Cukier RI (2004) Quantum molecular dynamics simulation of proton transfer in cytochrome c oxidase. Biochim Biophys Acta 1656:189–202CrossRefGoogle Scholar
  27. 27.
    Web-page. Energy Unit Converter. http://www.colby.edu/chemistry/PChem/Hartree.html. Accessed 11 July 2017
  28. 28.
    Web-page. Combining rules. https://en.wikipedia.org/wiki/Combining_rules. Accessed 11 July 2017
  29. 29.
    Reißer S, Poger D, Stroet M, Mark AE (2017) The real cost of speed: the effect of a time-saving multiple-time-stepping algorithm on the accuracy of molecular dynamics simulations. J Chem Theory Comput 13(6):2367–2372CrossRefGoogle Scholar
  30. 30.
    Toxvaerd S (1991) Algorithms for canonical molecular dynamics simulations. Mol Phys 72(1):159–168CrossRefGoogle Scholar
  31. 31.
    Toxvaerd S (1993) Molecular dynamics at constant temperature and pressure. Phys Rev E 47:343–350CrossRefGoogle Scholar
  32. 32.
    Berendsen HJC, Postma JPM, van Gunsteren WF, DiNola A, Haak JR (1984) Molecular dynamics with coupling to an external bath. J Chem Phys 81:3684–3690CrossRefGoogle Scholar
  33. 33.
    Nosé S (1984) A molecular dynamics method for simulations in the canonical ensemble. Mol Phys 52:255–268CrossRefGoogle Scholar
  34. 34.
    Posch HA, Hoover WG, Vesely FJ (1986) Canonical dynamics of the Nose oscillator: stability, order, and chaos. Phys Rev A 33:4253–4265CrossRefGoogle Scholar
  35. 35.
    Harvey SC, Tan RK, Cheatham E III (1998) The flying ice cube: velocity rescaling in molecular dynamics leads to violation of energy equipartition. J Comp Chem 19:726–740CrossRefGoogle Scholar
  36. 36.
    Grossfield A, Zuckerman DM (2009) Quantifying uncertainty and sampling quality in biomolecular simulations. Annu Rep Comput Chem 5:23–48CrossRefGoogle Scholar
  37. 37.
    Web-page. Molecular dynamics. https://en.wikipedia.org/wiki/Molecular_dynamics Accessed 5 July 2017
  38. 38.
    Web-page. Visual molecular dynamics. http://www.ks.uiuc.edu/Research/vmd/. Accessed 5 July 2017
  39. 39.
    Web-page. List of free and open-source software packages. https://en.wikipedia.org/wiki/List_of_free_and_open-source_software_packages. Accessed 5 July 2017
  40. 40.
    Jacob CR (2016) How open is commercial scientific software? J Phys Chem Lett 7(2):351–353CrossRefGoogle Scholar
  41. 41.
    Web-page. gnuplot home page. https://www.libreoffice.org/. Accessed 5 July 2017
  42. 42.
    Web-page. Xfig User-Manual. http://mcj.sourceforge.net/. Accessed 5 July 2017
  43. 43.
    Web-page. Libre Office, The Document Foundation. http://www.gnuplot.info/. Accessed 10 July 2017
  44. 44.
    Web-page. MOLDEN a pre- and post processing program of molecular and electronic structure. http://www.cmbi.ru.nl/molden/. Accessed 12 July 2017
  45. 45.
    Web-page. Home Page for RasMol and OpenRasMol http://www.openrasmol.org/. Accessed 12 July 2017
  46. 46.
    Yeh I-C, Hummer G (2004) System-size dependence of diffusion coefficients and viscosities from molecular dynamics simulations with periodic boundary conditions. J Phys Chem B 108:15873–15879CrossRefGoogle Scholar
  47. 47.
    Soetens J-C, Bopp PA (2015) Water-methanol mixtures: simulations of excess properties over the entire range of mole fractions. J Phys Chem B 119:8593–8599CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  • Philippe A. Bopp
    • 1
  • Ewa Hawlicka
    • 2
  • Siegfried Fritzsche
    • 3
  1. 1.Department of Material Science and Engineering, School of Molecular Science and EngineeringVidyasirimedhi Institute of Science and Technology (VISTEC)RayongThailand
  2. 2.Międzyresortowy Instytut Techniki RadiacyjnePolitechnikaŁódzkaPoland
  3. 3.Fakultät für Physik und Geowissenschaften, Institut für Theoretische PhysikUniversität LeipzigLeipzigGermany

Personalised recommendations