pyemma.msm.tpt¶
-
pyemma.msm.
tpt
(msmobj, A, B)¶ A->B reactive flux from transition path theory (TPT)
The returned
ReactiveFlux
object can be used to extract various quantities of the flux, as well as to compute A -> B transition pathways, their weights, and to coarse-grain the flux onto sets of states.- Parameters
msmobj (
MSM
object) – Markov state model (MSM) objectA (array_like) – List of integer state labels for set A
B (array_like) – List of integer state labels for set B
- Returns
tptobj – An object containing the reactive A->B flux network and several additional quantities, such as the stationary probability, committors and set definitions.
- Return type
ReactiveFlux
object
See also
ReactiveFlux
Reactive Flux model
-
class
pyemma.msm.models.
ReactiveFlux
(A, B, flux, mu=None, qminus=None, qplus=None, gross_flux=None, dt_model='1 step')¶ A->B reactive flux from transition path theory (TPT)
This object describes a reactive flux, i.e. a network of fluxes from a set of source states A, to a set of sink states B, via a set of intermediate nodes. Every node has three properties: the stationary probability mu, the forward committor qplus and the backward committor qminus. Every pair of edges has the following properties: a flux, generally a net flux that has no unnecessary back-fluxes, and optionally a gross flux.
Flux objects can be used to compute transition pathways (and their weights) from A to B, the total flux, the total transition rate or mean first passage time, and they can be coarse-grained onto a set discretization of the node set.
Fluxes can be computed in EMMA using transition path theory - see
msmtools.tpt()
- Parameters
A (array_like) – List of integer state labels for set A
B (array_like) – List of integer state labels for set B
flux ((n,n) ndarray or scipy sparse matrix) – effective or net flux of A->B pathways
mu ((n,) ndarray (optional)) – Stationary vector
qminus ((n,) ndarray (optional)) – Backward committor for A->B reaction
qplus ((n,) ndarray (optional)) – Forward committor for A-> B reaction
gross_flux ((n,n) ndarray or scipy sparse matrix) – gross flux of A->B pathways, if available
Notes
Reactive flux contains a flux network from educt states (A) to product states (B).
See also
msmtools.tpt
Methods
coarse_grain
(user_sets)Coarse-grains the flux onto user-defined sets.
get_model_params
([deep])Get parameters for this model.
load
(file_name[, model_name])Loads a previously saved PyEMMA object from disk.
major_flux
([fraction])Returns the main pathway part of the net flux comprising at most the requested fraction of the full flux.
pathways
([fraction, maxiter])Decompose flux network into dominant reaction paths.
save
(file_name[, model_name, overwrite, …])saves the current state of this object to given file and name.
set_model_params
(A, B, flux, mu[, qminus, …])update_model_params
(**params)Update given model parameter if they are set to specific values
Attributes
Returns the set of reactant (source) states.
Returns the set of product (target) states
Returns the set of intermediate states
Returns the backward committor probability
Returns the forward committor probability
Returns the effective or net flux
Returns the forward committor probability
Returns the gross A–>B flux
Returns the mean-first-passage-time (inverse rate) of A–>B transitions
Returns the stationary distribution
Returns the effective or net flux
Returns the number of states.
Returns the backward committor probability
Returns the forward committor probability
Returns the rate (inverse mfpt) of A–>B transitions
Returns the stationary distribution
Returns the total flux
-
A
¶ Returns the set of reactant (source) states.
-
B
¶ Returns the set of product (target) states
-
I
¶ Returns the set of intermediate states
-
backward_committor
¶ Returns the backward committor probability
-
coarse_grain
(user_sets)¶ Coarse-grains the flux onto user-defined sets.
- Parameters
user_sets (list of int-iterables) – sets of states that shall be distinguished in the coarse-grained flux.
- Returns
(sets, tpt) – sets contains the sets tpt is computed on. The tpt states of the new tpt object correspond to these sets of states in this order. Sets might be identical, if the user has already provided a complete partition that respects the boundary between A, B and the intermediates. If not, Sets will have more members than provided by the user, containing the “remainder” states and reflecting the splitting at the A and B boundaries. tpt contains a new tpt object for the coarse-grained flux. All its quantities (gross_flux, net_flux, A, B, committor, backward_committor) are coarse-grained to sets.
- Return type
(list of int-iterables, tpt-object)
Notes
All user-specified sets will be split (if necessary) to preserve the boundary between A, B and the intermediate states.
-
committor
¶ Returns the forward committor probability
-
dt_model
¶
-
flux
¶ Returns the effective or net flux
-
forward_committor
¶ Returns the forward committor probability
-
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
-
gross_flux
¶ Returns the gross A–>B flux
-
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
-
major_flux
(fraction=0.9)¶ Returns the main pathway part of the net flux comprising at most the requested fraction of the full flux.
-
mfpt
¶ Returns the mean-first-passage-time (inverse rate) of A–>B transitions
-
mu
¶ Returns the stationary distribution
-
net_flux
¶ Returns the effective or net flux
-
nstates
¶ Returns the number of states.
-
pathways
(fraction=1.0, maxiter=1000)¶ Decompose flux network into dominant reaction paths.
- Parameters
fraction (float, optional) – Fraction of total flux to assemble in pathway decomposition
maxiter (int, optional) – Maximum number of pathways for decomposition
- Returns
paths (list) – List of dominant reaction pathways
capacities (list) – List of capacities corresponding to each reactions pathway in paths
References
- 1
P. Metzner, C. Schuette and E. Vanden-Eijnden. Transition Path Theory for Markov Jump Processes. Multiscale Model Simul 7: 1192-1219 (2009)
-
qminus
¶ Returns the backward committor probability
-
qplus
¶ Returns the forward committor probability
-
rate
¶ Returns the rate (inverse mfpt) of A–>B transitions
-
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
(A, B, flux, mu, qminus=None, qplus=None, gross_flux=None, dt_model='1 step')¶
-
stationary_distribution
¶ Returns the stationary distribution
-
total_flux
¶ Returns the total flux
-
update_model_params
(**params)¶ Update given model parameter if they are set to specific values
References
Transition path theory was introduced for space-continuous dynamical processes, such as Langevin dynamics, in [1]_, [2]_ introduces discrete transition path theory for Markov jump processes (Master equation models, rate matrices) and pathway decomposition algorithms. [3]_ introduces transition path theory for Markov state models (MSMs) and some analysis algorithms. In this function, the equations described in [3]_ are applied.
- 1
W. E and E. Vanden-Eijnden. Towards a theory of transition paths. J. Stat. Phys. 123: 503-523 (2006)
- 2
P. Metzner, C. Schuette and E. Vanden-Eijnden. Transition Path Theory for Markov Jump Processes. Multiscale Model Simul 7: 1192-1219 (2009)
- 3
F. Noe, Ch. Schuette, E. Vanden-Eijnden, L. Reich and T. Weikl: Constructing the Full Ensemble of Folding Pathways from Short Off-Equilibrium Simulations. Proc. Natl. Acad. Sci. USA, 106, 19011-19016 (2009)
Computes the A->B reactive flux using transition path theory (TPT)
- Parameters
T ((M, M) ndarray or scipy.sparse matrix) – Transition matrix (default) or Rate matrix (if rate_matrix=True)
A (array_like) – List of integer state labels for set A
B (array_like) – List of integer state labels for set B
mu ((M,) ndarray (optional)) – Stationary vector
qminus ((M,) ndarray (optional)) – Backward committor for A->B reaction
qplus ((M,) ndarray (optional)) – Forward committor for A-> B reaction
= False (rate_matrix) – By default (False), T is a transition matrix. If set to True, T is a rate matrix.
Notes
The central object used in transition path theory is the forward and backward comittor function.
TPT (originally introduced in [1]) for continous systems has a discrete version outlined in [2]. Here, we use the transition matrix formulation described in [3].
See also
msmtools.analysis.committor()
,ReactiveFlux()
References
- 1
W. E and E. Vanden-Eijnden. Towards a theory of transition paths. J. Stat. Phys. 123: 503-523 (2006)
- 2
P. Metzner, C. Schuette and E. Vanden-Eijnden. Transition Path Theory for Markov Jump Processes. Multiscale Model Simul 7: 1192-1219 (2009)
- 3
F. Noe, Ch. Schuette, E. Vanden-Eijnden, L. Reich and T. Weikl: Constructing the Full Ensemble of Folding Pathways from Short Off-Equilibrium Simulations. Proc. Natl. Acad. Sci. USA, 106, 19011-19016 (2009)