Markov State Models for Rare Events in Molecular Dynamics

Rare, but important, transition events between long-lived states are a key feature of many molecular systems. In many cases, the computation of rare event statistics by direct molecular dynamics (MD) simulations is infeasible, even on the most powerful computers, because of the immensely long simulation timescales needed. Recently, a technique for spatial discretization of the molecular state space designed to help overcome such problems, so-called Markov State Models (MSMs), has attracted a lot of attention. We review the theoretical background and algorithmic realization of MSMs and illustrate their use by some numerical examples. Furthermore, we introduce a novel approach to using MSMs for the efficient solution of optimal control problems that appear in applications where one desires to optimize molecular properties by means of external controls.


Introduction
Stochastic processes are widely used to model physical, chemical or biological systems.The goal is to approximately compute interesting properties of the system by analyzing the stochastic model.As soon as randomness is involved, there are mainly two options for performing this analysis: (1) Direct sampling and (2) the construction of a discrete coarse-grained model of the system.In a direct sampling approach, one tries to generate a statistically significant amount of events that characterize the property of the system one in which is interested.For this purpose, computer simulations of the model are a powerful tool.For example, an event could refer to the transition between two well-defined macroscopic states of the system.In chemical applications, such transitions can often be interpreted as reactions or, in the context of a molecular system, as conformational changes.Interesting properties are, e.g., average waiting times for such reactions or conformational changes and along which pathways the transitions typically occur.The problem with a direct sampling approach is that many interesting events are socalled rare events.Therefore, the computational effort for generating sufficient statistics for reliable estimates is very high, and particularly if the state space is continuous and high dimensional, estimation by direct numerical simulation is infeasible.
Available techniques for rare event simulations in continuous state space are discussed in [1].In this article, we will discuss approach (2) to the estimation of rare event statistics via discretization of the state space of the system under consideration.That is, instead of dealing with the computation of rare events for the original, continuous process, we will approximate them by a so-called Markov State Model (MSM) with discrete finite state space.The reason is that for such a discrete model, one can numerically compute many interesting properties without simulation, mostly by solving linear systems of equations as in discrete transition path theory (TPT) [2].We will see that this approach, called Markov State Modeling, avoids the combinatorial explosion of the number of discretization elements with the increasing size of the molecular system in contrast to other methods for spatial discretization.
The actual construction of an MSM requires one to sample certain transition probabilities of the underlying dynamics between sets.The idea is: (1) to choose the sets such that the sampling effort is much lower than the direct estimation of the rare events under consideration; and (2) to compute all interesting quantities for the MSM from its transition matrix, cf.[2,3].There are many examples for the successful application of this strategy.In [4], for example, it was used to compute dominant folding pathways for the PinWW domain in explicit solvent.However, we have to make sure that the Markov State Model approximates the original dynamics well enough.For example, the MSM should correctly reproduce the timescales of the processes of interest.These approximation issues have been discussed since more than a decade now [5,6]; in this article, we will review the present state of research on this topic.In the algorithmic realization of Markov State Modeling for realistic molecular systems, the transition probabilities and the respective statistical uncertainties are estimated from short molecular dynamics (MD) trajectories only, cf.[7].This makes Markov State Modeling applicable to many different molecular systems and processes, cf.[8][9][10][11][12][13].
In the first part of this article, we will discuss the approximation quality of two different types of Markov State Models that are defined with respect to a full partition of state space or with respect to so-called core sets.We will also discuss the algorithmic realization of MSMs and provide references to the manifold of realistic applications to molecular systems in equilibrium that are available in the literature today.
The second part will show how to use MSMs for optimizing particular molecular properties.In this type of application, one wants to steer the molecular system at hand by external controls in a way such that a pre-selected molecular property is optimized (minimized or maximized).That is, one wants to compute a specific external control from a family of admissible controls that optimizes the property of interest under certain side conditions.The property to be optimized can be quite diverse: For example, it can be (1) the population of a certain conformation that one wants to maximize under a side condition that limits the total work done by the external control or (2) the mean first passage time to a certain conformation that one wants to minimize (in order to speed up a rare event), but under the condition that one can still safely estimate the mean first passage time of the uncontrolled system.The theoretical background of case (1) has been considered in [14], for example, and of case (2) in [1,15].There, one finds the mathematical problem that has to be solved in order to compute the optimal control.Here, we will demonstrate that one can use MSMs for the efficient solution of such a mathematical problem (for both cases).We will see that the spatial discretization underlying an MSM turns the high-dimensional continuous optimal control problem into a rather low-dimensional discrete optimal control problem of the same form that can be solved efficiently.Based on these insights, MSM discretization yields an efficient algorithm for solving the optimal control problem, whose performance we will outline in some numerical examples, including an application to alanine dipeptide.

