Skip to main content
Scientific Reports logoLink to Scientific Reports
. 2019 Feb 26;9:2803. doi: 10.1038/s41598-019-39420-x

The UWHAM and SWHAM Software Package

Bin W Zhang 1,, Shima Arasteh 1, Ronald M Levy 1
PMCID: PMC6391495  PMID: 30808938

Abstract

We introduce the UWHAM (binless weighted histogram analysis method) and SWHAM (stochastic UWHAM) software package that can be used to estimate the density of states and free energy differences based on the data generated by multi-state simulations. The programs used to solve the UWHAM equations are written in the C++ language and operated via the command line interface. In this paper, first we review the theoretical bases of UWHAM, its stochastic solver RE-SWHAM (replica exchange-like SWHAM)and ST-SWHAM (serial tempering-like SWHAM). Then we provide a tutorial with examples that explains how to apply the UWHAM program package to analyze the data generated by different types of multi-state simulations: umbrella sampling, replica exchange, free energy perturbation simulations, etc. The tutorial examples also show that the UWHAM equations can be solved stochastically by applying the RE-SWHAM and ST-SWHAM programs when the data ensemble is large. If the simulations at some states are far from equilibrium, the Stratified RE-SWHAM program can be applied to obtain the equilibrium distribution of the state of interest. All the source codes and the tutorial examples are available from our group’s web page: https://ronlevygroup.cst.temple.edu/software/UWHAM_and_SWHAM_webpage/index.html.

Introduction

The weighted histogram analysis method (WHAM) algorithm1,2 is widely applied to estimate the density of states and free energy differences based on the data generated by multi-state simulations. Multi-state simulations are popular advanced sampling algorithms that are applied in computational biophysics and computational chemistry. For example, the temperature replica exchange method is extensively applied to explore the configurational space of biomolecules; the umbrella sampling method is applied to construct free energy landscape of a system on chosen reaction coordinates; the free energy perturbation and Hamiltonian replica exchange method are powerful tools used to estimate the binding affinities of ligands and proteins for small-molecule drug discovery35. The WHAM algorithm is the standard tool to analyze the data generated by these multi-state simulations. Consider the simulation at each state as a measurement of density of states, the WHAM algorithm answers the question what the best estimate of density of states is if measurements have been taken at multiple states.

Since its introduction in 1992, the WHAM algorithm has been examined and studied by several research groups611. The most important improvement of WHAM is that an unbinned WHAM version named the multi-state Bennett acceptance ratio (MBAR) or the binless WHAM (UWHAM) was introduced1214. Compared with the original WHAM, which coarse-grains observations into bins of a histogram, the binless WHAM provides the estimate of density of states for each data point therefore increasing the statistical precision and importantly, estimating the density of states provides a connection with the potential distribution theorem15,16.

Complementary to the study of WHAM itself, how to solve WHAM equations efficiently in practice is another topic that has been an object of research1720. In fact, this topic became more challenging and more urgent after the introduction of binless WHAM because of the dramatic increase of the number of variables without coarse-graining. In ref.14, Tan et al. proposed to solve the UWHAM equations by minimizing a convex function. To further remove the computational bottleneck in scaling up UWHAM, we developed methods called stochastic UWHAM (SWHAM) which solve the UWHAM equations stochastically by using generalized ensemble algorithms to resample the data collected at multiple states21,22. One important assumption of applying WHAM is that the data obtained from each state has already reached global equilibrium. However, sometimes this assumption does not hold if the barriers between free energy basins are high at some of the states and the simulation times are not long enough. We developed a method called Stratified-UWHAM23 to analyze the data generated by multi-state simulations when the simulations at some states are far from equilibrium.

The purpose of this paper is to introduce the UWHAM and SWHAM software package developed by our group. The programs used to solve the UWHAM equations are written in the C++ language and operated via the command-line interface. The basic solver solves the UWHAM equations by either a direct iteration method or minimization of a convex function. When the data ensemble is large, we show that the multi-state free energies can be obtained directly by running serial tempering-like SWHAM (ST-SWHAM), which resamples the raw data by applying the serial tempering (ST) protocol; the multi-state distributions can be obtained directly by running replica exchange-like SWHAM (RE-SWHAM), which resamples the raw data by applying the replica exchange (RE) protocol. If the simulations at some states are far from convergence, the multi-state distributions can be estimated by Stratified RE-SWHAM. Local WHAM22, which is a variant of ST-SWHAM that couples the adjacent states by a stochastic resampling procedure, is also included in this software package. The remaining part of the paper proceeds as follows: First, we briefly review the theoretical basis of UWHAM and SWHAM. Then we introduce the tutorial examples on the web page of the UWHAM and SWHAM software package.

Methods and Discussion

UWHAM

Suppose M parallel (independent or coupled) simulations in the canonical ensemble are run at M states. Each state is characterized by a specific combination of thermodynamic parameters and potential energy functions. They are referred to as λ-states in the remaining part of this paper to avoid the confusion with the terms such as conformational states and microstates. Suppose Xαi is the ith microstate observed at the αth λ-state, the probability of observing Xαi at the γth λ-state is

