trans_rate_tot

mdtools.dtrj.trans_rate_tot(dtrj, axis=-1, discard_neg_start=False, discard_all_neg=False)[source]

Calculate the transition rate averaged over all compounds and over all states.

Parameters:
  • dtrj (array_like) – Array containing the discrete trajectory.

  • axis (int, optional) – The axis along which to search for state transitions. For ordinary discrete trajectories with shape (n, f) or (f,), where n is the number of compounds and f is the number of frames, set axis to -1. If you parse a transposed discrete trajectory of shape (f, n), set axis to 0.

  • discard_neg_start (bool, optional) – If True, discard all transitions starting from a negative state (see notes of mdtools.dtrj.trans_rate()). This is equivalent to discarding the lifetimes of all negative states when calculating state lifetimes with mdtools.dtrj.lifetimes_per_state(). Must not be used together with discard_all_neg.

  • discard_all_neg (bool, optional) – If True, discard all transitions starting from or ending in a negative state (see notes mdtools.dtrj.trans_rate()). This is equivalent to discarding the lifetimes of all negative states and of all states that are followed by a negative state when calculating state lifetimes with mdtools.dtrj.lifetimes_per_state(). Must not be used together with discard_neg_start.

Returns:

trans_rate (float) – The transition rate averaged over all compounds and over all states.

See also

mdtools.dtrj.trans_rate()

Calculate the transition rate for each compound averaged over all states

mdtools.dtrj.trans_rate_per_state()

Calculate the transition rate for each state averaged over all compounds

Notes

Transitions rates are calculated by simply counting the total number of valid state transitions (summed over all compounds) and dividing this number by the total number of valid frames (again, summed over all compounds).

The inverse of the transition rate gives an estimate for the average state lifetime. In contrast to calculating the average lifetime by simply counting how many frames a given compound stays in a given state (as done by mdtools.dtrj.lifetimes_per_state()), this method is not biased to lower lifetimes.

See mdtools.dtrj.trans_rate() for details about valid and invalid states (discard_neg_start and discard_all_neg).

Examples

>>> dtrj = np.array([[1, 2, 2, 3, 3, 3],
...                  [2, 2, 3, 3, 3, 1],
...                  [3, 3, 3, 1, 2, 2],
...                  [1, 3, 3, 3, 2, 2]])
>>> mdt.dtrj.trans_rate_tot(dtrj)  # (4 * 2) / (4 * 6)
0.3333333333333333
>>> mdt.dtrj.trans_rate_tot(dtrj, axis=0)
0.4166666666666667
>>> dtrj = np.array([[1, 2, 2, 3, 3, 3],
...                  [2, 2, 3, 3, 3, 1],
...                  [3, 3, 3, 1, 2, 2],
...                  [1, 3, 3, 3, 2, 2],
...                  [6, 6, 6, 6, 6, 6]])
>>> mdt.dtrj.trans_rate_tot(dtrj)
0.26666666666666666
>>> mdt.dtrj.trans_rate_tot(dtrj, axis=0)
0.5333333333333333
>>> dtrj = np.array([[ 1, -2, -2,  3,  3,  3],
...                  [-2, -2,  3,  3,  3,  1],
...                  [ 3,  3,  3,  1,  2,  2],
...                  [ 1,  3,  3,  3, -2, -2],
...                  [ 1,  4,  4,  4,  4, -1],
...                  [-6, -6, -6, -6, -6, -6],
...                  [ 6,  6,  6,  6,  6,  6]])
>>> ax = -1
>>> mdt.dtrj.trans_rate_tot(dtrj, axis=ax)
0.23809523809523808
>>> mdt.dtrj.trans_rate_tot(dtrj, axis=ax, discard_neg_start=True)
0.27586206896551724
>>> mdt.dtrj.trans_rate_tot(dtrj, axis=ax, discard_all_neg=True)
0.23809523809523808
>>> ax = 0
>>> mdt.dtrj.trans_rate_tot(dtrj, axis=ax)
0.6904761904761905
>>> mdt.dtrj.trans_rate_tot(dtrj, axis=ax, discard_neg_start=True)
0.5862068965517241
>>> mdt.dtrj.trans_rate_tot(dtrj, axis=ax, discard_all_neg=True)
0.45