MSM Construction
Let (X t ) t≥0 be a time-continuous Markov process on a continuous state space, E, e.g., E ⊂ R d .That is, X t is the state of the molecular system at time t resulting from any usually used form of molecular dynamics simulation, be it based on Newtonian dynamics with thermostats or resulting from Langevin dynamics or other diffusion molecular dynamics models.The idea of Markov State Modeling is to derive a Markov chain, ( Xk ) k∈N , on a finite and preferably small state space Ê = {1, ..., n} that models characteristic dynamics of the continuous process, (X t ).For example, in molecular dynamics applications, such characteristic dynamics could refer to protein folding processes [16,17], conformational rearrangements between native protein substates [18,19], or ligand binding processes [20].Since the approximating Markov chain, (X k ) k∈N , lives on a finite state space, the construction of an MSM boils down to the computation of its transition matrix, P : The main benefit is that for a finite Markov chain, one can compute many interesting dynamical properties directly from its transition matrix, e.g., timescales and the metastability in the system [5,21,22], a hierarchy of important transition pathways [2] or mean first passage times between selected states.With respect to an MSM, these computations should be used afterwards to answer related questions for the original continuous process.To do this, we must be able to link the states of the Markov chain back to the spatial information of the original process, and the approximation of the process (X t ) by the MSM must be valid in some sense.
Having this in mind, the first natural idea is to let the states of an MSM correspond to sets A 1 , ..., A n ⊂ E in continuous state space that form a full partition, i.e.: Typical choices for such sets are box discretizations or Voronoi tessellations [23].For such a full partition, it is trivial to also define a corresponding discretized process by the original switching dynamics between the sets.For a given lag time, τ > 0, we can define the index process: It is well known that this process is not Markovian, mainly due to the so-called recrossing problem.This refers to the fact that the original process typically crosses the boundary between two sets, A i and A j , several times when transitions take place, as illustrated in Figure 1.This results in cumulative transitions between indices i and j for the index process, that is, a not memoryless transition behavior.The non-Markovianity of the index process is often seen as a problem in Markov State Modeling, because many arguments assume that Xk is a Markov process.In this article, we will not make this assumption.We interpret the process ( Xk ) as a tool to construct the following transition matrix, P τ : and, hence, the MSM as the Markov chain, ( Xk ) k∈N , associated with this transition matrix.From above, it is clear that, in general, we have Xk = Xk , and in [24] it was analyzed how these two processes relate in terms of density propagation.In the following, we will show under which assumptions and in which sense the MSM ( Xk ) will be a good approximation of the original dynamics given by (X t ).For convenience, we will usually write P τ ≡ P and leave the τ -dependence implicit.

Analytical Results
In order to compare the MSM to the continuous process, we introduce one of the key objects for our analysis, the transfer operator of a Markov process.We assume that the Markov process (X t ) has a unique, positive invariant probability measure, µ, and that it is time-reversible.Then, for any time-step, t ≥ 0, we define the transfer operator, T t , via the property: for all measurable A as an operator T t : L 2 (µ) → L 2 (µ).Here, p(t, x, A) = P[X t ∈ A|X 0 = x] defines the transition probability measure and L 2 (µ) denotes the Hilbert space of functions v with: and the scalar product: Note that T t is nothing else other than the propagator of densities under the dynamics, but the densities are understood as densities with respect to the measure, µ.That is, if the Markov process is initially distributed according to: its probability distribution at time t is given by: The benefit of working with µ-weighted densities is that the transfer operator, T t , becomes essentially self-adjoint on L 2 (µ) for all cases of molecular dynamics satisfying some form of detailed balance condition.Hence, it has real eigenvalues and orthogonal eigenvectors with respect to Equation (7) (or, at least, the dominant spectral elements are real-valued).Moreover, the construction of an MSM can be seen as a projection of the transfer operator [25].Assume Q is an orthogonal projection in L 2 (µ) onto an n-dimensional subspace, D ⊂ L 2 (µ), with 1 ∈ D, and χ 1 , ..., χ n is a basis of D. Then, the so-called projected transfer operator, QT τ Q : D → D, has the matrix representation: with the non-negative, invertible mass matrix, M ∈ R n,n , with entries: The matrix, P ∈ R n,n , is also non-negative and has entries: Full Partition MSM.If we choose χ i = 1 A i to be the characteristic function of set A i for i = 1, ..., n, one can easily check that we get M = I to be the identity matrix and: as in Equation ( 4).The subscript, µ, shall indicate that X 0 ∼ µ.Therefore, the transition probabilities are evaluated along equilibrium paths.The previously constructed transition matrix of the MSM based on a full partition can be interpreted as a projection onto a space of densities that are constant on the partitioning sets.This interpretation of an MSM is useful, since it allows one to analyze its approximation quality.For example, in [25,26], it is proven that we can reproduce an eigenvalue, λ, of a self-adjoint transfer operator, T t , by the MSM by choosing the subspace appropriately.That is, if u is a corresponding normalized eigenvector, Q the orthogonal projection to a subspace, D, with 1 ∈ D, then there exists an eigenvalue, λ, of the projected transfer operator, QT t Q, with: where λ 1 < 1 is the largest non-trivial eigenvalue of T t and δ = u − Qu .
In particular, for δ ≤ 3 4 , one can simplify the equation to: An eigenvalue, λ i , of the transfer operator directly relates to an implied timescale, T i , of the system via: Therefore, the transition matrix Equation (4) that we construct from transitions between the sets, A 1 , ..., A n , will generate a Markov chain that will reproduce the original timescales well if the partitioning sets are chosen such that the corresponding eigenvectors are almost constant on these sets.In this case, δ = u − Qu ; that is, the approximation error of the eigenvector by a piecewise constant function on the sets will be small.The projection error, δ, depends on our choice of the discretizing sets.As an example, let us consider a diffusion in the potential that is illustrated in Figure 2, that is, the reversible Markov process given by the stochastic differential equation: where V is the potential, B t denotes a Brownian motion and ε > 0.
Figure 2. A potential with three wells and a choice of three sets, The figure also shows a choice of three sets that form a full partition of state space.The computation of the transition matrix Equation (4) for σ = 0.7 and a lag time τ = 1 yields: 0.9877 0.0123 0.0000 0.0420 0.9160 0.0419 0.0000 0.0123 0.9877    that has three eigenvalues λ 0 = 1, λ 1 = 0.9877, λ 2 = 0.9037.Table 1 shows the two resulting implied timescales Equation (15) in comparison to the timescales of the original system.
As one can see, the timescales are strongly underestimated.This is a typical phenomenon.From a statistical point of view, the recrossing problem will lead to cumulatively appearing transition counts when one computes the transition probabilities, P µ [X τ ∈ A j |X 0 ∈ A i ], from a trajectory (X t ), as discussed above.Therefore, on average, transitions between sets seem to become too likely, and hence, the processes in the coarse-grained system get accelerated.We have seen in Equation ( 14) that this cannot happen if the associated eigenvectors can be approximated well by the subspace that corresponds to the MSM. Figure 3 shows the first non-trivial eigenvector, u 1 , belonging to the timescale T 1 = 103.7608and its best-approximation by a step function.The eigenvector is indeed almost constant in the vicinity of the wells, but within the transition region between the wells, the eigenvector is varying and the approximation by a step function is not accurate.Therefore, we have two explanations of why the main error is introduced in the region close to shared boundaries of neighboring sets: (1) because of recrossing issues; and (2) because of the main projection error of the associated eigenvector.Of course, one solution would be an adaptive refinement of the discretization, that is, one could choose a larger number of smaller sets, such that the eigenvector is better approximated by a step function on these sets.In the following section, we will present an alternative solution for overcoming the recrossing problem and reducing the projection error without refining the discretization.

