Пример #1
0
            'something is wrong. distances and micro_assign not matching in dimensions'
        )
        print len(distances[ii])
        print len(micro_assign[ii])

# Identify 'sinks' for mfpt_off calculations
bulk_clusters = []
bound_clusters = [288, 1020]
for ii in clusters_dist.keys():
    if np.average(clusters_dist[ii]) > BULK_CUTOFF:
        bulk_clusters.append(ii)
#  else:
#         bound_clusters.append(ii)
print len(bulk_clusters)

mfpt_off = mfpt.mfpts(micro_msm, sinks=bulk_clusters, lag_time=80 * 1.8)
mfpt_on = mfpt.mfpts(micro_msm, sinks=bound_clusters, lag_time=80 * 1.8)
#print mfpt_mat.shape
print "Here are so mfpt_off times (ns) and corresponding cluster ids:"
print mfpt_off[mfpt_off > 7.354e6]
print np.where(mfpt_off > 7.354e6)
print("Maximum mfpt_off time is %.3g ns in cluster %d." %
      (np.max(mfpt_off), np.argmax(mfpt_off)))
print("and the mean mfpt_off is %.3g ns" % np.mean(mfpt_off))

print("Maximum mfpt_on time is %.g ns in cluster %d." %
      (np.max(mfpt_on), np.argmax(mfpt_on)))
print("and the mean mfpt_on is %.3g ns" % np.mean(mfpt_on))

mfpt_on_path = '/home/shenglan/TryMSMbuilder/output/C/all_clusters/KC_mfpton_c' + str(
    N_MICRO) + '_s' + str(LOAD_STRIDE) + '.out'
Пример #2
0
    else:
        print ('something is wrong. distances and micro_assign not matching in dimensions')
        print len(distances[ii]) 
        print len(micro_assign[ii])

# Identify 'sinks' for mfpt_off calculations
bulk_clusters = []
bound_clusters = [288,1020]
for ii in clusters_dist.keys():
    if np.average(clusters_dist[ii]) > BULK_CUTOFF:
        bulk_clusters.append(ii)
   #  else:
#         bound_clusters.append(ii)
print len(bulk_clusters)
    
mfpt_off = mfpt.mfpts(micro_msm,sinks = bulk_clusters,lag_time = 80*1.8)
mfpt_on = mfpt.mfpts(micro_msm,sinks = bound_clusters,lag_time = 80*1.8)
#print mfpt_mat.shape
print "Here are so mfpt_off times (ns) and corresponding cluster ids:"
print mfpt_off[mfpt_off > 7.354e6]
print np.where(mfpt_off> 7.354e6)
print ("Maximum mfpt_off time is %.3g ns in cluster %d." % (np.max(mfpt_off),np.argmax(mfpt_off)))
print ("and the mean mfpt_off is %.3g ns"%np.mean(mfpt_off))

print ("Maximum mfpt_on time is %.g ns in cluster %d." % (np.max(mfpt_on),np.argmax(mfpt_on)))
print ("and the mean mfpt_on is %.3g ns"%np.mean(mfpt_on))

mfpt_on_path = '/home/shenglan/TryMSMbuilder/output/C/all_clusters/KC_mfpton_c'+str(N_MICRO)+'_s'+str(LOAD_STRIDE)+'.out'
mfpt_off_path = '/home/shenglan/TryMSMbuilder/output/C/all_clusters/KC_mfptoff_c'+str(N_MICRO)+'_s'+str(LOAD_STRIDE)+'.out'

pickle.dump(mfpt_on,open(mfpt_on_path,'wb'))
    else:
        print(
            'something is wrong. distances and micro_assign not matching in dimensions'
        )
        print len(distances[ii])
        print len(micro_assign[ii])

# Identify 'sinks' for mfpt calculations
bulk_clusters = []
for ii in clusters_dist.keys():
    if np.average(clusters_dist[ii]) > BULK_CUTOFF:
        bulk_clusters.append(ii)
print "These microstates are designated as bulk states:"
print bulk_clusters

mfpt_mat = mfpt.mfpts(micro_msm, sinks=bulk_clusters, lag_time=1.0)
# print mfpt_mat.shape
# print mfpt_mat
print mfpt_mat[mfpt_mat > 0.0]
bound_clusters = np.where(mfpt_mat > 0.0)[0]
print 'The states to not in bulk are:'
print np.where(mfpt_mat > 0.0)

# calculate respawning probability
log_t = np.log(mfpt_mat[mfpt_mat > 0.0])
print log_t
norm = np.sum(np.log(mfpt_mat[mfpt_mat > 0.0]))
respawn_pr = log_t / np.sum(log_t)

print respawn_pr
print np.sum(respawn_pr)
                clusters_dist.update({micro_assign[ii][nn] : [distances[ii][nn]]})
                
    else:
        print ('something is wrong. distances and micro_assign not matching in dimensions')
        print len(distances[ii]) 
        print len(micro_assign[ii])

# Identify 'sinks' for mfpt calculations
bulk_clusters = []
for ii in clusters_dist.keys():
    if np.average(clusters_dist[ii]) > BULK_CUTOFF:
        bulk_clusters.append(ii)
print "These microstates are designated as bulk states:"
print bulk_clusters
    
mfpt_mat = mfpt.mfpts(micro_msm,sinks = bulk_clusters,lag_time = 1.0)
# print mfpt_mat.shape
# print mfpt_mat
print mfpt_mat[mfpt_mat > 0.0]
bound_clusters = np.where(mfpt_mat> 0.0)[0]
print 'The states to not in bulk are:'
print np.where(mfpt_mat> 0.0)


# calculate respawning probability
log_t = np.log(mfpt_mat[mfpt_mat > 0.0])
print log_t
norm = np.sum(np.log(mfpt_mat[mfpt_mat > 0.0]))
respawn_pr = log_t/np.sum(log_t)

print respawn_pr