Pγ(Xαi)~qγ({x}αi)Zγ=exp{βγEγ({x}αi)}Zγ, 1

where qγ({x}αi) = exp {−βγEγ({x}αi)} is the Boltzmann’s factor of Xαi at the γth λ-state; {x}αi is the coordinates of the microstate Xαi; βγ is the inverse temperature of the γth λ-state; Eγ({x}αi) is the potential energy of the microstate Xαi at the γth λ-state; and Zγ is the partition function of the γth λ-state. The likelihood of the observed data is proportional to14

α=1Mi=1NαΩ(uαi)qα(uαi)Zα, 2

where uαi is the energy coordinate of the microstate Xαi that in general may be written as the sum of a reference energy plus perturbations (see ref.14). Nα is the total number of observations observed at the αth λ-state; and Ω(uαi) is the density of states. Let Zˆα and Ωˆ(uγi) denote estimates of the partition function of the αth λ-states and the density of states of uγi, respectively. These two estimates satisfy the equation

Zˆα=γ=1Mi=1Nγqα(uγi)Ωˆ(uγi). 3

Maximizing the log likelihood function yields

Ωˆ(uγi)=1κ=1MNκZˆκ1qκ(uγi). 4

Eqs (3) and (4) are the UWHAM (or MBAR) equations13,14. Note that the UWHAM estimates do not depend on the original λ-state at which each observation was observed. Therefore the UWHAM equations can be simplified as

Zˆα=i=1Nqα(ui)Ωˆ(ui)Ωˆ(ui)=1κ=1MNκZˆκ1qκ(ui), 5

where N=α=1MNα is the total number of observations.

The UWHAM estimate of the probability of observing the observation ui at the αth λ-state is

pˆα(ui)=Zˆα1Ωˆ(ui)qα(ui)=wˆα(ui)Zˆα. 6

where wˆα(ui)=Ωˆ(ui)qα(ui) is the unnormalized probability. We can define one of the λ-states as the reference state, and the normalized probability of observing the observation ui at the reference state is

wˆ0(ui)=Ωˆ(ui)q0(ui)j=1NΩˆ(uj)q0(uj); 7

and wˆα=wˆ0(ui)Δqα(ui), where Δqα(ui) = qα(ui)/q0(ui) = exp{−[βαEα(ui) − β0E0(ui)]} is the biasing factor. Then the equation array Eq. (5) can be rewritten as

Zˆα=i=1Nwˆ0(ui)Δqα(ui)wˆ0(ui)=1κ=1MNκZˆκ1Δqκ(ui). 8

In practice, the UWHAM program solves the equation array Eq. (8) instead of Eq. (5). Suppose A is a property of interest of the system. According to Eq. (6), the expectation value of the property A at the αth λ-state is calculated by the weighted average

Aα=i=1Nwˆα(ui)A(ui)i=1Nwˆα(ui)=i=1Nwˆ0(ui)Δqα(ui)A(ui)i=1Nwˆ0(ui)Δqα(ui). 9

where A(ui) is the the property A measured by using the ith observation.

Currently, a self-consistent iteration solver and a solver that optimizes a convex function by using the Newton-Raphson algorithm14 have been implemented in the UWHAM program to solve the UWHAM equations.

SWHAM

Suppose the raw data were generated from simulations at M λ-states, and the total number of observations is N. During the procedure of UWHAM analysis, the program needs to evaluate M biasing factors (or Boltzmann’s factors) for each observation at the beginning. Namely, the UWHAM program evaluates a biasing matrix which contains n × M2 elements, where n = N/M is the average number of observations observed at each λ-state. Then the UWHAM equations are solved by minimization of a convex function, which involves multiplication of matrices that contain M × N elements (as large as the biasing matrix) and diagonalization of matrices that contain M × M elements. The costs of memory and computational time of running UWHAM are proportional to the second order of the number of λ-states M. To remove this computational bottleneck in scaling up UWHAM, we developed methods which solve UWHAM equations stochastically by using the generalized ensemble algorithms.

RE-SWHAM

RE-SWHAM is an algorithm that we developed to solve the UWHAM equations stochastically by applying the replica exchange (RE) protocol to resample the raw data generated by multi-state simulations21. As shown in Fig. 1, the observations observed at each λ-state are collected as the database for that λ-state beforehand. Then RE-SWHAM analyses are run by performing cycles of RE simulations. Each cycle consists of a “move” procedure and an “exchange” procedure. During the move procedure of RE-SWHAM, an observation in the database of a λ-state is randomly chosen with equal probability to associate with the replica at that λ-state. During the exchange procedure of RE-SWHAM, we attempt to swap two random replicas based on the Metropolis criterion. If the swap is accepted, in addition to swapping the replicas, the observation associated with the replica is also swapped to the database of the other λ-state21. The exchange step should be repeated multiple times to approach the infinite swapping limit for the best sampling efficiency24. At the end of the exchange procedure, the observation associated with the replica at each λ-state is recorded as the output of that λ-state. Note the direct outputs of RE-SWHAM are the estimates of the equilibrium distribution at each λ-state.