The Core Set Approach
From Equation (10), we know how to compute a matrix representation for a projected transfer operator for an arbitrary subspace, D ⊂ L 2 (µ).For a given basis, χ 1 , ..., χ n , we have to compute Equations ( 11) and (12), so: In general, the evaluation of these scalar products for arbitrary basis functions is a non-trivial task.On the other hand, we have seen that for characteristic functions χ i = 1 A i on a full partition, we do not have to compute the scalar products numerically, since the matrix entries have a stochastic interpretation in terms of transition probabilities between set Equation ( 13).This means they can be directly estimated from a trajectory of the process, which is a strong computational advantage, particularly in high-dimensional state spaces.Now, the question is if there is another basis other than characteristic functions that: (a) is more adapted to the eigenvectors of the transfer operator; and (b) still leads to a probabilistic interpretation of the matrix entries Equation (17), such that scalar products never have to be computed.The basic idea is to stick to a set-oriented definition of the basis, but to relax the full partition constraint.We will define our basis with respect to so-called core sets, C 1 , ..., C n ⊂ E, that are still disjoint, so C i ∩ C j = ∅, but they do not have to form a full partition.Figure 4 suggests that this could lead to a reduction of the recrossing phenomenon, since the sets do not share boundaries anymore.Now, we use the core sets to define our basis functions, χ 1 , ..., χ n .Assume T τ is, again, a self-adjoint transfer operator and consider n core sets C 1 , ..., C n .For every i, take the committor function, χ i , of the process with respect to core set C i ; that is, χ i (x) denotes the probability to hit the core set, C i , next, rather than the other core sets, when starting the process in x.If we now study the projection, Q, onto the space spanned by these committor functions, the two following properties hold [25,27].
(P1) The matrices, M and P , in Equation ( 10) can be written as: where ( X+ k ) and ( X− k ) are forward and backward milestoning processes [25,28]; that is, X− k = i if the process came at time t = kτ , last from core set C i and X+ k = j if the process went next to core set C j after time t = kτ .(P2) Let u i be an eigenvector of T τ that is almost constant on the core sets.Let the region C = E \ i C i that is not assigned to a core set be left quickly enough, so Then, u i − Qu i is small; so, the committor approximation to the eigenvector is accurate.
The message behind (P1) is that it is possible to relax the full partition constraint and use a core set discretization that does not cover the whole state space.We can still define a basis for a projection of the transfer operator that leads to a matrix representation that can be interpreted in terms of transition probabilities.
Important Remark: The construction of the projection onto the committors is only necessary for theoretical purposes.In practice, neither the committor functions nor scalar products between the committors have to be computed numerically, since the matrix entries of M and P can be estimated from trajectories again.
Property (P2) yields that the relaxation of the full partition constraint should also lead to an improvement of the MSM if the region, C, between the core sets is typically left on a faster timescale than the processes of interest taking place.Let us get back to the example from above.We will see that we can achieve a strong improvement of the approximation by simply excluding a small part of state space from our discretization.In Figure 5, we have turned our initial full partition into a core set discretization by removing parts of the transition region between the wells.
Figure 5. Excluding a small region of state space from the sets, A 1 , A 2 , A3, as in Figure 2, to form core sets C 1 , C 2 , C 3 that do not share boundaries anymore.
The matrix P Q = P M −1 that represents the projection, QT τ Q, of the transfer operator onto the committor space associated with the core sets is given by: 0.9897 0.0103 0.0000 0.0352 0.9298 0.0351 0.0000 0.0103 0.9897

  
Comparing to the MSM for the full partition one can see that transitions between indices i and j, i = j are less likely.Table 2 shows this leads to a far more accurate reproduction of the timescales in the system.
From the discussion above, this has to be expected, because the eigenvectors are almost constant in the vicinity of the wells, and we removed a part of state space from the discretization that is typically left quickly compared to the timescales, T 1 and T 2 .Therefore, the committor functions should deliver a good approximation of the first two eigenvectors.Figure 6 underlines this theoretical result.

