🧬 Polymer Chain as a Random Walk — Flory Scaling
Grow a polymer chain as an ideal random walk or self-avoiding walk and watch its end-to-end size scale with chain length as a power law — measure the Flory exponent live from an ensemble.
How it Works
This simulation grows a 2D polymer chain of N monomers one bond at a time. Each new monomer is placed at a fixed bond length from the previous one, at an angle chosen according to the selected solvent quality. In the ideal (theta) mode the angle is fully random, so segments are free to overlap — a simple random walk. In the good-solvent mode the walk is self-avoiding: new positions are rejected if they land too close to an existing monomer, and the chain backtracks a step when it gets stuck. In the poor-solvent mode, new bonds are weakly biased toward the chain's own center of mass, pulling it into a compact globule.
Chain size is characterized by the end-to-end distance R and the radius of gyration Rg, both of which scale with chain length as a power law, R ~ N^ν. The exponent ν — the Flory exponent — depends only on solvent quality and dimensionality, not on chemical details, which is why it is called a universal scaling exponent. Clicking "Run ensemble" generates many chains of varying N, averages their R and Rg, and fits a straight line to the log-log plot to recover ν directly from the slope.
Radius of gyration: Rg = √( (1/N) Σ (r_i − r_cm)² )
Scaling law: R ~ N^ν, Rg ~ N^ν
Good solvent (SAW): ν ≈ 0.75 (2D), ν ≈ 0.588 (3D)
Theta solvent (ideal chain): ν = 0.5
Poor solvent (collapsed globule): ν ≈ 1/3
Frequently Asked Questions
What does a random-walk model of a polymer represent physically?
A polymer chain in solution constantly wiggles due to thermal motion, so its instantaneous shape is essentially random. Modeling it as a random walk — a sequence of fixed-length bonds pointing in random directions — captures the conformational freedom of the backbone without tracking the exact chemistry of every bond.
What do end-to-end distance and radius of gyration measure, and why is Rg more experimentally accessible?
End-to-end distance R is the straight-line distance between the chain's first and last monomer. Radius of gyration Rg = √((1/N)Σ(r_i − r_cm)²) is the root-mean-square distance of every monomer from the center of mass. Rg is easier to measure experimentally because light, X-ray, and neutron scattering probe the overall mass distribution of the whole coil, not just its two endpoints.
What is the difference between an ideal chain and a self-avoiding walk?
An ideal (freely-jointed) chain allows segments to pass through each other and obeys Gaussian statistics with R ~ N^0.5. A self-avoiding walk (SAW) forbids monomers from overlapping, which swells the coil: in 2D the excluded-volume effect gives R ~ N^ν with ν ≈ 0.75, and in 3D ν ≈ 0.588. The ideal chain is a good approximation only at the theta condition, where attractive and excluded-volume effects cancel.
What is the Flory exponent and how was it derived?
The Flory exponent ν is the power in the scaling law R ~ N^ν relating chain size to the number of monomers N. Flory derived it from a simple mean-field argument that balances the entropic cost of stretching a chain against the excluded-volume energy of monomers repelling each other, yielding ν = 3/(d+2) in d dimensions — 0.75 in 2D and 0.6 in 3D, remarkably close to the accepted value of 0.588.
What do good, theta, and poor solvent conditions mean physically?
In a good solvent, monomers effectively repel each other (excluded volume dominates) and the chain swells into an expanded coil with ν ≈ 0.75 (2D). At the theta condition, monomer-monomer attraction exactly cancels excluded-volume repulsion, so the chain behaves like an ideal random walk with ν = 0.5. In a poor solvent, attraction dominates and the chain collapses into a compact globule with ν ≈ 1/3.
Why are log-log plots used to extract power-law scaling exponents?
If R = A·N^ν, taking logarithms gives log(R) = log(A) + ν·log(N), a straight line whose slope is exactly the exponent ν. Plotting many (N, R) pairs on log-log axes and fitting a line by linear regression turns a power-law relationship into an easily measured slope.
What real-world systems does this polymer chain scaling apply to?
Random-walk and self-avoiding-walk statistics underlie the physics of plastics and rubber elasticity, the conformational behavior of DNA and unfolded proteins in solution, and gel permeation chromatography, where molecules are separated by their effective coil size as they diffuse through a porous gel.
Why does the chain sometimes need to backtrack when growing as a self-avoiding walk?
Because a self-avoiding walk cannot place a new monomer on top of an existing one, a growing chain can wander into a position where every nearby direction is already occupied. The algorithm retries random directions a limited number of times, and if none work it removes the last monomer and tries again from an earlier point.
How does the ensemble average improve the exponent measurement over a single chain?
A single chain's R fluctuates a lot from one random realization to the next, especially at small N. Generating many independent chains at each chain length and averaging R and Rg smooths out this noise, so the log-log plot traces a cleaner straight line and the regression slope converges closer to the true theoretical ν.
About this simulation
This simulator grows a polymer chain monomer by monomer as either an ideal random walk, a self-avoiding walk, or a weakly attractive collapsed chain, then lets you watch its size scale with chain length. As the chain grows, the backbone is colored from one end to the other so you can trace it visually, and once complete a dashed circle shows its radius of gyration. The real payoff is the "Run ensemble" button: it grows 50+ independent chains at many lengths, plots end-to-end distance and Rg against N on log-log axes, and fits a line whose slope is a live, hands-on measurement of the Flory exponent.
🔬 What it shows
Two synchronized views: an animated, color-gradient polymer chain growing on the left with its center of mass and radius of gyration overlaid, and a log-log scatter plot on the right where R and Rg for many chain lengths line up along a straight line whose slope is the scaling exponent ν.
🎮 How to use
Drag the N slider to change chain length, switch solvent quality between good (self-avoiding), theta (ideal), and poor (collapsed) to see how the chain's shape and scaling exponent change, click "Generate new chain" to see a fresh random realization, and click "Run ensemble" to fit ν directly from data.
💡 Did you know?
The Flory exponent ν ≈ 0.588 in 3D real polymers is so close to Flory's original crude mean-field estimate of 0.6 that his simplified argument is still taught today, even though it gets some of the underlying physics wrong for the right reasons — a famous case of a good approximation from bad assumptions.
Frequently asked questions
What does the N slider actually change, and why is it capped at 300?
N is the number of monomers (bonded segments) in the chain. It's capped at 300 mainly for animation speed and canvas clarity — self-avoiding walks in particular get slower to grow and harder to see clearly as N increases, since the chain fills more of its own available space.
What happens when the self-avoiding walk generator "gets stuck"?
If every nearby direction from the current tip is already occupied by another monomer, the generator can't place a valid next step. After a limited number of failed attempts it removes the most recently placed monomer and tries growing from the point before it — a simple backtracking strategy that lets long self-avoiding chains finish reliably.
Why does the poor solvent mode look like a compact blob instead of a floppy line?
In poor solvent mode, each new bond is weakly biased toward the chain's own center of mass rather than pointing in a purely random direction. This attraction pulls the growing chain in on itself, producing a dense, roughly circular globule that approximates the real collapse transition polymers undergo in genuinely poor solvents.
What does the fitted ν value on the right-hand plot tell me, and how is it computed?
After running an ensemble, the plot shows log(R) and log(Rg) against log(N) for many chain lengths. Linear regression on the log(R) points gives a slope, displayed as "fitted ν" — this is the exponent your simulated data actually follows, which you can compare against the theoretical ν for the current solvent quality.
Why do multiple chains of the same N give different R and Rg values?
Each chain is an independent random realization — the sequence of bond angles is different every time, so even chains with identical N and mode end up with different shapes and sizes. This randomness is exactly why the ensemble average (many chains per N) is needed to extract a clean, reliable scaling exponent.
Is this a rigorous SAW / Flory-theory simulator, or a simplified teaching model?
It's a simplified teaching model. The self-avoiding walk uses basic retry-and-backtrack growth rather than an exact enumeration or pivot-algorithm sampler, and the poor-solvent collapse uses an ad hoc attraction bias rather than a proper pairwise potential. Both reproduce the qualitative scaling behavior and the right order-of-magnitude exponents, which is the pedagogical goal, but neither is a research-grade statistical sampler.
Grow a polymer chain as an ideal random walk or self-avoiding walk and watch its end-to-end size scale with chain length as a power law — measure the Flory exponent live from an ensemble.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install