Figure 1.

Figure 1

An illustration of the RE-SWHAM algorithm. This drawing illustrates two replica exchange cycles of the RE-SWHAM method, and shows only two λ-states with “gray” or “cyan” color. In each cycle one data element is chosen from λ-state first, then a replica exchange is performed. In the first cycle since the swap is accepted, the data associated with the two replicas is swapped to the other λ-state’s data array. At the end of each cycle, the data associated with replicas are recorded as the output like explicit RE simulations. Reprinted (adapted) with permission from ref.21. Copyright (2015) American Chemical Society.

In ref.21, we proved that the distribution of the outputs of RE-SWHAM at each λ-state are asymptotic to the UWHAM estimate when the number of observations observed at each λ-state is large by treating RE-SWHAM as a random walk in the space of the weight arrays of observations. Here we provide an alternative proof. Consider a trial exchange in RE-SWHAM which swaps one observation um at the αth λ-state and the other observation un at the γth λ-state. The probability that this trial exchange is accepted is

Pex=p˜α(um)p˜γ(un)min(1,exp[βαEα(un)]exp[βγEγ(um)]exp[βαEα(um)]exp[βγEγ(un)])=p˜α(um)p˜γ(un)Ψ(log[qα(um)qγ(un)qα(un)qγ(um)]). 10

where p˜X(uY) is the normalized time-average probability of choosing the observation uY to associate with the replica at the X th λ-state, and Ψ is the Metropolis function25

Ψ(x)=min(1,exp[x]), 11

which has the property Ψ(x)/Ψ(−x) = exp{−x}. Consider the reverse trial exchange that swaps the observation un at the αth λ-state and the observation um at the γ λ-state. The probability that this trial exchange is accepted is

Pex=p˜α(un)p˜γ(um)min(1,exp[βαEα(um)]exp[βγEγ(un)]exp[βαEα(un)]exp[βγEγ(um)])=p˜α(un)p˜γ(um)Ψ(log[qα(un)qγ(um)qα(um)qγ(un)]). 12

If the RE-SWHAM resampling procedure converges, Pex and Pex will agree with each other for each pair of observations (um, un) and each pair of λ-states (α, γ), which leads to the detailed balance relation of RE-SWHAM:

p˜α(um)/qα(um)p˜α(un)/qα(un)=p˜γ(um)/qγ(um)p˜γ(un)/qγ(un),forall(um,un)and(α,γ). 13

Eq. (13) can be rewritten as

p˜α(um)/qα(um)p˜0(um)/q0(um)=p˜α(un)/qα(un)p˜0(un)/q0(un)=Zˆα1,forall(um,un)andα. 14

where subscript 0 denotes the reference state. Then the probability p˜α(um) can be expressed as

p˜α(um)=Zˆα1Ωˆ(um)qα(um),forallumandα, 15

where Ωˆ(um)=p˜0(um)/q0(um). Summing both sides of Eq. (15) over all the observations and applying the relationship m=1Np˜α(um)=1 at each λ-state yields

Zˆα=m=1NΩˆ(um)qα(um). 16

Note that the probability of finding the observation um in the database of the αth λ-state is Nαp˜α(um) and there is one copy of each observation in the databases of all λ-states, namely, α=1MNαp˜α(um)=1. Multiplying both side of Eq. (15) by Nα and summing over all the λ-states yields

Ωˆ(um)=1α=1MNαZˆα1qα(um). 17

Thus, the RE-SWHAM estimates Zˆα and Ωˆ(um) satisfy Eqs (16) and (17), which are equivalent to the UWHAM equations (Eq. (5)).

ST-SWHAM

ST-SWHAM is an algorithm that we developed to solve the UWHAM equations stochastically by applying the serial tempering (ST) protocol to resample the raw data generated by multi-state simulations22. The procedure is illustrated in Fig. 2. Like the RE-SWHAM analysis, the observations observed at each λ-state are collected as the database for that λ-state beforehand. However, unlike resampling the data using replica exchanges, there is only one “simulation run” in the serial tempering resampling algorithm. For the sake of comparison and convenience, we still refer to this single simulation as a replica in this paper. Serial tempering simulations are also run by cycles, and each cycle consists of a “move” procedure and a “jump” procedure. During the move procedure of ST-SWHAM, an observation in the database of the λ-state sampled by the replica is randomly chosen with equal probability to associate with the replica. During the jump procedure, the replica jumps to the αth λ-state according to the probability22

p(α|ui;ζ,π0)=πα0eζαqα(ui)κ=1Mπκ0eζκqκ(ui), 18