Practical Considerations and MD Applications
In the previous sections, we have interpreted the construction of an MSM as a projection of the dynamics onto some finite dimensional ansatz space.We have discussed two types of spaces that both have been defined on the basis of a set discretization.First, we chose a full partition of state space and the associated space of step functions, and second, we analyzed a discretization by core sets and the associated space spanned by committor functions.These two methods have the advantage that the resulting projections lead to transition matrices for the MSM with entries that are given in terms of transition probabilities between the sets.That is, one can compute estimates for the transition matrices from simulation data.This is an important property for practical applications, because it means that we never need to compute committor functions or scalar products between committors or step functions.We rather generate trajectories x 0 , x 1 , ...x N of the process (X t ), let us say, for a time step h > 0, so x i = X hi .For example, we can then define for a full partition, A 1 , ..., A m , and a lag time τ = nh the discrete trajectory s k = i ⇔ x k ∈ A i and compute the matrix, P : It is well known [7] that P is a maximum likelihood estimator for the full partition MSM transition matrix Equation ( 4).Similarly one can also compute estimates for a core set MSM by using the definition of milestoning processes [27,28].That is, if we have core sets C 1 , ..., C m , a lag time τ = nh as before, and we define discrete milestoning trajectories by: we can compute an estimator PQ = P M −1 of the core set MSM matrix Equation ( 10) by counting transitions: Since, in practice, we will only have a finite amount of data available, we will have statistical errors when constructing an MSM.This is an additional error to the projection error related to the discretization that we have discussed above.On the other hand, one should note that these errors are not independent of each other.For example, it is clear that if we take a full partition of state space, and we let the partition become arbitrarily fine by letting the number of sets go to infinity, the discretization error will vanish.At the same time, for a fixed amount of statistics, the statistical error will become arbitrarily large, because we will need to compute more and more estimators for transition events between the increasing number of sets.For more information on statistical errors, we refer to the literature [7,29].
Besides the choice of discretization and the available statistics, the estimates above also depend on a lag time, τ .This dependence can be used to validate an MSM by a Chapman-Kolmogorov test [7].This is based on the fact that the MSM matrices approximately form a semi-group for all large enough lag times τ > τ * ; although, for small lag times, this is typically not true, due to memory effects.These facts also motivate one to look at something, like an infinitesimal generator, that approximately generates these MSM transition matrices for large enough lag times.In [27], two types of generator constructions have been compared for a core set setting.The first generator, K, is simply constructed from the transition rates between the core sets in the milestoning sense, that is: where N T ij is the amount of time in [0, T ] the process has spent on its way from core set C i to C j and R T i is the total time in [0, T ] the process came last from C i .On the other hand, one can see [27,30] that K * = KM −1 with the mass matrix, M , from above Equation (18), can be interpreted as a projection of the original generator of the process and, also, as a derivative of the core set MSM from above, i.e.: where P depends on τ Equation ( 17).
Let us now analyze how the choice of core sets, particularly the size of the core sets, influences the resulting approximation.Therefore, we consider an MD example that was discussed in [27], namely one molecule of alanine dipeptide monitored via its φ and ψ backbone dihedral angles.Two core sets are defined as balls with radius r around the two points with angular coordinates x α = (−80, −60) and x β = (−80, 170).The stationary distribution of the process and the two centers of the core sets, x α , x β , in the angular space are shown in Figure 7.For computing a reference timescale, several MSMs based on three different full partitions using 10, 15 and 250 sets have been constructed for increasing lag times.In [27], it is shown that in each setting, the estimate for the longest implied timescale of the process converged to ≈19 ps for large enough τ .Now, the implied timescales for the two different generators, K Equation ( 22) and K * Equation ( 23), are computed.In Figure 8, the resulting timescales are plotted against the reference timescale ≈ 19 ps for varying size of the core sets.
One can see that the estimate by the milestoning generator, K, is rather sensitive to the size of core sets.It overestimates the timescales for small core sizes and underestimates it for larger core sizes.On the other hand, the projected generator, K * , can never overestimate the timescale, due to its interpretation as projection.It is also rather robust against the choice of size of the core sets until the core sets become too large, e.g., r > 15.Then, the discretization becomes close to a full partition discretization using only two sets.In this case, the timescales have to be underestimated heavily, because of recrossing phenomena.On the other hand, the underestimation for very small core sets has to be explained by a lack of statistics.
When the core sets are chosen as arbitrarily small, it is clearly more difficult for the process to hit the sets, and therefore, transition events become rare.Note that for the straightforward milestoning generator, K, the processes seem to become very slow, but for the projected generator K * = KM −1 , this effect is theoretically corrected by the mass matrix, M .Nevertheless, in both cases, the generation of enough statistics will be problematic for too small core sets.

