Lab 4.6 · 40 min
Lab: a molecule by hand
So far our atoms only felt Lennard-Jones forces. A molecule needs more: bonds, angles and dihedrals, plus rules for which atoms inside a molecule may also feel LJ. We take one butane molecule, four beads, and compute every term by hand. The numbers show why each term is needed, what the force-field choices (1–4 scaling, combining rules) do to the result, and why constraining bonds lets us take three times longer time steps.
- Compute bond, angle and dihedral energies and forces from coordinates, with only dot and cross products
- See from the numbers why bonded neighbours are excluded from LJ, and how 1–4 scaling and combining rules change results
- Iterate SHAKE by hand, and measure how much longer a time step rigid bonds allow
The setup
Our molecule is n-butane, CH₃–CH₂–CH₂–CH₃, in the united-atom picture: each carbon together with its hydrogens is one bead. Four beads, three bonds, two angles, one dihedral. Parameters are those of the TraPPE force field. From here on we use the units of GROMACS, so the numbers can be compared with real input files.
(TraPPE keeps the bonds rigid; for the flexible runs we give them a typical C–C spring.) Every energy below is compared with k_B T = 2.494 kJ/mol: anything much larger is almost never visited at 300 K, anything smaller is visited all the time.
Step 1
Why a molecule needs bonded terms, and exclusions
Why: If LJ were enough, we could just put four beads together and let them stick. Let us check what LJ says about two carbons at the length of a real C–C bond.
What the numbers say: LJ describes how separate molecules touch, at about 0.4 nm. A chemical bond is a much shorter, much stronger thing: at 0.154 nm LJ gives 123 607 kJ/mol, 50 000 times k_B T, and would blow the molecule apart in one step. Two consequences. First, the shape of a molecule is held by its own terms: bonds, angles, dihedrals. Second, atoms 1 bond apart (1–2) and 2 bonds apart (1–3) must be excluded from LJ, otherwise 230 kJ/mol of fake repulsion fights the angle term. Every MD code keeps such an exclusion list.
Step 2
The bond: a stiff spring that sets the time step
Why: The bond keeps two beads near 0.154 nm. The simplest description is a spring. We need its force for the dynamics, and its vibration period, because the time step has to follow the fastest motion in the system (Lab 1).
What the numbers say: At 300 K the bond only wiggles by 2 %, so for most purposes it is effectively rigid, yet it is by far the fastest motion: one period every 35 fs. With about 15–20 steps per period (Lab 1), this alone limits us to about 2 fs. In an all-atom model the C–H bond vibrates every 11 fs, forcing 0.5–1 fs. We spend most of the computer time following a motion we do not care about. Step 7 shows the fix.
Step 3
The angle: dot product, energy, force
Why: Bonds alone would let the chain fold flat onto itself. The angle term keeps C–C–C near 114°. To use it we must get the angle from coordinates, then turn the energy into forces on the atoms.
What the numbers say: Turning an angle into forces needs nothing beyond the derivative and a lever arm: the torque dU/dθ divided by the bond length. At 300 K the angle wanders by about 4°, much more than the bond (2 %), and it vibrates 2.5 times more slowly (91 fs vs 37 fs). That ratio is exactly what we gain in step 7 when the bonds are frozen and the angle becomes the fastest motion.
Step 4
The dihedral: where the chemistry is
Why: With bonds and angles fixed, butane can still twist around its central bond. This twist decides whether the chain is straight (trans) or kinked (gauche), and in polymers and lipids it controls the whole shape. The dihedral angle φ needs four atoms and two cross products.
How fast does the molecule switch? An escape over a barrier happens at a rate of (vibration frequency) × e^(−barrier/k_B T):
| 10-ps window | 1 | 2 | 3 | 4 | 5 | 7 | 10 |
|---|---|---|---|---|---|---|---|
| start all trans | 0.905 | 0.774 | 0.723 | 0.717 | 0.740 | 0.719 | 0.675 |
| start all gauche | 0.159 | 0.364 | 0.520 | 0.572 | 0.605 | 0.622 | 0.651 |
Trans fraction in a Langevin run of 200 molecules at 300 K; one jump every 23 ps per molecule.
What the numbers say: The dihedral needs only two cross products, and its three-term formula gives the whole story of butane: trans is lowest, gauche is 3.6 kJ/mol higher (1.4 k_B T, so still common: about one third of the molecules), cis is almost never visited. The full sum (0.663) differs a little from the three-state count (0.677) because the wells have different widths. Limitation, by numbers: the molecule switches only every few tens of picoseconds. Starting from all-trans or all-gauche, 200 molecules need about 100 ps before both runs agree on 0.65–0.68. A longer chain, or a higher barrier, makes this nanoseconds to microseconds: sampling dihedrals is often the real bottleneck of a simulation (Chapter 7, metadynamics).
Step 5
1–4 pairs: exclude, scale or keep?
Why: Atoms 1 and 4 are three bonds apart. They are not held at a fixed distance by bonds and angles: their distance changes with φ. Should they feel LJ? Different force fields answer differently, and the numbers show this is not a detail.
| 1–4 LJ with the TraPPE dihedral | gauche − trans | trans fraction |
|---|---|---|
| excluded (TraPPE's rule) | 3.58 kJ/mol | 0.663 |
| scaled by 0.5 (OPLS's rule) | 13.48 kJ/mol | 0.957 |
| full | 23.37 kJ/mol | 0.988 |
What the numbers say: In gauche the two CH₃ ends are only 0.313 nm apart, inside σ = 0.375, so their LJ is strongly repulsive (+19 kJ/mol). TraPPE fitted its dihedral with this pair excluded; OPLS fitted its own dihedral with this pair at half strength. Mixing the two, TraPPE's dihedral with OPLS's rule, turns butane 96 % trans, almost no gauche left: the chains come out far too straight. The lesson: a force field is a package. Dihedral parameters, 1–4 scaling and exclusions were fitted together, and must be used together. In GROMACS this is gen-pairs, fudgeLJ and fudgeQQ; in LAMMPS special_bonds.
Step 6
Combining rules: CH₃ meets CH₂
Why: We have LJ parameters for CH₃–CH₃ and CH₂–CH₂, but a simulation also needs CH₃–CH₂, and with many atom types there are far too many pairs to fit each one. Combining rules make the cross parameters from the pure ones.
What the numbers say: For similar atoms like CH₃ and CH₂, the two rules agree to 0.0001 nm and the choice does not matter. For very different sizes, such as a small cation next to a large anion, they disagree by 12 % in σ: at 0.25 nm one rule says strong repulsion, the other mild attraction, and the contact distance moves by 0.034 nm. That directly shifts the radial distribution function and the binding. Like 1–4 scaling, the combining rule belongs to the force field (GROMACS comb-rule, LAMMPS pair_modify mix). Ion–ion and ion–solvent pairs are often fitted separately for exactly this reason.
Step 7
Constraints: SHAKE by hand, and the time step it buys
Why: The bond is stiff (2 % wiggle) and fast (35 fs). If we freeze it at 0.154 nm, the fastest motion becomes the angle (91 fs) and the time step can grow. SHAKE does this: after each normal step, it moves atoms along their old bond directions until every bond length is right again.
| time step | flexible bonds | rigid bonds (SHAKE) |
|---|---|---|
| 1 fs | 0.0117 | — |
| 2 fs | 0.0482 | 0.0042 |
| 4 fs | 0.2173 | 0.0169 |
| 6 fs | 0.6119 | 0.0392 |
| 8 fs | 1.7311 | 0.0729 |
| 10–12 fs | unstable | 0.1887 (12 fs) |
Energy fluctuation in NVE (kJ/mol, 20 molecules × 10 ps): smaller means a more accurate trajectory.
What the numbers say: The error falls very fast (1.5×10⁻³ → 7.5×10⁻⁶ → 1.8×10⁻¹⁰ nm), so two or three iterations are enough for one bond; coupled bonds in a chain need about 10, because fixing one bond disturbs its neighbours. The payoff: rigid bonds at 6 fs are as accurate as flexible bonds at 2 fs (0.039 vs 0.048), three times fewer steps for the same physics, and flexible bonds blow up at 10 fs while rigid ones still run at 12 fs. This matches the period ratio of step 3 (91/37 ≈ 2.5). In all-atom models, constraining only the bonds to H already doubles the time step (1 -> 2 fs). Limitations: the iterations cost time and are hard to parallelise (GROMACS prefers LINCS, and SETTLE for water); constraining angles in long chains converges badly; and every constraint removes a degree of freedom, which must be subtracted when computing the temperature.
Summary
| ingredient | why (number) | limitation / caution (number) |
|---|---|---|
| bonds + 1–2, 1–3 exclusions | LJ at 0.154 nm = 123 607 kJ/mol | bond period 35 fs (C–H 11 fs) limits dt |
| angle | keeps 114°, spread 4° | period 91 fs: next limit on dt |
| dihedral | trans 0.66, gauche 0.34 | one jump per ~30 ps: slow sampling |
| 1–4 rule | must match the dihedral fit | wrong rule: trans 0.96 instead of 0.66 |
| combining rule | cross terms for free | σ 12 % apart for unlike sizes |
| SHAKE / LINCS | dt 2 -> 6 fs at equal accuracy | ~10 iterations; N_f 12 -> 9 |
See it inside LAMMPS
The same idea in the real code, run live in your browser and checked by hand.