where ui is the ith observation associated with the replica; ζκ = −lnZκ is the unitless free energy of the κth λ-state; πκ0=Nκ/N is the proportion of the κth λ-state of the raw data generated by the multi-state simulations; and qκ(ui) is the biasing factor of the ith observation at the κth λ-state. Suppose πκ is the observed proportion of the κth λ-state sampled by the replica during the ST-SWHAM analysis. The values of {ζκ} are adjusted during the analysis of ST-SWHAM until the observed proportion of the replica being at the κth λ-state πκ agrees with πκ022. Note the direct outputs of ST-SWHAM are the estimates of the free energies of different λ-states — {ζκ}.

Figure 2.

Figure 2

An illustration of the ST-SWHAM algorithm. This drawing illustrates two serial tempering cycles of the ST-SWHAM method, and shows only two λ-states with “gray” or “cyan” color. In each cycle one data element is chosen from the λ-state sampled by the replica with equal probability to associate with the replica. Then the replica jumps to one of the λ-states according to the probability calculated by Eq. [18]. At the end of each cycle, the free energy estimates {ζk} are adjusted to match the observed proportion of the replica being at the κth λ-state πκ with the proportion of the κth λ-state of the raw data generated by the multi-state simulations πκ0.

It can be shown that ζκ is the UWHAM estimate of the free energy of the κth λ-state when πκ and πκ0 agree with each other for all λ-states. The details of the proof that ST-SWHAM solves the UWHAM equations stochastically can be found in ref.22. One brief rationale is as follows. First, if πκ equals πκ0, the probability of each observation being chosen to associate with the replica during the ST-SWHAM analysis is 1/N, where N is the total number of observations. Therefore, the observed proportion of the αth λ-state sampled by the replica during the ST-SWHAM analysis is

πα=1Ni=1Np(α|ui;ζ,π0)=1Ni=1Nπα0eζαqα(ui)κ=1Mπκ0eζκqκ(ui). 19

On the other hand, note that

1Ni=1Neζˆαqα(ui)κ=1Mπκ0eζˆκqκ(ui)=i=1NΩˆ(ui)qα(ui)Zα=i=1Npˆα(ui)=1. 20

Then πα0 can be rewritten as

πα0=1Ni=1Nπα0eζˆαqα(ui)κ=1Mπκ0eζˆκqκ(ui). 21

Comparison between Eqs (19) and (21) leads to the conclusion that πα and πα0 agree with each other if ζα=ζˆα for each λ-state.

The jump of the replica following Eq. (18) was referred to as the global jump proposal in ref.22 because the replica can reach any λ-state of the system by one jump. According to Eq. (18), every jump of the replica requires calculations of M exponential functions, where M is the total number of λ-states. When the total number of states is large, ST-SWHAM analyses using the global jump proposal take a long time to converge. In our software package, we implemented a much faster approximate solver of UWHAM–ST-SWHAM using a local jump proposal. This algorithm was referred to as local WHAM in ref.22 because the replica can only be at the λ-states that are the local neighbors of the initial λ-state at the end of the jump procedure if the number of jumps per cycle is finite. Suppose the replica that associates with the observation ui is at the γth λ-state initially. The procedure of performing one jump in local WHAM is as follows22:

  • select a trial λ-state with uniform probabilities from the nearest neighbors of the γth λ-state, suppose the chosen λ-state is the αth λ-state.

  • accept the αth λ-state as the new λ-state to jump to according to the Metropolis probability

min{1,Γ(α,γ)Γ(γ,α)p(α|ui;ζ,π0)p(γ|ui;ζ,π0)}, 22

where p(α|ui; ζ, π0) and p(γ|ui; ζ, π0) are defined by Eq. (18); and Γ(γ, α) is the probability of choosing the αth λ-state as the trial λ-state when the replica is at the γth λ-state originally. Namely, Γ(γ, α) = 1/nγ, where nγ is the total number of the nearest neighbors of the γth λ-state if the αth λ-state is one of the nearest neighbors of the γth λ-state; Γ(γ, α) = 0 otherwise.

As can be seen, the replica can only be at the original λ-state or one of its nearest neighbors after one jump. However, the replica can diffuse further away from the original λ-state by repeating this one jump procedure multiple times. As the number of jumps per cycle increases, the results of local WHAM converges asymptotically to the results of ST-SWHAM that uses the global jump proposal22. Therefore, the jump of the replica following Eq. (18) in the infinite jump limit in serial tempering simulations is analogous to the infinite swapping limit in replica exchange simulations24.

In ST-SWHAM, the free energy estimates are adjusted during the analysis until the observed proportion of the replica being at the κth λ-state πκ agrees with the proportion of the κth λ-state of the raw data generated by the multi-state simulations πκ0. So far a variant of the updating algorithm discussed in ref.22 is implemented in the ST-SWHAM program.

Stratified RE-SWHAM

When applying UWHAM and its stochastic solvers, the basic assumption is that the simulation at each λ-state is “approximately” equilibrated. However, this assumption might not always hold. To handle such situations, we developed an analysis tool called Stratified-UWHAM and its stochastic solver Stratified RE-SWHAM to compute free energy and expectations from a multi-state ensemble when the simulations at a subset of λ-states are far from global equilibrium23. In ref.23, we showed that the Stratified UWHAM equations can be solved in the form of the original UWHAM equations (Eq. (5)) with an expanded set of λ-states. The stochastic solver, Stratified RE-SWHAM, has been included in the UWHAM and SWHAM software package. See the Supporting Information for a brief review and discussion about Stratified UWHAM and Stratified RE-SWHAM.

