pyemma.thermo.StationaryModel

class pyemma.thermo.StationaryModel(pi=None, f=None, normalize_energy=True, label='ground state')

StationaryModel combines a stationary vector with discrete-state free energies.

__init__(pi=None, f=None, normalize_energy=True, label='ground state')

StationaryModel combines a stationary vector with discrete-state free energies.

Parameters
  • pi (ndarray(n)) – Stationary distribution. If not already normalized, pi will be scaled to fulfill \(\sum_i \pi_i = 1\). The free energies f will be computed from pi via \(f_i = - \log(\pi_i)\). Only if normalize_f is True, a constant will be added to ensure consistency with \(\sum_i \pi_i = 1\).

  • f (ndarray(n)) – Discrete-state free energies. If normalized_f = True, a constant will be added to normalize the stationary distribution. Otherwise f is left as given. If both (pi and f) are given, f takes precedence.

  • normalize_energy (bool, default=True) – If parametrized by free energy f, normalize them such that \(\sum_i \pi_i = 1\), which is achieved by \(\log \sum_i \exp(-f_i) = 0\).

  • label (str, default='ground state') – Human-readable description for the thermodynamic state of this model. May contain a temperature description, such as ‘300 K’ or a description of bias energy such as ‘unbiased’ or ‘Umbrella 1’

Methods

__init__([pi, f, normalize_energy, label])

StationaryModel combines a stationary vector with discrete-state free energies.

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 PyEMMA object from disk.

save(file_name[, model_name, overwrite, …])

saves the current state of this object to given file and name.

set_model_params([pi, f, normalize_f, label])

Call to set all basic model parameters.

update_model_params(**params)

Update given model parameter if they are set to specific values

Attributes

active_set

The active set of states on which all computations and estimations will be done.

f

The free energies (in units of kT) on the configuration states.

f_full_state

free_energies

The free energies (in units of kT) on the configuration states.

free_energies_full_state

label

Human-readable description for the thermodynamic state of this model.

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.

pi_full_state

stationary_distribution

The stationary distribution on the configuration states.

stationary_distribution_full_state

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.

classmethod load(file_name, model_name='default')

Loads a previously saved PyEMMA object from disk.

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 pyemma.list_models() to get a representation of all stored models.

Returns

obj

Return type

the de-serialized object

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: # doctest: +SKIP
...    m.save(file, 'simple') # doctest: +SKIP
...    inst_restored = pyemma.load(file, 'simple') # doctest: +SKIP
>>> np.testing.assert_equal(m.P, inst_restored.P) # doctest: +SKIP
set_model_params(pi=None, f=None, normalize_f=None, label=None)

Call to set all basic model parameters.

Parameters
  • pi (ndarray(n)) – Stationary distribution. If not already normalized, pi will be scaled to fulfill \(\sum_i \pi_i = 1\). The free energies f will then be computed from pi via \(f_i = - \log(\pi_i)\).

  • f (ndarray(n)) – Discrete-state free energies. If normalized_f = True, a constant will be added to normalize the stationary distribution. Otherwise f is left as given. Then, pi will be computed from f via \(\pi_i = \exp(-f_i)\) and, if necessary, scaled to fulfill \(\sum_i \pi_i = 1\). If both (pi and f) are given, f takes precedence over pi.

  • normalize_energy (bool, default=True) – If parametrized by free energy f, normalize them such that \(\sum_i \pi_i = 1\), which is achieved by \(\log \sum_i \exp(-f_i) = 0\).

  • label (str, default=None) – Human-readable description for the thermodynamic state of this model. May contain a temperature description, such as ‘300 K’ or a description of bias energy such as ‘unbiased’ or ‘Umbrella 1’.

stationary_distribution

The stationary distribution on the configuration states.

update_model_params(**params)

Update given model parameter if they are set to specific values