Abstract
Thermodynamic extrapolation has previously been used to predict arbitrary structural observables in molecular simulations at temperatures (or relative chemical potentials in open-system mixtures) different from those at which the simulation was performed. This greatly reduces the computational cost in mapping out phase and structural transitions. In this work we explore the limitations and accuracy of thermodynamic extrapolation applied to water, where qualitative shifts from anomalous to simple-fluid-like behavior are manifested through shifts in the liquid structure that occur as a function of both temperature and density. We present formulae for extrapolating in volume for canonical ensembles and demonstrate that linear extrapolations of water’s structural properties are only accurate over a limited density range. On the other hand, linear extrapolation in temperature can be accurate across the entire liquid state. We contrast these extrapolations with classical perturbation theory techniques, which are more conservative and slowly converging. Indeed, we show that such behavior is expected by demonstrating exact relationships between extrapolation of free energies and well-known techniques to predict free energy differences. An ideal gas in an external field is also studied to more clearly explain these results for a toy system with fully analytical solutions. We also present a recursive interpolation strategy for predicting arbitrary structural properties of molecular fluids over a predefined range of state conditions, demonstrating its success in mapping qualitative shifts in water structure with density.
I. INTRODUCTION
With modern advances in computational power and algorithms, data generated via molecular simulation has become ubiquitous across numerous fields.1,2 Despite the availability of past data and the ease with which new results may be generated, it is crucial that data be generated and utilized efficiently. Rather than improve computational efficiency directly through enhanced sampling algorithms3,4 or refining hardware usage,5–11 we focus here on general developments of statistical mechanical theory. It is often the case that simulation data is desired to demonstrate a trend with a specific state condition or other variable. For instance, it might be of interest to know the unfolding behavior of a protein as a function of temperature, or how the adsorption of fouling species at an interface changes over a wide range of temperatures, pressures, or even some adjustable parameter of the solute or interface. Many such quantities may be considered averages over configurations generated through Monte Carlo, molecular dynamics, or ab initio simulations. Recent work has provided “mapped averaging” formulas for calculating structural properties, greatly reducing the simulation time needed to achieve highly precise estimates of physical observables.12–14 However, this technique does not address the need to run multiple simulations at different state points, which can consume time.
Complementary to mapped averaging, thermodynamic extrapolation15–18 provides an efficient route to estimate the variation of observables with changes in simulation conditions, such as temperature or pressure. Thermodynamic extrapolation is based on statistical mechanical relationships that, via a single simulation, directly provide estimates of the derivatives of an observable with respect to a specific variable. This technique has met with great success in predicting grand canonical number density distributions across temperatures17,18 and relative chemical potentials.15 It has also proven effective in predicting changes in virial coefficients upon alchemical variation of simulation parameters.19 A number of structural properties as a function of temperature have also been successfully predicted for relatively simple model systems.20 Use of extrapolation expressions to provide temperature derivatives of dynamical quantities has been developed independently21,22 and used to more efficiently determine activation energies21 and fit kinetic expressions associated with structural reorganization of water.23
An open question remains, however, as to the general accuracy and precision of these techniques and their relevance to more realistic fluids. For instance, liquid water exhibits a number of anomalies as a function of state conditions.24,25 With changes to temperature and density, water’s fundamental structure may flip between what is expected for tetrahedral and simple fluids.26–28 Such changes are expected to be difficult for thermodynamic extrapolation to capture — indeed, we clearly demonstrate that this technique is subject to the same pitfalls as any extrapolation strategy. Interestingly, a recent study utilizing first-order extrapolation techniques successfully captured the temperature dependence of oxygen-oxygen radial distribution functions of liquid water.29 We find, however, that this is not necessarily general behavior. Namely, the success of the method relies on accurately capturing the local curvature in the observable of interest over a desired range of the extrapolation variable (e.g., temperature or density).
To better understand the errors inherent in extrapolation, we examine a toy ideal gas system for which analytic solutions exist. We develop intuition for the scaling of uncertainties in this toy system and propose practical guidelines for the use of extrapolation techniques. We also connect these results to rigorous theories underlying well-known free energy calculation techniques, which allows us to establish strategies and heuristics for consistently obtaining high accuracy from derivative estimation methods. Comparison of our methods to standard re-weighting of observables reveals significant gains in accuracy and efficiency, which we show is expected from previous literature concerning free energy calculations. Using these insights, we propose a polynomial interpolation approach based on thermodynamic extrapolation for efficiently using simulation data at multiple conditions, with popular free energy calculation techniques appearing as special cases of its implementation. Our presented algorithms are packaged into an easily extensible Python library that we use here to analyze both the ideal gas model and simulations of water across a wide range of liquid temperatures and densities. While we find linear extrapolation is capable of capturing the variation of many of water’s structural properties with temperature, more advanced strategies are necessary to describe its behavior with density.
We organize the paper as follows: Section II presents thermodynamic extrapolation and formalizes connections between estimation of general observables and free energies. Section IIA covers various classes of observables and how extrapolation must be adapted to each, while II B discusses the differences between extrapolation techniques and re-weighting via standard perturbation theories.30 Section III thoroughly investigates extrapolation, including extensive uncertainty analysis, for an analytic ideal gas system. With the lessons learned from this toy model, we propose a recursive interpolation algorithm in Section IV, providing fundamental connections to free energy calculation techniques, as well as a simple visual check for self-consistency. Section V applies all of these results to simulations of liquid water, testing their applicability in a more realistic system with non-trivial shifts in qualitative structural behavior.
II. THERMODYNAMIC EXTRAPOLATION AND ITS RELATIONSHIP TO RE-WEIGHTING
A. Classifications of thermodynamic extrapolation
Thermodynamic extrapolation is related to re-weighting techniques. To illustrate this, we first introduce common use cases that differ in the functional form of the quantity being extrapolated and its dependence on the extrapolation variable, with free energies appearing as our last example. This will be important later when we demonstrate that use of derivative information to perform polynomial interpolation with multiple data points is equivalent to both thermodynamic integration31 and optimal combinations of cumulant expansions.32 Though not completely exhaustive, the following classifications cover most cases of interest in molecular simulation. We define the function to be extrapolated as Y, the extrapolation variable as α, and some arbitrary simulation observable to be X. For instance, if Y is the average end-to-end distance of a polymer chain and we want to know how this varies with temperature (α), then X would be the end-to-end distance at each simulation snapshot. In the simplest case, we want to average an observable of interest that does not explicitly depend on α
| (1) |
This applies to most structural observables, such as radial distribution functions (RDFs), the radius of gyration of a polymer, or particle density, when extrapolating over temperature. The second case involves a structural observable that explicitly depends on the extrapolation variable.
| (2) |
Though the above dependence is not common for most average observables extrapolated in temperature (α = T), it is highly relevant to extrapolation over volume or simulation parameters (such as those appearing in a potential energy function). An example is the variation of a canonical ensemble RDF (Y) with respect to volume (α = V) where X is then the number of bin counts at a specific separation distance for a single system configuration. Though the first case is treated exhaustively in previous literature,16,17 we reproduce a simplified version of its derivation in the next section. Thorough investigation of the second case has also been performed17 and will not be repeated here, though we note that the released library of code is capable of handling such scenarios.
The next two cases are simple extensions of the first two. For quantities like excess chemical potentials, we are not interested in the average observable itself, but instead the negative of its natural logarithm.
| (3) |
| (4) |
Again, X may implicitly or explicitly depend on the extrapolation variable. The latter is true, for example, in the case of excess chemical potentials in the canonical ensemble given by with β as the inverse temperature and ΔU as the potential energy difference with and without the added molecule. For the case of hard-sphere excess chemical potentials, however, only Eq. 3 is necessary as the explicit temperature derivatives go to zero. The latter two cases in Eqs. 3 and 4 may be simply handled in terms of the first two by noting that the derivative of the negative natural logarithm of a function can be expressed in closed form at arbitrary order in terms of the function itself and its derivatives up to the same order.
| (5) |
The above expression may be derived from Faà di Bruno’s formula33 where Bn,k represents the partial Bell polynomials.34
Finally, the function of interest may be a free energy, in which case we wish to extrapolate the natural logarithm of a partition function that will in most cases of interest have an explicit dependence on the extrapolation variable.
| (6) |
Extrapolation of this quantity in terms of temperature for the canonical ensemble is almost identical to the cumulant expansions of Zwanzig in his original perturbation theory.30 In contrast to our work, Zwanzig focused on the free energy difference with respect to a specific change in the potential energy function. More importantly, Zwanzig always uses the infinite temperature state (inverse temperature β = 1/kBT equal to zero) as a reference when developing his expansions (hence the “high temperature equation of state”). If we wish to directly represent the free energy at a particular β in terms of a free energy and its derivatives at a reference β0, we may expand to obtain the following.
| (7) |
The Helmholtz free energy A is related to the canonical ensemble partition function Q = ∫ e−βH(rN,pN)drN dpN as βA = −ln Q with rN and pN representing the positions and momenta of all particles in the system. Averages and derivatives evaluated at specific values of the extrapolation variable are indicated with subscripts. Eq. 7 is a cumulant expansion in terms of the difference in β rather than β itself, with H being the Hamiltonian of the system, including both the potential and kinetic energies. A particularly useful form for many types of free energy calculations results from expanding in terms of an arbitrary variable in the Hamiltonian λ
| (8) |
B. Extrapolation versus perturbation in the canonical ensemble
Before contrasting extrapolation with perturbation theory, we derive temperature extrapolation in the canonical ensemble, which corresponds to the simplest case described above (i.e., Y = 〈X〉). More thorough treatments, including extension to other variables, may be found elsewhere,15,17 while more involved derivations for extrapolation of volume in the canonical ensemble are provided in the Appendix. For any observable X(rN) that only depends on coordinates rN of the N atoms in the system and does not depend on momenta or explicitly on temperature, we can write the extrapolation from β0 by an amount δβ for the ensemble average of X as
| (9) |
For structural averages, the relevant normalization factor is the configurational part Z of the canonical ensemble partition function Q and the appropriate configuration weight is then , with U being the potential energy. The derivatives in Eq. 9 (up to second order in β) become
| (10) |
| (11) |
As noted by Mahynski et al.,20 configurational quantities of interest can almost always be expressed as ensemble averages. This includes each point in any structural distribution function such as a RDF.
To relate thermodynamic extrapolation to more well known re-weighting methods, we briefly revisit perturbation theory. In the original theory developed by Zwanzig,30 we may re-weight averages in one ensemble in order to obtain the same average in another ensemble. For two canonical ensembles at different temperatures, with the observable having no explicit dependence on temperature or momenta, this becomes
| (12) |
Or more explicitly in terms of configuration weights in a given ensemble,
| (13) |
As each is mathematically rigorous, perturbation and extrapolation utilizing an infinite number of terms should yield identical results. In practice, the results will differ due to finite sampling and series truncation, despite both techniques utilizing the exact same data, namely the potential energies and observable values for each sampled configuration. In each case, we manipulate the data by taking various averages, then combine them to produce the result. To illustrate differences between the two approaches, we Taylor expand the numerator and denominator in Eq. 12 around an inverse temperature difference δβ of zero
| (14) |
We emphasize that there is no practical reason for expanding Eq. 12 in this way as it can be directly applied to simulation data. However, Eq. 14 demonstrates that we are effectively taking the ratio of two series expansions, with both extending to infinite order. Actually taking this ratio should yield Eq. 9 substituted with Eqs. 10 and 11. Indeed, we may obtain the numerator of Eq. 14 by multiplying the denominator by the combined Eqs. 9–11 and collecting terms of the same order of δβ. In practice, error is introduced into extrapolation predominantly through truncation of Eq. 9, while perturbation via Eq.12 evaluates the series in Eq. 14 at infinite order but suffers from finite sampling errors stemming from a lack of sufficient phase-space overlap.
Finite sampling limits both perturbation theory and extrapolation, with the latter also limited by the order at which we truncate the expansion. As demonstrated later, however, extrapolation may significantly outperform perturbation for the special cases of observables that vary approximately linearly or quadratically as a function of the extrapolation variable (i.e., first- or second-order extrapolation, respectively) over large ranges of temperatures or densities. This is because perturbation does not utilize information regarding the local curvature in terms of the dependence of the observable as a function of the extrapolation variable (Fig. 1). Instead, perturbation relies on selecting configurations that have high weights in the new ensemble but were sampled in the reference ensemble, as is the case for large observable fluctuations shown in Fig. 1. If no such configurations (or phase-space overlaps) exist, perturbation theory cannot work, as can be seen from the ratio of weights appearing in the numerator and denominator of Eq. 13. Moving further from the reference ensemble tends to greatly reduce overlap, rendering perturbation estimates unreliable. Lack of overlap becomes even more pronounced for large systems due to reductions in relative fluctuations with system size. On the other hand, extrapolation at a given order is only accurate while the observable of interest varies in a similar fashion to the highest-order term of the polynomial expansion (Fig. 1). Similar to perturbation theory, the highest extrapolation order we can use, and hence the distance we can perturb, is limited by the amount of sampling that we have performed. This is because extrapolation requires converged estimates of the moments of an observable.
FIG. 1.

