Molecular Dynamics: Ensembles

 

A Molecular Dynamics (MD) simulation can be carried within different conditions often referred to as ensembles, a fancy term from statistical mechanics.

A thermodynamic ensemble provides a way to derive the thermodynamic properties of a system through the laws of classical and quantum mechanics.

The mathematical methods needed to understand how the thermodynamic quantities are obtained will not be discussed in too many details. For now, we simply show the existing ensembles, underlining what type of system they aim to simulate.

The main idea is that different ensembles represent systems with different degrees of separation from the surrounding environment, ranging from completely isolated systems (i.e., microcanonical ensemble) to completely open ones (i.e., grand canonical ensemble). The ensemble you choose depends on the specific problem you are trying to solve and the conditions under which you want to simulate the system.

Let us consider the ensembles that are mostly used in Molecular Dynamics (MD).

 

 

Let’s start with the most basic one.

In the NVE ensemble, the system has constant moles (N), volume (V), and energy (E). The microcanonical ensemble, therefore, corresponds to an isolated system that can not exchange heat or matter with the outer environment.

The result is a system where the total energy is conserved but fluctuations in potential and kinetic energy ($E_{tot}=K+V$) are still allowed.

A typical MD simulation starts from an unstable initial structure characterized by high potential energies that need to be minimized. As a result, since the total energy needs to be conserved, a decrease in $V$ corresponds to an increase in kinetic energy $K$ translating into higher temperatures.

A sudden increase in temperature may lead to some problems. For instance, a protein may unfold when we increase the temperature causing an unsuccessful experiment.

The microcanonical NVE ensemble is not always appropriate to perform MD simulations.

 

 

In the NVT ensemble, moles (N), volume (V), and temperature (T) are kept constant. In this case, the system is allowed to exchange heat with outer space so that the temperature stays constant. We can imagine it as a system being immersed in a giant thermostat.

This condition is achieved by simply scaling the velocities of the system so that we adjust the kinetic energy and, consequently, the temperature. If the temperature is too low we increase the velocities and vice versa. In this way, we are able to implement a thermostat in our experiment.

The NVT ensemble is commonly used in MD simulations to mimic systems at a constant temperature. We already talked about the different ways to achieve Molecular Dynamics at constant temperature in another article.

 

 

Moles (N), pressure (P), and temperature (T) are conserved. This ensemble is more flexible than the one we previously saw. Our system is allowed to exchange heat and, at the same time, we can adjust the volume so that the pressure is kept constant.

Therefore, the pressure is manipulated by constantly rescaling one or multiple dimensions of the simulation box.

A simulation environment that keeps the pressure constant is called a barostat.

The NPT ensemble is great to simulate chemical reactions which are usually carried out at constant pressure in the laboratory. We have an article dedicated to the different ways to implement a barostat in Molecular Dynamics.

 

 

Chemical potential ($\mu$), volume (V), and temperature (T) are constant. The main difference with the above ensembles is that the number of molecules is allowed to fluctuate during the simulation. The system is assumed to be open and can exchange heat and particles with a very large reservoir. The two systems are in equilibrium, they can exchange matter between each other while the heat reservoir acts as a thermostat. This is usually not supported by most Molecular Dynamics software.

The vast majority of experimental observations are performed within an NPT, $\mu$VT, and NVT ensemble. On the other side, microcanonical ensembles (NVE) are rarely used in real experiments and, therefore, also in MD.

 

 

Performing an MD simulation requires you to perform different steps which have already been detailed in other articles.

As a result, a standard MD procedure is not performed within a single ensemble but is composed of different simulations carried out within different ensembles. In GROMACS, you can specify the ensemble you want to use by setting the appropriate parameters in the mdp files.

A typical course of action is the one reported in Figure 1.

 

Figure 1 Standard procedure for MD simulation

 

First of all, we perform an MD simulation in the NVT ensemble to bring the system to the desired temperature. Most of the time, this is needed even if our goal is to bring the system under constant pressure.

The NVT step is followed by a simulation in the NPT ensemble. Overall, the first two steps are needed to equilibrate the system, and are therefore named equilibration steps.

After the system is equilibrated we can start our real simulation at constant pressure mimicking laboratory conditions. After this phase, named production run, we will collect our data.

The above example is just one of the many ways you can choose to setup a simulation protocol. If you want to learn more about setting up simulations here you can find GROMACS tutorial providing a more detailed explanation of the process.