Further Applications in MD
Markov State Modeling has been show to apply successfully to many different molecular systems, like peptides, including time-resolved spectroscopic experiments [10][11][12], proteins and protein folding [4,9,13], DNA [31] and ligand-receptor interaction [32].In most of the respective publications, full partition MSMs are used, and the underlying discretization is based on cluster finding methods (see [7] for a review), while the sampling issues are tackled by means of ideas from enhanced sampling [33] and based on ensembles of rather short trajectories instead of one long one, cf.[4].Core set-based approaches have been used just recently [10,27]; related algorithms are less well developed.However, recent work has shown that and how every full partition MSM can be easily transformed into a core set-based MSM with significantly improved approximation quality [34], making core set MSMs the most promising next generation MSM tools.
Very Rare Transitions between Discretization Sets.When constructing a full partition or a core set MSM, we have to estimate transition probabilities between sets in state space, and it can happen that we cannot avoid that some of these transitions are very rare.That is, the transition probabilities for a lag time, τ , between some sets can be non-zero, but small even, if compared to the remaining transition probabilities that are small already.This is why it is important to note that neglecting these very rare transitions during the construction of an MSM does not harm its approximation quality.For example, we can define for a transition matrix, P , another transition matrix, P , by: where R denotes the set of pairs of indices for which the transition are very rare and for which we set the transition probability to zero.If the Markov chain is reversible and (i, j) ∈ R ⇔ (j, i) ∈ R, one can show that for all ordered eigenvalues, λ k (P ) and λ k ( P ), it holds that: That is, if we cannot estimate a very small transition probability, P ij , for a very rare transition event between two sets, A i and A j , and even totally neglect this probability by setting it to zero, the timescales of the MSM remain almost unaffected.Thus, if we compute the set of the "first order" transition probability of a system correctly enough and ignore all "higher order" ones, then our accuracy will not be spoiled.This nicely illustrates the main advantage of MSM modeling compared to classical long-term simulation: since only neighboring core sets have to be connected by accurately estimated rates, the long residence time of long-term trajectories between and in core sets can be avoided, thus cutting down total simulation time.
Computation from Trajectories.Clearly, constructing and analyzing a core set MSM will only have a computational advantage compared to the direct sampling of a rare event if the transition events between neighboring core sets occur on a much shorter timescale than the rare event itself.One should note that from the purely theoretical point of view, it would be optimal to choose only very few core sets in the most metastable regions of state space, because this would minimize the projection error δ = u − Qu for each dominant eigenvector u, as discussed in Section 3. On the other hand, when estimating the MSM from trajectories, only a finite amount of statistics will be available, so there will also be a statistical error.In order to keep the total error small, additional core sets in less metastable parts of state space typically have to be introduced.In the end, this makes the estimation of a core set MSM possible without having to sample rare events.Note that the projection error is still under control, as long as there is a transition region between the core sets that is typically left very quickly (see Property (P2) in Section 4).
In practice, the statistics of the transition events between core sets will preferably be estimated from many short trajectories using milestoning techniques [27,28] and parallel computing.However, any algorithm for the construction of a core set MSM has to find a balance between sampling issues (not too many too long trajectories needed) and discretization issues (not too many core sets).Construction of such an algorithm still is ongoing research.
This article cannot give a detailed review on the algorithmic realization of MSMs for realistic molecular systems and on the findings resulting from such applications, since this is discussed to some extent elsewhere; see [7] for a recent review of the algorithmic aspects and [32,35] for ligand-receptor interaction.

MSM for Optimal Control Problems
In this section, we will borrow ideas from the previous section and explain how MSMs can be used to discretize optimal control problems that are linear-quadratic in the control variables and which appear in, e.g., the sampling of rare events.Specifically, we consider the case that (X t ) t≥0 is the solution of: with potential V , Brownian motion B t and temperature ε > 0, as in Equation ( 16), and an unknown control variable, u : [0, ∞) → R d , that is chosen so as to minimize the cost function: (The factors of 1/2 and √ 2 in front of the control terms are for notational convenience.)Here, f ≥ 0 is a bounded continuous function called running cost and τ < ∞ (almost surely) is a random stopping time that is determined by X t hitting a given target set, A ⊂ E, i.e., τ = inf{t > 0 : X t ∈ A}, in other words, we are interested in controlling X t = X u t until it reaches A. As an example, consider the case f = 1 with the potential considered in Figure 5 and the target region, A, around the left well.This situation is illustrated in Figure 9 and amounts to the situation that one seeks to minimize the time to reach A by tilting the potential towards A; tilting the potential too much is prevented by the quadratic penalization term in the cost functional that grows when too much force is applied.Other choices of f in Equation ( 26) result in alternative applications.One obvious application would be to set τ = T to a fixed time and f to the characteristic function of the complement of a conformation set C, f = 1 E\C .In this case, minimization of J wrt. the control u t would mean maximization of the probability to find the system in the conformation, C, until time T under a penalty on the external work done to the system.See [14] for more details on such applications.
There are other types of cost functions, J, one might consider, e.g., control until a deterministic finite time τ = T is reached or, even, τ → ∞, and the construction would follow analogously.For compactness, we consider here only cost functions as in Equation (27).
Optimal Control and Equilibrium Expectation Values.It turns out that when minimizing J, it is sufficient to consider control strategies that are Markovian and depend only on X t , i.e., we consider feedback laws of the form u t = α(X t ) for some smooth function, α : E → R d .Moreover, only controls with finite energy are considered, for otherwise, J(u; x) = ∞.For control problems of the form Equations ( 26) and ( 27), the optimal feedback function can be shown to be α where W is the value function or optimal-cost-to-go [1,15]: with the minimum running over all admissible Markovian feedback strategies.It can be that W satisfies the following dynamic programming equation of the Hamilton-Jacobi-Bellman type (see [36]): with the second-order differential operator: that is the infinitesimal generator of the process, X t , for u = 0.If the value function, W , is known, it can be plugged into the equation of motion, which then turns out to be of the form: with the new potential: The difficulty is that Equation ( 29) is a nonlinear partial differential equation and for realistic highdimensional systems, it is not at all obvious how to discretize it, employing any kind of state space partitioning.It has been demonstrated in [14,15] that Equation ( 29) can be transformed into a linear equation by a logarithmic transformation.Setting: W (x) = −ε log φ(x) it readily follows, using chain rule and Equation (29), that φ solves the linear equation: The last equation is linear and can be solved by using MSMs, as we will show below.Moreover, by the Feynman-Kac theorem [37], the solution to Equation ( 31) can be expressed as: where X t solves the control-free equation: That is, the optimal control for Equation ( 26) can be computed by solving Equation (31), which can be done in principle via Monte Carlo approximation of the expected value in Equation ( 32) if critical slowing down by rare events can be avoided.
Remark.The optimization problem Equation ( 28) admits an interpretation in terms of entropy minimization: let Q = Q u x and P = Q 0 x denote the path probability measures of controlled and uncontrolled trajectories starting at x at time t = 0, and set: Then, it follows that we can write: where the notation "Q P " means that Q has a density (That is, the density function, dQ/dP , exists and is almost everywhere positive and normalized) with respect to P .It turns out that for every such Q, there is exactly one control strategy, u, such that Q = Q u x is generated by Equation ( 26); in this sense, the notation in Equation ( 33) is meaningful.The second term: is the relative entropy or Kullback-Leibler divergence between Q and P .For details on this matter that are based on Girsanov transformations for stochastic differential equations, we refer to [38] or the article [1] in this special issue.

