Back Original

Exploring the World of Molecular Dynamics

molecular-dynamics comp-bio

Joseph Campbell talks about “following your bliss” and heeding the hero’s call to adventure. It sounds quite grandiose, but it’s really just about listening to what genuinely interests you, using your volitional muscles and having the courage to pursue it if you have the means to do so (or after figuring out how to make it work). After years building software and web applications for everything from charities to startups, I found myself pulled back to my first love, science, through my discovery of the existence of the field of computational biology. This time things felt different. All the work I’d put into the craft of software development gave me the computational skills needed to jump into molecular dynamics.


"I became captivated by the edifices chemists had raised through experiment and imagination, but still I had a lurking question. Would it not be better if one could really 'see' whether molecules as complicated as the sterols, or strychnine were just as experiment suggested?"

But what exactly is molecular dynamics (MD)? What can it do that experimental methods cannot? What sort of questions can we ask and answer with it? I’ll preface this all with a disclaimer that I’m by no means an expert on this. I’m still learning and coming to grips with everything. Regardless, I’ll do my best to share what I know, laying it out in a way that, hopefully, makes it accessible to laypersons. If that sounds interesting to you, grab a cup of your favorite beverage, and let’s learn something together!

What is Molecular Dynamics?

Molecular dynamics sits at the intersection of several areas: computer science, biochemistry, and physics. A truly interdisciplinary subject! As the name implies, we’re interested in the motion (i.e., the dynamics) of a system of molecular components (atoms, for example) that operate under a set of physical forces/laws. We update our system in tiny time intervals (typically!), moving particles and recording all positions and velocities in a trajectory log. It’s like taking high-speed photos of some phenomena that we cannot fully observe with the human eye, like a lightning strike. The full details of the process can easily be seen when we can play back events at smaller intervals that we’d miss if we took the pictures instead with larger time steps.

So let’s say we have a box full of water (H₂O) molecules along with one sodium (Na+) and one chloride (Cl-) ion that we want to watch form sodium chloride (i.e., salt). We can randomly place the molecules into the box, ensuring that they are not overlapping one another. There’s a problem, though! These particles need to move in order to interact and simulate interesting things. A box of molecules that simply sits there is not what we want. How do we know what values to set for the starting velocities of the particles in our system?

That comes from the Maxwell-Boltzmann distribution, which defines the distribution of speeds(V) for a certain gas at a certain temperature(K). It was named after Ludzwig Boltzmann, an Austrian mathematician and theoretical physicist in the 20th century. There’s a nice live demo simulation of this at Wolfram with adjustable inputs or you can check out the graph below (Figure 1). For a given temperature (in units Kelvin) of our system, we can sample from this probability distribution to get the starting velocity distributions to assign to molecules for the initial step’s calculation in a simulation.

Graph of Maxwell-Boltzmann distribution at various temperatures

Figure 1. Shows the change in the Maxwell-Boltzmann distribution as the temperature changes. As temperature increases the distribution becomes flatter and more evenly distributed.

The basic MD algorithm that we run with each step is comprised of two simple parts:

  1. Calculate the forces on all particles, based on applicable forces. Forces are typically calculated based on pairwise interactions between particles.
  2. Update particle positions by integrating the equations of motion.

It’s a deceptively simple process! Using classical mechanics and the force field of the system, we can calculate the forces acting on each of the particles in order to determine the next configuration (velocity and position) of all particles over a VERY small time window (delta T). Repeated many times over, we build up a representation of how our atomic system evolves over time. As long as the temperature is higher, classical mechanics is a good enough approximation of the main forces at work, and one need not turn to quantum mechanics.

What advantages does MD have over experimental methods?

MD experiments are great for studying phenomena that experimental methods cannot easily study, like how the mechanism of the SARS COVID-19 spike protein works when it interacts with a cell surface. This is a rare event that is difficult to capture with experimental methods like NMR imaging and cryo-electron microscopy, which all take still images. Getting that shot or series of shots that would let us “see” how the spike protein worked is nearly impossible. MD is also a good tool to utilize for experiments that would be too expensive to carry out. For example, if the materials in question are rare, dangerous to work with, or would require highly specialized equipment.

It’s not a tool to use for everything, though. Some downsides of MD are that it’s a simulation, a best guess. Experimental methods are still the gold standard, and one should always confirm MD simulation results when possible! Done badly, MD simulations can be prone to artifacts in the results due to things like improperly equilibrated systems (where the forces are not stable) or using force fields that are not built to support the system you’re working with (e.g., some force fields are built for systems that have DNA nucleotides, and others have not). This can lead to incorrect results, conclusions, and wasted time, compute power, and money.

I’d be remiss if I didn’t talk about the other big limitation of MD: time. Remember how we were doing those calculations with each tiny time-step?

A/N: 2 femtoseconds, or ~2.0 x 10^-15 seconds is a commonly used time step for simulations.

Those tiny steps mean that it takes a heck of a lot of them to start to get towards more “normal” amounts of time simulated (like milliseconds or seconds). The compute power needed for running longer simulations is the major hurdle with using MD for simulations that model processes carried out over extended intervals. Typically, the “classical” MD we’ve discussed so far tops out at the microsecond range for simulation length. All is not lost, thanks in part to both more powerful CPUs and GPUs as well as a lot of really neat work going on in this field (something I’m highly interested in and following closely) the limitations are retreating. Methods like guided MD, umbrella sampling, coarse-grained models, and weighted ensembles all take different approaches to help support more efficient, longer simulations, and each comes with their own set of advantages and tradeoffs. It’s an exciting time!

What can we study with MD?

So given that we have these short “movies” of atomic molecules that are physically accurate, what sort of things can be done? The power of MD comes not from the movie itself, though it’s powerful for visually seeing processes and forming intuitions about what is happening. It comes from the fact that we have measurements of temperature, pressure, energy, velocity, and position for all of these molecules over time. This allows us to make calculations about the free energy of the molecule over time, to compare individual residues over time, and to ask many questions that are impossible to answer from experimental approaches. MD is used for studying things such as:

I love thinking of MD as a powerful tool that we can use to ask questions about biological phenomena as either a cheaper, exploratory starting point for thinking about what experimental angles and questions to ask. It’s one of the best ways to understand processes that are outside our ability to experimentally measure or work with. If you couldn’t tell, I’m so excited by this area of study! If you’re excited by it too and interested in learning more about MD, I’d highly recommend reading this paper which gives a fantastic intro to MD (far better than I did or could ever do here).

OK, that was a lot to take in, so we’ll stop here for now. Thanks for reading! I think I’ve got one last post left in this mini-series, writing about the actual, hands-on MD experiments that I have been playing around with. Watch the RSS feed or Mastodon for that to drop. Until next time, be well and take care of those you love.