Abstract
We derive simple analytical expressions for the error and computational efficiency of replica exchange molecular dynamics (REMD) simulations (and by analogy replica exchange Monte Carlo simulations). The theory applies to the important case of systems whose dynamics at long times is dominated by the slow interconversion between two metastable states. As a specific example, we consider the folding and unfolding of a protein. The efficiency is defined as the rate with which the error in an estimated equilibrium property, as measured by the variance of the estimator over repeated simulations, decreases with simulation time. For two-state systems, this rate is in general independent of the particular property. Our main result is that, with comparable computational resources used, the relative efficiency of REMD and molecular dynamics (MD) simulations is given by the ratio of the number of transitions between the two states averaged over all replicas at the different temperatures, and the number of transitions at the single temperature of the MD run. This formula applies if replica exchange is frequent, as compared to the transition times. High efficiency of REMD is thus achieved by including replica temperatures in which the frequency of transitions is higher than that at the temperature of interest. In tests of the expressions for the error in the estimator, computational efficiency, and the rate of equilibration we find quantitative agreement with the results both from kinetic models of REMD and from actual all-atom simulations of the folding of a peptide in water.
INTRODUCTION
Molecular dynamics (MD) allows us to explore the structure, energetics, and dynamics of molecular systems with atomistic resolution, including those of large biomolecular systems. However, the maximum time step permitted in the numerical integration of the equations of motion is of the order of a femtosecond, limited by the fast time scales associated with molecular vibrations and collisions. As a result of this short time step, simulations are currently limited to the nanosecond to microsecond regime. Therefore, many important (bio)molecular processes remain out of reach, such as the folding of all but the smallest proteins.
Replica exchange molecular dynamics (REMD)1, 2 has become an increasingly popular technique for accelerating MD simulations, including those of biological processes such as protein folding. Replica exchange (also named parallel tempering) was introduced originally3, 4 in combination with Monte Carlo sampling, but the central idea of establishing an equilibrium between canonical systems with different Hamiltonians (here, rescaled by temperature) can be traced back at least to the seminal papers by Bennett5 and Swendsen and Wang.6 In standard REMD, MD simulations of N identical molecular systems are run in parallel, but each replica is thermostatted at a different temperature Ti (where the thermostat has to maintain a canonical distribution7). At regular intervals, attempts are made to exchange the structures of pairs of replicas, i↔j, accepting the exchanges with a probability that conserves the canonical distributions at the two temperatures, Ti and Tj. In this way, one aims to transfer the improved sampling efficiency at the higher temperature, where activation barriers are more easily crossed, to the lower temperature of interest, where the system would otherwise be stuck in deep local potential energy minima.
Assessing the computational efficiency of REMD, or the analogous replica exchange Monte Carlo (REMC), is important because the primary purpose of these methods is to accelerate standard molecular simulations. Remarkably, though, the advantages of REMD are far from being clear. Despite the widespread use, there has been no general theory addressing the efficiency of the REMD protocol as a function of the system properties and simulation parameters, including the number and temperatures of the replicas and the frequency of exchange attempts.
Several recent studies addressed the problem of the replica exchange efficiency.8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 An important result obtained by Sindhikara et al.8 is that exchange attempts are best chosen as frequently as possible. Similar conclusions were obtained by Abraham and Gready17 based on analyzing the autocorrelation function of the potential energy.
Here, we develop a general quantitative theory of the statistical error and the computational efficiency of REMD. The theory applies to systems whose relaxation behavior at long times can be described by transitions between two states with finite rates of interconversion. Moreover, our results are derived in the fully equilibrated asymptotic limit, where the variance in the estimators decreases as the reciprocal of the simulation time. For systems with true first-order transitions (instead of the quasi-first-order transitions of, say, protein folding), this would require progressively longer simulation times as the system size is increased in approaching the thermodynamic limit.
We define the efficiency as the rate with which the error in an estimated equilibrium property (as measured by the variance of the estimator over repeated simulations of the same length) decreases with simulation time. For both regular MD and REMD simulations, we then determine analytical expressions for this rate of decrease in the error that is, in general, independent of the particular property of interest. These error expressions are derived for systems in which the dynamics at long times is dominated by a single slow and exponential relaxation process, such as the folding and unfolding of a protein.
Our theory is based on a kinetic model of two-state systems at multiple temperatures coupled by replica exchange. In our model, REMD is described by a rate matrix for 2N states, where N is the number of replicas. This kinetic framework is similar to the one presented recently by Zheng et al.,9 but is simplified by not keeping track of the temperature at which a certain replica started (which substantially reduces the number of states from N!2N to 2N). Our kinetic framework is also related to the master-equation description of replica exchange introduced by Nadler and Hansmann.13, 14, 15 However, these authors focused on the rate with which individual replicas sample the different temperatures and derived formulas for this rate under the assumption that at each replica the energy relaxes fast between replica exchange attempts.13 Here, we are concerned with the sampling of observables of interest (say, the fraction folded of a protein) at a given temperature, not the sampling of temperature space by individual replicas. These observables relax slowly at each temperature, whereas replica exchange is assumed to be fast. Indeed, in agreement with Refs. 13, 14, 15, we find that efficient sampling at a low temperature, in general, requires fast replica exchange with higher temperatures, which can be assessed with the “replica round-trip time.”15 We note, however, that for our systems of interest we assume ergodicity in the regular MD such that at long times properties of interest will be properly sampled even without replica exchange (i.e., with infinite round-trip times).
Addressing the REMD efficiency requires the solution of the eigenproblem of the 2N×2N rate matrix, which in the general case can be obtained only numerically. However, we derive a theoretical formula for the efficiency and the slowest relaxation rate of the overall dynamics of the replica exchange protocol in the important limit of fast replica exchange and for a large number of replicas that span the temperature range densely. We show that this formula provides an excellent approximation in practical applications.
The main result is a simple expression for the relative efficiency of REMD and MD simulations. We consider REMD simulations of duration tsim with N replicas at temperatures Ti (i=1,2,…,N). The temperatures and exchange attempt frequency are chosen such that exchanges are accepted frequently in comparison to the rate of the slow two-state transition. For the sake of concreteness, we use the specific example of folding and unfolding of a protein. In MD, a single simulation run is performed at the sole temperature of interest, Tk (which will typically be the lowest temperature, k=1), of length Ntsim. MD and REMD runs thus require the same computational effort if one ignores overheads from replica exchange and issues of serial versus parallel runs. In this case, the relative efficiency of sampling an observable A at temperature Tk in a REMD simulation versus sampling the same property in a MD simulation using the same net resources is
(1) |
where and are the variances of the estimated means of any typical observable A in MD and REMD simulations of the same length tsim, respectively, and and are the lifetimes of the system in its two long-lived (unfolded and folded) states at temperature Ti; and are the corresponding (folding and unfolding) rates. If ηk>1, it is more efficient to run REMD with N replicas to sample properties at temperature Tk than to run a single MD simulation N-times as long as Tk. In practice, the REMD efficiency is further enhanced by using results from the other temperatures, for instance through histogram reweighting.
Equation 1 for the relative efficiency of REMD simulations has a physical interpretation. ηk is the ratio of the number of folding and unfolding transitions per unit time in the REMD runs averaged over the N replicas and in the N-times longer MD simulation at the temperature of interest. Equivalently, ηk is the ratio of the reactive flux in REMD and MD, with the flux averaged over all temperatures in REMD. As a consequence, it is advantageous in REMD to include replica temperatures in which the frequency of transitions is higher than that at the temperature of interest. In contrast, including temperatures with lower fluxes (typically at lower temperatures) reduces the efficiency.
By analogy, Eq. 1 for the sampling efficiency also applies to REMC simulations. Assuming that the same Monte Carlo move sets are used in regular Monte Carlo and in REMC (except for replica exchange), the relaxation times can be measured in units of the number of attempted moves. The times and are then simply the lifetimes in the two-state (folded and unfolded) measured in units of Monte Carlo moves.
In Sec. 3, we test the validity of Eq. 1 and related expressions for the absolute error and the rates of relaxation and show that their predictions are in quantitative agreement with the results from both simulated REMD and actual all-atom simulations of an alanine pentapeptide in water. We conclude with a discussion of the practical relevance of our theoretical analysis of the error and efficiency of REMD.
THEORY
Rate model of REMD
We will analyze the statistical error and efficiency of REMD simulations for the important case of systems whose dynamics at long times is governed by a single slow exponential relaxation process. In general, complex molecular systems have multiple states and, correspondingly, a broad spectrum of relaxation processes. Nevertheless, in many of these systems, the relaxation to equilibrium is dominated by a single-exponential process at sufficiently long times, resulting from the slow and practically memoryless interconversion between the two longest-lived metastable states. A specific example is the folding of small proteins, where the populations of folded and unfolded states relax on time scales that range from microseconds to seconds.
In such systems, a reduced two-state description captures the long-time dynamics. For the sake of concreteness, we will refer to the slow processes as protein folding and unfolding. In the absence of replica exchange, we assume that the interconversion between the folded and unfolded states Fi and Ui, respectively, at temperature Ti of replica i can be described by first-order kinetics,
(2) |
In replica i, the folded and unfolded populations will relax to the respective equilibrium folded populations and unfolded populations qi=1−pi with a rate given by the sum of the folding and unfolding rates,
(3) |
where τi=1∕λi is the corresponding relaxation time. As an illustration, Fig. 1 shows the temperature dependence of the folding and unfolding rates and the corresponding relaxation rate for the λ-repressor fragment λ6–85.20
Replica exchange couples the dynamics of the systems at the different temperatures. To extend the kinetic description [Eq. 2] to REMD, we describe the overall state of the system by a vector si, where si is 1 if replica i is folded and 0 if it is unfolded. Accordingly, the number of states of the entire system is 2N. In REMD simulations, short regular MD simulations alternate with replica exchange attempts. Typically, the lifetimes in the folded and unfolded states will be long compared to the times between attempted exchanges. Therefore, instead of alternatingly propagating the kinetic equations [Eq. 2] and applying a Markov transition matrix to perform the replica exchange, we describe replica exchange simply as an additional kinetic process occurring in parallel with the folding∕unfolding processes. The dynamics can then be described by 2N coupled rate equations instead of the N uncoupled ones of Eq. 2 without replica exchange. In typical implementations, exchanges occur between neighboring replicas, ordered according to temperature, as illustrated in Fig. 2. To describe the kinetics of this coupling, we consider exchanges FiUj→UiFj, where the subscripts i and j=i±1 are for neighboring replicas. Exchanges between identical folding states, FiFj→FjFi=FiFj or UiUj→UjUi=UiUj, do not need to be considered since they do not change the overall state of the system.
Here, we implicitly assume that the two states dominating the relaxation at low and high temperatures are the same. This may not be the case always, with folding and unfolding dominating the dynamics of a protein at low temperature, for instance, and compact to extended transitions at high temperature. In such cases, the approach can be extended by expanding the number of states for each replica to, say, M. However, the overall number of possible states in a simulation with N replicas will then increase from 2N to MN. We note further that one could in addition keep track of the temperature from which each replica started at the beginning of the simulations. For a two-state model, this leads to the state space with N!2N distinct states considered by Zheng et al.9
The change in the population in states with, say, replica i folded and replica j unfolded by replica exchange i↔j, is described by the following kinetic equation:
(4) |
where we use the notation kxc(UiFj)=k(FiUj→UiFj) for the rate of exchange. In such an exchange, the state of the N−2 other replicas remains unchanged. The exchange rates in Eq. 4 are defined such that the equilibrium populations pi and qi of the uncoupled system are preserved. In REMD, this conservation of the equilibrium distribution is guaranteed by choosing an acceptance criterion that satisfies detailed balance. Accordingly, the exchange rates must satisfy
(5) |
We can determine the exchange rates from the simulations by considering the number of exchange events per unit time, i.e., by equating the flux associated with exchanges in the kinetic model and the simulations,
(6) |
where δtxc is the time interval between exchange attempts of replicas at temperatures Ti and Tj, and pacc(UiFj) is the probability of accepting a replica exchange between states Fi and Uj.
Error and efficiency of MD and REMD simulations
The calculation of equilibrium properties is one of the main objectives in both MD and REMD simulations. The computational efficiency of the simulations can then be defined as the rate with which the statistical error in the estimation of the property of interest decreases with the simulation time. In practice, this rate should be given in units of wall-clock time for given computational resources; but for simplicity, we here assume that there are no computational overheads for, say, replica exchange, such that we can instead give the rate in units of the simulation times tsim. For times tsim long compared to the overall longest simulation time of the system, we expect from the central limit theorem that the error in the estimate of the exact mean ⟨A⟩ of a property A decreases as , where indicates the variance about the true mean in multiple simulations of the same duration tsim and c is a constant that depends on the simulation method (MD versus REMD) and thermodynamic state (temperature, pressure, etc.). Note that we do not consider the systematic error resulting from the choice of a particular initial condition (say, all replicas folded or all unfolded). For a given initial condition, the estimate will approach the true mean ⟨A⟩ asymptotically as 1∕tsim, faster than the decrease in the statistical error (which decays as asymptotically).
To compare the efficiencies of MD and REMD simulations, we will calculate the constants c for each of the methods for systems with a single dominant slow relaxation process. While we consider explicitly the case of two-state protein folding, the results apply generally to systems with two metastable states that interconvert slowly compared to the relaxation processes within each state. In the two-state case the relative computational efficiencies will in general not depend on the particular property A. The reason is that in such systems, A will quickly relax to the average values ⟨A⟩F and ⟨A⟩U of the system in folded and unfolded states F and U, respectively, which will, in general, be different. As a consequence, the variance in the estimated mean can be expressed in terms of the variance of the relative fraction s of the folded (or, equivalently, the unfolded) state: , where s=1 if the system is folded, and s=0 if it is unfolded such that ⟨s⟩=p. The rate of decrease in the error of (the fraction of folded states) is thus sufficient to compare different simulation methods, such as MD and REMD.
We define the relative efficiency of REMD simulations as compared to MD based on the asymptotic error of measuring the mean equilibrium populations. If we are interested only in the equilibrium properties at a single temperature (Tk), then we define the efficiency gain from REMD as the ratio of the variance in the folded populations for N regular MD simulations of duration tsim to the variance for one REMD simulation of duration tsim with N replicas,
(7) |
With this definition, REMD converges more rapidly than MD if ηk>1.
For both MD and REMD simulations, we can express the variance in the estimated fraction folded as the time integral over the autocorrelation function of the folding state s(t) at the temperature of interest. The estimate of the fraction folded p=⟨s⟩ is
(8) |
The corresponding variance in the estimator can be expressed in terms of the autocorrelation function of s,21
(9) |
where Δs(t)=s(t)−p.
MD simulations
The analysis of the statistical error in regular MD simulations is analogous to that in single-molecule experiments.22, 23 For two-state kinetics, the autocorrelation function is single exponential, ⟨Δs(t)Δs(0)⟩=pq exp(−λt) with a relaxation rate λ=kF+kU, a folded fraction p=kF∕(kF+kU), and an unfolded fraction q=1−p. For this exponential relaxation, the integral in Eq. 9 can be evaluated analytically. If the duration tsim of the MD simulations is long compared to the folding and unfolding times 1∕kF and 1∕kU, respectively, then the variance in the estimator will decrease asymptotically as 1∕tsim,
(10) |
irrespective of the initial state of the system.
REMD simulations
To estimate the error in replica exchange simulations, we again use Eq. 9. Here the autocorrelation function ⟨Δs(t)Δs(0)⟩ is for the state (folded and unfolded) of the replica at the temperature of interest, which is typically the lowest temperature. In contrast to regular MD, ⟨Δs(t)Δs(0)⟩ will, in general, not be single exponential. For REMD with N replicas, there are 2N distinct states overall, and the correlation function will be multiexponential, requiring for its calculation either the diagonalization of the 2N×2N rate matrix or numerical integration. However, in the limit of fast replica exchange, one can obtain an accurate approximation to ⟨Δs(t)Δs(0)⟩ as explained in the following.
Limit of fast replica exchange
The dynamics of the folded and unfolded populations in a replica exchange simulation are described by the kinetic equations 2, 4 for the folding and exchange processes, respectively. For N>2 replicas, only numerical solutions are available in general. However, we will derive approximate but accurate analytical solutions in the limiting case when the replica exchange rates are much faster than the relaxation rates λi at the individual temperatures Ti.
In the limit of fast replica exchange, we can coarse grain the full problem by coupling states together that rapidly equilibrate with each other. For these collective states we can then construct a new rate matrix of greatly reduced dimension by using the local-equilibrium approximation.24 This process of defining macrostates composed of the original states (microstates), coupled by fast replica exchange, is illustrated in Fig. 2. For N=2, we can couple U1F2 and F1U2 states together in a collective “U1F2+F1U2” state and decrease the total number of states from 4 to 3,
(11) |
Replica exchange couples two microstates of the overall system only if they have equal number of folded (or unfolded) replicas. This means that the 2N-dimensional problem is reduced to N+1 dimensions, with macrostates n=0,1,…,N obtained by grouping together the microstates with exactly n folded replicas.
In the limit of fast exchange, the populations of states n are kinetically connected in a linear chain,
(12) |
To estimate the relaxation dynamics of n, we consider the limit of a large number of replicas N. In this limit, n will fluctuate about its mean
(13) |
with variance
(14) |
where Δn=n−⟨n⟩. These relations follow immediately from the independence of the N replicas at equilibrium. In the limit of large N, the problem can be further simplified by considering the continuum limit. Equation 12 can then be approximated as one-dimensional diffusion of a continuous variable n in a harmonic potential centered at ⟨n⟩ with a spring constant 1∕var(n). The slowest relaxation rate κ for such a diffusive harmonic oscillator description of the dynamics of n(t) is then given by
(15) |
where D is the diffusion coefficient in the continuous problem near n=⟨n⟩.
To estimate the effective diffusion coefficient D along n, we match the fluxes n→n+1 of the kinetic model [Eq. 12] and the harmonic oscillator diffusion model for n=nmax≈⟨n⟩, where nmax is the most probable n. In the kinetic model, the forward and backward rates of our model system are
(16) |
where we used the local-equilibrium approximation24 appropriate for fast replica exchange. p(Fi∣n) and p(Ui∣n) are the conditional probabilities of replica i at Ti being folded and unfolded, respectively, with the total number of folded replicas being exactly n. In the limit of large N, the properties of an individual replica will be the same in the restrained system with n fixed to nmax as in the unrestrained system with n fluctuating about nmax, analogous to the near equivalence of the microcanonical and canonical distributions for small components of a large system. The conditional probabilities can thus be replaced by the average probabilities p(Ui∣nmax)≈qi and p(Fi∣nmax)≈pi. In the discrete system [Eq. 12], the rate coefficients in Eq. 16 thus become and . For the continuum diffusive harmonic oscillator, spatially discretized at steps of Δn=1,25 the diffusion coefficient is directly related to these rates through D=Knmax−1,nmax=Knmax+1,nmax, where we used the fact that the potential surface is flat near the minimum. We thus arrive at the approximation
(17) |
By combining this relation with Eq. 15, we obtain an approximation for the overall slowest relaxation rate in an REMD simulation of a two-state system,
(18) |
The relaxation rate is expressed here as the weighted sum of the relaxation rates of the independent replicas at the different temperatures, where the weighting factor is the normalized product of folding and unfolding probabilities. The overall replica exchange relaxation rate falls between the fastest and the slowest relaxation rates among all the temperatures, λmin≤κ≤λmax. As shown in the Appendix0, Eq. 18 for κ can also be obtained from the exact short-time expansion of the correlation function ⟨Δn(t)Δn(0)⟩=⟨Δn2⟩exp(−κt) in the full system with 2N states.
Error of REMD in the limit of fast exchange
As discussed above, if the rate of replica exchange is fast compared to actual folding and unfolding, we can coarse grain the full 2N representation and reduce it to N+1 states of having exactly n=0,1,…,N replicas folded. At short times, the REMD dynamics is therefore governed by fast exchange between different replicas that quickly establishes an equilibrium for the given fixed number n of folded replicas. Over longer times, the dynamics will be dominated by the slow fluctuations of n(t). We thus separate our state function s(t) into two components,
(19) |
where p(Fk∣n(t)) is the equilibrium average of s(t) over trajectories with a fixed number of folded replicas, defined as the conditional probability of being folded in the replica at the target temperature, Tk, given that n out of N replicas are folded; and δs(t) describes the remaining fast fluctuations in the state of the replica at Tk associated with replica exchange. With this separation, the correlation function at times long compared to those associated with replica exchange becomes
(20) |
This separation into a fast and a slow process is equivalent to that used in the model-free formalism of Lipari and Szabo for the orientational relaxation.26 To evaluate the correlation function in Eq. 20, we again assume that we are in the limit of large N and expand p(Fk∣n(t)) about the mean number ⟨n⟩≈nmax of folded replicas, p(Fk∣n)≈p(Fk∣⟨n⟩)+B(n−⟨n⟩). To estimate the linear expansion coefficient B, we use that in the limit of large N and n≈⟨n⟩ individual replicas fluctuate independently, such that p(Fk∣⟨n⟩)≈pk is the probability of being folded at Tk. The difference p(Fk∣⟨n⟩+1)−p(Fk∣⟨n⟩) can then be estimated from the probability that folding at Tk accounted for the increase from ⟨n⟩ to ⟨n⟩+1, among all possible folding events. This relative probability is given by the product of the replica at Tk being unfolded at ⟨n⟩ and folded at ⟨n⟩+1, normalized by the corresponding product of probabilities for all other replicas. We thus obtain
(21) |
With this approximation, the correlation function in Eq. 20 at long times becomes
(22) |
We have already determined an approximation for the correlation function of n(t) above in the analysis of the kinetics with fast replica exchange, ⟨Δn(t)Δn(0)⟩≈⟨Δn2⟩exp(−κt), where and κ is given in Eq. 18. For the normalized folding state autocorrelation function, we obtain
(23) |
at long times and in the limit of fast replica exchange, with κ given in Eq. 18.
After substituting Eq. 22 into Eq. 9, using Eq. 18 for κ, integrating over time, and taking the limit of long simulation time tsim, we obtain
(24) |
for the variance in the estimated fraction folded at temperature Tk.
By combining Eqs. 10, 24, we can now compare the relative computational efficiencies of MD versus REMD simulation,
(25) |
By substituting and qi=1−pi, this relation for the relative efficiency can be rewritten as Eq. 1. The efficiency in REMD can thus be interpreted as the ratio of the sum of unfolded and folded lifetimes at the target temperature and the average of the reciprocal lifetime sums calculated over all temperatures. Equivalently, the relative efficiency of REMD is given by the ratio of the number of folding and unfolding transitions per unit time averaged over the N replicas and in the N-times longer MD simulation at the temperature of interest. ηk also corresponds to the ratio of the reactive flux in REMD and MD to the flux averaged over all temperatures in REMD.
The relative efficiency ηk of REMD approaches a constant as the number N of replicas increases. If the replicas are spaced at equal intervals in temperature, the limiting value is given by the integral,
(26) |
This independence of N may seem surprising at first glance. However, it can be understood by realizing that all folding or unfolding events at any replica temperature speed up the equilibration also at the temperature Tk of interest because of the fast replica exchange.
It is instructive to compare our results for the relative efficiencies of REMD and MD to the efficiency analysis of Zheng et al.9 Here, we have defined the efficiency as the rate with which the variance of the estimator of an essentially arbitrary observable decreases with simulation time. Specifically, we have calculated the relative efficiencies of MD and REMD simulations as the ratio of the variances in the fraction folded for given total simulation times, . This ratio tells us how much longer one has to simulate in MD to achieve the same statistical error in the estimator as in a REMD simulation, correcting for the fact that only one of the N REMD runs is actually used for the analysis. In contrast, Zheng et al.9 introduced as a measure of the efficiency of REMD simulations the number NTE(tsim∣Tk) of “round-trip” transitions of particular replicas between the U and F states at the temperature of interest Tk during the observation time tsim. For two replicas in the limit of fast exchange, they empirically found an approximation in terms of harmonic means, . Remarkably, despite the seemingly unrelated definitions, their measure of efficiency combined with their empirical approximation produces a formula essentially identical to ours for the specific case of a two-replica system, with the only difference being the normalizing factor for the MD reference simulation. Our analysis thus justifies both the choice of efficiency in Ref. 9, and the empirical approximation in terms of harmonic means. Specifically, we can now interpret the formula in Ref. 9 as the expected number of folding and unfolding events observed at all temperatures during the simulation time tsim, which in the fast-exchange limit all contribute to the relaxation at the temperature of interest.
Optimizing the number and temperature range of replicas
For optimal efficiency the lowest replica temperature should be chosen as T1=Tk if at temperatures below Tk the fraction in the integral of Eq. 26 is <1. To reach the fast replica exchange limit, as many replicas should be used as one can afford. The best choice of the upper temperature, TN, however can depend on the temperature dependence of the rates. In case of Arrhenius temperature dependence, with both folding and unfolding rates increasing with T, it is best to choose TN as high as possible given that replica exchange is still fast (to ensure fast and uniform replica exchange currents, one can employ different criteria11, 13, 14, 15, 27). However, for typical proteins, the relaxation rate exhibits “chevronlike” behavior (see Fig. 1). If one of the rates actually decreases with increasing temperature, and 1∕[τ+(T)+τ−(T)] has a maximum, the best choice is to use an upper temperature TN at a somewhat higher value than this maximum. More precisely, one should use a TN for which ηk in Eq. 26 itself becomes maximum. By differentiating Eq. 26 for equally spaced temperatures with respect to TN, one obtains an implicit equation for the optimal TN,
(27) |
With the help of Eq. 26, we find that the maximum efficiency is
(28) |
for systems with chevronlike rates and using the optimal T1=Tk and TN of Eq. 27.
Figure 3 shows the relative efficiency of REMD as a function of temperature TN for fixed T1=300 K for the folding of the λ6–85 protein20 and the Ala5 peptide in water.28, 29 Assuming that the rates fitted near ambient conditions hold to high temperatures (see Fig. 1 and the following section for rates), we find that for the λ6–85 protein, the optimal upper temperature is TN≈366 K, whereas for Ala5 it is best to go to temperatures as high as possible, as long as replica exchange is still fast.
RESULTS AND DISCUSSION
Convergence of the exact and approximate relaxation times
To test the range of validity of the theory, we first compare the analytical formulas for the error and efficiency of REMD to the exact values obtained by matrix diagonalization. Two systems are considered: (1) the folding of a λ repressor fragment,20 in which the unfolding rate exhibits an Arrhenius-like temperature dependence, but the folding rate is highly non-Arrhenius (Fig. 1); and (2) the folding of a small helical peptide Ala5 in water with Arrhenius-like folding and unfolding rates obtained from REMD simulations of Ala5.28 These rates were adjusted slightly for more accurate equilibrium populations from longer simulations according to the Langevin protocol in Ref. 7: kU(T)=AUe−EU∕T and kF(T)=AFe−EF∕T with AU=1047.7 ns−1, AF=2.9745×106 ns−1, EU=2656.3 K, and EF=5589.5 K.
In both cases, we used a total of N=12 replicas, resulting in 212=4096 states, spread uniformly over a range from 283 to 353 K for the λ repressor and from 295 to 350 K for Ala5. For each of the two systems, we set up a 4096×4096 rate matrix corresponding to Eqs. 2, 4 and varied the rates kxc of replica exchange (while maintaining detailed balance) to explore the convergence to the limit of fast replica exchange. We calculate both the rate κ of the slowest overall relaxation, defined as the nonzero eigenvalue of the rate matrix with the smallest magnitude, and the relative efficiency η1 at the lowest temperature.
Figure 4a shows the relaxation rate κ for the λ repressor as a function of the replica exchange flux jRE. The replica exchange rates were calculated from the flux according to Eq. 6, with jRE varied from 0 to 5 μs−1. As replica exchange is turned on (jRE>0), the slowest relaxation rate κ [blue line in Fig. 4a] rapidly rises from the limit λ1 without replica exchange. We conclude from these results that even infrequently accepted replica exchange can speed up the overall relaxation by a factor of 20 or more. The limit of infinitely fast replica exchange [black horizontal line in Fig. 4a] is approached already at jRE<1 μs, less than λN. We also find that the analytical formula [Eq. 18] for the fast-exchange limit (red horizontal line) is a good approximation of the exact rate κ. Finally, we note that for fast exchange κ is about two orders of magnitude faster than the relaxation rate at the lowest temperature (λ1 at 283 K) and two orders slower than that at the highest temperature (λN at 353 K).
For Ala5, the results are similar to those for the λ repressor, as shown in Fig. 5a. The main differences are that the rise in κ with increased replica exchange is not as dramatic. Also, notably, the analytical formula [Eq. 18] for κ in the fast-exchange limit (red horizontal line) is a near-perfect approximation of the exact relaxation rate.
Figure 4b plots the relative efficiency gain ηk of REMD over MD for the λ repressor at each of the 12 temperatures Tk. In the limit of infinitely fast replica exchange (black line with circles), the analytical formula [Eq. 1] is an excellent approximation to the actual efficiency gain, exceeding the exact value only slightly. We also note that an efficiency gain of more than 104 at the lowest temperature is dramatic. However, our model also shows that this fast-exchange limit is approached only very slowly as the exchange rate is increased. The thin lines show the efficiency for different values of the replica exchange rate [here we included very high replica exchange fluxes jRE=10 ns−1 (green) and jRE=100 ns−1 (magenta)]. An efficiency of ηk=1 is indicated as a horizontal blue line, whereas the bottom black line corresponds to no exchange with an efficiency of ηk=1∕N. We find that for finite exchange rates, the efficiency at the lower temperatures remains well below the fast-exchange limit. The inset in Fig. 4b shows the variance in the folded fraction (scaled to a simulation time tsim=2 μs) on a log scale as a function of the target temperature. Consistent with the efficiency gains, at low temperatures and with fast exchange the variance is dramatically lower with REMD than with MD simulations even if the latter are N=12 times longer.
We again find qualitatively similar behavior for Ala5, as shown in Fig. 5b. Here, the analytical formula [Eq. 1] for η1 is nearly exact. However, the overall efficiency gain from replica exchange is much smaller, about a factor of 4 at the lowest temperature. Nevertheless, this means that the error in the folded fraction decreases about four times faster in the REMD simulations compared to MD simulations of N=12 times the length.
We conclude from this analysis that the analytical expressions for both the overall relaxation rate and the relative efficiency of REMD in the limit of fast replica exchange are accurate and useful in realistic systems. The data in Fig. 4 predict large possible gains in efficiency from replica exchange. Practically, there are a number of limitations. For one, our formulas are derived for the asymptotic limit of long simulations. Most current REMD simulations of, say, protein folding are far from that limit: at times of 10–100 ns∕replica, a REMD simulation system with replicas starting unfolded cannot be expected to have reached equilibrium because typical folding times are at least microseconds over the entire range of temperatures. In addition, we assumed that replica exchange was fast. In practice, this may not be the case, in particular, for large systems requiring a narrow temperature spacing. Our kinetic model shows that to reach the maximum gains at low temperature would require unrealistically high rates of replica exchange [thin lines in Fig. 4b]. For more realistic rates of exchange, we find efficiency gains limited to factors of 10–100.
Simulations of penta-alanine
As a test against actual molecular simulations, we have analyzed the relaxation in long MD and REMD simulations of Ala5 in explicit water. The REMD simulations were run according to the Langevin protocol in Ref. 7. The MD simulation trajectories are those of Ref. 29. The folding state of the peptide was extracted from the simulation trajectories according to the transition-path based assignment described in Refs. 28, 29.
Figure 6 shows the normalized autocorrelation functions of the folding state c(t)=⟨Δs(t)Δs(0)⟩∕⟨Δs2⟩ at the 12 different temperatures of the REMD simulations, spanning the range from 295 to 350 K in intervals of 5 K. As predicted by the theory, after an initial sharp drop in c(t) because of replica exchange without actual folding or unfolding (see following paragraph), the c(t) at the different temperatures decay with the same relaxation rate κ. The amplitude of the c(t) at different temperatures is different, consistent with the predictions of the theory, but because of the narrow range in temperature with a relatively small change in the equilibrium fraction folded, the amplitudes of the slow relaxation phase vary by less than a factor of 1.5. The identical relaxation rate κ at the different temperatures is in sharp contrast to the large differences in the autocorrelation functions c(t) from regular MD simulations, as shown for 300 and 350 K. c(t) decays rapidly at 350 K and slowly at 300 K, both without an initial sharp drop.
Figure 6 also shows the normalized autocorrelation of the total number n(t) of folded states among all replicas. As predicted by the theory for fast replica exchange, this autocorrelation function exhibits single-exponential decay with the rate κ given in Eq. 18 and is consistent with the long-time decay of the c(t) curves.
In Fig. 7, we compare the variance in the folded population obtained from 11 independent REMD runs, each with 12 replicas and run for 150 ns, to that predicted by the theory [Eq. 24]. All variances have been scaled to correspond to a simulation time of tsim=2 ns for better readability. We find that the analytical formula provides a fully quantitative estimate of the actual variance over the entire range of temperatures. Also shown is the variance as a function of simulation temperature expected for MD simulations 12 times longer. We find that the latter is about four times larger at low temperatures than the REMD variance, but decreases with temperature; in contrast, the REMD variance increases with temperature. As predicted by the kinetic model [Fig. 5b], REMD results in an efficiency gain for temperatures below 325 K and an efficiency loss above.
CONCLUDING REMARKS
We have built a kinetic model of REMD simulations to assess their error and efficiency for systems described by two-state relaxation at long times. This kinetic framework allows us to determine the slowest relaxation rate of the overall system and the error of measuring folded∕unfolded equilibrium populations and other observables.
While the general kinetic model using actual replica exchange rates can be solved either by diagonalization or by kinetic simulation, we also provide an analytic solution for obtaining the relaxation rate and the statistical error of measuring equilibrium populations in the limit of fast exchange and densely spaced replicas within the temperature range of the simulation.
We show that the analytical formulas provide a practically useful approximation for the folding of the lambda repressor fragment and the Ala5 peptide solvated in explicit water. In particular, we obtained quantitative agreement between our formulas and the results from actual REMD simulations of Ala5. This agreement of the errors predicted from theory and obtained from Ala5 REMD simulations is encouraging because an earlier study of the same system29 had shown that the folding kinetics was significantly better described by a four-state system than the simpler two-state system assumed in the present formalism.
We note, however, that there are a number of practical issues that may limit the efficiency gains. Most importantly, our formulas apply to the asymptotic limit of long simulations, whereas many current simulations of, say, protein folding may be too short to see any significant number of genuine folding events. In addition, replica exchange has to be fast, which may require too many replicas for large molecular systems. If the two species U and F differ significantly in their internal energy compared to the potential energy fluctuations, then one may not have the relevant fast exchange of unfolded and folded species (UF↔FU) even if the rate of accepted replica exchanges appears to be large (dominated by exchanges FF↔FF and UU↔UU). This lack of energy overlap in UF↔FU exchanges is a particular concern in implicit-solvent simulations with large energy gaps between F and U states.
Although the implementation of the kinetic models as well as the theoretical formulas require some a priori knowledge of the temperature dependence of the rates, which may not be available, a number of general recommendations can be made without detailed rate information. In particular, our theoretical analyses and numerical studies have identified a number of factors relevant for the efficiency of REMD.
Exchange frequency and number of replicas
To achieve high efficiency gains from REMD, it is important that replica exchange is fast compared to folding and unfolding at the temperature of interest. This result is consistent with the conclusions of Sindhikara et al.8 There are a number of factors that affect the effective exchange rate, including the frequency of exchange attempts, the temperature spacing of the replicas, and the relaxation rate of the total potential energy differences between neighboring replicas as the main factor controlling the acceptance rate. Up to a certain point, one can increase the replica exchange rate simply by decreasing the time interval δtxc between exchange attempts. However, we expect that at short times δtxc the relaxation of degrees of freedom other than the folding state (U and F) will become important, resulting in a breakdown of the Markovian assumption underlying the kinetic description.10 As an alternative, to enhance the exchange acceptance probability and establish fast exchange, the temperature spacing can be decreased without penalty in efficiency. The reason is that according to Eq. 1 an increase in the number of replicas within a fixed temperature range will not reduce the efficiency as long as replica exchange is fast. Finally, alternative implementations of replica exchange may also help overcome the limitations arising from low acceptance probabilities in larger systems, such as “replica exchange with solute tempering” by Liu et al.30
Temperature range
Typically, τ+(T)+τ−(T) decreases as temperature T increases. Then, the target temperature Tk should be the lowest temperature in the REMD simulations (k=1). The upper limit of TN of the temperature range should be chosen by keeping two factors in mind. Most importantly, for a fixed number N of replicas, the temperature range should be small enough such that the replica exchange rates are fast compared to folding and unfolding. Once near the fast limit, the optimal TN depends on the temperature dependence of the folding and unfolding rates. For Arrhenius rates, τ+(T)+τ−(T) monotonically decreases with T, and TN should be chosen as high and possible, while staying in the fast limit. If τ+(T)+τ−(T) has a minimum, then the upper temperature will also have an optimal value, as defined in Eq. 27.
Other variables that can be optimized are the precise temperatures Ti of the replicas. Here, we have implicitly assumed an even temperature spacing of the replicas. However, it follows from Eq. 1 that the highest efficiency can be achieved by having relatively more replicas where τ+(T)+τ−(T) has a minimum, while still maintaining fast replica exchange. Such optimization would result in an uneven temperature spacing of the replicas.
Equilibration
Plotting autocorrelation functions of the properties of interest, as in Fig. 6, should help in assessing the degree of equilibration. The theory predicts that at long times, the autocorrelation functions for any property coupled to folding in a two-state system should decay with a single-exponential relaxation, with a rate irrespective of the temperature of the replica and the property of interest. Moreover, in the limit of fast exchange, the autocorrelation function for the number n(t) of folded replicas should exhibit a single-exponential decay with the same time constant as the state autocorrelation functions at fixed temperatures.
In addition to the formal results of this paper, one can directly use the kinetic frameworks [Eqs. 2, 4] to explore and optimize REMD parameters. Such an approach has been pursued by Hritz and Oostenbrink.12 Replica exchange rates can be obtained from the attempt frequencies and acceptance rates. The latter can be estimated from the energy distributions in the folded and unfolded states at the different temperatures (from simulation at some temperatures and interpolation at others). Combined with estimates of the folding and unfolding rates, the kinetic matrix can be constructed and solved either by diagonalization or by kinetic simulations. In this way, a numerically optimized protocol can be determined for an actual simulation system by minimizing the error at the temperature of interest.
In summary, we have shown that replica exchange can substantially enhance the computational efficiency, as measured by the decrease in the simulation time required to achieve a particular statistical accuracy. However, to achieve high efficiency requires a careful choice of the simulation parameters.
ACKNOWLEDGMENTS
We thank Dr. A. Szabo, Dr. N.-V. Buchete, Dr. A. M. Berezhkovskii, Dr. A. B. Adib, and Dr. Y.-C. Kim for many helpful and stimulating discussions. This research used the Biowulf Linux cluster at the NIH and was supported by the Intramural Research Program of the NIDDK, NIH.
APPENDIX: SHORT-TIME APPROXIMATION OF THE CORRELATION FUNCTION
In this appendix, an approximation for the relaxation rate κ of the number n of folded replicas will be derived from the short-time expansion of the correlation function ⟨Δn(t)Δn⟩ for the kinetic system [Eq. 12]. We show that the κ derived from this approximation is identical to Eq. 18 derived in the main text under the assumption of diffusive dynamics on a quadratic surface for a continuous n.
The autocorrelation function of n can be written as
(A1) |
where the propagator p(n,t∣m,0) is the conditional probability that exactly n replicas are folded at time t, given that m replicas were folded at time 0, and peq(m) is the equilibrium probability of having exactly m folded replicas. At short times, the propagator can be approximated as p(n,t∣m,0)=δnm+Knmt+O(t2), where δnm is the Kronecker symbol and the Knm are the rate coefficients in the kinetic scheme of Eq. 12. At short times, we can thus approximate ⟨Δn(t)Δn(0)⟩∕⟨Δn2⟩≈exp(−κt)≈1−κt with
(A2) |
To simplify this expression for κ, we first use that only neighboring states are connected in the kinetic system [Eq. 12],
(A3) |
with KN+1,N=K−1,0=0. To further simplify the above expression, we use that the columns of the rate matrix sum to zero, such that Knn=−Kn+1,n−Kn−1,n,
(A4) |
Substituting the detailed balance relation, Kn+1,npeq(n)=Kn,n+1peq(n+1), into Eq. A4 and regrouping of the terms results in
(A5) |
In the final step, we assume that replica exchange is fast, such that we can use the local-equilibrium approximations [Eq. 16] for Kn±1,n. Substituting Eq. 16 into Eq. A5, we obtain
(A6) |
By exchanging the order of summation, the condition on n can be eliminated, ∑np(Ui∣n)peq(n)=qi, which results in
(A7) |
Substituting ⟨Δn2⟩ from Eq. 14, we find that κ in Eq. A7 is identical to that in Eq. 18.
References
- Sugita Y. and Okamoto Y., Chem. Phys. Lett. 314, 141 (1999). 10.1016/S0009-2614(99)01123-9 [DOI] [Google Scholar]
- García A. E. and Sanbonmatsu K. Y., Proc. Natl. Acad. Sci. U.S.A. 99, 2782 (2002). 10.1073/pnas.042496899 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Geyer C. J., Computing Science and Statistics: Proceedings of the 23rd Symposium on the Interface (American Statistical Association, New York, 1991), pp. 156–163.
- Hukushima K. and Nemoto K., J. Phys. Soc. Jpn. 65, 1604 (1996). 10.1143/JPSJ.65.1604 [DOI] [Google Scholar]
- Bennett C. H., J. Comput. Phys. 22, 245 (1976). 10.1016/0021-9991(76)90078-4 [DOI] [Google Scholar]
- Swendsen R. H. and Wang J. -S., Phys. Rev. Lett. 57, 2607 (1986). 10.1103/PhysRevLett.57.2607 [DOI] [PubMed] [Google Scholar]
- Rosta E., Buchete N. -V., and Hummer G., J. Chem. Theory Comput. 5, 1393 (2009). 10.1021/ct800557h [DOI] [PMC free article] [PubMed] [Google Scholar]
- Sindhikara D., Meng Y. L., and Roitberg A. E., J. Chem. Phys. 128, 024103 (2008). 10.1063/1.2816560 [DOI] [PubMed] [Google Scholar]
- Zheng W., Andrec M., Gallicchio E., and Levy R. M., Proc. Natl. Acad. Sci. U.S.A. 104, 15340 (2007). 10.1073/pnas.0704418104 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Zheng W., Andrec M., Gallicchio E., and Levy R. M., J. Phys. Chem. B 112, 6083 (2008). 10.1021/jp076377+ [DOI] [PMC free article] [PubMed] [Google Scholar]
- Trebst S., Troyer M., and Hansmann U. H. E., J. Chem. Phys. 124, 174903 (2006). 10.1063/1.2186639 [DOI] [PubMed] [Google Scholar]
- Hritz J. and Oostenbrink C., J. Chem. Phys. 127, 204104 (2007). 10.1063/1.2790427 [DOI] [PubMed] [Google Scholar]
- Nadler W. and Hansmann U. H. E., Phys. Rev. E 75, 026109 (2007). 10.1103/PhysRevE.75.026109 [DOI] [PubMed] [Google Scholar]
- Nadler W. and Hansmann U. H. E., Phys. Rev. E 76, 065701 (2007). 10.1103/PhysRevE.76.065701 [DOI] [PubMed] [Google Scholar]
- Nadler W. and Hansmann U. H. E., J. Phys. Chem. B 112, 10386 (2008). 10.1021/jp805085y [DOI] [PubMed] [Google Scholar]
- Nymeyer H., J. Chem. Theory Comput. 4, 626 (2008). 10.1021/ct7003337 [DOI] [PubMed] [Google Scholar]
- Abraham M. J. and Gready J. E., J. Chem. Theory Comput. 4, 1119 (2008). 10.1021/ct800016r [DOI] [PubMed] [Google Scholar]
- Denschlag R., Lingenheil M., and Tavan P., Chem. Phys. Lett. 458, 244 (2008). 10.1016/j.cplett.2008.04.114 [DOI] [PubMed] [Google Scholar]
- Zhang C. and Ma J., J. Chem. Phys. 129, 134112 (2008). 10.1063/1.2988339 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Yang W. Y. and Gruebele M., Biochemistry 43, 13018 (2004). 10.1021/bi049113b [DOI] [PubMed] [Google Scholar]
- Yeh I. -C. and Hummer G., Biophys. J. 86, 681 (2004). 10.1016/S0006-3495(04)74147-8 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Boguna M., Berezhkovskii A. M., and Weiss G. H., J. Phys. Chem. A 105, 4898 (2001). 10.1021/jp004023b [DOI] [Google Scholar]
- Berezhkovskii A. M., Szabo A., and Weiss G. H., J. Chem. Phys. 110, 9145 (1999). 10.1063/1.478836 [DOI] [Google Scholar]
- Zwanzig R., Nonequilibrium Statistical Mechanics (Oxford University Press, New York, 2001). [Google Scholar]
- Bicout D. J. and Szabo A., J. Chem. Phys. 109, 2325 (1998). 10.1063/1.476800 [DOI] [Google Scholar]
- Lipari G. and Szabo A., J. Am. Chem. Soc. 104, 4546 (1982). 10.1021/ja00381a009 [DOI] [Google Scholar]
- Denschlag R., Lingenheil M., and Tavan P., Chem. Phys. Lett. 473, 193 (2009). 10.1016/j.cplett.2009.03.053 [DOI] [Google Scholar]
- Buchete N. V. and Hummer G., Phys. Rev. E 77, 030902 (2008). 10.1103/PhysRevE.77.030902 [DOI] [PubMed] [Google Scholar]
- Buchete N. V. and Hummer G., J. Phys. Chem. B 112, 6057 (2008). 10.1021/jp0761665 [DOI] [PubMed] [Google Scholar]
- Liu P., Kim B., Friesner R. A., and Berne B. J., Proc. Natl. Acad. Sci. U.S.A. 102, 13749 (2005). 10.1073/pnas.0506346102 [DOI] [PMC free article] [PubMed] [Google Scholar]