コード例 #1
0
    def test1(self):
        m1 = self.db.getMinimum(1)
        m2 = self.db.getMinimum(2)
        m3 = self.db.getMinimum(3)
        m4 = self.db.getMinimum(4)

        rcalc = RateCalculation(self.db.transition_states(), [m1], [m2],
                                T=0.592)
        rcalc.compute_rates()
        self.assertAlmostEqual(rcalc.get_rate_AB(), 7106337458., delta=1e4)
        self.assertAlmostEqual(rcalc.get_rate_BA(), 1955395816., delta=1e4)

        rcalc = RateCalculation(self.db.transition_states(), [m1, m3],
                                [m2, m4],
                                T=0.592)
        rcalc.compute_rates()
        self.assertAlmostEqual(rcalc.get_rate_AB(), 8638736600., delta=1e4)
        self.assertAlmostEqual(rcalc.get_rate_BA(), 3499625167., delta=1e4)

        rla = RatesLinalg(self.db.transition_states(), [m1], [m2], T=0.592)
        rAB = rla.compute_rates()
        self.assertAlmostEqual(rAB, 7106337458., delta=1e4)

        rla = RatesLinalg(self.db.transition_states(), [m1, m3], [m2, m4],
                          T=0.592)
        rAB = rla.compute_rates()
        self.assertAlmostEqual(rAB, 8638736600., delta=1e4)
コード例 #2
0
    def _color_by_mfpt(self, min1, T=1.):
        print("coloring by the mean first passage time to get to minimum",
              min1._id)
        # get a list of transition states in the same cluster as min1
        edges = nx.bfs_edges(self.graph, min1)
        transition_states = [
            self.graph.get_edge_data(u, v)["ts"] for u, v in edges
        ]
        if not check_thermodynamic_info(transition_states):
            raise Exception(
                "The thermodynamic information is not yet computed")

        # get an arbitrary second minimum2
        for ts in transition_states:
            if ts.minimum2 != min1:
                min2 = ts.minimum2
                break
        A = [min1]
        B = [min2]
        rcalc = RatesLinalg(transition_states, A, B, T=T)
        rcalc.compute_rates()
        mfptimes = rcalc.get_mfptimes()
        tmax = max(mfptimes.values())

        def get_mfpt(m):
            try:
                return mfptimes[m]
            except KeyError:
                return tmax

        self.dg.color_by_value(get_mfpt)
        self.redraw_disconnectivity_graph()
コード例 #3
0
    def do_check_committors(self, A, B):
        rcalc = RateCalculation(self.db.transition_states(), A, B)
        rcalc.compute_rates_and_committors()
        committors = rcalc.get_committors()

        rla = RatesLinalg(self.db.transition_states(), A, B)
        cla = rla.compute_committors()

        for m, qla in cla.items():
            self.assertAlmostEqual(committors[m], qla, 7)
コード例 #4
0
    def do_check_rates(self, A, B):
        rcalc = RateCalculation(self.db.transition_states(), A, B)
        rcalc.compute_rates()
        rAB = rcalc.get_rate_AB()
        rBA = rcalc.get_rate_BA()

        rla = RatesLinalg(self.db.transition_states(), A, B)
        rAB_la = rla.compute_rates()

        self.assertAlmostEqual(rAB, rAB_la, 7)