Illustrative applications

So far the tutorial examples include how to analyze the data generated by “one dimensional umbrella sampling”, “two dimensional umbrella sampling”, “temperature replica exchange”, “Hamiltonian replica exchange”, “two dimensional replica exchange” and “ free energy perturbation” simulations. The tutorials provide the raw data generated by different types of multi-state simulations and explain the corresponding analysis procedures and outputs in details.

One Dimensional Umbrella Sampling

We explain how to apply UWHAM or ST-SWHAM to analyze the raw data generated by one dimensional umbrella sampling simulations. The potential function of the system studied in this example is a one dimensional double well potential26

U(x)=HW4(x2W2)2, 23

where H = 20 kBT is the height of the barrier between the two wells; kB is Boltzmann’s constant; T is the temperature; and W = 1 is the half width between the two minima of the potential. This one dimensional potential can be explored by a Brownian particle simulated with the over-damped Langevin dynamics26. Here we applied 31 parabolic potentials in the region between x = −3 to x = 3 to perform the umbrella sampling simulations. Then UWHAM and ST-SWHAM are used to analyze the data and construct the potential energy profile.

Umbrella sampling simulations are usually applied to construct free energy profiles for systems with multiple degrees of freedom. Although the example that we used here is a Brownian particle governed by a one dimensional potential function, the analysis procedure is the same for applying UWHAM or ST-SWHAM to construct one dimensional free energy profiles of complex systems. In such cases, the position of the complex system projected on the chosen reaction coordinate is analogous to the position of the Brownian particle in this tutorial.

Two Dimensional Umbrella Sampling

This example explains how to apply UWHAM or ST-SWHAM to raw data generated by two dimensional umbrella sampling simulations (of ~100 degrees of freedom) to construct the free energy profile. The system studied in this example is an alanine dipeptide (AlaD) molecule in implicit solvent at 300 K. The simulations were performed by using the GROMACS 5.1.2 simulation package with the Amber99SB force field and the OBC GB model27,28. To explore the two dimensional free energy surface (the Ramachandran plot of AlaD), we applied 24 × 24 parabolic potentials by using the PLUMED plugin29 to perform the umbrella sampling simulations. The Ramachandran plots of AlaD are constructed by using the UWHAM and ST-SWHAM estimates.

Temperature Replica Exchange

We explain how to apply UWHAM or RE-SWHAM to raw data generated by temperature replica exchange simulations to obtain the estimates of the equilibrium distribution at the λ-state of interest. The system studied in this example is the same as the previous example–an alanine dipeptide (AlaD) molecule in implicit solvent. The RE simulations were performed by using the GROMACS 5.1.2 simulation package with the Amber99SB force field and the OBC GB model27,28. The coupled simulations were run at 10 temperatures (300 K, 317.52 K, 336.063 K, 355.689, 376.462 K, 398.447 K, 421.716 K, 446.345 K, 472.411, 500 K). The Ramachandran plots of AlaD in implicit solvent at 300 K are constructed by using the UWHAM and RE-SWHAM estimates.

Free Energy Perturbation

This example shows how to analyze the data generated by free energy perturbation (FEP) simulations. Here we calculate the solvation free energy of a water molecule in pure solvent (TIP3P) at 300 K by using the slow-growth method. The simulations were performed by using the GROMACS 5.1.227 and the TIP3P water model. In this example, we ran 11 independent parallel simulations for a box of pure solvent with a fixed tagged water molecule inside. The interaction between the tagged water molecule and the environment were gradually turned off through 11 λ-states30. The chosen λ values are 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0. The UWHAM estimate of the solvation free energy of a water molecule in pure solvent is −6.18 kcal/mol. One can obtain the same result by using ST-SWHAM. More details and discussion about measuring the excess chemical potential of water molecules in solution using UWHAM can be found in ref.30.

BEDAM: Hamiltonian Replica Exchange

We explain how to use UWHAM or RE-SWHAM to analyze the data generated by Hamiltonian replica exchange simulations. In this example, we study the binding affinity of a guest molecule (heptanoate) to a host molecule (β-cyclodextrin) in implicit solvent (OPLA-AA/AGBNP2)31,32. Here we apply the binding energy distribution analysis method (BEDAM)33 to obtain the binding free energy and binding energy distributions of this complex. BEDAM is a free energy method based on the Hamiltonian replica exchange algorithm. Suppose there are M parallel simulations in BEDAM, the Hamiltonian (potential) function of the ith λ-state is

Hi=V0+λiu, 24