Schematic representations of scenarios in which extrapolation/interpolation or perturbation (re-weighting) are expected to be efficient. When the behavior of X with respect to α is well-approximated by a low-order polynomial (a and b), only derivatives of low order (here second for extrapolation, first for polynomial interpolation) are needed to accurately capture a wide range of α values and extrapolation/interpolation is appropriate. Perturbation is suitable when fluctuations in X are large compared to its variations with α (a and c). Neither method is efficient for systems with many extrema and relatively small fluctuations (d). The adjustable parameter α may be a thermodynamic variable (e.g., temperature or density) or model parameter (e.g., appearing in a potential energy function).
III. ANALYTICAL EXAMPLE: IDEAL GAS IN AN EXTERNAL FIELD
To concretely compare perturbation and extrapolation and understand why each fails or succeeds, we examine the simple case of a one-dimensional ideal gas in an external potential depending linearly on the particle positions. This model is analytically tractable, but still exhibits non-trivial behavior in the temperature dependence of its structural properties. We treat a canonical ensemble with temperature T, number of particles N, and length of L in the single dimension with the coordinate of the ith particle being xi. The particles do not interact with each other, but do interact with an external field linear in the particle positions, Φ(x) = ax. The total N-particle partition function Q is given by the product of single-particle partition functions q as with
| (15) |
where Λ accounts for kinetic degrees of freedom and will not be of interest here, and z is the configurational partition function given by
| (16) |
The total potential energy for a system with N particles is simply U = a∑ixi. For a single particle, the probability of a given x is
| (17) |
and the total probability for N particles with different positions is the product of the probability in Eq. 17 due to lack of particle-particle interactions. For a single particle the potential energy distribution is also given by P(x) because a particle coordinate uniquely maps to a potential energy. For a sufficiently large number of particles, however, the distribution of potential energies becomes Gaussian and can be completely characterized by only its mean and variance. Throughout, we use 1000 particles, which satisfies this condition and is on an order of magnitude with the degrees of freedom that might be present in a molecular simulation. The average x position (for a single particle or over all particles) is given by
| (18) |
The average potential energy is then given by 〈U〉 = Na〈x〉 and, similarly, the variance of the potential energy is , where
| (19) |
We will treat the average position 〈x〉 as our structural property of interest that we perturb and extrapolate in temperature space. It is important that 〈x〉 is not a simple function of β and in fact exhibits significant non-linearity (Fig. 2). This makes the extrapolation non-trivial even though analytical results for extrapolation at each order (i.e., the exact nth derivative with respect to β) are trivial to compute. Without loss of generality, we henceforth set a and L equal to 1 for simplicity.
FIG. 2.

Perturbation theory and extrapolation at various orders are compared for predicting the average position 〈x〉 of an ideal gas particle in a linear external field. Analytical behavior at infinite order and sampling is shown as a black dashed line, the analytical result with infinite sampling for each order of extrapolation is shown as a red solid line, and perturbation or extrapolation results with varying numbers of randomly sampled configurations from the reference state of β = 5.6 are represented by circles.
Fig. 2 shows finite sampling results for perturbation and extrapolation along with analytical results in the limit of infinite sampling. Finite sampling consists of generating Ns configurations by sampling from P(x) for each particle and calculating 〈x〉 and U for each configuration. It is clear that finite sampling limits both perturbation and extrapolation, but in different ways. Perturbation works well close to the reference temperature but reaches a saturation value further away. The accuracy range is extended slightly with more samples, but the increases in accuracy (i.e., distance from the infinite sampling, infinite-order result) are marginal. The reason for this can be inferred from P(x) at various temperatures (Fig. S1). To obtain the correct average at one temperature, samples are required from all relevant configurations with high P(x) at that temperature. In other words, the distributions of potential energies at the two temperatures must overlap. Thus, sampling only a subset of these configurations amounts to implicit truncation of the average.35 The result is a highly conservative (i.e., predicting no variation with temperature) estimate due to overly concentrated sampling of phase space relevant only to the reference temperature. This behavior is well-known in perturbation theory — most modern techniques involving free energy calculations and enhanced sampling seek to overcome exactly the difficulties described above.3,4
For the ideal gas system investigated in Fig. 2, both linear and quadratic extrapolation are superior to perturbation theory, even though extrapolation suffers from not only sampling error, but also truncation error that is not present in perturbation theory. Depending on the system, however, both errors may be much lower than those obtained from re-weighting techniques. Fig. 2 also provides some sense of the behavior of both errors as a function of extrapolation order and sample size. While first-order extrapolation quickly converges to the infinite sampling limit, second order takes many more samples to attain similar accuracy. At higher orders, finite sampling errors result in inaccurate estimates of local derivatives, which in turn lead to highly inaccurate estimates far from the reference temperature. This is in contrast to the very low truncation error for sixth-order extrapolation with infinite sampling, which nearly exactly tracks the analytical result of Eq. 18.
There is clearly a trade-off between sampling and truncation errors when using extrapolation. As shown in Figs. 2 and 3a error and uncertainty (or imprecision) also grow with extrapolation distance δβ. This is expected since increasing extrapolation distance magnifies errors in derivative estimates according to Eq. 9. The dependence of the uncertainty on sample size and order is summarized in Fig. 3b–c for a fixed temperature difference. Estimation of higher-order derivatives involves higher-order moments of the potential energy, leading to exponentially increasing uncertainty (Fig. 3b). At any order, the uncertainty in extrapolation estimates or derivative estimates vary as or 1/Ns, respectively, with Ns being the number of samples (Fig. 3c). Relative unsigned errors from infinite-sampling results also decrease significantly with sampling and increase quickly as the order is increased (Fig. S2), which is also obvious from Fig. 2. In most practical settings, it is in fact the sampling error that will dominate, limiting the order and determining the truncation error. Even for the simple system investigated here, more than 10000 uncorrelated samples are required to achieve less than 10% uncertainty at third order. In molecular systems involving biomolecules, obtaining on the order of 100000 uncorrelated samples can require hundreds of nanoseconds or more of simulation time. As we demonstrate below, it is likely more efficient to combine the results of short simulations at multiple conditions, using only lower-order information.
FIG. 3.