MSM Discretization of Optimal Control Problems
The basic idea is now to choose a subspace, D ⊂ L 2 (µ), with basis χ 1 , . . ., χ n as in Markov State Modeling and then discretize the dynamic programming Equation (29) of our optimal control problem by projecting the equivalent log transformed Equation (31) onto that subspace.As we will see, the resulting discrete matrix equation can be transformed back into an optimal control problem for a discrete Markov jump process (MJP).
We will do this construction for the full partition case χ i = 1 A i and the core set case χ i = q i discussed earlier.We will see that in both cases, we arrive at a structure-preserving discretization of the original optimal control problem, where the states of the corresponding MJP will be related to the partition subsets, A i .The first case will give us back a well-known lattice discretization for continuous control problems, the Markov chain approximation [39].This is illustrated in the following diagram: Subspace Projection.The key step for the discretization is that we pick a suitable subspace, D ⊂ L 2 (µ), that is adapted to the boundary value problem Equation (31).Specifically, we require that the subspace contains the constant function, 1 ∈ D, and that it gives a good representation of the most dominant metastable sets.To this end, we choose basis functions χ 1 , . . ., χ n+1 with the following properties: (S1) The χ i form a partition of unity, that is n+1 i=1 χ i = 1.
(S2) The χ i are adapted to the boundary conditions in Equation (31), that is Now, let Q be the orthogonal projection onto D, and define the matrices: Now, if φ solves the linear boundary value problem Equation ( 31), then the coefficients, φ1 , . . ., φn+1 , of its finite-dimensional representation Qφ = j φj χ j on the subspace, D, satisfy the constrained linear system: that is the discrete analogue of Equation (31).The discrete solution φ = Qφ is optimal in the sense of being the best approximation of φ in the energy norm, i.e.: where: is the energy norm on L 2 (µ), and the infimum runs over all functions, ψ ∈ L 2 (µ), that are of the form ψ(x) = j ψ j χ j (x) with coefficients ψ j ∈ R.This is a standard result about projections of PDEs; see [40] for details.(By the same argument as in the previous sections, A = ε −1 f − L is symmetric and positive definite as an operator on the weighted Hilbert space, L 2 (µ).Moreover, φ 2 A = ε −1 φ, f φ + ε ∇φ, ∇φ .)In analogy with Equation ( 14), we can use the above result to get the error estimate: where A = ε −1 f − L is a shorthand for the operator appearing in Equation ( 31) and the constant δ > 0 is defined, such that v 2 A ≥ δ v 2 µ holds for all v ∈ L 2 (µ); see [41].The bottom line of Equation (35) shows that discretizing Equation (31) via Equation (34) minimizes the projection error measured in the energy norm.Since all functions are µ-weighted, the approximation will be good in regions visited with high probability and less good in regions with lower probability.The error estimate Equation ( 36) is along the lines of the MSM approximation result: if we switch to the norm on L 2 (µ), the function φ = Qφ is still almost the best approximation of φ, provided that A leaves the subspace, D, almost invariant.As was pointed out earlier, this is exactly the case when the χ i are close to the eigenfunctions of A (e.g., when the system is metastable).
The best approximation error Q ⊥ φ µ = inf ψ∈D φ − ψ µ , which appears in Equation ( 36), will vanish if the χ i form an arbitrarily fine full partition of E. If we follow the core set idea from Section 4 and choose the χ i to be committor functions, we have good control over Q ⊥ φ µ .Due to [41]: where C = E \ ∪ i C i is the transition region, κ = sup x∈C E x τ E\C is the maximum expected time of hitting the metastable set from outside (which is short) and P is the orthogonal projection onto the subspace Note that P ⊥ φ = 0 on C. The errors, P ⊥ φ µ and P ⊥ φ ∞ , measure how constant the solution, φ, is on the core sets.Hence, Equation (37) together with Equation ( 36) gives us complete control over the approximation error of our projection method, even if we consider just a few core sets.In Section 9, we will investigate the full and core set partition cases further.
Properties of the Projected Problem.We introduce now the diagonal matrix, Λ, with entries Λ ii = j F ij (zero otherwise) and the full matrix G = K − ε −1 (F − Λ), and rearrange Equation (34) as follows: This equation can be given a stochastic interpretation.To this end, let us introduce the vector, π ∈ R n+1 , with nonnegative entries π i = χ i , 1 and notice that i π i = 1 follows immediately from the fact that the basis functions, χ i , form a partition of unity, i.e., i χ i = 1.This implies that π is a probability distribution on the discrete state space Ê = {1, . . ., n + 1}.We summarize properties of the matrices, K, F and G; see also [41]: (M1) K is a generator matrix of an MJP ( Xt ) t≥0 (i.e., K is a real-valued square matrix with row sum zero and positive off-diagonal entries) with stationary distribution, π, that satisfies detailed balance: (M3) G has a row sum of zero and satisfies π T G = 0 and π i G ij = π j G ji for all i, j ∈ Ê; furthermore, there exists a constant 0 < C < ∞, such that G ij ≥ 0 for all i = j if f ∞ ≤ C. In this case, Equation ( 38) admits a unique and strictly positive solution φ > 0.
It follows that if the running costs, f , are such that (M3) holds, then G is a generator matrix of an MJP that we shall denote by ( Xt ) t≥0 , and Equation (38) has a unique and positive solution.In this case, the logarithmic transformation Ŵ = −ε log φ is well defined.It was shown in [42] that Ŵ can be interpreted as the value function of a Markov decision problem with cost functional (cf.also [36]): that is minimized over the set of Markovian control strategies, v : Ê → (0, ∞), subject to the constraint that the controlled process Xt = Xv t is generated by G v , where: with stopping time τ = inf{t > 0 : Xt = n + 1} and running costs: Properties of the Projected Problem, Continued.From [42], we know that the optimal cost: is given by Ŵ = − log φ, where φ solves Equation (38), with the optimal feedback strategy given by v * (i) = φi (see [36]).We list additional properties: (i) The v-controlled system has the unique invariant distribution: with Z v an appropriate normalization constant; in terms of the value function, π * = π v * reads: (iii) Ĵ admits the same interpretation as Equation (33) in terms of the relative entropy: where P denotes expectation with respect to the uncontrolled MJP, Xt , starting at X0 = i, Q denotes the path measure of the corresponding controlled process with generator G v and: A few remarks seem in order: Item (i) of the above list is in accordance with the continuous setting, in which the optimally controlled dynamics is governed by the new potential U = V + 2W and has the stationary distribution, µ * ∝ exp(−2 −1 W )µ, with µ being the stationary distribution of the uncontrolled process.Hence, the effect of the control on the invariant distribution is the same in both cases.Further, note that optimal strategies change the jump rates according to: that is, Ŵ acts as an effective potential as in the continuous case, and the change in the jump rates can be interpreted in terms of Kramer's law for this effective potential.This completes our derivation of the discretized optimal control problem, and we now compare it with the continuous problem we started with for the case of a full partition of E and a core set partition of E.

