Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

Molecular dynamics (MD) simulation is a common approach to the (classical) many-body problem. It relies on integration of Newton's equations of motion to simulate the trajectories of many (e.g., ~1,000-100,000) particles.

In my limited exposure to the MD literature, a recurring theme that I think I see (at least on the chemical physics end of things) is that MD simulations are often performed in the canonical ($NVT$) ensemble. Why does this seem to be the case?

Here are the common thermodynamic ensembles:

  • Microcanonical ensemble ($NVE$)

    • The system is isolated.
    • The total energy $E$ is fixed.
    • Every accessible microstate has equal probability. That is, if $\Omega$ is the number of accessible microstates, the probability that a system is in a particular microstate is $\frac{1}{\Omega}$.
    • Please correct me if I am wrong, but I think that the microcanonical ensemble satisfies ergodicity -- time averages can be replaced with ensemble averages.
  • Canonical ensemble ($NVT$)

    • The system is not isolated. The system can exchange energy with a heat bath. The total energy of the system + bath is fixed. The average or equilibrium energy of the system is constant.
    • The absolute temperature $T$ is well-defined. (Is $T$ fixed? I think so.) $T$ is given by the temperature of the heat bath.
    • The probability of finding the system in some microstate $i$ with energy $E_i$ is given by the Boltzmann distribution: $$p_i = \frac{e^{-\frac{E_i}{k_B T}}}{\sum_i e^{-\frac{E_i}{k_B T}}}$$
  • Isothermal-isobaric ensemble ($NPT$)

    • The absolute temperature $T$ and the pressure $P$ are fixed.

Looking at this non-exhaustive list of choices, it seems that we can eliminate the $NVE$ ensemble from consideration because "real world" chemistry involves energy exchange with the environment.

MD simulations typically do not model chemical reactions, but still, I would say that most chemistry in the "real world" occurs at nearly constant pressure (e.g., atmospheric pressure). So the $NPT$ ensemble seems like a reasonable candidate.

What about the $NVT$ ensemble? Constant temperature perhaps seems reasonable for equilibrium, "real world" chemistry, but I am not so sure about constant volume.

Now let's jump back to my very rudimentary of MD simulations in the literature. In MD simulations, molecules sit in a simulation box to which periodic boundary conditions are applied. From reading some literature articles it seems that the $NPT$ ensemble is used for equilibration -- to obtain the simulation box size that gives an average pressure of, for example, 1 atm. Then, the system is simulated in the $NVT$ ensemble -- that is, the simulation box's dimensions are held fixed, hence fixing the system volume. It is from this simulation in the $NVT$ ensemble that ensemble averages are computed and the system's chemistry is analyzed.

Why is the $NVT$ ensemble used for MD simulation production runs?

share|improve this question
add comment

4 Answers 4

up vote 3 down vote accepted

To amplify on something in the Ron's answer: Fixed energy is hard to maintain numerically; the slight computational errors accumulate over time. The "thermalization" effects serve to fix this, and keep the overall system with a (relatively) stable average energy (large N).

share|improve this answer
Thanks! So you mean constant temperature is easier to maintain than constant energy? –  Andrew Jul 17 '12 at 0:02
Stack Exchange sites don't maintain a reliable presentation order for answers in the way that more traditional forums do, which makes phrases like "in the previous answer" difficult for later readers to parse reliably. Better to link to the answer you are referencing. I'll do this one for you. –  dmckee Jul 17 '12 at 0:02
add comment

The reason is that it is just annoying to have the volume of a simulation fluctuate. What do you do if you want to change the volume? Have periodic boundaries that move? Then you need equations of motion for the boundaries.

To thermalize water molecules you can just bounce them off a boundary wall with a Maxwellian distribution of velocities (or do this some other way, like picking a molecule at random and making it's velocity maxwellian with velocity v every once in a while). This implements a temperature in an easy way.

If you want to implement a fixed pressure ensemble, you need to allow the volume to fluctuate. This is much more numerically annoying than allowing the energy to fluctuate. You would need to simulate the walls of the simulation container moving, or the periodic boundaries shrinking, and calculate the force required to shrink the boundaries or move the walls, and this is a terrible headache.

It's also an unnecessary headache, because a constant volume simulation and a constant pressure simulation are equivalent at large numbers of particles. This is also true of a constant temperature and constant energy simulation. In order to make the pressure right, all you have to do is put in enough water molecules to make the density of water the right one for the appropriate temperature, and this is something that's easy to do numerically. The fluctuations in the pressure are not a worry, the only worry is that the pressure you are simulating at is far too low or far too high.

share|improve this answer
Thanks. Why are "a constant volume simulation and a constant pressure simulation equivalent at large numbers of particles"? –  Andrew Jul 14 '12 at 15:44
@Andrew: Just because the fluctuations become small at large numbers, by the law of large numbers. It's only not true at a first order phase transition point, where a constant pressure simulation of water can fluctuate from all-water to a much larger all-vapor configuration. –  Ron Maimon Jul 17 '12 at 3:56
add comment

This is related to NVE vs NVT.

When I once had to do a molecular simulation, the goal was to make the molecule trajectories as accurate as possible. Therefore I did molecular dynamics, initialized with NVT, checked that the pressure was appropriate, then did the production run with NVE. The usual ways to implement NVT--where there are imaginary frictional forces and imaginary fluctuations--gives you unrealistic trajectories; NVE does not have that problem. [Of course I had to check that the NVE simulation was staying stable (see Dave's answer).]

When you don't care so much about trajectories, just configurations, NVT is usually better than NVE because in real life the temperature is constant (like you say). This is especially true for Monte Carlo simulations, which don't even try to give realistic molecule-by-molecule trajectories.

share|improve this answer
add comment

I think, the choice of the ensemble depends on the problem or the method you want to use and there is no general answer to your question

Why is the NVT ensemble used for MD simulation production runs?

Let me give you an example (which is very specific tbh). If you want to simulate a solid, you need to simulate an $NPT$ (or an isotension) ensemble since the shape of the simulation box influences the structure. In other words: if you omit a variable box shape you suppress candidate structures. If you know the (stable) structure/box shape you can start $NVT$ simulations from that configuration to calculate changes in the free energy for example (that would be a method that utilizes $NVT$ simulations).

Another example would be the calculation of the chemical potential using a Gibbs ensemble (where particles can be exchanged between two simulation boxes).

I agree, $NVT$ simulations are moslty used. But you have to keep in mind that the ensemble is only the "framework" and you have to use the specific framework that suits your needs. Often (like the simulation of a solid) you have to use specific ensembles, sometimes you have multiple choices and things like available tools, difficulty in implementation or efficiency play a deciding role.

Besides the said, I'd answer your question: The $NVT$ ensemble is simple to implement (especially if you are not interested in dynamic properties like e.g. the diffusion coefficient). Also, it is commonly implemented in open source simulation tools and there are methods that utilize multiple connected $NVT$ simulations (free energy methods).

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.