Uncertainty (standard deviations over 1000 independent data draws at the reference condition) in the average position 〈x〉 relative to the infinite sampling extrapolation result 〈x〉analytic (top row) and in the derivative estimates (bottom) are shown as functions of extrapolation distance δβ (a), extrapolation order (b), and number of samples Ns (c). In (b) and (c) the extrapolation distance is fixed at δβ = 1.0. Uncertainty increases with greater distance from the reference point, higher order, and fewer numbers of samples. In the bottom panel of (a), uncertainties in derivatives do not grow with δβ as these are locally estimated at the reference state.
IV. AN INTERPOLATION STRATEGY FOR OBSERVABLE ESTIMATION
Instead of extrapolating from a single point, we can simultaneously extrapolate from multiple points to improve our estimate. Simulations at additional state points are already necessary to check the accuracy of the extrapolation, even if the uncertainty may be estimated through bootstrapping. Previous work has suggested weighting each extrapolation estimate by the distance to the new state point,15 which we refer to as “weighted extrapolation”, where subscripts 1 and 2 below indicate the two reference points
| (20) |
This formulation affords a great deal of flexibility in that m may be optimized as a free parameter in order to satisfy criteria such as the Gibbs-Duhem relation.15 For simplicity, however, we set m = 20 throughout this work. This approach is most useful in the case of interpolation, when we desire the behavior of the observable over a range between two points at which data is available. From the perspective of free energy calculations, this is similar to techniques that utilize information from two states, such as Bennett’s Acceptance Ratio (BAR)36. Determining the behavior of an observable over an exactly or approximately known region between two states is in fact a common task. We may then use derivative information up to the maximum order possible to interpolate within the interval of interest, greatly reducing our uncertainty and increasing accuracy.
As an alternative to weighted extrapolation, we suggest directly fitting observable values and their derivatives, which are related to fluctuations (e.g., Eqs. 10 and 11), with an interpolating polynomial. Given two sets of observable and derivative values up to order k, it is possible to exactly fit a polynomial of order 2k + 1. For example, with derivative information up to first order we obtain the third-order polynomial that best approximates the observable over the interval of interest. By design, this polynomial will exactly match the provided observables and their derivatives at the values of the interpolation variable (e.g., temperature or density) for which data was collected. Using two points up to arbitrary order of derivatives, this is obtained by solving for the polynomial coefficients ci of order i in the set of Eqs.
| (21) |
It is also possible to incorporate more than two points, further increasing the polynomial order. However, this can lead to overfitting It is also possible to incorporate more with large numbers of data points. As described below, we found a piecewise interpolation procedure to be more reliable.
We directly compare weighted extrapolation, polynomial interpolation, and re-weighting using BAR in Fig. 4a for the average x position in the ideal gas model. In the last technique, we use BAR to estimate the free energy difference, and hence weight of each state, for the lowest and highest temperatures. To re-weight observations from each state to the state of interest, weights from BAR are combined with observed Boltzmann weights. This is very similar to using standard perturbation theory to re-weight, the only difference being that we are also incorporating relative weights between the two states from which samples are drawn. Polynomial interpolation provides the smoothest curve, which is expected in comparison to the weighted extrapolation procedure of stitching together two first-order extrapolations rather than cleanly fitting a higher-order polynomial. Notably, polynomial interpolation also has the highest uncertainty predicted by bootstrap resampling. This indicates that the results for weighted extrapolation and BAR re-weighting exhibit less variance, but in this case also exhibit greater bias. Lower accuracy with BAR re-weighting is due to the same deficiencies as for standard perturbation theory extrapolations. Namely, the lack of phase-space overlap results in a highly conservative estimate heavily weighted towards the state with the lower free energy.
FIG. 4.

