Search

Search papers and lessons

Markov State Model

Level 4 · 11 min read

A Markov state model groups a long molecular simulation into a few states, counts how often it hops between them, and reads the slow processes from the eigenvalues of that hopping table.

On this page

  • Colour = topic mix
  • Calculus
  • Linear algebra
  • Probability
  • Classical mechanics
  • Discrete math
  • Computational chemistry
  • ReadReady to readNot yet

TL;DR

A Markov state model turns a very long molecular dynamics simulation into a small table of probabilities. The simulated conformations are grouped into a modest number of states, the program counts how often the molecule moves from one state to another over a fixed lag time, and the resulting transition matrix is analysed. Its eigenvalues give the slow processes, such as folding or binding, and its stationary distribution gives the equilibrium populations of the states. The method works only if the next state really depends on the current state alone, which must be checked.

Builds on: Markov Chain, Molecular Dynamics, Eigenvalues and Eigenvectors · Leads to: the analysis of rare events in simulation, and the estimation of rates from many short runs.

Where it's used

Protein folding. A protein can fold in microseconds to seconds, and a single molecular dynamics simulation rarely captures a full folding event. Many short simulations started from different conformations are pooled into one model, which is a sampling strategy as much as a model. Projects such as Folding@home have used this approach to estimate how often a protein passes through each folded or partly folded state.

Drug and ligand binding. The rate at which a small molecule binds to and leaves a protein's pocket is a slow event that simulation must capture. A Markov state model gives both the rates and the pathway through intermediate states, which can suggest where a drug might bind more tightly.

Comparing with experiment. Spectroscopy and other measurements report relaxation times for conformational changes. A model whose slow eigenvalues predict those times gives a direct test of the simulation against the experiment.

How it works

Imagine a simulated molecule that can be in one of three shapes, which we call states A, B and C. The simulation records which state it is in every 1 nanosecond. Lag time is the chosen interval between two recorded frames. Here the lag time is 1 ns. The Markov chain of states is the model used throughout.

  1. Group the conformations. The simulation contains millions of frames, each a different arrangement of atoms. Similar frames are grouped together, for example with k-means clustering on a set of coordinates, and each group becomes one state.
  2. Count the transitions. Go through the sequence of states frame by frame. Each time the molecule is in state i and then, one lag later, in state j, add 1 to the count CijC_{ij}. Suppose the counts from the simulation are: from A, 90 stays in A and 10 move to B; from B, 20 move to A and 80 stay in B.
  3. Normalise each row. Divide each row of counts by its total. The row for A sums to 100, so A goes to A with probability 0.9 and to B with probability 0.1. The row for B sums to 100, so it goes to A with probability 0.2 and stays with probability 0.8. These numbers form the transition matrix.
  4. Propagate a population. Start with all molecules in B, so the population is (0, 1). Each step is a matrix-vector product of the population row by the transition matrix. After one lag time, the population is (0.2, 0.8): one fifth have moved to A. After another lag time it is (0.34, 0.66).
  5. Read off the slow process. The population settles towards a steady split, and the rate of settling is set by the second eigenvalue of the matrix. Its value is 0.7, so the implied timescale is set by ln⁡0.7\ln 0.7.
  6. Check the model. The same counts at a lag of 2 ns should give a matrix whose implied timescale is the same. If it does, the one-step Markov assumption is supported.
flowchart LR
  A["Long simulation of conformations"] --> B["Cluster frames into states"]
  B --> C["Count transitions at lag time"]
  C --> D["Normalise rows: transition matrix"]
  D --> E["Eigenvalues give timescales"]
  D --> F["Stationary vector gives populations"]
  E --> G["Check: same timescale at other lags"]

The math

Definition: Transition matrix at lag τ

Let the states be 1,…,n1, \dots, n and let CijC_{ij} be the number of times the molecule was seen in state ii and then in state jj one lag time τ\tau later. The transition matrix T(τ)T(\tau) has entries Tij=Cij/∑kCikT_{ij} = C_{ij} / \sum_k C_{ik}. Each row sums to 1, so T(τ)T(\tau) is a Markov transition matrix as described in Markov Chain.

Step 2 in symbols: counting

For the example, the counts are CAA=90C_{AA} = 90, CAB=10C_{AB} = 10, CBA=20C_{BA} = 20 and CBB=80C_{BB} = 80. The row sums are ∑kCAk=100\sum_k C_{Ak} = 100 and ∑kCBk=100\sum_k C_{Bk} = 100.

Step 3 in symbols: the matrix

Dividing by the row sums gives

T(1 ns)=(0.90.10.20.8)T(1\,\text{ns}) = \begin{pmatrix} 0.9 & 0.1 \\ 0.2 & 0.8 \end{pmatrix}

with rows and columns in the order A, B.

Step 4 in symbols: propagation

If pt\mathbf{p}_t is a row vector of state populations at time tt, then pt+τ=pt T(τ)\mathbf{p}_{t+\tau} = \mathbf{p}_t\, T(\tau). From p0=(0,1)\mathbf{p}_0 = (0, 1) we get

