MDMolecular Dynamics in Biomolecular Systems · Basic level
Key discoveries: 0 / 9

Chapter 02 · Interactive edition

Energy, forces and numerical motion

By tinkering, you will discover what an MD program does at every step: why we can treat atoms as balls, how often we need to compute them and how often we need to save them.

1

Find out with your own trials why atoms can be treated as classical balls and how F = ma produces a trajectory.

2

Starting from the bands of an IR spectrum, choose the time step of an MD program.

3

Measure, with data from a real simulation, how the saving interval changes what you can see.

Lab 1 · The classical approximationDo atoms behave like balls? Why MD uses F = ma instead of Schrödinger

The theory that correctly describes the world of atoms is quantum mechanics. Even so, an MD program moves atoms with Newton's law, F = ma. In this lab you will find out with your own trials why this is usually enough, where it is not, and why the Schrödinger equation cannot be applied to a whole protein.

1 · Particle workshop

Wave or ball? Choose the particle and the temperature

A hint from experiment: in crystal structures we see atoms at definite positions and write a structure as a list of coordinates. This shows that thinking of atoms as balls with a definite position usually works. How "wave-like" a particle is, however, is given by the thermal de Broglie wavelength λ = h/√(2π·m·k·T): λ is a measure of how blurred the particle's position is according to quantum mechanics. If λ approaches the distance to neighboring atoms (about 3 Å), the "ball" picture breaks down.

Particle
77 K liquid nitrogen · 100 K cryo-crystallography · 300 K room · 310 K body
Mass
Wavelength λ
λ / 3 Å (neighbor distance)
Rough verdict
Change somethingWhen you change the particle or the temperature, a comparison with the previous setting appears here. Changing only one at a time separates the effects.
Open

Choose the electron

The particle that forms chemical bonds is the electron. How large is its wavelength compared with the size of a molecule?

Choose the electron as the particle.
Open

Compare hydrogen with a heavy atom

At the same temperature, switch from H to C or O (or the other way round). The mass grows 12-16 times; by what factor does λ shrink?

At the same temperature, switch between H and C or O.
Open

Cool it down or heat it up

Change the temperature of the same particle by at least a factor of two. How does the quantum blur change?

Keep the particle fixed and change the temperature by at least a factor of 2.
2 · Vibration workshop

Is a vibration awakened by heat, or frozen?

In quantum mechanics a vibration cannot take just any energy: its energy rises in steps of size ħω (ħω = h·c·ν̃, where ν̃ is the wavenumber in the IR). The measure of the thermal energy coming from the surroundings is kT. If the step is much larger than kT, the vibration freezes on the lowest step; if it is much smaller, the steps are not noticeable and classical mechanics gives the right result. Classical MD, however, gives every vibration an average energy of kT, no matter how fast it is.

The parabola is the potential energy of the vibration; the horizontal lines are the allowed energy steps. The darkness of a line is the probability of being on that step (Boltzmann). The colored band is the thermal energy kT; the vertical axis is in units of kT.

Vibrations
5 to 4000 cm⁻¹ (logarithmic)
ħω / kT
Open

Examine a stiff bond at room temperature

Choose the O–H or C–H stretch between 250 and 350 K. What state is the vibration in?

Examine a vibration with ħω/kT of at least 5 between 250 and 350 K.
Open

Examine a slow motion

The large, slow motions of proteins lie far below the IR, at tens of cm⁻¹. How accurate is classical mechanics here?

Bring ħω/kT below 0.5.
Open

Find the boundary

Find the wavenumber at which ħω is exactly equal to kT. Does this boundary depend on temperature?

Bring ħω/kT between 0.97 and 1.03.
3 · Bench

From force to trajectory: run F = ma yourself

We have accepted the classical picture: the nuclei are balls, and the whole effect of the electrons is an energy surface U(x). The rest of MD is a single rule: the force is the slope of the energy (F = −dU/dx) and the acceleration is the force divided by the mass (a = F/m). The surface here has two stable positions with a barrier between them; you can think of it as two conformations of a side chain. The calculation uses the velocity Verlet integrator used by MD programs, in steps of 0.5 fs. While paused, you can place the ball anywhere on the surface with the mouse or your finger; the force arrow shows the push at that point.

Mass
kT = 2.49 kJ/mol at 300 K
Surroundings
Speed
Vibration period at the bottom of a well
Elapsed time
Total energy
Well-to-well crossings
Open

