MBAR¶
The MBAR
estimator is a light wrapper around the reference implementation of MBAR [Shirts2008] from pymbar
(pymbar.mbar.MBAR
).
As a generalization of BAR, it uses information from all sampled states to generate an estimate for the free energy difference between each state.
A more robust version of MBAR
is provided as
AutoMBAR
, where the class will iteratively
try different means of solving the MBAR estimate to avoid unconverged results.
The process of iterating different methods is documented in the logger
alchemlyb.estimators.AutoMBAR.
API Reference¶
- class alchemlyb.estimators.MBAR(maximum_iterations=10000, relative_tolerance=1e-07, initial_f_k=None, method='hybr', verbose=False)¶
Multi-state Bennett acceptance ratio (MBAR).
- Parameters
maximum_iterations (int, optional) – Set to limit the maximum number of iterations performed.
relative_tolerance (float, optional) – Set to determine the relative tolerance convergence criteria.
initial_f_k (np.ndarray, float, shape=(K), optional) – Set to the initial dimensionless free energies to use as a guess (default None, which sets all f_k = 0).
method (str, optional, default="hybr") – The optimization routine to use. This can be any of the methods available via scipy.optimize.minimize() or scipy.optimize.root().
verbose (bool, optional) – Set to
True
if verbose debug output frompymbar
is desired. Output from alchemlyb is logged vialogging
.
- delta_f_¶
The estimated dimensionless free energy difference between each state.
- Type
DataFrame
- d_delta_f_¶
The estimated statistical uncertainty (one standard deviation) in dimensionless free energy differences.
- Type
DataFrame
- theta_¶
The theta matrix.
- Type
DataFrame
Notes
See [Shirts2008] for details of the derivation and cite the paper when using MBAR in published work.
See also
Changed in version 1.0.0: delta_f_, d_delta_f_, states_ are view of the original object.
- fit(u_nk)¶
Compute overlap matrix of reduced potentials using multi-state Bennett acceptance ratio.
- Parameters
u_nk (DataFrame) – u_nk[n,k] is the reduced potential energy of uncorrelated configuration n evaluated at state k.
- property overlap_matrix¶
MBAR overlap matrix.
The estimated state overlap matrix \(O_{ij}\) is an estimate of the probability of observing a sample from state \(i\) in state \(j\).
The
overlap_matrix
is computed on-the-fly. Assign it to a variable if you plan to re-use it.See also
- get_params(deep=True)¶
Get parameters for this estimator.
- set_params(**params)¶
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters
**params (dict) – Estimator parameters.
- Returns
self – Estimator instance.
- Return type
estimator instance
- class alchemlyb.estimators.AutoMBAR(maximum_iterations=10000, relative_tolerance=1e-07, initial_f_k=None, verbose=False, method=None)¶
A more robust version of Multi-state Bennett acceptance ratio (MBAR).
Given that there isn’t a single method that would allow
MBAR
to converge for every single use case, theAutoMBAR
estimator iteratively tries all the available methods to obtain the converged estimate.The fastest method hybr will be tried first, followed by the most stable method adaptive. If adaptive does not converge, BFGS will be used as last resort. Although BFGS is not as stable as adaptive, it has been shown to succeed in some cases where adaptive cannot.
AutoMBAR
may be useful in high-throughput calculations where it can avoid failures due non-converged MBAR estimates.- Parameters
method (str, optional, default=None) –
The optimization routine to use. This parameter defaults to
None
. When a specific method is set, AutoMBAR will behave in the same way as MBAR.New in version 1.0.0.
Note
All arguments are described under
MBAR
except that the solver method is determined byAutoMBAR
as described above.See also
New in version 0.6.0.
Changed in version 1.0.0: AutoMBAR accepts the method argument.