In this version Labs 1 and 2 of the module are published. The cut-off distance is in MD-CUT, salt and Ewald in MD-ELEC. Every number is computed in your browser right now.
MD-PBC · Lab 1 · Periodic boundaries

The box without edges: how do a few thousand molecules behave like an ocean?

An MD simulation puts a protein and a few thousand surrounding water molecules into a small box. In a real sample the protein sits far from any edge, in the middle of countless water molecules. What changes if the small box also has an edge? How do we remove the edge, and why does it matter for the energy?

Discoveries: 0 / 9
Experimental bridge

Edges behave differently; you already know this from the lab

The edge-well effect. On a 96-well plate the wells of the outer ring evaporate more and feel temperature changes sooner. This is why most experiments leave the outer wells empty. The 36 edge wells are 37.5% of the plate.

The unit cell. In crystallography the whole crystal is one unit cell repeated by translation in every direction. Solving one cell means solving the whole crystal. The periodic box in MD is the same idea; the difference is that the cell holds a liquid and molecules can cross the cell boundary.

A simulation box is a few nanometers across. If such a small box had an edge, a large share of the molecules would sit "at the edge", like the outer wells of the plate. Below you will try this first with a single molecule, then with a crowded liquid.

1 · Workshop

Launch a molecule and follow where it goes

The box is 3 nm wide; the ball inside is a single water molecule (18 g/mol). Grab the ball and drag it backwards: the arrow shows the direction and speed it will take when you let go. With the keyboard you can use the "Launch at random" button. At room temperature a typical water molecule moves a few hundred meters per second. Try the three kinds of boundary one after the other.

Grab the ball, drag it and let go.
Boundary of the box

Speed
0 m/s
vx · vy
0 · 0 m/s
Kinetic energy
0 kJ/mol
Ratio to kT at 300 K
0
Wall hits
0
Energy in the box
0 kJ/mol
Launch the ballWhen the ball hits a wall, crosses the boundary or escapes, what changed is written here.
Open

What does the wall do?

Launch the ball in the walled box and watch it hit at least twice. Which velocity component changes, and does the energy change?

Launch in wall mode; two hits are enough.
Open

What happens without a wall?

Launch the ball in vacuum mode. What happens to the energy in the box?

In vacuum mode, send the ball out of the box.
Open

Where does the ball go in the periodic box?

Launch in periodic mode and watch it cross the boundary at least three times.

Launch in periodic mode; three crossings are enough.
2 · Bench

In a crowd: why is the energy of a molecule at the edge different?

Now the box holds a liquid of 100 molecules (a Lennard-Jones liquid, argon-like; a two-dimensional toy model). The color of each molecule is its own potential energy: dark blue is a molecule strongly attracted by the neighbors around it, so its energy is low; a light color is a molecule with few neighbors and high energy. Tap a molecule to see its neighbors and its energy; grab and drag it to give it speed. You can do the same with the keyboard using the select and push buttons. The energy unit is ε; for argon ε is about 1 kJ/mol. The temperature is chosen low (kT = 0.40 ε): here this two-dimensional model is close to freezing, and you may see hexagonally ordered, solid-like patches in the liquid. A molecule at the edge has a higher energy in a solid as well; the direction the page teaches does not change.

Tap a molecule, or grab and drag it.
Boundary of the box
low energyhigh
With 3 or fewer neighbors
Potential energy per molecule
Temperature (start = 100)
Evaporated molecules
Selected molecule
none
Try itIn vacuum mode watch the square-shaped liquid round off over time; then switch to the wall and periodic modes.
Open

A molecule at the edge and one in the middle

In wall or vacuum mode, tap a light-colored molecule at the edge first, then a dark one in the middle.

Tap a molecule with at most 3 neighbors and one with at least 5.
Open

Where did the energy you gave go?

In periodic mode, grab a molecule, fling it fast and wait a little.

In periodic mode, give a molecule a strong push.
Open

