pyemma.thermo.MultiThermModel¶
-
class
pyemma.thermo.MultiThermModel(models, f_therm, pi=None, f=None, label='ground state')¶ Coupled set of stationary models at multiple thermodynamic states
-
__init__(models, f_therm, pi=None, f=None, label='ground state')¶ Parameters: - models (list of model objects) – List of model objects, e.g.
StationaryModelor :class:`ThermoMSM <pyemma.thermo.models.memm.ThermoMSM> objects, at the different thermodynamic states. This list may include the ground state, such that self.pi = self.models[*].pi holds, where * denotes the ground state. An example for that is data obtained from parallel tempering or replica-exchange, where the lowest simulated temperature is usually identical to the thermodynamic ground state. However, the list does not have to include the thermodynamic ground state. For example, when obtaining data from umbrella sampling, models might be the list of stationary models for n umbrellas (biased ensembles), while the thermodynamic ground state is the unbiased ensemble. In that case, self.pi would be different from any self.models[i].pi. - f_therm (numpy.ndarray(k)) – Free energies of the different thermodynamic states.
- pi (numpy.ndarray(n), default=None) – Stationary distribution of the thermodynamic ground state. If not already normalized, pi will be scaled to fulfill \(\sum_i \pi_i = 1\). If None, models[0].pi will be used.
- f (numpy.ndarray(n)) – Discrete-state free energies of the thermodynamic ground state.
- label (str, optional, default='ground state') – Human-readable description for the thermodynamic ground state or reference state of this multiensemble. May contain a temperature description, such as ‘300 K’ or a description of bias energy such as ‘unbiased’.
- models (list of model objects) – List of model objects, e.g.
Methods
__init__(models, f_therm[, pi, f, label])param models: List of model objects, e.g. expectation(a)Equilibrium expectation value of a given observable. get_model_params([deep])Get parameters for this model. load(file_name[, model_name])loads a previously saved object of this class from a file. meval(f, *args, **kw)Evaluates the given function call for all models 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])update_model_params(**params)Update given model parameter if they are set to specific values -
active_set¶ The active set of states on which all computations and estimations will be done.
-
expectation(a)¶ Equilibrium expectation value of a given observable.
Parameters: a ((M,) ndarray) – Observable vector Returns: val – Equilibrium expectation value of the given observable Return type: float Notes
The equilibrium expectation value of an observable a is defined as follows
\[\mathbb{E}_{\mu}[a] = \sum_i \mu_i a_i\]\(\mu=(\mu_i)\) is the stationary vector of the transition matrix \(T\).
-
f¶ The free energies (in units of kT) on the configuration states.
-
free_energies¶ The free energies (in units of kT) on the configuration states.
-
get_model_params(deep=True)¶ Get parameters for this model.
Parameters: deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns: params – Parameter names mapped to their values. Return type: mapping of string to any
-
label¶ Human-readable description for the thermodynamic state of this model.
-
load(file_name, model_name='default')¶ loads a previously saved object of this class from a file.
Parameters: - file_name (str or file like object (has to provide read method)) – The file like object tried to be read for a serialized object.
- model_name (str, default='default') – if multiple models are contained in the file, these can be accessed by
their name. Use func:
pyemma.list_modelsto get a representation of all stored models.
Returns: obj
Return type: the de-serialized object
-
meval(f, *args, **kw)¶ Evaluates the given function call for all models Returns the results of the calls in a list
-
nstates¶ Number of active states on which all computations and estimations are done.
-
nstates_full¶ Size of the full set of states.
-
pi¶ The stationary distribution on the configuration states.
-
save(file_name, model_name='default', overwrite=False, save_streaming_chain=False)¶ saves the current state of this object to given file and name.
Parameters: - file_name (str) – path to desired output file
- model_name (str, default='default') – creates a group named ‘model_name’ in the given file, which will contain all of the data. If the name already exists, and overwrite is False (default) will raise a RuntimeError.
- overwrite (bool, default=False) – Should overwrite existing model names?
- save_streaming_chain (boolean, default=False) – if True, the data_producer(s) of this object will also be saved in the given file.
Examples
>>> import pyemma, numpy as np >>> from pyemma.util.contexts import named_temporary_file >>> m = pyemma.msm.MSM(P=np.array([[0.1, 0.9], [0.9, 0.1]]))
>>> with named_temporary_file() as file: ... m.save(file, 'simple') ... inst_restored = pyemma.load(file, 'simple') >>> np.testing.assert_equal(m.P, inst_restored.P)
-
stationary_distribution¶ The stationary distribution on the configuration states.
-
unbiased_state¶ Index of the unbiased thermodynamic state.
-
update_model_params(**params)¶ Update given model parameter if they are set to specific values
-