where V0 is the effective potential energy of the complex without the direct and solvent-mediated ligand-receptor interactions, and u is the binding energy33. Namely, the λ factor in BEDAM simulations linearly scales the interaction between the ligand and acceptor. We ran BEDAM simulations at 300 K by using 16 λ-states. The chosen λ values are 0.0, 0.001, 0.002, 0.004, 0.01, 0.04, 0.07, 0.1, 0.2, 0.4, 0.6, 0.7, 0.8, 0.9, 0.95, 1.021. We applied UWHAM to estimate the binding free energy of the β-cyclodextrin Heptanoate Complex— −0.603 kcal/mol + Gvsite, where Gvsite is a correction because of the restraint applied to the ligand during the BEDAM simulation. One can obtain the same result by applying ST-SWHAM to the raw data. We also show how to apply UWHAM or RE-SWHAM to estimate the equilibrium distribution of the binding energy at the λ = 1 state (full interaction state).

Two Dimensional (Temperature and Hamiltonian) Replica Exchange

This example shows how to use SWHAM to analyze the data generated by two dimensional (Hamiltonian and temperature) replica exchange simulations. We study the binding affinity of a guest molecule (heptanoate) to a host molecule (β-cyclodextrin) in implicit solvent (OPLA-AA/AGBNP2)32 at different temperatures. The raw data used in this example were generated by 15 separated BEDAM33 simulations at temperatures 200 K, 206 K, 212 K, 218 K, 225 K, 231, 238 K, 245 K, 252 K, 260 K, 267 K, 275, 283 K, 291 K, 300 K. The chosen λ values are the same as the previous example–0.0, 0.001, 0.002, 0.004, 0.01, 0.04, 0.07, 0.1, 0.2, 0.4, 0.6, 0.7, 0.8, 0.9, 0.95, 1.0. There are totally 16 × 15 = 240 states, and each state has 144,000 data points21,22. Although there are no exchanges between replicas at different temperatures, the procedure described in this tutorial can be applied to two dimensional (Hamiltonian and temperature) replica exchange simulations without any alteration. The goal of this practice is to obtain the best estimates of the binding affinity at 200 K, which is the most difficult for BEDAM simulation to converge. Because the raw data ensemble is large, UWHAM is not suitable to analyze them directly. Here, we applied RE-SWHAM to estimate the equilibrium distribution of binding energies of each λ-state at 200 K. And the RE-SWHAM results are compared with the corresponding distributions calculated from the raw data. See ref.21 and 22 for more discussion about this tutorial example. The equilibrium distributions constructed by the RE-SWHAM output can be used as the input for UWHAM to estimate the binding free energy at the temperature of interest. The binding free energy of the β-cyclodextrin Heptanoate Complex is about −6.3 kcal/mol + Gvsite at 200 K, which is much stronger compared with its binding free energy at 300 K. This result can also be obtained by applying ST-SWHAM with the local jump algorithm to the raw data directly.

Two Binding Modes of the β-cyclodextrin Heptanoate Complex

The β-cyclodextrin heptanoate complex has two binding states depending on the orientation of the heptanoate molecule23. The two binding modes are referred to as the UP and DOWN macrostates. We ran two sets of independent MD simulations at 300 K of the β-cyclodextrin heptanoate complex in implicit solvent (AGBNP GB model32) at 16 λ-states. The initial structures of the complex in the first and the second sets of simulations were chosen from the UP and Down macrostates, respectively. The interaction between the ligand and the receptor was scaled by a λ factor like BEDAM33, However, all the simulations are independent. The chosen λ values are (0.0, 0.001, 0.002, 0.004, 0.01, 0.04, 0.07, 0.1, 0.2, 0.4, 0.6, 0.7, 0.8, 0.9, 0.95, 1.0). In this example, the λ-states with the largest seven λ values (λ = 1.0, 0.95, 0.9, 0.8, 0.7, 0.6, 0.4) are considered as the partially connected states because it is difficult for the binding complex to switch its binding mode and the simulations have not converged at these λ-states; the other nine λ-states are the fully connected states23. This tutorial shows how to apply Stratified RE-SWHAM to estimate the equilibrium distribution at the λ = 1 state (full interaction state) when some simulations are far from convergence. See ref.23 for more discussion about this tutorial example.

Supplementary information

Supporting Information (168.3KB, pdf)

Acknowledgements

This work was supported by NIH grant (GM30580), NSF grant (1665032) and by an NIH computer equipment grant OD020095. This work also used Extreme Science and Engineering Discovery Environment (XSEDE), which is supported by National Science Foundation (ACI-1053575). The authors acknowledge invaluable discussions with Zhiqiang Tan at Rutgers University.

Author Contributions

B.W.Z. and R.M.L. wrote the manuscript. B.W.Z. wrote the program codes and prepared the tutorial examples. B.W.Z. and S.A. constructed the web page. All authors reviewed the manuscript.

Data Availability