Small droplet, large droplet, periodic box

Measure with different numbers of molecules in the notebook below.

Measure at least three different molecule numbers in both setups.
3 · Discovery notebook

Does the size of the sample change the result?

Whether you measure the molar heat of solution of a salt in 1 mL or in 1 L, you expect the same result; properties that do not depend on the size of the sample are called intensive properties. The energy per molecule is one of them: in an unbounded liquid it should not depend on the number of molecules.

Here you prepare two kinds of "sample": a free droplet in vacuum and a periodic box. In each measurement the liquid is equilibrated at constant temperature, then the potential energy per molecule is averaged. The energy is negative; the more negative, the more tightly the molecules are bound.

Sample
Number of molecules

No measurements yet. Measure a few droplets first, then a few periodic boxes.

The pictures are the last moment of each measurement, all drawn to the same scale; as on the bench, the colors are the energy of each molecule. As the droplet grows, the light-colored edge ring becomes a smaller part of the whole.

Horizontal axis
DropletPeriodic box
SampleMoleculesEnergy per molecule (ε)Share of molecules at the edge1/√N
4 · Back to the protein

A protein's box: edge or copies, and how much water?

The goal of a protein simulation is to measure how the protein behaves in aqueous solution: the stability of the folded state, the binding energy of a ligand, the motion of a loop. All of these are energy differences, and as you saw in the notebook, an edge adds a term that depends on the box size.

Below is a cross-section of the water box of ubiquitin (1UBQ); each dot is a water molecule drawn to scale. The box is built like gmx editconf -d in GROMACS: d of water is added on every side of the largest dimension of the protein (4.49 nm). The value used most often in practice is d = 1 nm.

Dotted circle: the largest dimension of the protein (4.49 nm); editconf builds the box from it. Dashed circle: the 1 nm water shell around it. The light mark on the protein shows that the copies rotate at the same moment.

Boundary of the box
Box shape
Box edge
Water molecules
Total atoms
Water next to the wall
Speed on an RTX 5080 (2 fs)
For 100 ns
For 1 µs
Cost relative to d = 1 nm
Share of water next to the wall in a walled cubic box (left axis)Time for 100 ns on an RTX 5080 with the selected box shape (right axis; on the dashed part the GPU is not fully loaded and the real time may be shorter)

What do you see? Enlarging a walled box does not solve the edge problem; it only eases it and makes the calculation more expensive. The periodic box has no water next to a wall; one question remains: how far should the protein be from its own copy? At d = 1 nm there are at least 2 nm of water between two copies, and the 1 nm water shells around the protein do not touch. This is why this setting usually causes no problems for small, nearly globular proteins; making the box even larger hardly changes the result but raises the cost quickly. For elongated or flexible proteins, or proteins that open and close, d should be larger and the shortest distance between copies (gmx mindist -pi) should be monitored during the run.

Box shape. In a rhombic dodecahedron the copies are as far apart as in a cube, but the volume is about 29% smaller; for the same d there is less water and the calculation is faster. This project's ubiquitin preparation was built this way (editconf -d 1.0 -bt dodecahedron: 5,902 waters, 18,937 atoms). The calculation in the panel is calibrated with this preparation and with the second one at d = 0.5 nm (3,378 waters, 11,365 atoms); at these two values of d the panel gives the same numbers. The cross-section is drawn as a square so it is easy to read.

The price. In a periodic box the copies make exactly the same motion; as the protein rotates you see its copies rotate at the same moment. You know that crystal packing contacts can push a loop into an artificial position; if the box is too small, the protein also feels its own copy. You will try where to cut off the interaction between copies, and long-range electrostatics, in the next labs.

