Skip to content

datasets

Set of datasets to use for the tutorials.

propagate_tmat(tmat, nsteps, start=None)

Markov chain Monte Carlo propagation of transition matrix for nsteps.

Parameters:

  • tmat (ndarray) –

    Transition matrix to propagate.

  • nsteps (int) –

    Number of steps to propagate.

  • start (int, default: None ) –

    Index where to start. If None a random number will be used.

Returns:

  • traj ( ndarray ) –

    Markov chain Monte Carlo state trajectory of given tmat.

Source code in src/msmhelper/utils/datasets.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
def propagate_tmat(tmat, nsteps, start=None):
    """Markov chain Monte Carlo propagation of transition matrix for nsteps.

    Parameters
    ----------
    tmat : ndarray
        Transition matrix to propagate.
    nsteps : int
        Number of steps to propagate.
    start : int
        Index where to start. If `None` a random number will be used.

    Returns
    -------
    traj : ndarray
        Markov chain Monte Carlo state trajectory of given tmat.

    """
    if not is_transition_matrix(tmat):
        raise ValueError('tmat needs to be a row-normalized matrix.')

    n_states = len(tmat)
    cummat = np.cumsum(  # enforce exact normalization
        row_normalize_matrix(tmat),
        axis=1,
    )
    cummat_perm = np.tile(np.arange(n_states), (n_states, 1))

    if start is None:
        start = np.random.randint(n_states)

    return _propagate_MCMC(
        cummat=(cummat, cummat_perm),
        start=start,
        steps=nsteps,
    )

hummer15_4state(rate_k, rate_h, nsteps, return_macrotraj=False)

Four state model taken from Hummer and Szabo 15.

Gerhard Hummer and Attila Szabo The Journal of Physical Chemistry B 2015 119 (29), 9029-9037 DOI: 10.1021/jp508375q

Parameters:

  • rate_k (float) –

    Rate between state 1<->2 and 3<->4.

  • rate_h (float) –

    Rate between state 2<->3.

  • nsteps (int) –

    Number of steps to propagate.

  • return_macrotraj (bool, default: False ) –

    If True return a macrotraj where state (1,2) and (3,4) are lumped as well.

Returns:

  • traj ( ndarray ) –

    Markov chain Monte Carlo state trajectory.

  • macrotraj ( ndarray ) –

    Markov chain Monte Carlo macrostate trajectory if macrotraj=True.

Source code in src/msmhelper/utils/datasets.py
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
def hummer15_4state(rate_k, rate_h, nsteps, return_macrotraj=False):
    """Four state model taken from Hummer and Szabo 15.

    Gerhard Hummer and Attila Szabo
    The Journal of Physical Chemistry B 2015 119 (29), 9029-9037
    DOI: [10.1021/jp508375q](https://pubs.acs.org/doi/10.1021/jp508375q)

    Parameters
    ----------
    rate_k : float
        Rate between state 1<->2 and 3<->4.
    rate_h : float
        Rate between state 2<->3.
    nsteps : int
        Number of steps to propagate.
    return_macrotraj : bool, optional
        If `True` return a macrotraj where state (1,2) and (3,4) are lumped
        as well.

    Returns
    -------
    traj : ndarray
        Markov chain Monte Carlo state trajectory.
    macrotraj : ndarray
        Markov chain Monte Carlo macrostate trajectory if `macrotraj=True`.

    """
    return _hummer15_nstate(
        n_states=4,
        rate_k=rate_k,
        rate_h=rate_h,
        nsteps=nsteps,
        return_macrotraj=return_macrotraj,
    )

hummer15_8state(rate_k, rate_h, nsteps, return_macrotraj=False)

Eight state model inspired by Hummer and Szabo 15.

Gerhard Hummer and Attila Szabo The Journal of Physical Chemistry B 2015 119 (29), 9029-9037 DOI: 10.1021/jp508375q

Parameters:

  • rate_k (float) –

    Rate between state 1<->2, 3<->4, 5<->6, 7<->8.

  • rate_h (float) –

    Rate between state 2<->3, 4<->5, 6<->7.

  • nsteps (int) –

    Number of steps to propagate.

  • return_macrotraj (bool, default: False ) –

    If True return a macrotraj where state (1,2), (3,4), (5,6), and (7,8) are lumped as well.