The UWHAM and SWHAM software package and its tutorials are available from the web page: https://ronlevygroup.cst.temple.edu/software/UWHAM_and_SWHAM_webpage/index.html. The UWHAM and SWHAM software package is distributed using the MIT license. In the future, we will keep adding more examples of the application of UWHAM and SWHAM to the web page. For instance, free energy perturbation (FEP) is one popular method that is applied to measure the relative ligand binding potency34,35. Currently we are applying UWHAM to analyze the FEP data and extract a density of states that can be used to estimate the relative binding free energy differences for multiple ligands simultaneously to solve the cycle closure challenge34. We will continue optimizing the code and plan to introduce parallelism to the software package.

Competing Interests

The authors declare no competing interests.

Footnotes

Publisher’s note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Electronic supplementary material

Supplementary information accompanies this paper at 10.1038/s41598-019-39420-x.

References

  • 1.Kumar S, Rosenberg JM, Bouzida D, Swendsen RH, Kollman PA. The weighted histogram analysis method for free-energy calculations on biomolecules. i. the method. J. Comput. Chem. 1992;13:1011–1021. doi: 10.1002/jcc.540130812. [DOI] [Google Scholar]
  • 2.Kumar S, Rosenberg JM, Bouzida D, Swendsen RH, Kollman PA. Multidimensional free-energy calculations using the weighted histogram analysis method. J. Comput. Chem. 1995;16:1339–1350. doi: 10.1002/jcc.540161104. [DOI] [Google Scholar]
  • 3.Zuckerman DM. Equilibrium sampling in biomolecular simulations. Annu. Rev. Biophys. 2011;40:41–62. doi: 10.1146/annurev-biophys-042910-155255. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Gallicchio E, Levy RM. Advances in all atom sampling methods for modeling protein, ligand binding affinities. Curr. Opin. Struct. Biol. 2011;21:161–166. doi: 10.1016/j.sbi.2011.01.010. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Maximova T, Moffatt R, Ma B, Nussinov R, Shehu A. Principles and overview of sampling methods for modelling macromolecular structure and dynamics. PLoS Comput. Biol. 2016;12:e1004619. doi: 10.1371/journal.pcbi.1004619. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6.Roux B. The calculation of the potential of mean force using computer-simulations. Comput. Phys. Commun. 1995;91:275–282. doi: 10.1016/0010-4655(95)00053-I. [DOI] [Google Scholar]
  • 7.Bartels, C. & Karplus, M. Multidimensional adaptive umbrella sampling: Applications to main chain and side chain peptide conformations. J. Comput. Chem. 18, 1450–1462, 10.1002/(sici)1096-987x (1997).
  • 8.Bartels C. Analyzing biased Monte Carlo and molecular dynamics simulations. Chem. Phys. Lett. 2000;331:446–454. doi: 10.1016/s0009-2614(00)01215-x. [DOI] [Google Scholar]
  • 9.Souaille M, Roux B. Extension to the weighted histogram analysis method: combining umbrella sampling with free energy calculations. Comput. Phys. Commun. 2001;135:40–57. doi: 10.1016/s0010-4655(00)00215-0. [DOI] [Google Scholar]
  • 10.Gallicchio E, Andrec M, Felts AK, Levy RM. Temperature weighted histogram analysis method, replica exchange, and transition paths. J. Phys. Chem. B. 2005;109:6722–6731. doi: 10.1021/jp045294f. [DOI] [PubMed] [Google Scholar]
  • 11.Chodera JD, Swope WC, Pitera JW, Seok C, Dill KA. Use of the weighted histogram analysis method for the analysis of simulated and parallel tempering simulations. J. Chem. Theory Comput. 2007;3:26–41. doi: 10.1021/ct0502864. [DOI] [PubMed] [Google Scholar]
  • 12.Tan Z. On a likelihood approach for Monte Carlo integration. J. Am. Stat. Assoc. 2004;99:1027–1036. doi: 10.1198/016214504000001664. [DOI] [Google Scholar]
  • 13.Shirts MR, Chodera JD. Statistically optimal analysis of samples from multiple equilibrium states. J. Chem. Phys. 2008;129:124105. doi: 10.1063/1.2978177. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Tan Z, Gallicchio E, Lapelosa M, Levy RM. Theory of binless multi-state free energy estimation with applications to protein-ligand binding. J. Chem. Phys. 2012;136:144102. doi: 10.1063/1.3701175. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Widom B. Some topics in the theory of fluids. J. Chem. Phys. 1963;39:2808. doi: 10.1063/1.1734110. [DOI] [Google Scholar]
  • 16.Beck, T. L., Paulaitis, M. E. & Pratt, L. R. The Potential Distribution Theorem and Models of Molecular Solutions (Cambridge University Press, 2006).
  • 17.Bereau T, Swendsen RH. Optimized convergence for multiple histogram analysis. J. Comput. Phys. 2009;228:6119–6129. doi: 10.1016/j.jcp.2009.05.011. [DOI] [Google Scholar]
  • 18.Kim J, Keyes T, Straub JE. Communication: Iteration-free, weighted histogram analysis method in terms of intensive variables. J. Chem. Phys. 2011;135:061103. doi: 10.1063/1.3626150. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Zhu F, Hummer G. Convergence and error estimation in free energy calculations using the weighted histogram analysis method. J. Comput. Chem. 2012;33:453–465. doi: 10.1002/jcc.21989. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Zhang C, Lai C-L, Pettitt BM. Accelerating the weighted histogram analysis method by direct inversion in the iterative subspace. Mol. Simul. 2016;42:1079–1089. doi: 10.1080/08927022.2015.1110583. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Zhang BW, Xia J, Tan Z, Levy RM. A stochastic solution to the unbinned wham equations. J. Phys. Chem. Lett. 2015;6:3834–3840. doi: 10.1021/acs.jpclett.5b01771. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Tan Z, Xia J, Zhang BW, Levy RM. Locally weighted histogram analysis and stochastic solution for large-scale multi-state free energy estimation. J. Chem. Phys. 2016;144:034107. doi: 10.1063/1.4939768. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Zhang BW, Deng N, Tan Z, Levy RM. Stratified UWHAM and its stochastic approximation for multicanonical simulations which are far from equilibrium. J. Chem. Theory Comput. 2017;13:4660–4674. doi: 10.1021/acs.jctc.7b00651. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 24.Zhang BW, et al. Simulating replica exchange: Markov state models, proposal schemes, and the infinite swapping limit. J. Phys. Chem. B. 2016;120:8289–8301. doi: 10.1021/acs.jpcb.6b02015. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.Bennett CH. Efficient estimation of free energy differences from monte carlo data. J. Comput. Phys. 1976;22:245–268. doi: 10.1016/0021-9991(76)90078-4. [DOI] [Google Scholar]
  • 26.Zhang BW, Jasnow D, Zuckerman DM. Transition-event durations in one-dimensional activated processes. J. Chem. Phys. 2007;126:074504. doi: 10.1063/1.2434966. [DOI] [PubMed] [Google Scholar]
  • 27.Abraham MJ, et al. GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers. SoftwareX. 2015;1–2:19–25. doi: 10.1016/j.softx.2015.06.001. [DOI] [Google Scholar]
  • 28.Onufriev A, Bashford D, Case DA. Exploring protein native states and large-scale conformational changes with a modified generalized born model. Proteins: Struct., Funct., Bioinf. 2004;55:383–394. doi: 10.1002/prot.20033. [DOI] [PubMed] [Google Scholar]
  • 29.Tribello GA, Bonomi M, Branduardi D, Camilloni C, Bussi G. PLUMED 2: New feathers for an old bird. Comput. Phys. Commun. 2014;185:604–613. doi: 10.1016/j.cpc.2013.09.018. [DOI] [Google Scholar]
  • 30.Zhang BW, Cui D, Matubayasi N, Levy RM. The excess chemical potential of water at the interface with a protein from end point simulations. J. Phys. Chem. B. 2018;122:4700–4707. doi: 10.1021/acs.jpcb.8b02666. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 31.Wickstrom L, He P, Gallicchio E, Levy RM. Large scale affinity calculations of cyclodextrin host-guest complexes: Understanding the role of reorganization in the molecular recognition process. J. Chem. Theory Comput. 2013;9:3136–3150. doi: 10.1021/ct400003r. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.Gallicchio E, Paris K, Levy RM. The agbnp2 implicit solvation model. J. Chem. Theory Comput. 2009;5:2544–2564. doi: 10.1021/ct900234u. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 33.Gallicchio E, Lapelosa M, Levy RM. The binding energy distribution analysis method (bedam) for the estimation of protein-ligand binding affinities. J. Chem. Theory Comput. 2010;6:2961–2977. doi: 10.1021/ct1002913. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34.Wang L, et al. Modeling local structural rearrangements using fep/rest: Application to relative binding affinity predictions of CDk2 inhibitors. J. Chem. Theory Comput. 2013;9:1282–1293. doi: 10.1021/ct300911a. [DOI] [PubMed] [Google Scholar]
  • 35.Wang L, et al. Accurate and reliable prediction of relative ligand binding potency in prospective drug discovery by way of a modern free-energy calculation protocol and force field. J. Am. Chem. Soc. 2015;137:2695–2703. doi: 10.1021/ja512751q. [DOI] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Supporting Information (168.3KB, pdf)

Data Availability Statement

The UWHAM and SWHAM software package and its tutorials are available from the web page: https://ronlevygroup.cst.temple.edu/software/UWHAM_and_SWHAM_webpage/index.html. The UWHAM and SWHAM software package is distributed using the MIT license. In the future, we will keep adding more examples of the application of UWHAM and SWHAM to the web page. For instance, free energy perturbation (FEP) is one popular method that is applied to measure the relative ligand binding potency34,35. Currently we are applying UWHAM to analyze the FEP data and extract a density of states that can be used to estimate the relative binding free energy differences for multiple ligands simultaneously to solve the cycle closure challenge34. We will continue optimizing the code and plan to introduce parallelism to the software package.


Articles from Scientific Reports are provided here courtesy of Nature Publishing Group

RESOURCES