🧬 Protein Folding

Energy:
Best:
H-H contacts:
MC steps: 0

HP Lattice Model

The HP (Hydrophobic-Polar) model assigns each residue as H (hydrophobic, dark) or P (polar, light) on a 2D square lattice. Energy E = minus the number of non-bonded H-H contacts. The chain minimises energy by forming a hydrophobic core, mimicking the dominant driving force behind real protein folding.

Monte Carlo Search

At each step a random end-move or pivot rotation is proposed. The Metropolis criterion accepts uphill moves with probability e^(−ΔE/kT), balancing exploration at high temperature with exploitation at low temperature. This stochastic search navigates the rugged energy landscape toward compact folds.

Levinthal's Paradox

A 100-residue protein has ~3^98 conformations. Random sampling would take longer than the age of the universe. Yet proteins fold in milliseconds by following a funnel-shaped energy landscape, not a random walk. This simulation makes that funnel tangible through the energy trace chart.

About Protein Folding

This simulation models the folding of an amino acid chain on a two-dimensional square lattice using the HP (hydrophobic-polar) model, one of the foundational frameworks in computational biology. Each residue is classified as either hydrophobic (H, dark bead) or polar (P, light bead), and the energy of any conformation is defined as the negative count of non-bonded H-H contacts. Folding is driven by a Monte Carlo algorithm using the Metropolis acceptance criterion, which mimics thermal fluctuations and allows the chain to escape shallow energy traps while drifting toward lower-energy compact structures that bury hydrophobic residues inside a core away from the surrounding aqueous environment.

The simulation visualises the protein backbone as a self-avoiding walk on the lattice, with dashed purple lines marking favourable H-H contacts that stabilise the fold. A live energy trace chart on the right shows how the conformation energy evolves over Monte Carlo steps, revealing the funnel-shaped landscape described by the energy landscape theory of protein folding. Controls let you choose between an 8-mer, 16-mer, or 24-mer sequence, adjust the dimensionless temperature kT to explore the exploration-exploitation balance, run continuous Monte Carlo sampling, or trigger an intensive low-temperature search to approach the optimal fold. Despite its simplicity, the model captures the essential physics: the hydrophobic effect, cooperative collapse, and the paradox of fast folding despite an astronomically large conformational space.

Frequently Asked Questions

What is the HP model of protein folding?

The HP (hydrophobic-polar) model is a coarse-grained lattice model introduced by Lau and Dill in 1989. It reduces each amino acid to one of two types: hydrophobic (H) or polar (P), places them on a square lattice as a self-avoiding walk, and defines energy as the negative number of non-bonded H-H contacts. Despite its stark simplicity it correctly predicts that hydrophobic residues cluster into a buried core, the same driving force that governs real protein folding.

Why does protein folding happen at all?

Proteins fold because burying hydrophobic residues away from water is thermodynamically favourable. Water molecules form ordered hydrogen-bond cages around exposed non-polar groups, which costs entropy. Hiding those groups in a compact core releases the water molecules to adopt more disordered configurations, lowering the overall free energy of the system. This hydrophobic effect is the dominant physical force that drives folding, supplemented by hydrogen bonds, electrostatics and van der Waals interactions.

What does the energy E = −(H-H contacts) mean?

Each pair of hydrophobic residues that are neighbours on the lattice but not consecutive in the sequence contributes minus one unit of energy. The total energy is therefore a negative integer; the more negative it is, the more stable the conformation. The simulation aims to minimise this energy, which corresponds to maximising the number of H-H contacts and thus the size of the hydrophobic core. The live energy chart lets you watch the search progress in real time.

How does the Monte Carlo algorithm work here?

At each step a random move is proposed: either an end-move (one terminus steps to a new neighbouring lattice site) or a pivot rotation (one segment of the chain is rotated 90 degrees about a randomly chosen pivot residue). If the resulting conformation overlaps with itself it is rejected immediately. Otherwise the energy change ΔE is computed. If ΔE is negative (lower energy) the move is accepted unconditionally; if positive it is accepted with probability e^(−ΔE/kT). This Metropolis criterion ensures the chain samples conformations according to a Boltzmann distribution at temperature kT.

What does the temperature kT slider control?

The dimensionless temperature kT sets the scale of thermal fluctuations. At high kT (approaching 5) the Boltzmann factor e^(−ΔE/kT) remains close to 1 even for large energy increases, so the chain explores the conformational space widely and rarely gets trapped. At low kT (down to 0.1) only energy-lowering moves are practically accepted, so the chain descends steeply into whatever local minimum it is near. The Find Optimum button forces kT = 0.1 for 8,000 steps to drive the search deep into the lowest accessible basin.

What is Levinthal's paradox?

Levinthal's paradox, formulated by Cyrus Levinthal in 1969, points out that a protein of N residues has on the order of 3^N possible conformations. For a modest 100-residue protein that is roughly 10^47 states. If the chain sampled them at 10^6 per second it would take far longer than the age of the universe to find the minimum-energy fold by brute force. Yet real proteins fold reliably in microseconds to milliseconds. The resolution is that folding is not a random search: the energy landscape is funnel-shaped, with many downhill paths guiding the chain toward the native state.

Why is finding the optimal HP fold NP-hard?

The computational problem of finding the minimum-energy conformation in the HP model on a 2D square lattice was proven NP-complete by Hart and Istrail in 1996. This means there is no known algorithm that guarantees the global optimum in polynomial time as sequence length grows. In practice, heuristics such as Monte Carlo, simulated annealing, and genetic algorithms are used to find good but not necessarily optimal folds. The Find Optimum button in this simulation runs a greedy low-temperature search, not an exhaustive one.

How does the energy landscape theory explain fast folding?

Energy landscape theory, developed principally by Wolynes, Onuchic and Dill in the 1990s, describes folding as motion on a high-dimensional energy surface over conformation space. For sequences that fold reliably the landscape has a funnel shape: conformations at the rim of the funnel are high-energy and disordered; conformations near the bottom are low-energy and compact. The funnel provides a thermodynamic bias that consistently steers the chain downhill, explaining why folding is fast and reproducible despite the enormous number of possible states.

What are the limitations of this simulation?

The model is deliberately simplified. Real proteins use 20 amino acid types, not 2. They fold in three dimensions rather than on a flat lattice. Important interactions such as hydrogen bonding, backbone rigidity, side-chain geometry, electrostatics, and solvation are all absent. The HP model also cannot distinguish different hydrophobic residues from one another. Nevertheless, it captures the essential physics of hydrophobic collapse and the funnel landscape, making it a valuable conceptual tool even though it cannot be used for quantitative predictions about real proteins.

What do N and C labels on the chain mean?

N marks the N-terminus, the end of the polypeptide chain that begins with an amino group (-NH2), and C marks the C-terminus, the end bearing a carboxyl group (-COOH). In real proteins the sequence of amino acids is always read from N to C, which is also the direction of biosynthesis on the ribosome. In the HP model the labels simply mark the two ends of the self-avoiding walk so you can track chain orientation as the conformation evolves during folding.