pyemma.thermo.WHAM¶
-
class
pyemma.thermo.WHAM(*args, **kwargs)¶ Weighted Histogram Analysis Method.
-
__init__(bias_energies_full, maxiter=10000, maxerr=1e-15, save_convergence_info=0, dt_traj='1 step', stride=1)¶ Weighted Histogram Analysis Method
- Parameters
bias_energies_full (numpy.ndarray(shape=(num_therm_states, num_conf_states)) object) – bias_energies_full[j, i] is the bias energy in units of kT for each discrete state i at thermodynamic state j.
maxiter (int, optional, default=10000) – The maximum number of self-consistent iterations before the estimator exits unsuccessfully.
maxerr (float, optional, default=1.0E-15) – Convergence criterion based on the maximal free energy change in a self-consistent iteration step.
save_convergence_info (int, optional, default=0) – Every save_convergence_info iteration steps, store the actual increment and the actual loglikelihood; 0 means no storage.
dt_traj (str, optional, default='1 step') –
Description of the physical time corresponding to the lag. May be used by analysis algorithms such as plotting tools to pretty-print the axes. By default ‘1 step’, i.e. there is no physical time unit. Specify by a number, whitespace and unit. Permitted units are (* is an arbitrary string):
’fs’, ‘femtosecond*’’ps’, ‘picosecond*’’ns’, ‘nanosecond*’’us’, ‘microsecond*’’ms’, ‘millisecond*’’s’, ‘second*’stride (int, optional, default=1) – not used
Example
>>> from pyemma.thermo import WHAM >>> import numpy as np >>> B = np.array([[0, 0],[0.5, 1.0]]) >>> wham = WHAM(B) >>> ttrajs = [np.array([0,0,0,0,0,0,0,0,0,0]),np.array([1,1,1,1,1,1,1,1,1,1])] >>> dtrajs = [np.array([0,0,0,0,1,1,1,0,0,0]),np.array([0,1,0,1,0,1,1,0,0,1])] >>> wham = wham.estimate((ttrajs, dtrajs)) >>> wham.log_likelihood() -6.6... >>> wham.state_counts array([[7, 3], [5, 5]]) >>> wham.stationary_distribution array([ 0.5..., 0.4...]) >>> wham.meval('stationary_distribution') [array([ 0.5..., 0.4...]), array([ 0.6..., 0.3...])]
References
- 1
Ferrenberg, A.M. and Swensen, R.H. 1988. New Monte Carlo Technique for Studying Phase Transitions. Phys. Rev. Lett. 23, 2635–2638
- 2
Kumar, S. et al 1992. The Weighted Histogram Analysis Method for Free-Energy Calculations on Biomolecules. I. The Method. J. Comp. Chem. 13, 1011–1021
Methods
_Loggable__create_logger()_SerializableMixIn__interpolate(state, klass)__delattr__(name, /)Implement delattr(self, name).
__dir__()Default dir() implementation.
__eq__(other)Return self==value.
__format__(format_spec, /)Default object formatter.
__ge__(value, /)Return self>=value.
__getattribute__(name, /)Return getattr(self, name).
__getstate__()__gt__(value, /)Return self>value.
__init__(bias_energies_full[, maxiter, …])Weighted Histogram Analysis Method
__init_subclass__(*args, **kwargs)This method is called when a class is subclassed.
__le__(value, /)Return self<=value.
__lt__(value, /)Return self<value.
__my_getstate__()__my_setstate__(state)__ne__(value, /)Return self!=value.
__new__(cls, *args, **kwargs)Create and return a new object.
__reduce__()Helper for pickle.
__reduce_ex__(protocol, /)Helper for pickle.
__repr__()Return repr(self).
__setattr__(name, value, /)Implement setattr(self, name, value).
__setstate__(state)__sizeof__()Size of object in memory, in bytes.
__str__()Return str(self).
__subclasshook__Abstract classes can override this to customize issubclass().
_check_estimated()_cleanup_logger(logger_id, logger_name)_estimate(trajs)_get_classes_to_inspect()gets classes self derives from which 1.
_get_interpolation_map(cls)_get_model_param_names()Get parameter names for the model
_get_param_names()Get parameter names for the estimator
_get_private_field(cls, name[, default])_get_serialize_fields(cls)_get_state_of_serializeable_fields(klass, state):return a dictionary {k:v} for k in self.serialize_fields and v=getattr(self, k)
_get_version(cls[, require])_get_version_for_class_from_state(state, klass)retrieves the version of the current klass from the state mapping from old locations to new ones.
_logger_is_active(level)@param level: int log level (debug=10, info=20, warn=30, error=40, critical=50)
_set_state_from_serializeable_fields_and_state(…)set only fields from state, which are present in klass.__serialize_fields
estimate(trajs)- param X
Simulation trajectories. ttrajs contain the indices of the thermodynamic state and
expectation(a)Equilibrium expectation value of a given observable.
fit(X[, y])Estimates parameters - for compatibility with sklearn.
get_model_params([deep])Get parameters for this model.
get_params([deep])Get parameters for this estimator.
load(file_name[, model_name])Loads a previously saved PyEMMA object from disk.
log_likelihood()meval(f, *args, **kw)Evaluates the given function call for all models Returns the results of the calls in a list
save(file_name[, model_name, overwrite, …])saves the current state of this object to given file and name.
set_model_params([models, f_therm, pi, f, label])Call to set all basic model parameters.
set_params(**params)Set the parameters of this estimator.
update_model_params(**params)Update given model parameter if they are set to specific values
Attributes
_Estimator__serialize_fields_Loggable__ids_Loggable__refs_MultiThermModel__serialize_version_SerializableMixIn__serialize_fields_SerializableMixIn__serialize_modifications_map_SerializableMixIn__serialize_version_StationaryModel__serialize_version_SubSet__serialize_fields_SubSet__serialize_version_ThermoBase__serialize_fields_ThermoBase__serialize_version_WHAM__serialize_fields_WHAM__serialize_version__dict____doc____hash____module____weakref__list of weak references to the object (if defined)
_estimated_loglevel_CRITICAL_loglevel_DEBUG_loglevel_ERROR_loglevel_INFO_loglevel_WARN_save_data_produceractive_setThe active set of states on which all computations and estimations will be done.
dt_trajfThe free energies (in units of kT) on the configuration states.
f_full_stateforce_constantsThe individual force matrices labelled accordingly to ttrajs.
free_energiesThe free energies (in units of kT) on the configuration states.
free_energies_full_statelabelHuman-readable description for the thermodynamic state of this model.
loggerThe logger for this class instance
modelThe model estimated by this Estimator
nameThe name of this instance
nstatesNumber of active states on which all computations and estimations are done.
nstates_fullSize of the full set of states.
piThe stationary distribution on the configuration states.
pi_full_statestationary_distributionThe stationary distribution on the configuration states.
stationary_distribution_full_statetemperaturesThe individual temperatures labelled accordingly to ttrajs.
umbrella_centersThe individual umbrella centers labelled accordingly to ttrajs.
unbiased_stateIndex of the unbiased thermodynamic state.
-