Markov Chain Approximations and Beyond
Full Partitions.Let E be fully partitioned into disjoint sets, A 1 , . . ., A n+1 , with centers x 1 , . . ., x n+1 and such that A n+1 := A, and define χ i := χ A i .These χ i satisfy Assumptions (S1) and (S2) discussed in Section 8. Since they are not overlapping, F is diagonal, and: is just obtained by averaging f (x) over the cell, A i .Equation ( 43) is also a sampling formula for f (i).It follows directly that G = K, and in particular, (M3) holds for any f .One can show that K has components: if i and j are neighbors (K ij = 0 otherwise).Here, m is the Lebesgue measure, and h ij , S ij and xij are defined as in Figure 10.K is the generator of an MJP on the cells, A i , and coincides with the so-called finite volume approximation of L discussed in [43].It is reversible with stationary distribution: One can show that the approximation error vanishes for n → ∞.K and π can be computed from the potential, V , and the geometry of the mesh.By inspecting Equations ( 12) and ( 13), we see that K is connected to the transition matrix, P τ , of a full partition MSM with lag time τ by thus K is the generator of the semigroup of transition matrices, P τ .Therefore we could obtain K by sampling in the same way we obtained P τ through Equation ( 19) in Section 5.This is difficult, however, due to recrossing problems for small τ ; see e.g., [44].Finally, let us note in passing that we can drastically simplify k v if the cells, A i , are boxes of length h.Denote the elementary lattice vectors by e n .Then, which establishes the connection to the continuous case.However, more is true: The whole discrete control problem reduces to first order in h to the well-known Markov chain approximation (MCA) [39], which allows us to use convergence theory for MCAs to conclude that, for n → ∞, the optimal control and value function of the discrete control problem converge to their continuous counterparts.More details can be found in [41].
Figure 10.The mesh for the full partition.
Core Set Partition.Now, we choose core sets C 1 , . . ., C n+1 with C n+1 = A, and we let χ i = q i be the committor function of the process with respect to C i , as in Section 4. These χ i satisfy Assumptions (S1) and (S2) discussed in Section 8.The projection onto the committor basis also allows for a stochastic interpretation.Recall the definition of the forward and backward milestoning process, X± t , from Equation (18).The discrete costs can be written as: where is the probability density of finding the system in state x given that it came last from i. Hence, f (i) is the average costs conditioned on the information X− t = i, i.e., X t came last from A i , which is the natural extension to the full partition case, where f (i) was the average costs conditioned on the information that X t ∈ A i .
The matrix K = π −1 i q i , Lq j is reversible with stationary distribution and is related to core MSMs again: where P τ and M are now the matrices for core MSMs, as in Equation (18).Formally, K is the generator of the P τ , but these do not form a semigroup, since M = 1.Therefore, we cannot interpret K directly as, e.g., the generator of X− t .Nevertheless, the entries of K are the transition rates between the core sampling estimate suffers from a large bias and variance and is practically useless.In contrast, the MSM estimator for W performs well for all considered values of σ, and always, its variance is significantly small.The constant, C, which ensures φ > 0 when σ ≤ C, is approximately 0.2 in this case.This seems restrictive, but still allows one to capture all interesting information about φ and W .