Change the mass

On the same surface, play two different masses for at least one vibration each. How does the motion change?

Play two masses for one period each with the same barrier.
Open

Will it get over the barrier?

In the isolated system, try an initial energy once below and once above the barrier.

Play both cases for at least three periods.
Open

Turn on the heat bath

Keep the energy below the barrier, but make the surroundings a "heat bath" and increase the speed. What happens?

In the heat bath, see one crossing while the barrier is at least 2 kT.
4 · Discovery notebook

How much rarer do crossings become as the barrier rises?

The button computes a 1 ns run (2 million steps) in a 300 K heat bath with the mass and barrier of the bench and counts the crossings. If you press it again with the same settings, the time adds up. Try different barriers.

Open

What is the rule?

With the same mass, count at least 3 crossings at each of at least three different barriers of at least 3 kT (7.5 kJ/mol). Keep at least 5 kJ/mol between the lowest and the highest barrier.

Open

Does the mass change the rule?

Do the same with a second mass and compare the two slopes.

5 · Why not Schrödinger?

How do we know the force without computing the electrons?

In the workshop you saw that the electron is definitely a quantum particle. Electrons form chemical bonds, so the forces come from them too. The key idea here is the Born-Oppenheimer approximation: the electron is 1836 times lighter than even the lightest nucleus, the proton. By the time the nuclei have moved one step, the electrons have long since adjusted to the new arrangement. The nuclei can therefore be thought of as moving on an energy surface U(R) created by the electrons.

So why don't we compute the electrons with quantum mechanics at every step? Because the cost grows very quickly with the number of atoms. Enlarge the system below: the bars show how many times more expensive one force calculation of each method becomes when you go from the 22-atom alanine dipeptide (without water) to the size you choose.

22 to 1 million (logarithmic)
Estimated speed with a force field

The scalings are formal: a force field grows roughly as N with a cut-off radius and neighbor lists (N log N with PME), common DFT methods as N³, and CCSD(T), regarded as the gold standard, as N⁷. There are also linear-scaling quantum methods and QM/MM, which combines a force field with quantum mechanics; ab initio MD usually stays at the scale of hundreds of atoms and picoseconds. The force-field speed is a rough estimate scaled linearly from the value measured in this book's alanine dipeptide pilot.

6 · Back to the protein

In a protein simulation, what is classical and what is lost?

ComponentCriterion at 300 KIn classical MDWhat is lost, how it is compensated

The criteria have just been computed with the formulas on this page. The boundary values (0.15 and 0.5 for λ/3 Å) are this page's rough criterion, not a sharp physical threshold.

7 · Test yourself

Six questions

Models: thermal de Broglie wavelength λ = h/√(2π·m·k·T); quantum harmonic oscillator (Boltzmann distribution, mean energy including zero-point energy, Einstein heat capacity); on the bench U(x) = E_b·((x/0.5 Å)² − 1)², velocity Verlet (Δt = 0.5 fs), Langevin dynamics in the heat bath (BAOAB, friction 10 ps⁻¹, 300 K). Your notebook is stored only in this browser.

Lab 2 · Time stepThe atom's clock: how often should an MD program look?

An MD program does not follow the positions of the atoms continuously; it computes them at intervals, moving forward by a time step Δt. If the interval is too large, it misses a fast motion. You already know the fastest motions from experiment: the bands in an IR spectrum are bond vibrations.

1 · Bond workshop

Build a bond and see where its band falls

Think of a bond as two masses with a spring between them: the masses are the atoms, and the stiffness of the spring (the force constant k) is the strength of the bond. Change the atoms and the stiffness; the vibration of the bond and its position in the IR spectrum change instantly. The spectrum is schematic: the colored strips are the typical regions of the bands.

The vibration is slowed down 3 × 10¹³ times: 1 second on screen is about 33 fs for the bond. This way you can compare the speeds of different bonds by eye. The amplitude is enlarged so that it is visible.

Preset bonds
Atom 1
Atom 2
single bond ≈ 450-500 N/m · double ≈ 1000-1200 · triple ≈ 1900
Reduced mass μ
Band position ν̃
Vibration period T
grompp limit Δt = T/5
Change somethingWhen you change an atom, the spring or a preset bond, a comparison with the previous setting appears here.
Open

Replace hydrogen with deuterium

