Пример #1
0
    print "new A", len(newA)
    print [m._id for m in newA]
    print "new B", len(newB)
    print [m._id for m in newB]
    exit()


if True:
    print "\nestimating rates"
    estimator = EstimateRates(rates, weights, B)
    print "max rate estimate", max(estimator.rate_estimates.itervalues())
    print "max rate estimate", min(estimator.rate_estimates.itervalues())
    print "rate estimate", estimator.rate_estimates[A[0]] / rate_norm
    mfpt_estimates = dict(( (u, 1./k) for u, k in estimator.rate_estimates.iteritems() ))

tsr = TwoStateRates(rates, A, B, weights=weights)
print "after removing unconnected we have", len(tsr.mfpt_computer.nodes), "nodes and", len(tsr.mfpt_computer.rates), "rates"
if True:
    print "computing rates using mfpt estimates"
#    tsr.compute_rates(mfpt_estimates=mfpt_estimates)
    tsr.compute_rates(mfpt_estimates=mfpt_estimates, cg=True)
if False:
    tsr.compute_rates(symmetric=True, Peq=weights)
else:
    tsr.compute_rates(use_umfpack=False, cg=False)
kAB = tsr.get_rate_AB()
mfpt = tsr.mfpt_computer.mfpt_dict
print "rate AB", kAB * np.exp(pele_rates.max_log_rate)
print "sparse linalg finished in", tsr.mfpt_computer.time_solve, "seconds"
print "max mfpt time", max(mfpt.itervalues())
print "min mfpt time", min(mfpt.itervalues())
Пример #2
0
    print "min ratio", min([kest / kcalc for kcalc, kest in estimates.values()])

if True:
    print "computing rates using symmetric method"
    lin.compute_mfpt_symmetric(Peq)
    print "rate symetric", 1./lin.mfpt_dict[A[0]] / rate_norm
            
if False:
    print "computing rates using conjugant gradient method"
    lin.compute_mfpt(cg=True)
    print "rate cg", 1./lin.mfpt_dict[A[0]] / rate_norm


if True:
    print "computing committors and steady state rate constants"
    tsr = TwoStateRates(rates, A, B)
    tsr.compute_rates()
    rAB = tsr.get_rate_AB() * np.exp(pele_rates.max_log_rate)
    print "rate AB", rAB
    tsr.compute_committors()
    rABss = tsr.get_rate_AB_SS() * np.exp(pele_rates.max_log_rate)
    print "steady state rate", rABss

if False:
    print "saving the graph structure"
    nodes = list(lin.nodes)
    node2i = dict([(node, i) for i, node in enumerate(nodes)])
    node2i = dict([(node, node._id) for node in nodes])
    with open("error.graph.id", "w") as fout:
        fout.write("# %d\n" % (node2i[iter(B).next()]))
        for uv in lin.rates.iterkeys():