Speed estimate: from Exxact's AMBER 26 measurements on an RTX 5080 (JAC 23,558 atoms, 1,468.55 ns/day, 4 fs; FactorIX 90,906 atoms, 365.36 ns/day, 2 fs; Cellulose 408,609 atoms, 99.07 ns/day, 2 fs; STMV 1,067,095 atoms, 63.17 ns/day, 4 fs), steps per second are interpolated by atom count and converted to a 2 fs time step. Below 23,558 atoms the GPU is not fully loaded, so the speed shown for small systems is a lower bound ("at least"). GROMACS gives speeds of similar size on the same card, but they depend on the version, cut-off distance, PME settings and CPU; for your own system, the "Performance" line in the log of a short run is the most accurate measure. With hydrogen mass repartitioning (HMR) and 4 fs, the times roughly halve. Calculation: water = 33.07 nm⁻³ × (box volume − 14.93 nm³), atoms = 1,231 + 3 × water (TIP3P, no ions); the two constants come from the water counts of the d = 1.0 and 0.5 nm preparations. On the dashed part of the curve the system has fewer than 23,558 atoms; the time shown there is an upper bound.

5 · Test yourself

Six questions

Model: in the workshop, a single frictionless particle (mass of a water molecule, 3 nm box). On the bench and in the notebook, a two-dimensional Lennard-Jones liquid in reduced units (σ, ε, m), cut-off 2.5 σ, velocity Verlet, Δt = 0.005; density ρ = 0.82 (periodic and walled box); in the notebook measurements the temperature is held constant with a Langevin heat bath (k_BT = 0.40 ε). A two-dimensional model does not give the numbers of real water; it shows the direction and order of magnitude of the surface effect. Your notebook is stored only in this browser.

MD-PBC · Lab 2 · Box size

How large should the box be? Concentration, images and the flow of water

In a periodic box the protein touches no edge, but it cannot escape its own images either. If the box is small, the protein sees its image within the cut-off distance, and the water it pushes comes back and hits the protein itself. If the box is large, every step becomes more expensive. In this lab you build the box yourself: first you look at the concentration, then at the gap between images, and finally at the flow of water and diffusion.

Experimental bridge

What is the concentration of the protein in your box?

When you prepare an NMR sample you choose the concentration: in a PFG-NMR experiment that measured the diffusion of ubiquitin, for example, the sample was 0.5 mM. An MD box also has a concentration, but nobody chooses it: with a single protein molecule in the box the concentration depends only on the box volume, c = 1/(NA · V). This project's ubiquitin box (dodecahedron, 193.42 nm³) with one protein means about 8.6 mM: seventeen times more concentrated than the NMR sample.

The ruler below shows the concentration in grams per liter. As you move the slider in the workshop, the "your box" mark moves too.

In the lab you also measure how fast a protein spreads: in FRAP from how quickly the bleached area refills, in DLS from the fluctuations of scattered light, in PFG-NMR from how the signal decays with the gradient. The diffusion coefficient of GFP has been measured as about 87 µm²/s in water and 7.7 µm²/s in the E. coli cytoplasm. The PFG-NMR measurement gave ubiquitin a hydrodynamic radius of 1.539 nm; this means about 158 µm²/s in water at 25 °C (Stokes-Einstein). Can MD give this number? As you will see on the bench, the answer depends on the size of the box.

Sources: ubiquitin, 0.5 mM, Rh = 15.39 Å (288 K, PFG-NMR; Ramanujam et al. 2020, J Magn Reson 312:106701). Macromolecule concentration in the E. coli cytoplasm 0.3-0.4 g/ml (Zimmerman and Trach 1991, J Mol Biol 222:599). GFP diffusion 87 µm²/s in water, 7.7 µm²/s in E. coli (Elowitz et al. 1999, J Bacteriol 181:197). Molecular mass of ubiquitin 8,565 Da (from the 76 amino acid sequence). 158 µm²/s was computed from D = kT/(6πηRh) with 298 K and η = 0.896 mPa·s (Rh was assumed not to change between 288 K and 298 K).

1 · Workshop

Build the box: d, concentration and the gap between images

