Biochemistry is the study of the chemistry of life processes. Generally these experimental studies can occur in wet labs (the physical labs where we handle chemicals), or using computer software to kind of imitate or reproduce the wet-lab experiments, which is where computational biochemistry through molecular dynamics simulations come in.
As an overview, in computational biochemistry, we apply computer algorithms, mathematical modeling, and high-performance computing to investigate the structure, dynamics, and the interactions of biological molecules at the atomic level. This is interdiciplinary because in here we traverse biochemistry, molecular biology, physics, and computer science (in a dry lab) to simulate exeriments including the impractical ones.
Molecular dynamics (MD) lets us follow atomic motion using a model of a system’s potential energy using Newtonian mechanics. The basic idea is that we mimic what atoms do in real life, assuming a given energy function (what enables us to calculate the force experienced by any atom, given the positions of the other atoms in a system). Thus, instead of a single static structure, we get a trajectory: thousands of snapshots showing how atoms interact, a protein breathes, how a ligand settles into a pocket, or how the non-polar hydrophobic valine replaces the polar hydophilic glutamic acid at the 6th postion of both the hemoglobin's HBB genes which is the root cause of the Sickle Cell Disease (the primary reason why we are here, more on this later).
How MD simulation works
At its core, MD integrates Newton's second law for every atom i and the general equation is:
m_i \frac{d^2 \mathbf{r}_i}{dt^2} = \mathbf{F}_i = -\nabla_i V(\mathbf{r}_1, \ldots, \mathbf{r}_N)
In the simplest terms possible, the equation above describes how an atom moves when forces act on it. We have a lot going on in there, so we begin with ordinary motion, then connect the dots.
1. Newtonian Mechanics; Second Law of Motion
Well, we all know:
\boxed{F=ma}
This put in simple terms means:
The net force acting on an object equals its mass multiplied by its acceleration.
The three quantities involved here are:
| Symbol | Meaning | A simple example |
|---|---|---|
| F | Force: a push or pull | Pushing a trolley |
| m | Mass: how much the object resists changes in motion | A loaded trolley has more mass |
| a | Acceleration: how quickly velocity changes | The trolley starts moving faster |
When we rearrange it we get:
a=\frac{F}{m}
Two things become clear:
- With the same mass, a larger force produces a larger acceleration.
- With the same force, a larger mass produces a smaller acceleration.
The molecular dynamics equation uses this same law, applied to individual atoms in a system.
2. What does the little i mean?
Imagine a system containing three atoms. We can label them as:
1,\quad 2,\quad 3
The symbol i means whichever atom we are currently considering.
Thus:
m_i=\text{mass of atom }i
For atom 2, this becomes m_2. It is worth mentioning that the subscript is a label and does not mean multiplication.
Similarly, N is the total number of atoms. If the system contains 1,000 atoms, then N=1000, meaning i can run from 1 to 1,000.
3. What is \mathbf r_i?
This is the position of an item, in our case, an atom. Before describing the motion of an atom, we need to describe where it is within a system.
Along a straight line, one number is enough. In other words, an atom is whatever metric units of length (usually nanometres) from a given reference point:
x=2\ \text{nanometres}
In three dimensions, we need three coordinates:
\mathbf r_i=(x_i,y_i,z_i)
These describe the position of atom i relative to a chosen origin.
For example:
\mathbf r_i=(2,3,1)\ \text{nm}
means its coordinates are 2 nanometres along the x-axis, 3 along the y-axis, and 1 along the z-axis.
Therefore, the bold \mathbf r indicates a vector. Recall quantities with both magnitude and direction such as velocity, acceleration, displacement, and force just to name a few.
4. From position to velocity
Velocity describes how position changes with time. It includes direction.
For motion along a straight line:
\text{average velocity} = \frac{\text{change in position}}{\text{elapsed time}}
If an object moves from x=2 metres to x=8 metres in 3 seconds, here's how we'd calculate its velocity;
v_{\text{average}} = \frac{8-2}{3} = 2\ \text{m/s}
But an atom’s velocity may change throughout its motion. We therefore want its velocity at a particular instant.
Calculus writes this as:
\mathbf v_i=\frac{d\mathbf r_i}{dt}
This reads as:
“The rate of change of atom i’s position with respect to time.”
The notation d/dt means take the time derivative. This is kind of like a way of measuring how quickly something is changing at an instant.
5. From velocity to acceleration
Acceleration describes how velocity changes with time.
For example, if velocity increases from 2\ \text{m/s} to 8\ \text{m/s} over 3 seconds, the average acceleration is:
a_{\text{average}} = \frac{8-2}{3} = 2\ \text{m/s}^2
This means velocity increases by 2\ \text{m/s} each second.
Remembering instantaneous acceleration is:
\mathbf a_i=\frac{d\mathbf v_i}{dt}
Since velocity is already the derivative of position, we can then rewrite the equation substituting V_i as such:
\mathbf a_i=\boxed{\frac{d}{dt}\left( \frac{d\mathbf r_i}{dt} \right)}=\boxed{\frac{d^2\mathbf r_i}{dt^2}}
This is the second derivative of position with respect to time:
\text{position} \xrightarrow{\text{rate of change}} \text{velocity} \xrightarrow{\text{rate of change}} \text{acceleration}
The d^2 notation does not mean “square the position.” It means taking a derivative twice, which on other words, means finding the rate of change of position first (which gives us velocity), and then finding out how that rate changes (which gives us acceletaion in this case).
By now we notice that the first part of the equation is simply:
\underbrace{m_i}_{\text{mass}} \underbrace{\frac{d^2\mathbf r_i}{dt^2}}_{\text{acceleration}} = \underbrace{\mathbf F_i}_{\text{net force}}
which is ma=F.
6. The origin of the force
\mathbf F_i=-\nabla_i V
Before tackling \nabla_i, we need to understand potential energy.
Potential energy is energy associated with a system’s configuration. For example, the relative positions of interacting objects, in our case atoms.
Let us use a spring as an eample:
- Stretching it stores potential energy.
- Releasing it allows that stored energy to become motion.
- The spring exerts a force that pulls it back toward its relaxed length.
In a molecular system, potential energy depends on the arrangement of atoms. Changing bond lengths, bond angles, or distances between atoms can change that energy.
Thus, we would have;
V(\mathbf r_1,\ldots,\mathbf r_N)
which when put in words means:
“Calculate the potential energy using the positions of all N atoms.”
Here, V is the potential energy of the whole system, not its velocity. Velocity is usually written as lowercase \mathbf v.
Back to \nabla, a symbol pronounced as “nabla,” is used here to calculate a gradient.
A gradient describes:
How steeply a quantity increases, and in which direction it increases most rapidly.
Imagine a landscape where height represents potential energy:
- Valleys represent lower energy.
- Hills represent higher energy.
- A steep slope represents a rapid change in energy over a short distance.
The gradient points uphill, toward increasing potential energy.
The subscript i tells us to examine how the energy changes when atom i moves, while holding the other atoms’ positions fixed for this calculation.
In three dimensions, this can be represented as;
\nabla_i V = \left( \frac{\partial V}{\partial x_i}, \frac{\partial V}{\partial y_i}, \frac{\partial V}{\partial z_i} \right)
Each component measures how the energy changes when we move atom i along one coordinate direction.
The symbol \partial indicates a partial derivative. It means changing one variable while keeping the others fixed. For now, we will not care much about how to calculate these yet; understanding what they measure is the first step.
7. The minus sign!
\boxed{\mathbf F_i=-\nabla_i V}
The gradient points uphill. The minus sign makes the force point downhill in potential energy.
A steeper energy slope produces a larger force.
For a one-dimensional example, this reduces to:
F=-\frac{dV}{dx}
Here is a tabular representation;
| How potential energy changes as x increases | Resulting force |
|---|---|
| Energy increases | Force points toward decreasing x |
| Energy decreases | Force points toward increasing x |
| Energy slope is zero | Force is zero at that point |
One important distinction: force points downhill, but an atom need not be moving downhill. Its existing velocity can carry it uphill while the force slows it down, the same way a ball thrown upward keeps rising for a while despite gravity pulling downward.
8. An example with a spring!
Suppose an object is attached to a spring. Let x measure its displacement from the spring’s relaxed position.
Its potential energy is:
V(x)=\frac12 kx^2
Here, k is the spring stiffness.
Taking the energy derivative gives:
\frac{dV}{dx}=kx
Therefore:
F=-kx
If:
k=10\ \text{N/m},\qquad x=0.2\ \text{m}
then:
F=-10(0.2)=-2\ \text{N}
The negative sign means the force points back toward the relaxed position.
If the mass is 1\ \text{kg}:
a=\frac{F}{m}=\frac{-2}{1}=-2\ \text{m/s}^2
We have followed the same relationship as our molecular equation:
\boxed{ \text{position} \longrightarrow \text{potential-energy slope} \longrightarrow \text{force} \longrightarrow \text{acceleration} }
A vibrating chemical bond can be approximated by spring-like behaviour near its equilibrium length.
9. Now, we revisit and read the complete equation in plain English
\boxed{ m_i \frac{d^2 \mathbf{r}_i}{dt^2} = \mathbf{F}_i = -\nabla_i V(\mathbf{r}_1,\ldots,\mathbf{r}_N) }
For atom i, mass multiplied by acceleration equals the net force acting on it. That force is calculated from how the system’s potential energy changes when that atom moves.
In molecular dynamics, a computer repeatedly calculates these forces and uses them to update the atoms’ velocities and positions over tiny time steps, what we call femtoseconds;
1\ \mathrm{fs}=10^{-15}\ \mathrm{s} =0.000000000000001\ \mathrm{s}
For now, the foundation to hold onto is: positions determine forces through the potential-energy model; forces determine accelerations through Newton’s second law.
From the equation to a simulation
The basic algorithm divides time into small, discrete steps. At each step, we calculate the forces acting on the atoms using a molecular mechanics force field, then update their positions and velocities using an integration method.
The potential energy V comes from a force field, which is a set of functional forms and parameters describing bonds, angles, torsions and non-bonded interactions. Van der Waals interactions, for example, are commonly modelled with the Lennard-Jones potential:
V_{LJ}(r) = 4\varepsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6} \right]
Integrating the equations of motion
Most MD engines use a variant of the Verlet family of integrators. The velocity Verlet scheme is short enough to write out in a few lines:
import numpy as np
def velocity_verlet(x, v, force, mass, dt, steps):
"""Advance positions and velocities with the velocity Verlet scheme."""
a = force(x) / mass
for _ in range(steps):
x = x + v * dt + 0.5 * a * dt**2
a_next = force(x) / mass
v = v + 0.5 * (a + a_next) * dt
a = a_next
return x, v
The time step dt is limited by the fastest motions in the system, bond
vibrations involving hydrogen. This explains why biomolecular simulations
typically use steps of 1–2 fs.
A first look at an example workflow
With GROMACS, preparing a protein in a box of water starts like this1. These commands illustrate the initial preparation steps. They do not represent a complete simulation setup:
gmx pdb2gmx -f protein.pdb -o processed.gro -water spce
gmx editconf -f processed.gro -o boxed.gro -c -d 1.0 -bt cubic
gmx solvate -cp boxed.gro -cs spc216.gro -o solvated.gro -p topol.top
Simulation parameters live in an .mdp file. This excerpt illustrates a few settings; a complete file also needs settings appropriate to the system and simulation stage:
integrator = md ; leap-frog integrator
dt = 0.002 ; 2 fs
nsteps = 500000 ; 1 ns
tcoupl = V-rescale
ref_t = 300 300
A simulation is only as good as its setup. Most of the work happens before the first production step.
What comes next
Upcoming notes will cover energy minimisation, equilibration in the NVT and NPT ensembles, and how to tell whether a trajectory is telling us something real.
-
Following the structure of Justin Lemkul's GROMACS tutorials, which remain one of the best places to start. ↩