Advanced Usage
High level overview
Use of this package proceeds as follows.
- Define a
TransitionMatrix, and provide source, target and avoid indices as desired. - Select a
TPTProblem. - Compute the relevant statistics.
Defining transition matrices
TransitionPathTheory.TransitionMatrix — Typestruct TransitionMatrix{S, C}A transition probability matrix with Stochasticity S and Connectivity C.
Fields
P: The transition probabilityMatrixitself.stochasticity:Sconnectivity:C
Constructors
TransitionMatrix(P_size; n_zeros = 0, normalize = true, seed = 1234)Construct a randomly generated transition matrix.
Arguments
P_size: The number of rows (== columns) of the matrix.
Optional Arguments
n_zeros: This many zeros will be placed in the matrix at random. If this results in a row of the matrix having all zeros, a1will be placed randomly in that row.normalize: Whether to normalize the row sums of the resulting matrix.seed: A seed for reproducible randomness.
TransitionMatrix(P)Construct a TransitionMatrix from a matrix P. The properties of P are inferred automatically.
Arguments
P: The transition matrix.
Stochasticity
TransitionPathTheory.Stochasticity — Typeabstract type StochasticitySupertype for all transition matrix stochasticity types.
TransitionPathTheory.Stochastic — Typestruct StochasticA Stochasticity such that the row sums of the transition matrix are all equal to 1.
TransitionPathTheory.SuperStochastic — Typestruct SuperStochasticA Stochasticity such that the row sums of the transition matrix are all strictly greater than 1.
TransitionPathTheory.NonStochastic — Typestruct NonStochasticA Stochasticity such that the row sums of the transition matrix are incomparable to 1.
Connectivity
TransitionPathTheory.Connectivity — Typeabstract type ConnectivitySupertype for all transition matrix connectivity types.
TransitionPathTheory.StronglyConnected — Typestruct StronglyConnectedA Connectivity such that the directed graph implied by the transition matrix is strongly connected.
TransitionPathTheory.WeaklyConnected — Typestruct WeaklyConnectedA Connectivity such that the directed graph implied by the transition matrix is weakly connected.
TransitionPathTheory.Disconnected — Typestruct DisconnectedA Connectivity such that the directed graph implied by the transition matrix is disconnected.
Defining a TPTProblem
TransitionPathTheory.TPTProblem — Typeabstract type TPTProblemSupertype for all TPT problems.
TransitionPathTheory.HomogeneousTPTProblem — Typestruct HomogeneousTPTProblemA TPTProblem where the transition matrix is homogeneous, i.e. time-independent.
Fields
transition_matrix: ATransitionMatrix.source: A vector of indices defining the TPT source, akaA.target: A vector of indices defining the TPT target, akaB.
Constructor
HomogeneousTPTProblem(P, source, target; avoid = Int64[])Build a HomogeneousTPTProblem where each argument of the constructor maps to the corresponding field.
Optional Arguments
avoid: Indices provided here will be appended to bothAandBand will hence be avoided by transition path theory.
Basic sets in a TPTProblem
TransitionPathTheory.𝒫 — Function𝒫(tpt)Return tpt.transition_matrix.P.
TransitionPathTheory.𝒜 — Function𝒜(tpt)Return tpt.source.
TransitionPathTheory.ℬ — Functionℬ(tpt)Return tpt.target.
TransitionPathTheory.𝒮 — Function𝒮(tpt)Return all possible indices implied by the transition matrix, i.e. 1:size(P, 1).
TransitionPathTheory.Ω — FunctionΩ(tpt)Return the set of avoided states.
TransitionPathTheory.𝒜_true — Function𝒜_true(tpt)Return the set of states that are members of the source, but are not avoided.
TransitionPathTheory.ℬ_true — Functionℬ_true(tpt)Return the set of states that are members of the target, but are not avoided.
TransitionPathTheory.𝒞 — Function𝒞(tpt)Return the set of states that are not in the source or target.
TPT Statistics
High level
TransitionPathTheory.stationary_statistics — Functionstationary_statistics(tpt)Compute and return the following statistics in a NamedTuple:
stationary_distributionforward_committorbackward_committorreactive_densityreactive_currentforward_currentreactive_ratereactive_timeremaining_timehitting_location_distribution
TransitionPathTheory.nonstationary_statistics — Functionnonstationary_statistics(tpt, horizon; B_to_S::Symbol = :interior, initial_dist = :stat)Compute and return the following statistics in a NamedTuple:
densityreactive_densitytAB_cdf
Arguments
tpt: TheTPTProblem.horizon: The time step at which to cut off the calculation. Note that thehorizonvalue does NOT enforce that trajectories leaving A hit B by that time.
Optional Arguments
initial_dist: ASymboldetermining how the initial distribution inside𝒜has calculated.:stat: The initial distribution is equal to stationary distribution of𝒫(tpt)restricted𝒜.:uniform: A uniform distribution supported on𝒜.
Low level
TransitionPathTheory.stationary_distribution — Functionstationary_distribution(tpt)Compute the stationary distribution of tpt.transition_matrix.P.
Errors when P is not strongly connected.
TransitionPathTheory.𝒫_backwards — Function𝒫_backwards(tpt)Compute the "backwards" transition matrix; return a Matrix.
TransitionPathTheory.forward_committor — Functionforward_committor(tpt)Compute the forward committor.
TransitionPathTheory.backward_committor — Functionbackward_committor(tpt)Compute the backward committor.
TransitionPathTheory.𝒮_plus — Function𝒮_plus(tpt)The set of indices i such that
- if
iis inB_true, theniis inS_plus - if
iis outsideB_true, theniis inS_plusif bothq_minus[i] > 0.0sum(P[i, j]*qp[j] for j in sets.S) > 0.0
Intuitively: i is either in B_true, or could have come from A_true and is connected to a state that is reactively connected to B.
TransitionPathTheory.𝒫_plus — Function𝒫_plus(tpt)The forward-reactive analogue of 𝒫.
TransitionPathTheory.remaining_time — Functionremaining_time(tpt)Compute the remaining time, aka the lead time.
TransitionPathTheory.hitting_location_distribution — Functionhitting_location_distribution(tpt)Compute the distribution of target-hitting locations.
Return a matrix R such that R[i, j] is the probability that - starting in state i - the first visit to B occurs in state j. Note that R[i, j] == 0 for all j ∉ B.
Helpers
TransitionPathTheory.current2arrows — Functioncurrent2arrows(f, x, y; excluded = nothing)Compute forward current vectors in a 2D physical space.
Return (u, v) where u[i] and v[i] are the x and y components of vector centered at (x, y) and pointing in the direction of the weighted average by f[i,:] of each other point.
Arguments
f:forward_currentcomputed fromstationary_statistics.x: AVectorof points[x1, x2, ...]y: AVectorof points[y1, y2, ...]
Optional Arguments
excluded: If aVector{<:Integer}is provided, rows and columns corresponding to them are excluded fromf. Whenexcluded === nothing, the last index offis excluded automatically.