def do_check(self, A, B, nnodes=20, nedges=20): np.random.seed(0) maker = _MakeRandomGraph(nnodes=20, nedges=20, node_set=A+B) maker.run() reducer = NGT(maker.rates, A, B, debug=False) reducer.compute_rates() rAB = reducer.get_rate_AB() rBA = reducer.get_rate_BA()
def compare_linalg(self, A, B, nnodes=20, nedges=20): from kmc_rates import TwoStateRates maker = _MakeRandomGraph(nnodes=20, nedges=20, node_set=A+B) maker.run() reducer = NGT(maker.rates, A, B) reducer.compute_rates_and_committors() committors = reducer.get_committors() la = TwoStateRates(maker.rates, A, B) # la.compute_rates() la.compute_committors() qla = la.committor_dict for n, qla in la.committor_dict.iteritems(): self.assertAlmostEqual(qla, committors[n], 7)
def _test_rate(self, i, j): reducer = NGT(self.rates, [i], [j], debug=False) reducer.compute_rates() rAB = reducer.get_rate_AB() rBA = reducer.get_rate_BA() self.assertAlmostEqual(rAB, self.final_rate, 7) self.assertAlmostEqual(rBA, self.final_rate, 7) rAB_SS = reducer.get_rate_AB_SS() rBA_SS = reducer.get_rate_BA_SS() self.assertAlmostEqual(rAB_SS, self.final_rate_SS, 7) self.assertAlmostEqual(rBA_SS, self.final_rate_SS, 7)
def _test_rate(self, A, B): # from kmc_rates import GraphReduction reducer = NGT(self.rates, A, B, debug=False) reducer.compute_rates() kAB = reducer.get_rate_AB() kBA = reducer.get_rate_BA() self.assertAlmostEqual(kAB, self.true_kAB, 7) self.assertAlmostEqual(kBA, self.true_kBA, 7) rAB_SS = reducer.get_rate_AB_SS() rBA_SS = reducer.get_rate_BA_SS() self.assertAlmostEqual(rAB_SS, self.true_kAB_SS, 7) self.assertAlmostEqual(rBA_SS, self.true_kBA_SS, 7)