gmx editconf -d adds d on both sides to the distance between the two most distant atoms of the protein (4.49 nm for ubiquitin); the box vector becomes L = 4.49 + 2d. The section shows the central box and four neighboring images. The protein turns slowly, and its images turn in exactly the same way. The dashed line is the 1.0 nm cut-off belt around the protein: if an image enters this belt, the protein interacts with its own image.

Box shape
Box vector L
Volume
Concentration (one protein)
Same concentration, g/L
Water molecules (estimate)
Number of atoms (estimate)
Cost of each step (relative to d = 1.0 nm)
Gap between images, now
Same gap, smallest (full turn)

Box volumes from the formula (L = 4.491 + 2d nm, dodecahedron): 193.38 nm³ at d = 1.0 nm and 117.07 nm³ at d = 0.5 nm; water counts from this project's two real preparations (5,902 and 3,378). The volumes reported by GROMACS for the same preparations are 193.42 and 117.10 nm³; the difference comes from rounding the protein diameter. From the formula volumes follow 33.07 water molecules per nm³ and about 14.93 nm³ taken up by the protein (the same calculation as in Lab 1). The cost was taken as proportional to the number of atoms (roughly linear with PME). The section is two-dimensional and the protein is schematic; the gap is measured between the closest points of the two outlines. The "smallest" row is the worst case over one full turn of the protein; the real protein does not turn this far in 10 ps: the shortest distance measured in this project's narrow box (S3) was 1.26 nm (below, back to the protein).

2 · Bench

The protein runs into its own flow: water in a periodic box

As the protein moves through water it pushes the water in front of it. In an infinite liquid this flow dies away with distance. In a periodic box, however, the pushed water comes back through the opposite face of the box and joins the flow of the images; for the box as a whole to stay at rest, the water has to flow backwards somewhere. Below, a constant force is applied to the protein; the tracers show where the water goes. Orange streaks show water moving in the same direction as the protein, blue streaks water flowing backwards. The drawing shows the instantaneous velocity of the water; the protein is drawn in place, its images faded. The on-screen speed of the tracers is a relative scale: it is proportional to the real flow but greatly slowed down (for size, see the 1 nm bar at the bottom right). Tracers that fall inside the protein are drawn faded; in the model the protein is a soft cloud of force that drags the water along with it.

Liquid
Speed of the protein (relative to infinite liquid)
First-order formula: 1 − 2.837 R/L
Fastest backflow in the section

Calculation: the flow of water follows from the Stokes equations, with the protein as a soft cloud of force (Gaussian) of radius R = 1.539 nm, summed in reciprocal space together with all the images of the cubic box; it is computed on the page. For small R/L the same sum gives the Hasimoto (1959) series: 1 − 2.837297 R/L + (4π/3)(R/L)³. Yeh and Hummer (2004) proposed its first two terms as the diffusion correction for MD. In the infinite-liquid drawing there is only the protein's own flow (regularized Stokes flow); the window edge is only the edge of the drawing. The drawing is the section of the box through the center of the protein.

Open

Does the image enter the cut-off?

In the workshop, set d to 0.5 nm or less, then to 1.0 nm or more.

Set d once to 0.5 nm or less and once to 1.0 nm or more.
Open

Does a small box slow the protein down?

On the bench, try the periodic box in at least three sizes, then look at the infinite liquid.

Try at least three values of L in the periodic box (the largest at least twice the smallest) and open the infinite liquid once.
Open

Where is the diffusion of the infinite box?

In the notebook below, measure at least four box sizes and extend the line to 1/L = 0.

Measure at least four boxes with the same water model; one of 8 nm or smaller and one of 15 nm or larger.
3 · Discovery notebook

Where does diffusion go as the box grows?

Each measurement finds the diffusion coefficient of a single ubiquitin (R = 1.539 nm) in a cubic box with the bench calculation: DPBC = D∞ · (mobility ratio). D∞ comes from Stokes-Einstein with the viscosity of the chosen water (298 K). The graph plots DPBC against 1/L; the value at 1/L = 0 of the line through your points is the estimate for the infinite box. You used the same method in Lab 1 for the energy per molecule.

