In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import openpathsampling as paths
import openpathsampling.storage as st
In [2]:
#import logging.config
#logging.config.fileConfig("../resources/logging.conf", disable_existing_loggers=False)
In [3]:
%%time
storage = st.AnalysisStorage("mstis.nc")
In [4]:
len(storage.steps)
Out[4]:
In [5]:
mstis = storage.networks.load(0)
retis = mstis.sampling_transitions[0]
scheme = storage.schemes[0]
In [6]:
sset0 = storage.samplesets[0]
numeric_labels = {s.ensemble : s.replica for s in sset0}
string_labels = {s.ensemble : str(s.replica) for s in sset0}
numeric_to_string = {numeric_labels[e] : string_labels[e] for e in numeric_labels.keys()}
In [7]:
%%time
trace_1 = paths.trace_ensembles_for_replica(0, storage.steps)
In [8]:
plt.plot([numeric_labels[e] for e in trace_1])
Out[8]:
In [9]:
%%time
repx_net = paths.ReplicaNetwork(scheme, storage.steps)
In [10]:
%%time
flow = repx_net.flow(bottom=retis.minus_ensemble, top=retis.ensembles[-1],
included_ensembles=[retis.minus_ensemble]+retis.ensembles)
print(flow)
In [11]:
flow_num = {numeric_labels[k] : flow[k] for k in flow.keys()}
print(flow_num)
In [12]:
sorted_vals = []
for k in sorted(flow_num.keys()):
sorted_vals.append(flow_num[k])
In [13]:
plt.plot(sorted(flow_num.keys()), sorted_vals)
Out[13]:
In [14]:
repx_net.trips(bottom=retis.minus_ensemble, top=retis.ensembles[-1])
Out[14]:
In [15]:
repx_net.transition_matrix().style
# .style has the effect that 0.0 is reported as 0 instead of 0.000000
Out[15]:
If you would like to set a different order, that can be done by providing a list of the ensembles in whatever order you choose:
In [16]:
import numpy as np
perm = np.random.permutation(len(mstis.all_ensembles))
print(perm)
In [17]:
order = [mstis.all_ensembles[p] for p in perm]
repx_net.transition_matrix(index_order=order).style
Out[17]:
In [18]:
repx_net.mixing_matrix().style
Out[18]:
In [19]:
repxG = paths.ReplicaNetworkGraph(repx_net)
In [20]:
# draw('graphviz') gives better results, but requires pygraphviz
repxG.draw('spring')
Blue is a minus interface, red is a normal interface. The multiple state outer interface is green.
In [ ]: