Implied TimescalesΒΆ

implied-timescales_evaluated
In [1]:
%matplotlib inline
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
loading from /home/rmcgibbo/miniconda/lib/plugins
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       : 2507.29146811
Mean distance : 0.0250731654128
Max  distance : 0.0445165514739

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=False))
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()
/home/rmcgibbo/miniconda/lib/python2.7/site-packages/msmbuilder-3.2.0-py2.7-linux-x86_64.egg/msmbuilder/utils/param_sweep.py:55: ExperimentalWarning: 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Warning: 'ContinuousTimeMSM' is in an experimental state.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  model.fit(sequences)
In [7]:
 

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

Versions