Exactly like an experimental isotope exchange: the same bond, only the mass changes. Where does the band shift?

Switch from O–H to O–D (or from C–H to C–D).
Open

Stiffen the bond

Keep the atoms fixed and change only k, for example from C–O to C=O.

Change k by at least a factor of 1.5 with the same atoms.
Open

Give hydrogen a fake mass

A trick used in MD: make the mass of hydrogen 3 u. What happens to the vibration and the allowed Δt?

Set atom 2 to "H (3 u)".
2 · Bench

At what interval should this vibration be computed?

Here the bond you built in the workshop is computed with the velocity Verlet integrator, the method used by MD programs (harmonic approximation). Slide Δt; every place where you release the slider is added to the notebook below as a trial.

Top: the positions computed by the integrator, one dot per Δt. Bottom: the relative deviation of the total energy from its initial value over 20 vibrations. In a real molecule this energy does not change; the whole deviation is numerical error coming from the calculation interval. In a stable run the error always stays below zero: the bond is released from its longest, motionless state, and starting from this phase the velocity-Verlet energy only swings downwards.

0.05 fs to 20 fs (logarithmic)
Bond
Vibration period
Calculations per period
Largest energy error
Status
Steps for 1 ns
3 · Discovery notebook

Your trials

Horizontal axis
Open

What happens to the error when Δt doubles?

On one bond, try at least four Δt values that differ considerably from each other.

Open

Where does the calculation blow up?

Increase Δt until the calculation blows up, then narrow the limit from both sides.

Open

Is every bond happy with the same Δt?

Make trials on two different bonds, then switch the horizontal axis to "calculations per period".

4 · Back to the protein

Where does 2 fs come from?

In a protein all these bonds are present at once, and the time step is set by the fastest vibration. A commonly used rule in practice is to limit the step to one fifth of the period of the fastest vibration (the T/5 rule: at least five steps per period); the grompp stage of GROMACS warns by this rule too. It is a safety margin established by experience; the limit that cannot be crossed is T/π (blow-up). You can see the counterpart on the bench: at Δt = T/10 the energy error is about 10%, at T/5 about four times that (the error grows with Δt²). T/5 is an upper limit, not a comfortable setting.

Bondν̃ (cm⁻¹)Period T (fs)Blow-up limit ≈ T/π (fs)grompp limit T/5 (fs)T/10 (fs)Energy error at 2 fs

Bonds involving H (O–H, N–H, C–H) are the fastest, because hydrogen is very light. A protein computed with them needs Δt ≈ 0.5 to 1 fs. MD programs use two routes:

Constraints: The lengths of these bonds are fixed (SHAKE, LINCS, SETTLE). Once their vibration is removed from the calculation, the fastest remaining vibrations are those of about 20 fs, such as C=O (with this page's spring constant; in this project's ubiquitin topology the fastest free bond is 22.21 fs, T/5 = 4.44 fs), and Δt = 2 fs can be used comfortably.

Hydrogen mass repartitioning (HMR): The trick you tried in the workshop. Mass is taken from the bonded heavy atom and given to the hydrogen (the total mass does not change). The vibrations slow down; together with constraints, up to 4 fs becomes possible. The masses are artificial, so conclusions about the speed of the dynamics (such as diffusion) must be interpreted with care.

The last column of the table has just been computed with the harmonic model on this page. Real bonds are anharmonic and vibrations in a protein are coupled to each other; the numbers are therefore rules of thumb, not the energy error of a protein itself. The spring constants in the table are textbook values. In this project's ubiquitin topology (amber99sb-ildn) the periods are somewhat different: O–H 8.99 fs, backbone N–H 10.11 fs, backbone C=O 23.83 fs (about 1,400 cm⁻¹; the C=O spring of this force field does not by itself give the amide I band). The bond-by-bond detail is in the MD-DT module.

5 · Test yourself

Six questions

Model: diatomic harmonic oscillator. ν̃ = (1/2πc)·√(k/μ), T = 1/(c·ν̃); velocity Verlet. The force constants are approximate textbook values; the computed band positions fall in the same region as typical measurements but do not replace the spectrum of a molecule. Your notebook is stored only in this browser.

Lab 3 · Saving intervalThe program does not write every step

An MD program computes the forces at every time step, but writes a frame to the trajectory file only at certain intervals. The saving interval does not change the accuracy of the calculation; it changes what you can see afterwards. In this lab you will save first a vibration and then a real simulation from this book at sparse intervals, and measure what is lost.