Water model
Edge of the cubic box, L (nm)

No measurements.

TIP3PReal waterExperiment (from the PFG-NMR radius, 158 µm²/s)Dashed line: D∞ in the chosen water; dotted line: the Yeh-Hummer line D∞ − kTξ/(6πηL); ring: this project's two dodecahedral boxes
WaterL (nm)1/L (nm⁻¹)Mobility ratioDPBC (µm²/s)Yeh-Hummer corrected D (µm²/s)

Viscosity (298 K, 1 bar): TIP3P 0.321 mPa·s, real water 0.896 mPa·s (González and Abascal 2010, J Chem Phys 132:096101). TIP3P water is about three times more fluid than real water; therefore in TIP3P the protein also spreads about three times faster in the infinite box. The last column applies the Yeh-Hummer correction to a single box: DPBC + kTξ/(6πηL). In a small box the corrected value exceeds D∞: the first-order correction overshoots there. Your notebook is stored only in this browser.

4 · Back to the protein

This project's two boxes: d = 1.0 nm and d = 0.5 nm

In this project ubiquitin was run in two boxes: the main preparation (S0, editconf -d 1.0) and the narrow-box trial (S3, -d 0.5). In both, after 10 ps of unrestrained dynamics, the shortest distance of the protein to its own image was measured with gmx mindist -pi. The graph shows these measurements themselves.

S0: d = 1.0 nmS3: d = 0.5 nmDashed line: cut-off distance 1.0 nm; dotted line: two cut-offs (2.0 nm)
S0 (d = 1.0 nm)S3 (d = 0.5 nm)

What do we see? In the narrow box the protein came as close as 1.26 nm to its own image: just above the cut-off distance. 10 ps is a very short time; in a longer run there is no guarantee that this distance will not drop below 1.0 nm when the protein turns and stretches. In the main box the shortest distance is 2.25 nm, above two cut-off distances: no water molecule sees both the protein and its image within the cut-off distance at the same time.

Diffusion. The diffusion coefficient of the protein was not measured in this project's runs; 10 ps is far too short for that. This scenario was not computed. The D rows in the table are not measurements but the estimate of the bench model for these two dodecahedral boxes. A striking result emerges: in the infinite box TIP3P water makes the protein spread about three times faster than in experiment, while the small box slows it down about threefold. The two errors almost cancel. If an MD diffusion value agrees with experiment, it is worth asking separately whether it agrees for the right reason.

Data: gromacs_trial (S0) and scenarios/S3 (GROMACS 2023.3, amber99sb-ildn, TIP3P, 300 K, V-rescale and C-rescale; unrestrained run 5,000 steps × 2 fs, mindist at 1 ps intervals, 11 frames). Box vector: editconf's initial value and the last frame of the unrestrained run; volume L³/√2 for the dodecahedron. The mobility ratio of the protein was computed with the bench lattice sum for the dodecahedral lattice (R = 1.539 nm).

5 · Test yourself

Six questions

Model: in the workshop a schematic two-dimensional section of ubiquitin; volume, concentration and number of waters calibrated from this project's two real preparations. On the bench and in the notebook Stokes flow: the force on the protein is spread over a Gaussian cloud whose radius equals the hydrodynamic radius; all periodic images are included through a reciprocal-space lattice sum; the mean flow is zero (the box is at rest). This is an estimate that treats the protein as a rigid sphere; the real shape of the protein and its water layer change the numbers somewhat. The distances and box sizes in "back to the protein" come from this project's real runs. Your notebook is stored only in this browser.

Next module: MD-CUT · Nearest image and cut-off. Which of the infinitely many copies in the periodic box does a molecule interact with, and where is the interaction cut off?

Terms in this module

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