Returns:

  • traj ( ndarray ) –

    Markov chain Monte Carlo state trajectory.

  • macrotraj ( ndarray ) –

    Markov chain Monte Carlo macrostate trajectory if macrotraj=True.

Source code in src/msmhelper/utils/datasets.py
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
def hummer15_8state(rate_k, rate_h, nsteps, return_macrotraj=False):
    """Eight state model inspired by Hummer and Szabo 15.

    Gerhard Hummer and Attila Szabo
    The Journal of Physical Chemistry B 2015 119 (29), 9029-9037
    DOI: [10.1021/jp508375q](https://pubs.acs.org/doi/10.1021/jp508375q)

    Parameters
    ----------
    rate_k : float
        Rate between state 1<->2, 3<->4, 5<->6, 7<->8.
    rate_h : float
        Rate between state 2<->3, 4<->5, 6<->7.
    nsteps : int
        Number of steps to propagate.
    return_macrotraj : bool, optional
        If `True` return a macrotraj where state (1,2), (3,4), (5,6), and (7,8)
        are lumped as well.

    Returns
    -------
    traj : ndarray
        Markov chain Monte Carlo state trajectory.
    macrotraj : ndarray
        Markov chain Monte Carlo macrostate trajectory if `macrotraj=True`.

    """
    return _hummer15_nstate(
        n_states=8,
        rate_k=rate_k,
        rate_h=rate_h,
        nsteps=nsteps,
        return_macrotraj=return_macrotraj,
    )

nagel20_4state(nsteps)

Four state model taken from Nagel et al. 20.

Daniel Nagel, Anna Weber, and Gerhard Stock Journal of Chemical Theory and Computation 2020 16 (12), 7874-7882 DOI: 10.1021/acs.jctc.0c00774

Parameters:

  • nsteps (int) –

    Number of steps to propagate.

Returns:

  • traj ( ndarray ) –

    Markov chain Monte Carlo state trajectory.

Source code in src/msmhelper/utils/datasets.py
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
@_decorate_tmat(_NAGEL20_4STATE_TMAT)
def nagel20_4state(nsteps):
    """Four state model taken from Nagel et al. 20.

    Daniel Nagel, Anna Weber, and Gerhard Stock
    Journal of Chemical Theory and Computation 2020 16 (12), 7874-7882
    DOI: [10.1021/acs.jctc.0c00774](https://doi.org/10.1021/acs.jctc.0c00774)

    Parameters
    ----------
    nsteps : int
        Number of steps to propagate.

    Returns
    -------
    traj : ndarray
        Markov chain Monte Carlo state trajectory.

    """
    return propagate_tmat(_NAGEL20_4STATE_TMAT, nsteps) + 1

nagel20_6state(nsteps)

Six state model taken from Nagel et al. 20.

Daniel Nagel, Anna Weber, and Gerhard Stock Journal of Chemical Theory and Computation 2020 16 (12), 7874-7882 DOI: 10.1021/acs.jctc.0c00774

Parameters:

  • nsteps (int) –

    Number of steps to propagate.

Returns:

  • traj ( ndarray ) –

    Markov chain Monte Carlo state trajectory.

Source code in src/msmhelper/utils/datasets.py
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
@_decorate_tmat(_NAGEL20_6STATE_TMAT)
def nagel20_6state(nsteps):
    """Six state model taken from Nagel et al. 20.

    Daniel Nagel, Anna Weber, and Gerhard Stock
    Journal of Chemical Theory and Computation 2020 16 (12), 7874-7882
    DOI: [10.1021/acs.jctc.0c00774](https://doi.org/10.1021/acs.jctc.0c00774)

    Parameters
    ----------
    nsteps : int
        Number of steps to propagate.

    Returns
    -------
    traj : ndarray
        Markov chain Monte Carlo state trajectory.

    """
    return propagate_tmat(_NAGEL20_6STATE_TMAT, nsteps) + 1