1 · Stroboscope workshop

How does the frame interval show a vibration?

A hint from experience: in films, a fast-spinning car wheel sometimes seems to slow down, stop or even turn backwards. The camera takes a fixed number of frames per second; if the wheel makes almost a full turn between two frames, it appears to stand still in the frames. An MD trajectory is the same: the program computes the motion at every step but writes a frame to the file only at certain intervals. Choose a bond and slide the saving interval.

real vibrationsaved framesmotion seen in the frames
Bond
0.5 to 40 fs; the calculation step is 0.5 fs
Vibration period T
Saving interval Δ
Δ / T
Period seen in the frames
Change somethingWhen you change the saving interval, the motion shown by the frames is compared here with the real motion.
Open

Find the boundary

On the same bond, bring the saving interval slightly below and slightly above half the period. When does the apparent period start to be wrong?

Bring Δ/T once between 0.40 and 0.50 and once between 0.50 and 0.65.
Open

Stop the vibration

Exactly like the wheel standing still in a film: make the saving interval equal to the period.

Bring Δ/T between 0.98 and 1.02.
Open

A fake slow vibration

Make the saving interval slightly longer than the period. What do you see in the frames?

Bring Δ/T between 1.02 and 1.25.
2 · Bench

Thin out the saving of a real simulation

Run 1 of this book's alanine dipeptide pilot: GROMACS 2026.3, 2 fs calculation step, 10 ns. The program wrote a frame every 500 steps, that is every 1 ps (nstxout-compressed = 500), and saved only the dipeptide. Below are the dipeptide's ψ angle (or φ, if you like) and its conformation in every frame (αR, β, αL; definitions as in MD-U). ψ separates αR from β: the dashed lines are the edges of the αR band (−120° and 50°); the color changes in the strip below are the moments when ψ crosses these lines. What would we have seen if we had saved more sparsely? Choose a saving interval; the page subsamples the same data at that interval.

αRβαL
Angle in the plot
Saving interval

Whatever you choose, the calculation is the same run with a 2 fs step; only the frames written to the file change.

Number of frames
αR fraction
State changes counted
File size
Mean residence time (from the 1 ps data)

3 · Discovery notebook

What does sparse saving change, and what does it leave unchanged?

Every interval you choose on the bench is added here as a trial. Both quantities are divided by their values at 1 ps: 1 means that thinning out the saving changed nothing.

Open

Equilibrium fraction

Try at least three intervals, one of them 100 ps or sparser. How much did the αR fraction change?

At least three intervals, one ≥ 100 ps.
Open

Transitions

What happened to the number of state changes counted in the same trials?

Try at least three intervals.
Open

Disk

Compare the file sizes of 1 ps and a sparse interval.

Try 1 ps and an interval of 100 ps or sparser.
4 · Back to the protein

Which question needs which saving interval?

QuestionRule for the saving intervalIn the pilot data

The saving interval does not change the accuracy of the calculation: the forces are computed every 2 fs, and the frames are only stored. But it determines which questions you can ask afterwards; a frame that was not written cannot be recovered. In GROMACS the relevant settings are nstxout-compressed (the number of steps between written positions), compressed-x-grps (which atoms are written) and nstenergy (the interval for the energy terms). In the pilot, positions and energies were written every 500 steps (1 ps); positions only for the dipeptide.

5 · Test yourself

Six questions

Model and data: in the stroboscope the vibration is a cosine, with periods from the formula of Lab 2; the apparent period is computed from sampling theory (aliasing) and is shown as "seems to stand still" if it exceeds 50 times the period. The data on the bench come from this book's alanine dipeptide pilot; the state definitions are as in MD-U (αL: φ ≥ 0; αR: φ < 0 and −120° ≤ ψ < 50°; β: the rest). Your notebook is stored only in this browser.

Next module, MD-PBC: instead of a single particle as on this page, we will put thousands of atoms into a small box and decide what happens at the edge of the box.

About this page. Interactive edition for CH02. The numbers on this page are being computed in your browser right now; the data of Lab 3 come from this project's alanine dipeptide pilot (GROMACS 2026.3). The models in Labs 1 and 2 are teaching models; their details are given below each lab.

Terms in this module

The definition of each term and the other modules where it appears are in the glossary.