In [1]:
from __future__ import print_function
# if our large test file is available, use it. Otherwise, use file generated from toy_mistis_1_setup_run.ipynb
import os
test_file = "../toy_mistis_1k_OPS1.nc"
filename = test_file if os.path.isfile(test_file) else "mistis.nc"
In [2]:
print(filename)
In [3]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import openpathsampling as paths
In [4]:
%%time
storage = paths.AnalysisStorage(filename)
In [5]:
mistis = storage.networks.load(0)
In [6]:
mistis.hist_args['max_lambda'] = { 'bin_width' : 0.01, 'bin_range' : (-0.35, 0.5) }
mistis.hist_args['pathlength'] = { 'bin_width' : 5, 'bin_range' : (0, 150) }
In [7]:
%%time
scheme = storage.schemes[0]
scheme.move_summary(storage.steps)
In [8]:
scheme.move_summary(storage.steps, 'shooting')
In [9]:
scheme.move_summary(storage.steps, 'minus')
In [10]:
scheme.move_summary(storage.steps, 'repex')
In [11]:
# we need to load the states and the innermost interface for each transition
stateA = storage.volumes['A']
stateB = storage.volumes['B']
stateC = storage.volumes['C']
inner_AB = mistis.transitions[(stateA, stateB)].interfaces[0]
inner_AC = mistis.transitions[(stateA, stateC)].interfaces[0]
inner_BA = mistis.transitions[(stateB, stateA)].interfaces[0]
In [12]:
# got these from mistis_flux.ipynb
fluxes = {(stateA, inner_AB): 0.0916199741819,
(stateA, inner_AC): 0.0915271110694,
(stateB, inner_BA): 0.0916882528979}
mistis.set_fluxes(fluxes)
In [13]:
%%time
rate = mistis.rate_matrix(storage.steps, force=True)
rate
In [35]:
import pandas as pd
pd.options.display.float_format = '{:.3e}'.format
rate
Out[35]:
In [46]:
# this can be copy-pasted into an article
print(rate.to_latex(float_format='{:.3e}'.format))
In [14]:
trans = list(mistis.transitions.values())[2]
trans_hists = trans.histograms['max_lambda']
print(trans)
In [15]:
for hist in trans_hists:
cross_prob = trans_hists[hist].reverse_cumulative()
plt.plot(cross_prob.x, np.log(cross_prob))
plt.plot(trans.tcp.x, np.log(trans.tcp), '-k', lw=2)
Out[15]:
In [16]:
len(storage.steps)
Out[16]:
In [17]:
#import logging.config
#logging.config.fileConfig("../resources/debug_logging.conf", disable_existing_loggers=False)
In [18]:
n_blocks = 1 # for testing code
In [19]:
#! skip
n_blocks = 5 # for real examples
In [20]:
resampling = paths.numerics.BlockResampling(storage.steps, n_blocks=n_blocks)
In [21]:
rate_df_func = lambda steps: mistis.rate_matrix(steps, force=True)
In [22]:
%%time
rates = paths.numerics.ResamplingStatistics(function=rate_df_func, inputs=resampling.blocks)
In [37]:
rates.mean
Out[37]:
In [38]:
rates.std
Out[38]:
In [39]:
rates.percentile(0)
Out[39]:
In [40]:
rates.percentile(25)
Out[40]:
In [41]:
rates.percentile(50)
Out[41]:
In [42]:
rates.percentile(75)
Out[42]:
In [43]:
rates.percentile(100)
Out[43]:
In [ ]: