Molecular Dynamics: Ensembles & Phase Space
What is an Ensemble?
An ensemble, in simple terms, is a collection of points that describe the possible states of a system at any given moment. Imagine a system with eight (8) possible states — if you could represent each of these states as a point in some space, that collection would be the ensemble of your system. In molecular dynamics (MD), this space is known as phase space, where the states of the system are defined by both the positions and momenta of its components.
Let’s explore this concept with a straightforward example: Consider a system that can only move along the x-axis, and thus, has momentum along x (Px). For instance, think of a car moving straight along a road with no turns. The phase space points, in this case, represent the possible states of the car in terms of its position (x) and momentum (Px). That is, at any instance, the position and momentum are enough to describe the current state of the car
The ensemble, therefore, is just a collection of these points. Each point represents a state of the system, fully defined by its x and Px values.
Quick Thought: Now, what if the car could also move along the y-axis or even the z-axis (well flying cars are not there yet but you get it, just consider moving to an elevated expressway for z-axis locomotion)?
In that scenario, we would have additional degrees of freedom: For 2D (x-y plane) motion, the DOFs are: x, y, Px, Py. To represent these states, we would need a 4D space — impossible to visualize, but conceptually important. So, any point in that 4D phase space will denote the state of the car. Just imagine a hyper-dimensional space with discrete points denoting certain possible states of a system. For now, let’s stick to our simpler 2D phase space and grasp its basics before expanding our understanding to higher dimensions, ND spaces.
How does this relate to MD simulations?
In MD simulations, we begin by initializing a system with specific atomic positions and velocities. If our system contains 50 atoms, we need 50 position (x) and 50 momentum (Px) values to describe its initial state. These values correspond to a single point in the phase space. By starting with different sets of (x, Px) values, we could map out other possible states of the system, collectively forming the ensemble.
But wait, you might wonder, if we start with just one set of (x, Px) values, how can we be sure this state is the correct one for our MD simulation? What about the other possible states?
Excellent question! To answer this, we must delve into the ergodic hypothesis and its connection to MD and statistical thermodynamics — a topic I’ll cover in a future article. For now, here’s a quick insight: During an MD run, the system evolves and moves through different points in phase space, as shown below:
As the system progresses, the (x, Px) values change over time — say, at times t0, t1, and t2 — meaning the system visits different states. Even though we start with one configuration, we need to ensure that the simulation explores the entire phase space to capture all relevant contributions to the property we’re studying. This exploration, or phase space probing, is crucial for the accuracy of the simulation. If the phase space isn’t fully probed, the average value we compute won’t accurately represent the system’s true behavior.
Start at state 5 → compute the desired property → move in time to get to state 4 → compute and average → move to state 2 → compute & average → repeat until phase space probing is complete
Up until now, we’ve only considered a car moving along the x-axis (2 degrees of freedom, or DOFs). If we scale this up to 50 cars, we now have 100 DOFs. For a more complex system, say 50 cars with motion in three dimensions, we have 300 DOFs: (x, y, z, Px, Py, Pz) set for each car, and therefore, a 300D phase space. So we have a 300-D phase space and we need to ensure we probe all representative (I’ll explain representative states later) states in the ensemble. This is why, when working with systems of thousands of atoms, we deal with a phase space of hundreds of thousands of dimensions — an astronomical concept!
This is why if you write out (x, Px) values at t0, t1, and t2, you will see they are different from each other.
Examples of phase space: The first two figures are used for explanation, they are not real phase space scenarios for simple systems like a car moving along x or a simple pendulum. More realistic and simplified versions of such phases are shown below:
Now, a system of 50,000 atoms will have a staggering 300,000-D phase space, considering flexible movements in all possible directions. However, the classical equations are solved not in 300,000D space, but in 6D space. Here’s how:
From 6-D Space to 6N-D Space
Interestingly, while classical MD equations are solved in a 6-dimensional space (considering x, y, z, and their corresponding momenta), the entire system’s information is contained in a 6N-dimensional phase space (where N is the number of particles). This higher-dimensional space helps ensure ergodicity, the idea that over time, the system will visit every possible state consistent with its energy (I will explain it next time).
6-D space = solve Newton’s equations to have atomic information
6N-D space = system’s information (no atoms are present in this space) to ensure ergodicity
So, when we blame LAMMPS for not having a good physical property, it is probably because the system failed to achieve ergodicity. In other words, the phase-space probing failed and our simulated value does not represent the actual theoretical statistical value of that property. This is due to a bad starting configuration, having too much force in the system for which the system moves erratically across the phase space, not giving the system enough time to probe the phase space, or maybe due to the system being stuck in a certain area of the phase space. Anyway, we should do our due diligence of understanding phase space probing (i.e., running longer) before taking our frustration out on LAMMPS or other MD simulation packages.
This article is just the beginning of this MD series, and I hope it has clarified the concepts of ensembles and phase space. I will cover types of ensembles in the next article. Stay tuned for more insights, and feel free to share your thoughts or spot any errors — let’s learn together!