p1=(0,1)(0.90.10.20.8)=(0.2, 0.8)\mathbf{p}_1 = (0, 1)\begin{pmatrix} 0.9 & 0.1 \\ 0.2 & 0.8 \end{pmatrix} = (0.2,\ 0.8)

and then p2=(0.34, 0.66)\mathbf{p}_2 = (0.34,\ 0.66), as in the walkthrough.

Step 5 in symbols: the stationary distribution and the eigenvalues

The stationary distribution π\boldsymbol{\pi} is the row vector with πT=π\boldsymbol{\pi} T = \boldsymbol{\pi} and entries summing to 1. Solving 0.9πA+0.2πB=πA0.9\pi_A + 0.2\pi_B = \pi_A gives πA=2πB\pi_A = 2\pi_B, so π=(2/3, 1/3)\boldsymbol{\pi} = (2/3,\ 1/3). These are the equilibrium populations.

The eigenvalues of TT solve det⁡(T−λI)=0\det(T - \lambda I) = 0. The trace is 0.9+0.8=1.70.9 + 0.8 = 1.7, and one eigenvalue is 1, so the other is 0.70.7. The implied timescale of the slow process is

t2=−τln⁡λ2=−1ln⁡0.7≈2.8 nst_2 = -\frac{\tau}{\ln \lambda_2} = -\frac{1}{\ln 0.7} \approx 2.8\ \text{ns}

Here ln⁡0.7\ln 0.7 is negative, so the result is positive. The random walk picture gives the same intuition: the larger the eigenvalue, the slower the decay of the memory of the starting state.

Step 6 in symbols: the lag check

If the process is Markov at lag τ\tau, then the matrix at lag 2τ2\tau is the square of the matrix at lag τ\tau. This is the Chapman–Kolmogorov condition, which follows from the Markov property that the next step depends only on the current state. Here

T(2 ns)=T(1 ns)2=(0.830.170.340.66)T(2\,\text{ns}) = T(1\,\text{ns})^2 = \begin{pmatrix} 0.83 & 0.17 \\ 0.34 & 0.66 \end{pmatrix}

Its second eigenvalue is 0.72=0.490.7^2 = 0.49, so the implied timescale is −2/ln⁡0.49≈2.8-2/\ln 0.49 \approx 2.8 ns, the same as before.

Worked examples

Example
Example 1: one row of the matrix (tiny)

Counts from state A are 90 stays and 10 moves. Find the transition probability from A to B.

  1. The row total is 90+10=10090 + 10 = 100.
  2. The entry for A to B is 10/100=0.110 / 100 = 0.1.
  3. Check: the entries of the row sum to 0.9+0.1=10.9 + 0.1 = 1.

Interpretation: from state A, the molecule moves to B in one tenth of the lag intervals on average.

Example
Example 2: the first step of propagation (standard)

Start with the molecule entirely in state B, and find the population of A after one lag time.

  1. The starting population is p0=(0,1)\mathbf{p}_0 = (0, 1).
  2. Population of A after one step: pA=0⋅0.9+1⋅0.2=0.2p_A = 0 \cdot 0.9 + 1 \cdot 0.2 = 0.2.
  3. Population of B after one step: pB=0⋅0.1+1⋅0.8=0.8p_B = 0 \cdot 0.1 + 1 \cdot 0.8 = 0.8.
  4. Check: 0.2+0.8=10.2 + 0.8 = 1, so the population still adds to 1.
  5. Interpretation: after 1 ns, one molecule in five has moved to state A, and four in five remain in B.

Interpretation: the transition matrix predicts the population after any number of lag times by repeated multiplication. Here the first step moves the population a fifth of the way from B to A.

Example
Example 3: testing a folding model (realistic)

A folding study clusters its frames into a folded state A and an unfolded state B, and counts transitions at a lag of 1 ns. The numbers below are illustrative, chosen to be easy to follow, not taken from a real protein. The counts give

T(1 ns)=(0.990.010.0050.995).T(1\,\text{ns}) = \begin{pmatrix} 0.99 & 0.01 \\ 0.005 & 0.995 \end{pmatrix}.
  1. Check the rows: 0.99+0.01=10.99 + 0.01 = 1 and 0.005+0.995=10.005 + 0.995 = 1.
  2. Stationary populations: πA⋅0.01=πB⋅0.005\pi_A \cdot 0.01 = \pi_B \cdot 0.005, so πA=πB/2\pi_A = \pi_B / 2 and π=(1/3,2/3)\boldsymbol{\pi} = (1/3, 2/3). In this model about a third of the time is spent folded.
  3. The trace is 0.99+0.995=1.9850.99 + 0.995 = 1.985, and one eigenvalue is 1, so λ2=0.985\lambda_2 = 0.985.
  4. Implied timescale at lag 1 ns: t2=−1/ln⁡0.985≈66t_2 = -1/\ln 0.985 \approx 66 ns.
  5. Repeat at lag 2 ns. The second eigenvalue is 0.9852≈0.9700.985^2 \approx 0.970, so t2=−2/ln⁡0.970≈66t_2 = -2/\ln 0.970 \approx 66 ns.
  6. Interpretation: the timescale is the same at both lags, so the one-step Markov assumption is supported for these states. If the two timescales had differed, the states would need to be refined before the rates could be trusted.

