Implied TimescalesΒΆ

implied-timescales_evaluated
In [1]:
import numpy as np
import matplotlib.pyplot as pp
from msmbuilder.example_datasets import fetch_alanine_dipeptide
from msmbuilder.cluster import KCenters
from msmbuilder.msm import ContinuousTimeMSM, MarkovStateModel
from msmbuilder.msm import implied_timescales
/Users/rmcgibbo/miniconda/envs/3.4.2/lib/python3.4/site-packages/sklearn/externals/joblib/_multiprocessing_helpers.py:29: UserWarning: [Errno 28] No space left on device.  joblib will operate in serial mode
  warnings.warn('%s.  joblib will operate in serial mode' % (e,))

In [2]:
trajectories = fetch_alanine_dipeptide()['trajectories']
heavy_inds = trajectories[0].topology.select_atom_indices('heavy')
trajectories = [t.atom_slice(heavy_inds) for t in trajectories]
In [3]:
cluster = KCenters(metric='rmsd', n_clusters=25)
sequences = cluster.fit_transform(trajectories)
print(cluster.summarize())
KCenters clustering
--------------------
n_clusters : 25
metric     : rmsd

Inertia       : 2686.6779000755137
Mean distance : 0.02686704767123185
Max  distance : 0.044182708394108414


In [4]:
lag_times = [1, 4, 8, 12]
n_timescales = 10
In [5]:
msm_timescales = implied_timescales(sequences, lag_times, n_timescales=n_timescales, msm=MarkovStateModel(verbose=False))
for i in range(n_timescales):
   pp.plot(lag_times, msm_timescales[:, i], 'o-')

pp.title('Discrete-time MSM Relaxation Timescales')
pp.semilogy()
pp.show()
In [6]:
ctmsm_timescales = implied_timescales(sequences, lag_times, n_timescales=n_timescales, msm=ContinuousTimeMSM(verbose=True))
for i in range(n_timescales):
   pp.plot(lag_times, ctmsm_timescales[:, i], 'o-')

pp.title('Continuous-Time MSM Relaxation Timescales')
pp.semilogy()
pp.show()
/Users/rmcgibbo/miniconda/envs/3.4.2/lib/python3.4/site-packages/msmbuilder-3.0.0-py3.4-macosx-10.5-x86_64.egg/msmbuilder/utils/param_sweep.py:55: ExperimentalWarning: 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Warning: 'ContinuousTimeMSM' is in an experimental state.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  model.fit(sequences)
/Users/rmcgibbo/miniconda/envs/3.4.2/lib/python3.4/site-packages/msmbuilder-3.0.0-py3.4-macosx-10.5-x86_64.egg/msmbuilder/utils/param_sweep.py:55: ExperimentalWarning: 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Warning: 'ContinuousTimeMSM' is in an experimental state.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  model.fit(sequences)

[ContinuousTimeMSM] 140 rates pegged to zero
[ContinuousTimeMSM] 129 rates pegged to zero
[ContinuousTimeMSM] 113 rates pegged to zero
/Users/rmcgibbo/miniconda/envs/3.4.2/lib/python3.4/site-packages/msmbuilder-3.0.0-py3.4-macosx-10.5-x86_64.egg/msmbuilder/utils/param_sweep.py:55: ExperimentalWarning: 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Warning: 'ContinuousTimeMSM' is in an experimental state.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  model.fit(sequences)
/Users/rmcgibbo/miniconda/envs/3.4.2/lib/python3.4/site-packages/msmbuilder-3.0.0-py3.4-macosx-10.5-x86_64.egg/msmbuilder/utils/param_sweep.py:55: ExperimentalWarning: 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Warning: 'ContinuousTimeMSM' is in an experimental state.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  model.fit(sequences)


[ContinuousTimeMSM] 118 rates pegged to zero

(implied-timescales.ipynb; implied-timescales_evaluated.ipynb; implied-timescales.py)

Versions