Alanine Dipeptide
Lastly, we study α-β-transitions in alanine dipeptide, a well-studied test system for molecular dynamics applications.We use a 1µs long trajectory simulated with the CHARMM (Chemistry at HARvard Molecular Mechanics) 27 force field.The conformational dynamics is monitored as usual via the backbone dihedral angles, φ and ψ.The data was first presented in [27].We construct a full partition MSM with 250 clusters using k-means clustering.We are interested in the MFPT (mean first passage time) t(i) = E i [τ α ], where τ α is the first hitting time of the α conformation, which we define as a circle with radius r = 45 around (φ α , ψ α ) = (−80, −60).The MFPT vector, t, solves the boundary value problem K t = −1 outside of α, t = 0 in α , but since K is not available directly via sampling, we have to consider the equation 1 τ (P τ − 1) t = −1 outside of α, t = 0 in α instead.The result will depend on the choice of lag time τ .In Figure 12a, the results are shown for τ = 5; we can identify the β-structure as the red cloud of clusters where t(i) is approximately constant.
In Figure 12b, tβα = E( t(i)|i ∈ β) is shown as a function of τ .We observe a linear behavior for large τ , which is due to the linear error introduced in the replacement of K with 1 τ (P τ − 1), and a nonlinear drop for small τ , which is due to non-Markovianity.Our best guess is, therefore, a linear interpolation to τ = 0, which is indicated by the solid line.The result is t(0) βα = 35.5ps.As a comparison, the reference value tref βα = 36.1psfrom [27] is shown as a dashed line.It was computed in [27] as an inverse rate, using the slowest ITS (implied time scale) and information about the equilibrium weights of the α and β structure.We see very good agreement.The result is, of course, dependent, though, on the assignment of clusters to the α and β structure.Some tests show that t(0) βα as computed with the interpolation method is fairly insensitive to this choice.In [14], it is demonstrated how to use the method presented herein for maximizing the population of the α-conformation of alanine dipeptide based on the MSM used here.

Conclusions
In this article, we have discussed an approach to overcome direct sampling issues of rare events in molecular dynamics based on spatial discretization of the molecular state space.The strategy is to define a discretization by subsets of state space, such that the sampling effort with respect to transitions between the sets is much lower than the direct estimation of the rare events under consideration.That is, without having to simulate rare events, we construct a so-called Markov State Model, a Markov chain approximation to the original dynamics.Since the state space of the MSM is finite, we can then calculate the properties of interest by simply solving linear systems of equations.Of course, it is crucial that these properties of the MSM can be related to the rare event properties of the original process that we have not been able to sample directly.This is why we have analyzed the approximation quality of MSMs in the first part of the article.We have used the interpretation of MSMs as projections of the transfer operator to: (1) derive conditions that guarantee an accurate reproduction of the dynamics; and (2) show how to construct models based on a core set discretization by leaving the state space partly undiscretized.
In the second part of the article, we have used the concept of MSM discretization to solve MD optimal control problems in which one computes the optimal external force that drives the molecular system to show an optimized behavior (maximal possible population in a conformation; minimal mean first passage time to a certain conformation) under certain constraints.We have demonstrated that the spatial discretization underlying an MSM turns the high-dimensional continuous optimal control problem into a rather low-dimensional discrete optimal control problem of the same form that can be solved efficiently.This result allows two different types of applications: (1) if one can construct an MSM for a molecular system in equilibrium, then one can use it to compute optimal controls that extremize a given costs criterion; (2) if an MSM can be computed based on transition probabilities between neighboring core sets alone, then the rare event statistics for transitions between strongly separated metastable states of the system can be computed from an associated optimal control problem that can be solved after discretization using the pre-computed MSM.

Figure 1 .
Figure 1.Cumulative transitions between two sets along boundaries are typical.

Figure 4 .
Figure 4. Core sets do not have to share boundaries anymore.This can reduce the recrossing effect.

Figure 6 .
Figure 6.(Upper panel) The first non-trivial eigenvector, u 1 (solid blue), and its projection, Q f u 1 (finely dashed red), onto step functions (full partition) and its projection, Q c u 1 (dashed green), onto committors (core sets).(Lower panel) The same plot for the second non-trivial eigenvector, u 2 .

Figure 7 .
Figure 7.The stationary distribution of alanine dipeptide and the two centers of the core sets, x α , x β , in the angular space as white dots.

Figure 8 .
Figure 8. Estimate of the implied timescales from K Equation (22), the projected generator K * Equation (23) and the reference computed from several full partition Markov State Models (MSMs).
generator K estimate from projection K* reference estimate from standard MSMs

Figure 9 .
Figure 9.The potential from Figure 5 (blue) and a tilted potential to minimize the time required to hit the target set, A (green).

Figure 12 .
Figure 12.Dipeptide example.(a) MFPT from β to α in φ-ψ space for τ = 5.The red cloud to the right is the β-structure.(b) MFPT as a function of τ (dashed line) and linear interpolation to τ = 0 (solid line).Green dashed line: reference computed via the slowest ITS .

Table 1 .
Comparison of implied timescales

Table 2 .
More accurate approximation if implied timescales