-
Notifications
You must be signed in to change notification settings - Fork 0
/
system_functions_ALA4-21x21grids.py
executable file
·36 lines (31 loc) · 1.56 KB
/
system_functions_ALA4-21x21grids.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import unittest
import warnings
import numpy as np
from copy import copy, deepcopy
# from PyEmma
from pyemma.msm.analysis import pcca
def ALA4_msstates( T_AA ):
# Define the metastable states from analysis of T_AA_mle
membership=pcca(T_AA, 4)
# the precise definitions were fine-tuned by hand, I should plot the PCCA states to double check!
E1 = np.where(membership[:,0]>0.4)[0]
E2 = np.where(membership[:,1]>0.5)[0]
H = np.where(membership[:,2]>0.5)[0]
I = np.where(membership[:,3]>0.5)[0]
# make sure there is no overlap
#print "checking the overlap of metastable states:"
check = [val for val in H if val in I]
if (len(check) != 0 ): raise ValueError('Some metastable states are overlapping!')
check = [val for val in H if val in E1]
if (len(check) != 0 ): raise ValueError('Some metastable states are overlapping!')
check = [val for val in H if val in E2]
if (len(check) != 0 ): raise ValueError('Some metastable states are overlapping!')
check = [val for val in I if val in E1]
if (len(check) != 0 ): raise ValueError('Some metastable states are overlapping!')
check = [val for val in I if val in E2]
if (len(check) != 0 ): raise ValueError('Some metastable states are overlapping!')
check = [val for val in E1 if val in E2]
if (len(check) != 0 ): raise ValueError('Some metastable states are overlapping!')
return H, I, E2, E1
# shortcut function for msstates, should always be linked to the particular calculation (above) for each system
get_msstates = lambda T, lcc, bins: ALA4_msstates( T )