Interpolation procedures are shown for weighted extrapolation and interpolating polynomials (both using only first-order derivatives), as well as BAR or MBAR depending on the number of data points (using the pymbar package37). Interpolation from two points is shown in (a), while interpolation using all of the points selected during a recursive interpolation run using polynomial interpolation and an error tolerance of 2% are shown in (b). Eq. 18 is shown as a black dashed line. The same 10000 samples at each temperature are used for each method, with error bars representing one standard deviation in 100 bootstrap resamples. (c) shows polynomial fits on sliding sets of three points selected during recursive interpolation, which are indicated by black squares and vertical lines. For each set, a polynomial in the same color is plotted based on each pair of points (solid lines indicate the outermost points of the set, dotted the left two points, and dash-dot the right two points). In many cases, polynomials diverge significantly outside the interval over which they were fit. In the shared interval, however, good overlap indicates that the local curvature of the polynomial fits is consistent, meaning additional points are not necessary.
This exact malady has been known since the inception of BAR.36 In his original paper, Bennett recommends against using BAR in cases where there is very little overlap of the distributions of potential energy differences. In such cases, Bennett instead suggests to fit the logarithm of each distribution to a polynomial and graphically determine the shift necessary to make the polynomials align, which is the free energy difference. Recent work has also used this same polynomial interpolation of potential energies to efficiently predict free energy differences between crystal polymorphs.38 This is closely related to work that optimally combines cumulant expansions built from two states.32 We may recover identical expressions in the current context by performing polynomial interpolation to determine the free energy as a function of the variable of interest. In this case, we assume that the first state has a free energy of zero and lose an order of the polynomial as we must also estimate the unknown free energy difference.
| (22) |
With first-order derivatives, solving the above system yields
| (23) |
If we let λ1 = 0 and λ2 = 1 and H(λ) = H0 + λΔH, as is common in free energy calculation literature and equivalent to the choices in Ref. 32, we find that
| (24) |
This is identical to the result found by Hummer32 if we note that non-equilibrium work in one direction is the negative of the work in the opposite direction. Going to fourth order in the derivatives (yielding an exact eighth-order polynomial and free energy difference) results in
| (25) |
In the above, C(i) represents the ith cumulant of the free energy evaluated at a specific state indicated by λ. This is again identical to the cumulant expansion derived by Hummer, but with the explicit interpretation as an interpolating polynomial. If we also consider thermodynamic integration via the trapezoid rule, we are assuming that the derivative of the free energy as a function of the variable λ is linear. This is equivalent to assuming that the free energy itself is a second-order polynomial and using the estimated derivatives at the end points to simultaneously fit this polynomial and determine the free energy difference, as in Eq. 22. In the context of estimating free energy differences, we have thus shown that our polynomial interpolation strategy using up to first derivatives is equivalent to thermodynamic integration or optimal combination of cumulant expansions. We also obtain a closed-form polynomial expression of the free energy estimate over the entire interpolation range, whereas other techniques solely provide the free energy difference.
From the above considerations, it is not surprising that an interpolating polynomial for predicting structural observables outperforms re-weighting with BAR (Fig. 4a). Being equivalent to thermodynamic integration in the context of free energy calculations, polynomial interpolation only relies on accurately capturing the local curvature of the observable as a function of the interpolation variable, not on overlapping phase-space probability distributions as in BAR.39 While statistically optimal re-weighting methods such as BAR or the Multistate Bennett Acceptance Ratio (MBAR)40 can reliably provide highly precise free energy estimates, they are not always optimal compared to thermodynamic integration.39 When curvature along the chosen thermodynamic path is high and there is significant phase-space overlap, as is typical in computing solvation free energies of small molecules, re-weighting techniques significantly outperform thermodynamic integration.41,42 Such behavior is not observed in our present work, but is represented by panel c in Fig. 1. Our purpose here is not, then, to advocate for the general use of polynomial interpolation (or equivalently thermodynamic integration) to compute free energy differences or potentials of mean force. We make the connection only to explain differences in performance observed in Fig. 4 and Section V, where there is very little configurational overlap over large changes in temperature or density. This is analogous to the situation shown in Fig. 1(b), where extrapolation or interpolation is efficient while perturbation is not.
If we are not interested in computing the free energy but only an observable over a specific range of conditions, methods that rely on free energy calculations to perform re-weighting will consistently provide estimates heavily biased towards the reference state ensemble. Re-weighting will only be preferred to interpolation if the fluctuations in the observable at a fixed state point rival its variations with changing simulation conditions (Fig. 1(a,c)). For extensive observables, this criterion will be met with vanishing frequency as system size increases. In any scenario, it is expected that if free energies are computed accurately, observables will be as well. However, a reduced computational cost is expected for computing observables alone, as performing the extensive sampling necessary for accurate free energy calculations is typically a computationally expensive endeavor. In such a case, direct polynomial interpolation of the observables further reduces the simulation cost by providing a prediction of the observable over the specified range. Interpolation relies on the local curvature of the observable (as a function of interpolation variable) being of equal or lower order to the estimated polynomial over the interval of interest. In the worst-case scenario shown schematically in Fig. 1(c,d), this is not true and the observable function is rugged. For small fluctuations in the observable (Fig. 1(d)), this will require collecting a similar number of data points as if a re-weighting procedure were implemented.
To address this issue, we require an algorithm to guide selection of additional data points, as well as a simple method to gauge convergence of the interpolation over the range of interest. Heuristics along these lines already exist in the free energy calculation literature, namely that efficiency and accuracy of re-weighting methods may be enhanced by selecting intermediate states that maximize phase-space overlap and enforce constant entropy differences at each step.35,43,44 As mentioned previously, we have found that it is advantageous to fit interpolating polynomials in a piecewise fashion rather than use all data points to estimate coefficients for a higher-order polynomial. This is accomplished through a recursive algorithm. We start with the two most extreme points over the range of interest and collect data at each. Estimates of the observable of interest along with bootstrapped uncertainty estimates are obtained over the entire interval on a fine grid. The relative uncertainties given by are computed and compared to a specified error tolerance. If the tolerance is not met for all points on the interval, the point with maximum uncertainty is selected for new data collection. This algorithm recurses, dividing all high-uncertainty intervals into two parts, until the error tolerance is satisfied on all subintervals. Fig. 4b shows the result of executing this algorithm with a tolerance of 2% on the ideal gas model. A total of four points are necessary to achieve the desired accuracy.
This interpolation method crucially requires accurate estimates of local curvature on each interval. We can check this self-consistently with a simple visualization, similar to checking for histogram overlap when performing free energy calculations.45 This visual check is shown in Fig. 4c. If we consider all sets of three adjacent points used to calculate polynomials, we can compare the local curvature of interpolations using the outer points of the interval to those using the points on the two sub-intervals. If the polynomials on the subintervals match closely the polynomial on the larger interval then the curvature of that interval is well-approximated to the given polynomial order and no additional points are needed. In the ideal gas case, overlap occurs for only a small number of points when using third-order polynomials (Fig. 4c). More generally, local curvature of a third-order polynomial will capture scenarios where the sign of the derivative changes, covering a wide variety of scenarios. However, a third-order polynomial only requires observable values and first derivative information, which is exponentially easier to obtain to a given uncertainty compared to higher-order derivative information (Fig. 3). Additionally, the interpolations on different intervals agree in their value and first derivative at the selected data points. Thus the resulting piecewise function is continuous in both its value and first derivative by construction.
V. PREDICTING STRUCTURAL PROPERTIES OF LIQUID WATER
To demonstrate our above theory and algorithms on a more realistic system, we examine the TIP4P/2005 model of water46 in its liquid state. Simulations of 1400 water molecules spanning a wide range of temperatures (250-350 K) and densities (0.87-1.40 g/cm3) were performed with GROMACS 2016.1,47 with additional details published previously.28 The range of temperatures and densities was selected to span the structural anomaly envelop first described by Errington and Debenedetti,27 which encompasses much of the liquid state including metastable regions (for instance, the state point discussed later at 0.87 g/cm3 and 300 K is very near the liquid-vapor spinodal). Each simulation consists of snapshots saved every 1 ps over 5 ns trajectories, with simulations at 300 K and 1.00 g/cm3 extended to 50 ns to examine the effect of increasing sampling by an order of magnitude. We consider both translational and orientational properties that classify water structure in addition to hard-sphere insertions (0.33 nm radius), which characterize local density fluctuations.48,49 In all results below, error bars are the standard deviation as determined by bootstrap resampling (the calculation is repeated 100 times with random samples of the same size as the original data set drawn with replacement).
A. Variation in temperature
Fig. 5a demonstrates that oxygen-oxygen RDFs at 1.00 g/cm3 may be extrapolated from ambient conditions over nearly the entire liquid-state temperature range using only first-order derivative information. We accomplish this by individually extrapolating the count in each RDF bin before normalization.20 In other words, the count in each bin of the RDF corresponds to the observable X in Eq. 9. The accuracy in Fig. 5 (and Fig. S10) is remarkable considering that a structural anomaly boundary is crossed over this temperature range (see Fig. 4 in Ref. 28). These results hold true even at the highest and lowest densities (Figs. S4–S7). Extrapolations remain quantitatively accurate even when RDFs undergo qualitative changes, such as developing shoulders at lower temperatures. This implies that each set of histogram bin counts varies approximately linearly in temperature according to its own temperature derivative. Since we allow these derivatives to vary for each bin, we capture qualitative shifts in RDF behavior. Using second-order derivative information greatly increases uncertainty in the extrapolation, which remains the case even with an order of magnitude more simulation time (Fig. S3). Given the success of first-order extrapolation, any improvements associated with adding second derivative information are likely not worth the increased cost of sampling to the point of low uncertainty (on the order of 100 ns). Extrapolating RDFs in temperature also allows us to capture variation of the translational order parameter of Errington and Debenedetti27 (Fig. 6a). Based on the integration of RDFs, this metric characterizes radial translational order and is defined as where ξ = rρ1/3 with ξc = 2.843.27 In contrast, re-weighting via perturbation theory only performs well for temperatures close to the reference simulation.
FIG. 5.

In all panels, lines represent direct simulation results at each temperature for RDFs (a) or three-body angle distributions (b) while points are the estimates via extrapolation from 300 K (constant density of 1.00 g/cm3) with 5000 snapshots obtained at regular intervals over a 5 ns simulation. Error bars represent one standard deviation and are determined through bootstrap resampling. The neighbor cutoff was set to 0.34 nm in computing three-body angles.
FIG. 6.

Direct simulation results (solid lines), perturbation theory estimates (stars), and first- (circles) and second-order (diamonds) extrapolations are shown versus temperature for (a) translational order parameters, (b) tetrahedral order parameters, (c)/(d) excess chemical potentials of 0.33 nm radii hard-spheres. Translational order parameters are computed from RDFs extrapolated in temperature from 5 ns simulations at 300 K and 1.00 g/cm3, while all other quantities are extrapolated directly from the same reference state. Due to the inherently high ratio of noise to temperature variation for excess chemical potential estimates at this density, 50 ns of simulation are used for extrapolations in (c) and (d). For clarity, error bars are not shown for perturbation or second-order extrapolation in (c) or (d), as they are on the same scale as the entire ordinate axis.
Similar success is found in temperature extrapolations of orientational properties, while perturbation encounters the same difficulties that were previously discussed. Three-body angles are defined as the angle between two water oxygens within a predefined cutoff (here 0.34 nm) of a central water oxygen. This structural feature has proven critical to developing monatomic models of water50 and has also been shown to qualitatively track water’s response to changes in state conditions or the presence of solutes.28 Again, only 5 ns are necessary to successfully extrapolate entire three-body angle distributions over the entire temperature range (Fig. 5b). Qualitative shifts in the distribution are even more pronounced compared to RDFs, but are nonetheless predicted accurately with only first derivative information. Second derivative information based on these short trajectories only serves to significantly increase uncertainty, as was the case with translational measures of structure. Fig. 6b also demonstrates that extrapolation is successful in predicting the tetrahedral order parameter, which is defined as .27,51 The summation runs over all unique pairs of the four nearest neighbors of a central water oxygen with θi,j, representing the three-body angle of a pair. Averaging is performed over all water oxygens and system configurations. q is related to but can be calculated independently of three-body angle distributions.28,52 In this case, it is more obvious why first order is appropriate — the order parameter only varies linearly in temperature. This is not only the case at ambient conditions, but also at lower and higher densities (Figs. S4–S7).
Water’s density fluctuations as a function of temperature are more difficult to capture with extrapolation. Such fluctuations are critical to understanding solvation phenomena,53 hydrophobic association,48,54 and characterizing the nature of interfaces in contact with water.49,55 Density fluctuations are commonly characterized by the excess chemical potential of a hard-sphere solute, which is given by the probability of having zero water oxygens within the hard-sphere volume
| (26) |
As Eq. 26 depends on histogram counts of a quantity that only depends on sampled configurations, we categorize hard-sphere chemical potential as a structural observable akin to others discussed in this paper. Fig. 6c–d shows extrapolations in temperature from 300 K for hard-sphere excess chemical potentials, also revealing non-monotonic behavior with temperature (extrapolations of P(N = 0) are also shown in Fig. S8). With non-monotonicity in P(N = 0) and , it is no surprise that first-order extrapolation fails for some portions of the temperature range. It is interesting to note that, at this density, the temperature dependence of is weak, with the changes in dominated by its linear dependence on β (Fig. 6c–d). This weak temperature dependence means that extremely precise estimates of the P(N = 0) are needed to correctly capture the variation. As such, we utilize 50 ns at the reference temperature to perform extrapolation in Fig. 6c–d, as it is clear in Fig. S9 that the first derivative estimate with 5 ns of simulation time is highly inaccurate. In this case, the inherent noise in the method used to calculate the observable is similar to its variations with temperature. To reduce the overall simulation time in this scenario, faster converging methods of observable estimation should be employed. Other methods to estimate could then be extrapolated in the same way but at higher certainty and accuracy.
Polynomial interpolations over temperature are presented in Fig. S11, converging to very low uncertainty (and high accuracy) using simulations at only the two most extreme temperatures. Since the translational and tetrahedral order parameters vary approximately linearly over the studied temperature range, extrapolation already performs well and interpolation displays only marginally better accuracy. In the case of hard-sphere chemical potentials, which vary non-monotonically with temperature, interpolation leads to starker improvement over extrapolation (Fig. S11c). Variations with density are non-monotonic for all observables and are explored in detail in the next section.
B. Variation in volume
First-order derivatives in the canonical ensemble of arbitrary observables with respect to volume may be computed according to
| (27) |
where X is the observable of interest, W is the virial, and xi represents the ith degree of freedom in the system. The last term appearing on the right hand side involves the response of the observable itself to changes in volume, and as such will be unique to each observable. A derivation of Eq. 27 along with expressions necessary to compute the last term for a variety of observables are provided in the Appendix. We do not pursue more than first-order derivative information in what follows, as higher-order derivatives in volume require derivatives of forces, which are not readily available in most MD simulation packages. Given the difference in observed uncertainties of first and second-order extrapolations with respect to temperature, it is likely that high uncertainty would prevent the use of such extrapolations. In contrast, perturbation is not feasible at all due to negligible phase-space overlap between simulations at different densities.
On the whole, extrapolation in density is much less successful than in temperature, as shown in Figs. 7–8 and Fig. S12. Contributing to this is the fact that canonical ensemble simulations at different densities are spaced further apart in terms of their phase-space overlap, resulting in higher uncertainties in extrapolation estimates. Liquid structure is typically highly sensitive to density, with pressure changing by multiple orders of magnitude over the range studied here. Additionally, many properties of water naturally exhibit non-monotonic behavior as a function of density. With changing density, water structure changes significantly, crossing the structural anomaly boundary twice27,28 and leading the translational and tetrahedral order parameters to behave non-monotonically. As such, first-order extrapolations should not in fact be expected to produce accurate results over large density differences. On the other hand, perturbation is highly impractical (and as such is not presented) as there is effectively no configurational overlap between even neighboring densities.
FIG. 7.

Lines represent direct simulation results at each density for RDFs (a) or three-body angle distributions (b) while points are the estimates via extrapolation from a density of 1.00 g/cm3 (top) or interpolation from the two most extreme densities of 0.87 and 1.40 g/cm3 (bottom). Temperature is constant at 300 K. Error bars represent one standard deviation and are determined through bootstrap resampling.
FIG. 8.

Direct simulation results (solid lines), first-order extrapolations from 1.0 g/cm3 (circles), and interpolations from the most extreme densities (squares) are shown versus density (at constant temperature of 300 K) for (a) translational order parameters, (b) tetrahedral order parameters, (c) excess chemical potentials of 0.33 nm radii hard-spheres. Translational order parameters are computed from RDFs extrapolated in density from 5 ns simulations at 300 K and 1.00 g/cm3, while all other quantities are extrapolated directly from the same reference state. Interpolations utilize two 5 ns simulations, one from each of the most extreme densities. Hard-sphere chemical potentials could not be computed at densities above 1.20 g/cm3.
It is clear from Figs. 7–8 that successful extrapolation in density would require higher-order derivative information. However, relative uncertainties will grow exponentially with derivative order, as established in Section III. As a result, orders of magnitude more simulation time will be required to estimate even second-order derivatives. More modest increases in simulation time will further lower uncertainty in first-order extrapolations, but will not significantly improve accuracy. We turn instead to our recursive algorithm for polynomial interpolation, using the tetrahedral order parameter as a test case. This metric exhibits non-monotonic behavior in density, which is easy to visualize, as it is a scalar, and can be directly extrapolated or interpolated (unlike the translational order parameter). Fig. 8b shows that interpolation using two state points correctly captures the basic qualitative behavior of the tetrahedral order parameter. However, the local curvature is not accurate across the range of interest. This is largely due to the steep slope estimated at the lowest density point, which is in very close proximity to the liquid-vapor spinodal.28 As a result, the slope of q changes rapidly across low-density, metastable state points (see Fig. S14), representing a mild case of what is shown schematically in Fig. 1d. Though our statistical analysis indicates low uncertainty in presented q values and derivatives, we caution that, as stability limits are approached, all properties become more difficult to determine with high statistical certainty due to increasing wavelengths and magnitudes of density fluctuations.56
Complicating matters further, the bootstrapped uncertainty is already within 1% over the entire region using just the two most extreme densities. In this case, it is necessary to check the consistency of the local curvature in a piecewise fashion by adding an additional point within the interval (specifically where the bootstrapped uncertainty is greatest). The resulting visual consistency check is shown in Fig. 9a. It is clear that the interpolation over the full interval (solid line) does not overlap very well with either of the interpolations over subintervals (dotted and dashed lines). This indicates a lack of consistency in the local curvature and suggests that at least one additional point should be added. The result of adding a single point on the high-density interval is shown in Fig. 9b, revealing that the local curvature is consistent on that interval, but not on the low-density interval where the curvature is in fact the largest. We can reduce the error tolerance for the recursive algorithm until the visual consistency check is passed, or (likely at lower computational cost) manually inspect each interval and add points where the local curvature is highest until self-consistent results are obtained. A complete implementation of this procedure is illustrated in Fig. S13, revealing that 50% or less of the original simulation data is required to achieve the same accuracy. We note, however, that this procedure is only necessary for quantitatively accurate results in the present case. With two 5 ns simulations providing 5 000 snapshots each, we obtain correct qualitative behavior for the tetrahedral order parameter over the density range from 0.87 to 1.40 g/cm3. Such information would be sufficient to determine the presence of an anomaly boundary and roughly approximate its location.
FIG. 9.