Try it: a model has second eigenvalue 0.50.5 at lag τ=1\tau = 1 ns. Find its implied timescale, and say whether it is the same at lag 2 ns if the matrix is consistent.

Answer: t2=−1/ln⁡0.5=1/0.6931≈1.44t_2 = -1/\ln 0.5 = 1/0.6931 \approx 1.44 ns. At lag 2 ns the second eigenvalue is 0.52=0.250.5^2 = 0.25, and −2/ln⁡0.25=2/1.3863≈1.44-2/\ln 0.25 = 2/1.3863 \approx 1.44 ns. The two agree, so the model passes the check.

Common mistakes and tradeoffs

It is tempting to think that a Markov state model is a faithful picture of the molecule's motion at every time. In fact it is a model of the dynamics at the chosen lag time, and it is only valid if the states capture the slow motions. If important structure is hidden inside one state, the transitions look memoryless when they are not.

It is tempting to think that the number of states should be as large as possible. In fact each state needs enough frames to estimate its transition probabilities. Many sparsely sampled states produce noisy rows, and the eigenvalues then become unreliable.

It is tempting to think that the stationary distribution equals the true equilibrium distribution. In fact it equals it only when the simulation samples the whole equilibrium space. Otherwise the estimate reflects where the simulation happened to go. Reversibility, the condition in Detailed Balance, is often assumed to hold, and it should be checked. When to use it: for slow conformational changes and binding events that are too rare to observe in one simulation, when many short simulations are available. When not to use it: when the system has few slow processes and one long run already covers them, or when the states cannot be defined well from the coordinates. Alternatives: free-energy profiles along a chosen coordinate, and the principal component analysis of coordinates before clustering, which often gives better states.

History

Statistical models of molecular motion date to the early days of computer simulation, when Markov chains were used to describe random jumps between configurations. The idea that a molecular dynamics trajectory could be reduced to a transition matrix among clustered states took shape in the late 1990s and early 2000s, when mathematicians such as Christof Schütte worked on transfer operators for molecular systems.

Once cheap computing made many short simulations possible, groups led by Vijay Pande and others showed that pooling them into Markov state models could reveal folding pathways that no single simulation captured. The approach became a standard part of computational chemistry because it turns many small pieces of data into a single model of slow dynamics.

The method's success depends on two things that are easy to state and hard to guarantee: the states must be good enough to make the process Markov, and the simulations must cover the relevant states. Checking these, as in the lag test above, is part of every careful application.

Recap

  • A Markov state model groups a simulation into states and counts transitions at a fixed lag time.
  • Normalising the counts gives a transition matrix, and its rows sum to 1.
  • The stationary distribution gives equilibrium populations, and the eigenvalues give implied timescales of slow processes.
  • The model is valid only if the same timescales appear at longer lag times, as the Chapman–Kolmogorov check requires.
  • Good states need enough sampling, and the population estimates depend on what the simulations covered.

Next, read Boltzmann Distribution to see how equilibrium populations relate to energy, and Detailed Balance to see when the matrix is reversible.

Check yourself

QuestionRecall: what does each row of a transition matrix add up to, and why?Show answer

Each row adds up to 1. Each row describes all the possible next states from one current state, so the probabilities of those next states must total 1.

QuestionCompute: a transition matrix has rows (0.6, 0.4) and (0.1, 0.9). Find the stationary distribution (π_A, π_B).Show answer

The condition πA=0.6πA+0.1πB\pi_A = 0.6\pi_A + 0.1\pi_B gives 0.4πA=0.1πB0.4\pi_A = 0.1\pi_B, so πB=4πA\pi_B = 4\pi_A. With πA+πB=1\pi_A + \pi_B = 1, we get 5πA=15\pi_A = 1, so πA=0.2\pi_A = 0.2 and πB=0.8\pi_B = 0.8.

QuestionWhy: why does the implied timescale need to be the same at lag 1 ns and at lag 2 ns?Show answer

If the one-step Markov assumption holds, the process at lag 2 ns is the square of the process at lag 1 ns. Its slow eigenvalue is then the square of the first eigenvalue, and the implied timescale, which is the lag divided by minus the log of the eigenvalue, stays the same. A change in timescale signals that the states do not capture the memory in the dynamics.

QuestionApplied: a simulation of a ligand binding a receptor gives a model whose slow timescale is 0.5 microseconds at lag 1 ns and 3 microseconds at lag 10 ns. What should the researcher do?Show answer

The timescale is not consistent across lags, so the one-step Markov assumption is not supported at this lag. The researcher should refine the states, for example by adding coordinates that describe the ligand's pathway, and then rebuild and test the model again at several lag times.

Sources