Polynomial fits are shown on sliding sets of three points, which are indicated by solid black vertical lines. For each set, a polynomial in the same color is plotted based on each pair of points (solid lines indicate the outermost points of the set, dotted the two higher-density points, and dash-dot the two lower-density points). Piecewise interpolations using three (a) and four (b) data points are compared to demonstrate improvement of local curvature consistency with the number of points. Results from direct simulation at each density are shown as a black dashed line.
VI. CONCLUSIONS
We have demonstrated, both for analytic and more realistic systems, that the use of thermodynamic extrapolation or interpolation performs no worse, and in many cases better, than re-weighting observables to other state conditions using standard perturbation theory. This result is not in fact surprising once connections between thermodynamic extrapolation and the extensive free energy calculation literature are made explicit. We find that the use of interpolating polynomials to calculate free energy differences and profiles along predefined coordinates is a special case of applying interpolating polynomials to general observables. This then illuminates why the same techniques outperform re-weighting for estimating structural observables in the case of very little overlap in phase space.36 Successful interpolations of water structural properties in volume make this point particularly clear, as configurations satisfying other densities are exceptionally rare, rendering re-weighting impractical.
The connection with free energy calculations (or just rudimentary knowledge of numerical methods) also makes it clear that interpolation should be preferred over extrapolation. A particular range of interest for parameters or state variables is not always known, but can usually be determined at little computational cost. Based on extensive uncertainty analysis of our analytic ideal gas system, we have also provided guidelines for allocation of computational resources: as higher-order derivatives are exponentially more difficult to converge to low uncertainty, it is recommended to use only low (first or second) order derivatives and run more short simulations at different conditions. This is corroborated by our studies of water, finding that only a few nanoseconds are required to converge first derivative information while hundreds of nanoseconds may be required for even second-order derivatives. Our subsequent results indicate that the behavior of a system can be determined straightforwardly over a continuous range of conditions by collecting low-order derivative information, which requires minimal additional computational cost. To facilitate the use of such methods, we have presented a recursive interpolation algorithm as well as a simple self-consistency check. These procedures are available as a Python library (available at https://github.com/usnistgov/thermo-extrap) that was used for both the ideal gas and water systems presented here. Such techniques may not only be used to efficiently generate new data, but also to extract additional information from previously generated trajectories, as we have done.
We expect that the presented theory and techniques will improve the efficiency of calculations based on molecular simulation. Derivative information for a very general set of observables is readily available, though typically underused. Our results suggest that the use of this information can greatly reduce the amount of required simulation, even when compared to other techniques for re-using simulation data such as standard perturbation theories. It has recently been pointed out that this derivative information also provides easy access to thermodynamic properties.29 Indeed, entropies are immediately obtained by applying expressions presented here and elsewhere15–17 to determine first temperature derivatives of potentials of mean force. This is possible because potentials of mean force represent differences in natural logarithms of probabilities and we have demonstrated in two cases how to extrapolate bin counts that form the basis of determining relative probabilities. It is not immediately clear that such information may be usefully interpreted in the case of RDFs or three-body angle distributions, but could, for example, quickly determine entropies associated with solvation free energies. Remarkably, this information can be directly extracted from the simulations used to determine solvation free energies without additional computational expense. To further enhance efficiency, it may be fruitful to consider classes of functions beyond polynomials when interpolating or extrapolating. For instance, Gaussian process regression57 only assumes that functions are smooth on a specified length scale, positing the most likely functions satisfying both this criteria and the provided observable values and derivative information. Such improvements are currently under investigation.
Supplementary Material
ACKNOWLEDGMENTS
We thank Vikram Khanna for fruitful conversations and careful reading of the manuscript. This research was performed while J.I.M. held an NRC Research Associateship award at the National Institute of Standards and Technology.
Appendix A: Volume extrapolation in the canonical ensemble
To compute the derivative at constant temperature and number of particles, we follow the derivations for found in McQuarrie58 or Shell.59 Both derivations rely on the scaling of the coordinates by the characteristic length of the system volume. We will here treat cubic volumes where V = L3 so that we can compute and in turn the desired derivative with respect to volume through the chain rule. From the above references and use of the chain rule, we have that
| (A1) |
The summation runs over all degrees of freedom in a specific cartesian dimension x (i.e., atomic coordinates in this dimension). If the potential energy is pairwise, this may simplify the expression to only include pairwise distances in this dimension. As written, however, the above equation includes potentials where the system experiences an external field dependent on the atomic coordinates, or includes angle, dihedral or other terms to describe intramolecular interactions.
The derivative we want is
| (A2) |
We have only written the integration over translational coordinates in the simulation box. This is sufficient to fully describe monatomic particles, but for full molecules we should also integrate over rotations and intramolecular motions, not just center of mass translations. If we assume that such degrees of freedom do not depend on the size of the box, these terms do not affect the above derivative and simply contribute to the definition of the average. This treatment is exact for rigid molecules or for molecules that are small relative to the typical box size. For large flexible molecules, however, even intramolecular interactions may depend on the box size (following best practices in determining simulation box sizes for periodic systems this should in practice occur only rarely). In such cases we may instead simply assume that the integration in Eq. A2 does indeed run over all atomic positions and that the potential energy function includes bonds, angles, etc. in terms of these coordinates (in practice this is in fact the case). In real simulations, the potential energy will also depend on the box size through the application of minimum imaging in systems with periodic boundaries. This is not explicitly treated in the following derivation, but is assumed to be accurately captured if the virial (defined below) is properly computed.
First define a scaled coordinate as and transform the integrals in Eq. A2 so that we can take derivatives directly inside the integral.
| (A3) |
We can substitute in the derivative with respect to Z from Eq. A1, but must determine the derivatives with respect to U and X. If we have not transformed the coordinates inside these functions, we can write
| (A4) |
The same goes for X. Substituting in all of the derivatives
| (A5) |
We now transform the integral back to the original coordinates and clean everything up.
| (A6) |
Using the chain rule we can write
| (A7) |
It is typical to define the virial as . Using this definition we obtain Eq. 27 in the main text
| (A8) |
We can obtain the virial W from most simulation software packages, with rigid-body constraints and periodic boundary conditions with minimum imaging properly accounted for. Note that the above derivation only allows extrapolation up to first order. Continuing to second order will result in second derivatives of the potential energy with respect to the box length, which in turn results in second derivatives of the potential energy with respect to the coordinates. This means that we would need to keep track of the derivatives of the forces, which is not typically trivial in most simulation packages. With the value of the observable and the virial for each simulation configurational snapshot, we can easily compute the first two terms in Eq. 27. A remaining difficulty, however, is the last term involving derivatives of the observable with respect to coordinates. There is no general expression for this quantity as it will depend on the definition of the observable of interest. Derivations for approximations to this term are provided below for radial distribution functions, three-body angle distributions, and hard-sphere insertions. Though this term is typically orders of magnitude smaller than the other terms in Eq. 27, it may still become significant when the difference between the other two terms is small. While we have found the last term in Eq. 27 to be small for RDFs and three-body angle distributions, it makes a non-negligible contribution for hard-sphere insertions. For the case of the tetrahedral order parameter, we do not present a derivation as we expect no contribution — interparticle distances do not affect the calculation of the three-body angle and are only used to determine the four nearest neighbors. The selected neighbors will not change with box scaling as all particle separations will be scaled by the same amount.
1. Radial distribution functions
Extrapolating an RDF entails extrapolating each set of bin counts of a certain interparticle radial distance r. The average fraction of particle pairs with a separation in bin k of fixed bin width d is the average number of bin counts divided by the number of particle pairs and is given by
| (A9) |
The summation runs over all pairs of particles with the ith pairwise particle distance given by ri. The product of Heaviside functions Θ(x) ensures that the configuration is only counted if the interparticle separation is within bin k. In the last line, we have utilized the fact that all particle pairs are identical. It will be convenient to rewrite Eq. A9 explicitly in terms of cartesian coordinates and transform these coordinates such that . For a homogeneous system, setting r1 as the origin does not change the average since the potential energy only depends on relative particle positions. With this new coordinate system and selecting the first pair as particles 1 and 2, we may write
| (A10) |
where the distance between particles 1 and 2 is, in cartesian coordinates, . It is then clear that the simulation observable we are averaging is . All of the derivatives in last term of Eq. 27 will be zero except those with respect to the transformed coordinates of particle 2. The derivative with respect to a single cartesian coordinate of particle 2 is
| (A11) |
Due to most derivatives being zero, the sum inside the expectation in the last term of Eq. 27 becomes
| (A12) |
Taking the expectation over all system configurations yields
| (A13) |
By performing the integration over all coordinates except we obtain a marginal probability . In order to integrate the above, we first transform from cartesian to spherical coordinates.
| (A14) |
By transforming to spherical coordinates, the probability density is divided by a term that cancels the Jacobian determinant. To arrive at the second line we have integrated over the angular coordinates to obtain the marginal probability of only the radial coordinate. P(r) represents the marginal probability density of observing any particle pair with an interparticle separation of r. If the bin width d is sufficiently small, then to a good approximation . Furthermore, these are also approximately equal to ck divided by the width of the bin
| (A15) |
In practice, we obtain ck for each frame by counting the number of pairs of particles with a separation in bin k and dividing by the total number of unique pairs.
Strictly speaking, the definition of the radial distribution function involves normalizing by a term depending on the volume in order to account for the fractional volume of the bins.
| (A16) |
The volume of bin k is given by and V is the total volume. Through the chain rule, the appropriate full derivative for the radial distribution function becomes
| (A17) |
This is only the first-order derivative, but will suffice for the present work.
2. Three-body angle distributions
While an RDF classifies the translational order in water, the angular order may be explored by using the distribution of three-body angles.28 Given a central water oxygen, the three-body angle is that between vectors connecting the central water to two neighbors within its first hydration shell. The hydration shell is simply defined through a cutoff distance rc, with the resulting probability distribution being largely insensitive to this cutoff as long as it does not extend significantly beyond the first minimum in the RDF.28 As with RDFs, we may consider all triples of particles indistinguishable and average over only one of them. As such, the observable that we will average is
| (A18) |
Particle 1 has been chosen as the central particle with distances to the two other particles defined by r1,j. When averaged over all configurations, this counts the number of times that a triple is observed with two particles within the cutoff and forming an angle θ. Technically, the angle θ is binned and so the delta function should be the product of two Heaviside functions. However, the term within the inverse cosine does not depend on the box size due to the normalizations of the vectors between particles and so treatment of this term will not impact the analysis below. This can be seen by imagining that we reference all particles to the coordinates of the central particle and transform to spherical coordinates. The term in the delta function will then no longer depend on the radial coordinates but only the angles. Angular coordinates will have no dependence on the system size and thus not enter into the sum over degrees of freedom in the last term of Eq. 27. By performing the coordinate transform mentioned above, we arrive at the derivative with respect to the radial coordinate of a non-central particle j
| (A19) |
where k represents the other non-central particle forming the angle. Multiplying by the interparticle separation followed by summing and averaging yields
| (A20) |
In the first line, we have asserted that terms from particles 2 and 3 will be identical, resulting in factor of 2. Integrating over all degrees of freedom except those of particles 2 and 3, we arrive at the second line where is a marginal probability density. The final line indicates that further integration results in the probability that the angle θ is formed with particle 3 within the cutoff and particle 2 exactly at a radial distance of rc from the central particle. Configurations contributing to this probability are a subset of those contributing to the full probability of an angle with both non-central particles at or below the cutoff. As such, we may write
| (A21) |
The first probability on the right-hand side is equal to 〈X〉 which is proportional to the number of counts. The second is the probability of r2 being at a distance of rc given that all other conditions are met. In other words, this represents the fraction of the number of counts of an angle θ where one non-central particle is exactly at the cutoff. If we approximate P(r2 = rc|θ, r2 ≤ rc, r3 ≤ rc) to be uniform along r2, then
| (A22) |
Combining this with Eqs. A20 and A21 we obtain
| (A23) |
In practice, 〈X〉 is the average number of counts over all configurations where a triple of particles exhibits an angle θ and the non-central molecules are within the cutoff. Presented three-body angle distributions represent the probability of an angle given that the distance cutoff is satisfied, which involves a normalization by the total number of bin counts. Note that the three-body angle distribution with discrete bins is a probability mass function with the sum of the bins equalling one. While we directly extrapolate bin counts, we always normalize the result so that multiple such distributions may be compared on the same scale.
3. Hard-sphere insertions
For hard-spheres, the potential energy change upon adding the particle is infinite if any molecules overlap and zero otherwise, leading to a simplification in the expression for the excess chemical potential
| (A24) |
Hence the average quantity of interest is the probability that no atoms lie within the defined volume of a hard-sphere particle placed randomly within the system. In the case of most water models, we only check water oxygens as the hydrogens do not participate in LJ or other repulsive core interactions. We can write P(N = 0) for a hard-sphere centered at the origin with a distance of closest-approach to water oxygens of R as
| (A25) |
ri is the radial coordinate (or distance from the origin) of particle i with the product running over all particles in the system (oxygens only for water). The product takes the value of 1 only if no particles are within R of the hard-sphere particle centered at the origin. In this way, the total probability of having no particles in the hard-sphere volume is totaled by integrating over all configurations weighted by their configurational weights. From this it is clear that, in our usual notation, 〈X〉 = P(N = 0) and X = ∏iΘ(ri − R). We have that
| (A26) |
Under an integral, the above ensures that no particles j ≠ i are within the hard-sphere volume and that particle i is exactly at R.
| (A27) |
The approximation on the fifth line assumes that the probability of a particle residing at R is negligibly affected by the fact that no other particles are inside the hard-sphere volume, which for a homogeneous system with uniform particle density leads to the expression on the last line. This is certainly not true if no particles are inside R, in which case the probability of finding a particle at R is increased and is termed the “contact value.”53 More accurate expressions for this quantity may be found in the context of scaled particle theories,53 but are not implemented here.
Footnotes
SUPPLEMENTARY MATERIAL
Additional supporting figures are provided in the Supplementary Material.
DATA AVAILABILITY
The data that support the findings of this study are available from the corresponding author upon reasonable request.
References
- 1.Palmer JC and Debenedetti PG, “Recent advances in molecular simulation: A chemical engineering perspective,” AIChE Journal 61, 370–383 (2015). [Google Scholar]
- 2.Hollingsworth SA and Dror RO, “Molecular Dynamics Simulation for All,” Neuron 99, 1129–1143 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Spiwok V, Sucur Z, and Hosek P, “Enhanced sampling techniques in biomolecular simulations,” Biotechnology Advances 33, 1130–1140 (2015). [DOI] [PubMed] [Google Scholar]
- 4.Yang YI, Shao Q, Zhang J, Yang L, and Gao YQ, “Enhanced sampling in molecular dynamics,” The Journal of Chemical Physics 151, 070902 (2019). [DOI] [PubMed] [Google Scholar]
- 5.Brown WM, Wang P, Plimpton SJ, and Tharrington AN, “Implementing molecular dynamics on hybrid high performance computers – short range forces,” Computer Physics Communications 182, 898–911 (2011). [Google Scholar]
- 6.Brown WM, Kohlmeyer A, Plimpton SJ, and Tharrington AN, “Implementing molecular dynamics on hybrid high performance computers – Particle–particle particle-mesh,” Computer Physics Communications 183, 449–459 (2012). [Google Scholar]
- 7.Eastman P, Swails J, Chodera JD, McGibbon RT, Zhao Y, Beauchamp KA, Wang L-P, Simmonett AC, Harrigan MP, Stern CD, Wiewiora RP, Brooks BR, and Pande VS, “OpenMM 7: Rapid development of high performance algorithms for molecular dynamics,” PLOS Computational Biology 13, e1005659 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Götz AW, Williamson MJ, Xu D, Poole D, Le Grand S, and Walker RC, “Routine Microsecond Molecular Dynamics Simulations with AMBER on GPUs. 1. Generalized Born,” Journal of Chemical Theory and Computation 8, 1542–1555 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Kutzner C, Páll S, Fechner M, Esztermann A, Groot BL, and Grubmüller H, “More bang for your buck: Improved use of GPU nodes for GROMACS 2018,” Journal of Computational Chemistry 40, 2418–2431 (2019). [DOI] [PubMed] [Google Scholar]
- 10.Salomon-Ferrer R, Götz AW, Poole D, Le Grand S, and Walker RC, “Routine Microsecond Molecular Dynamics Simulations with AMBER on GPUs. 2. Explicit Solvent Particle Mesh Ewald,” Journal of Chemical Theory and Computation 9, 3878–3888 (2013). [DOI] [PubMed] [Google Scholar]
- 11.Shaw DE, Grossman J, Bank JA, Batson B, Butts JA, Chao JC, Deneroff MM, Dror RO, Even A, Fenton CH, Forte A, Gagliardo J, Gill G, Greskamp B, Ho CR, Ierardi DJ, Iserovich L, Kuskin JS, Larson RH, Layman T, Lee L-S, Lerer AK, Li C, Killebrew D, Mackenzie KM, Mok SY-H, Moraes MA, Mueller R, Nociolo LJ, Peticolas JL, Quan T, Ramot D, Salmon JK, Scarpazza DP, Schafer UB, Siddique N, Snyder CW, Spengler J, Tang PTP, Theobald M, Toma H, Towles B, Vitale B, Wang SC, and Young C, “Anton 2: Raising the Bar for Performance and Programmability in a Special-Purpose Molecular Dynamics Supercomputer,” in SCI4: International Conference for High Performance Computing, Networking, Storage and Analysis (IEEE, New Orleans, LA, USA, 2014) pp. 41–53. [Google Scholar]
- 12.Purohit A, Schultz AJ, and Kofke DA, “Force-sampling methods for density distributions as instances of mapped averaging,” Molecular Physics 117, 2822–2829 (2019). [Google Scholar]
- 13.Schultz AJ and Kofke DA, “Alternatives to conventional ensemble averages for thermodynamic properties,” Current Opinion in Chemical Engineering 23, 70–76 (2019). [Google Scholar]
- 14.Schultz AJ, Moustafa SG, Lin W, Weinstein SJ, and Kofke DA, “Reformulation of Ensemble Averages via Coordinate Mapping,” Journal of Chemical Theory and Computation 12, 1491–1498 (2016). [DOI] [PubMed] [Google Scholar]
- 15.Mahynski NA, Errington JR, and Shen VK, “Multivariable extrapolation of grand canonical free energy landscapes,” The Journal of Chemical Physics 147, 234111 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16.Mahynski NA, Blanco MA, Errington JR, and Shen VK, “Predicting low-temperature free energy landscapes with flat-histogram Monte Carlo methods,” The Journal of Chemical Physics 146, 074101 (2017). [DOI] [PubMed] [Google Scholar]
- 17.Mahynski NA, Errington JR, and Shen VK, “Temperature extrapolation of multicomponent grand canonical free energy landscapes,” The Journal of Chemical Physics 147, 054105 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Witman M, Mahynski NA, and Smit B, “Flat-Histogram Monte Carlo as an Efficient Tool To Evaluate Adsorption Processes Involving Rigid and Deformable Molecules,” Journal of Chemical Theory and Computation 14, 6149–6158 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Hatch HW, Jiao S, Mahynski NA, Blanco MA, and Shen VK, “Communication: Predicting virial coefficients and alchemical transformations by extrapolating Mayer-sampling Monte Carlo simulations,” The Journal of Chemical Physics 147, 231102 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Mahynski NA, Jiao S, Hatch HW, Blanco MA, and Shen VK, “Predicting structural properties of fluids by thermodynamic extrapolation,” The Journal of Chemical Physics 148, 194105 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Piskulich ZA, Mesele OO, and Thompson WH, “Removing the barrier to the calculation of activation energies: Diffusion coefficients and reorientation times in liquid water,” The Journal of Chemical Physics 147, 134103 (2017). [DOI] [PubMed] [Google Scholar]
- 22.Piskulich ZA, Mesele OO, and Thompson WH, “Activation Energies and Beyond,” The Journal of Physical Chemistry A 123, 7185–7194 (2019). [DOI] [PubMed] [Google Scholar]
- 23.Piskulich ZA and Thompson WH, “The dynamics of supercooled water can be predicted from room temperature simulations,” The Journal of Chemical Physics 152, 074505 (2020). [DOI] [PubMed] [Google Scholar]
- 24.Brini E, Fennell CJ, Fernandez-Serra M, Hribar-Lee B, Lukšič M, and Dill KA, “How Water’s Properties Are Encoded in Its Molecular Structure and Energies,” Chemical Reviews 117, 12385–12414 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 25.Gallo P, Amann-Winkel K, Angell CA, Anisimov MA, Caupin F, Chakravarty C, Lascaris E, Loerting T, Panagiotopoulos AZ, Russo J, Sellberg JA, Stanley HE, Tanaka H, Vega C, Xu L, and Pettersson LGM, “Water: A Tale of Two Liquids,” Chemical Reviews 116, 7463–7500 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 26.Agarwal M, Alam MP, and Chakravarty C, “Thermodynamic, Diffusional, and Structural Anomalies in Rigid-Body Water Models,” The Journal of Physical Chemistry B 115, 6935–6945 (2011). [DOI] [PubMed] [Google Scholar]
- 27.Errington JR and Debenedetti PG, “Relationship between structural order and the anomalies of liquid water,” Nature 409, 318–321 (2001). [DOI] [PubMed] [Google Scholar]
- 28.Monroe JI and Shell MS, “Decoding signatures of structure, bulk thermodynamics, and solvation in three-body angle distributions of rigid water models,” The Journal of Chemical Physics 151, 094501 (2019). [DOI] [PubMed] [Google Scholar]
- 29.Piskulich ZA and Thompson WH, “On the temperature dependence of liquid structure,” The Journal of Chemical Physics 152, 011102 (2020). [DOI] [PubMed] [Google Scholar]
- 30.Zwanzig RW, “High-Temperature Equation of State by a Perturbation Method. I. Nonpolar Gases,” The Journal of Chemical Physics 22, 1420–1426 (1954). [Google Scholar]
- 31.Kirkwood JG, “Statistical Mechanics of Fluid Mixtures,” The Journal of Chemical Physics 3, 300–313 (1935). [Google Scholar]
- 32.Hummer G, “Fast-growth thermodynamic integration: Error and efficiency analysis,” The Journal of Chemical Physics 114, 7330–7337 (2001). [Google Scholar]
- 33.Craik ADD, “Prehistory of Faà di Bruno’s Formula,” The American Mathematical Monthly 112, 119–130 (2005). [Google Scholar]
- 34.Comtet L, Advanced, Combinatorics (D. Reidel Publishing Company, Dordrecht, Holland, 1974). [Google Scholar]
- 35.Lu N and Kofke DA, “Understanding and Improving Free Energy Calculations in Molecular Simulations: Error Analysis and Reduction Methods,” in Free Energy Calculations, edited by Chipot C and Pohorille A (Springer, 2007) pp. 199–247. [Google Scholar]
- 36.Bennett CH, “Efficient estimation of free energy differences from Monte Carlo data,” Journal of Computational Physics 22, 245–268 (1976). [Google Scholar]
- 37.Beauchamp KA, Chodera JD, Naden LN, and Shirts MR, “Pymbar,”. [Google Scholar]
- 38.Kamat K and Peters B, “Diabat Interpolation for Polymorph Free-Energy Differences,” The Journal of Physical Chemistry Letters 8, 655–660 (2017). [DOI] [PubMed] [Google Scholar]
- 39.Klimovich PV, Shirts MR, and Mobley DL, “Guidelines for the analysis of free energy calculations,” Journal of Computer-Aided Molecular Design 29,397–411 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 40.Shirts MR and Chodera JD, “Statistically optimal analysis of samples from multiple equilibrium states,” The Journal of Chemical Physics 129, 124105 (2008). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 41.Shirts MR and Pande VS, “Comparison of efficiency and bias of free energies computed by exponential averaging, the Bennett acceptance ratio, and thermodynamic integration,” The Journal of Chemical Physics 122, 144107 (2005). [DOI] [PubMed] [Google Scholar]
- 42.Bruckner S and Boresch S, “Efficiency of alchemical free energy simulations. II. Improvements for thermodynamic integration,” Journal of Computational Chemistry 32, 1320–1333 (2011). [DOI] [PubMed] [Google Scholar]
- 43.Kofke DA, “Free energy methods in molecular simulation,” Fluid Phase Equilibria 228–229, 41–48 (2005). [Google Scholar]
- 44.Lu N and Kofke DA, “Optimal intermediates in staged free energy calculations,” The Journal of Chemical Physics 111, 4414–4423 (1999). [Google Scholar]
- 45.Pohorille A, Jarzynski C, and Chipot C, “Good Practices in Free-Energy Calculations,” The Journal of Physical Chemistry B 114, 10235–10253 (2010). [DOI] [PubMed] [Google Scholar]
- 46.Abascal JLF and Vega C, “A general purpose model for the condensed phases of water: TIP4P/2005,” The Journal of Chemical Physics 123, 234505 (2005). [DOI] [PubMed] [Google Scholar]
- 47.Abraham MJ, Murtola T, Schulz R, Páll S, Smith JC, Hess B, and Lindahl E, “GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers,” SoftwareX 1-2, 19–25 (2015). [Google Scholar]
- 48.Hummer G, Garde S, Garcia AE, Pohorille A, and Pratt LR, “An information theory model of hydrophobic interactions.” Proceedings of the National Academy of Sciences 93, 8951–8955 (1996). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 49.Jamadagni SN, Godawat R, and Garde S, “Hydrophobicity of Proteins and Interfaces: Insights from Density Fluctuations,” Annual Review of Chemical and Biomolecular Engineering 2, 147–171 (2011). [DOI] [PubMed] [Google Scholar]
- 50.Molinero V and Moore EB, “Water Modeled As an Intermediate Element between Carbon and Silicon †,” The Journal of Physical Chemistry B 113, 4008–4016 (2009). [DOI] [PubMed] [Google Scholar]
- 51.Chau P-L and Hardwick AJ, “A new order parameter for tetrahedral configurations,” Molecular Physics 93, 511–518 (1998). [Google Scholar]
- 52.Chaimovich A and Shell MS, “Tetrahedrality and structural order for hydrophobic interactions in a coarse-grained water model,” Physical Review E 89, 022140 (2014). [DOI] [PubMed] [Google Scholar]
- 53.Ashbaugh HS and Pratt LR, “Colloquium : Scaled particle theory and the length scales of hydrophobicity,” Reviews of Modern Physics 78, 159–178 (2006). [Google Scholar]
- 54.Willard AP and Chandler D, “Instantaneous Liquid Interfaces,” The Journal of Physical Chemistry B 114, 1954–1958 (2010). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 55.Patel AJ, Varilly P, Jamadagni SN, Hagan MF, Chandler D, and Garde S, “Sitting at the Edge: How Biomolecules use Hydrophobicity to Tune Their Interactions and Function,” The Journal of Physical Chemistry B 116, 2498–2503 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 56.Debenedetti PG, Metastable Liquids: Concepts and Principles, Physical Chemistry: Science and Engineering (Princeton University Press, Princeton, NJ, 1997). [Google Scholar]
- 57.Rasmussen CE and Williams CKI, Gaussian Processes for Machine Learning, Adaptive Computation and Machine Learning (MIT Press, Cambridge, MA, 2006). [Google Scholar]
- 58.McQuarrie DA, Statistical Mechanics (University Science Books, Sausalito, CA, 2000). [Google Scholar]
- 59.Shell MS, Thermodynamics and Statistical Mechanics (Cambridge University Press, Cambridge, United Kingdom, 2015). [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
