def setup(self):
        self.cv = paths.FunctionCV("Id", lambda snap: snap.xyz[0][0])
        cv_neg = paths.FunctionCV("Neg", lambda snap: -snap.xyz[0][0])
        self.stateA = paths.CVDefinedVolume(self.cv, -1.0, 0.0)
        self.stateB = paths.CVDefinedVolume(self.cv, 1.0, 2.0)
        self.stateC = paths.CVDefinedVolume(self.cv, 3.0, 4.0)
        interfacesAB = paths.VolumeInterfaceSet(
            self.cv, -1.0, [0.0, 0.2, 0.4]
        )
        interfacesBC = paths.VolumeInterfaceSet(
            self.cv, 1.0, [2.0, 2.2, 2.4]
        )
        interfacesBA = paths.VolumeInterfaceSet(
            cv_neg, -1.0, [-1.0, -0.8, -0.6]
        )

        network = paths.MISTISNetwork([
            (self.stateA, interfacesAB, self.stateB),
            (self.stateB, interfacesBC, self.stateC),
            (self.stateB, interfacesBA, self.stateA)
        ])
        self.tisAB = network.input_transitions[(self.stateA, self.stateB)]
        self.tisBC = network.input_transitions[(self.stateB, self.stateC)]
        self.tisBA = network.input_transitions[(self.stateB, self.stateA)]
        self.network = network
        self.snapA = make_1d_traj([-0.5])[0]

        self.noforbid_noextra_AB = paths.FullBootstrapping(
            transition=self.tisAB,
            snapshot=self.snapA
        )
Exemple #2
0
    def setup(self):
        paths.InterfaceSet._reset()
        self.cv = paths.FunctionCV("x", lambda x: x.xyz[0][0])
        self.state_A = paths.CVDefinedVolume(self.cv, float("-inf"), 0.0)
        self.state_B = paths.CVDefinedVolume(self.cv, 1.0, float("inf"))
        pes = paths.engines.toy.LinearSlope([0, 0, 0], 0)
        integ = paths.engines.toy.LangevinBAOABIntegrator(0.01, 0.1, 2.5)
        topology = paths.engines.toy.Topology(n_spatial=3,
                                              masses=[1.0],
                                              pes=pes)
        self.engine = paths.engines.toy.Engine(options={'integ': integ},
                                               topology=topology)

        interfaces = paths.VolumeInterfaceSet(self.cv, float("-inf"),
                                              [0.0, 0.1, 0.2])
        network = paths.MISTISNetwork([(self.state_A, interfaces, self.state_B)
                                       ])
        init_traj = make_1d_traj([-0.1, 0.2, 0.5, 0.8, 1.1])
        scheme = paths.MoveScheme(network)
        scheme.append([
            paths.strategies.OneWayShootingStrategy(
                selector=paths.UniformSelector(), engine=self.engine),
            paths.strategies.PathReversalStrategy(),
            paths.strategies.OrganizeByMoveGroupStrategy()
        ])
        init_cond = scheme.initial_conditions_from_trajectories(init_traj)
        self.sim = PathSampling(storage=None,
                                move_scheme=scheme,
                                sample_set=init_cond)
def make_mistis_network():
    cvX = paths.FunctionCV(name="cvX", f=xval)
    cvY = paths.FunctionCV(name="cvY", f=yval)
    cvXprime = paths.FunctionCV(name="cvXprime", f=xprime)

    x_under_min = paths.CVDefinedVolume(cvX, float("-inf"), -0.35)
    x_over_max = paths.CVDefinedVolume(cvX, 0.35, float("inf"))
    y_under_min = paths.CVDefinedVolume(cvY, float("-inf"), -0.35)
    y_over_max = paths.CVDefinedVolume(cvY, 0.35, float("inf"))

    stateA = (x_under_min & y_under_min).named("A")
    stateB = (x_over_max & y_under_min).named("B")
    stateC = (x_under_min & y_over_max).named("C")

    interfacesAB = paths.VolumeInterfaceSet(
        cvX, float("-inf"), [-0.35, -0.3, -0.27, -0.24, -0.2, -0.1]
    )
    interfacesAC = paths.VolumeInterfaceSet(
        cvY, float("-inf"), [-0.35, -0.3, -0.27, -0.24, -0.2, -0.1, 0.0]
    )
    interfacesBA = paths.VolumeInterfaceSet(
        cvXprime, float("-inf"), [-0.35, -0.3, -0.27, -0.24, -0.2, -0.1]
    )

    ms_outer = paths.MSOuterTISInterface.from_lambdas(
        {iface: 0.0 for iface in [interfacesAB, interfacesBA]}
    )
    network = paths.MISTISNetwork(
        [(stateA, interfacesAB, stateB),
         (stateA, interfacesAC, stateC),
         (stateB, interfacesBA, stateA)],
        ms_outers=ms_outer,
        strict_sampling=True
    ).named("mistis")
    return network
 def test_fail_without_lambdas(self):
     fake_ifaceA = paths.InterfaceSet(cv=self.ifacesA.cv,
                                      volumes=self.ifacesA.volumes,
                                      direction=self.ifacesA.direction)
     network = paths.MISTISNetwork([(self.stateA, fake_ifaceA, self.stateB)
                                    ])
     network.sampling_transitions[0].tcp = self.tcp_A
     bias = paths.SRTISBiasFromNetwork(network)
Exemple #5
0
    def setup(self):
        # set up the trajectories, ensembles, etc. for this test
        paths.InterfaceSet._reset()
        cv_A = paths.FunctionCV('Id', lambda s: s.xyz[0][0])
        cv_B = paths.FunctionCV('1-Id', lambda s: 1.0-s.xyz[0][0])
        self.cv_x = cv_A
        self.state_A = paths.CVDefinedVolume(cv_A,
                                             float("-inf"), 0.0).named("A")
        self.state_B = paths.CVDefinedVolume(cv_B,
                                             float("-inf"), 0.0).named("B")
        interfaces_AB = paths.VolumeInterfaceSet(cv_A, float("-inf"),
                                                 [0.0, 0.1, 0.2])
        interfaces_BA = paths.VolumeInterfaceSet(cv_B, float("-inf"),
                                                 [0.0, 0.1, 0.2])

        # trajectory that crosses each interface, one state-to-state
        self.trajs_AB = [make_tis_traj_fixed_steps(i) for i in [0, 1, 2]]
        self.trajs_AB += [make_1d_traj([(-0.5 + i) * 0.1
                                        for i in range(12)])]

        self.trajs_BA = [make_tis_traj_fixed_steps(i, reverse=True)
                         for i in [0, 1, 2]]
        self.trajs_BA += [make_1d_traj([1.0 - (-0.5 + i) * 0.1
                                        for i in range(12)])]

        # set up mistis
        self.mistis = paths.MISTISNetwork([
            (self.state_A, interfaces_AB, self.state_B),
            (self.state_B, interfaces_BA, self.state_A)
        ])
        mover_stub_mistis = MoverWithSignature(self.mistis.all_ensembles,
                                               self.mistis.all_ensembles)

        mistis_ssets = self._make_fake_sampling_sets(self.mistis)
        self.mistis_steps = self._make_fake_steps(mistis_ssets,
                                                  mover_stub_mistis)

        self.mistis_weighted_trajectories = steps_to_weighted_trajectories(
            self.mistis_steps,
            self.mistis.sampling_ensembles
        )

        # TODO: set up mstis
        self.mstis = paths.MSTISNetwork([
            (self.state_A, interfaces_AB),
            (self.state_B, interfaces_BA)
        ])
        mover_stub_mstis = MoverWithSignature(self.mstis.all_ensembles,
                                              self.mstis.all_ensembles)
        mstis_ssets = self._make_fake_sampling_sets(self.mstis)
        self.mstis_steps = self._make_fake_steps(mstis_ssets,
                                                 mover_stub_mstis)

        self.mstis_weighted_trajectories = steps_to_weighted_trajectories(
            self.mstis_steps,
            self.mstis.sampling_ensembles
        )
    def test_bias_from_ms_network(self):
        ms_outer = paths.MSOuterTISInterface.from_lambdas({
            self.ifacesA: -0.1,
            self.ifacesB: 0.1
        })
        network = paths.MISTISNetwork(
            [(self.stateA, self.ifacesA, self.stateB),
             (self.stateB, self.ifacesB, self.stateA)],
            ms_outers=[ms_outer])
        transition_AB = None
        transition_BA = None
        for t in network.sampling_transitions:
            if t.stateA == self.stateA:
                t.tcp = self.tcp_A
                transition_AB = t
            elif t.stateA == self.stateB:
                t.tcp = self.tcp_B
                transition_BA = t
            else:
                print([t.stateA, t.stateB])
                print([self.stateA, self.stateB])
                raise RuntimeError("Weird states in test transition")

        bias = paths.SRTISBiasFromNetwork(network)

        n_ensembles = len(bias.dataframe.index)
        for i in range(n_ensembles):
            for j in range(i, n_ensembles):
                if not np.isnan(bias.dataframe.loc[i, j]):
                    np.testing.assert_almost_equal(
                        bias.dataframe.loc[i, j],
                        old_div(1.0, bias.dataframe.loc[j, i]))

        for i in range(len(transition_AB.ensembles) - 1):
            ens_to = transition_AB.ensembles[i]
            ens_from = transition_AB.ensembles[i + 1]
            assert_almost_equal(bias.bias_value(ens_from, ens_to), 0.5)

        for i in range(len(transition_BA.ensembles) - 1):
            ens_to = transition_BA.ensembles[i]
            ens_from = transition_BA.ensembles[i + 1]
            assert_almost_equal(bias.bias_value(ens_from, ens_to), 0.2)

        for ensA in transition_AB.ensembles:
            for ensB in transition_BA.ensembles:
                assert_equal(np.isnan(bias.bias_value(ensA, ensB)), True)
                assert_equal(np.isnan(bias.bias_value(ensB, ensA)), True)

        assert_almost_equal(
            bias.bias_value(transition_BA.ensembles[-1], network.ms_outers[0]),
            old_div(5.0, 2))
        assert_almost_equal(
            bias.bias_value(transition_AB.ensembles[-1], network.ms_outers[0]),
            old_div(2.0, 2))

        raise SkipTest
    def setup(self):
        self.HAS_TQDM = paths.progress.HAS_TQDM
        paths.progress.HAS_TQDM = False
        paths.InterfaceSet._reset()
        cvA = paths.FunctionCV(name="xA", f=lambda s: s.xyz[0][0])
        cvB = paths.FunctionCV(name="xB", f=lambda s: -s.xyz[0][0])
        state_A = paths.CVDefinedVolume(cvA, float("-inf"), -0.5).named("A")
        state_B = paths.CVDefinedVolume(cvB, float("-inf"), -0.5).named("B")
        interfaces_A = paths.VolumeInterfaceSet(cvA, float("-inf"),
                                                [-0.5, -0.3])
        network = paths.MISTISNetwork([(state_A, interfaces_A, state_B)])
        self.scheme = MoveScheme(network)
        self.scheme.append(OneWayShootingStrategy())
        self.scheme.append(NearestNeighborRepExStrategy())
        self.scheme.append(OrganizeByMoveGroupStrategy())

        root_mover = self.scheme.move_decision_tree()
        path_sim_mover = paths.PathSimulatorMover(root_mover, None)
        null_mover = paths.IdentityPathMover(counts_as_trial=False)

        ens_0 = network.sampling_ensembles[0]
        ens_1 = network.sampling_ensembles[1]

        # acc repex ens1-2
        # acc   fwd ens1
        # acc  bkwd ens2
        # rej  bkwd ens1
        # rej repex ens1-2
        step_info = [(1, True, path_sim_mover, 'repex', [ens_0, ens_1], None),
                     (2, True, path_sim_mover, 'shooting', [ens_0], 0),
                     (3, True, path_sim_mover, 'shooting', [ens_1], 1),
                     (4, False, path_sim_mover, 'shooting', [ens_0], 1),
                     (5, False, path_sim_mover, 'repex', [ens_0, ens_1], None)]
        self.steps = [_make_acceptance_mock_step(*info) for info in step_info]

        self.null_mover_6 = _make_null_mover_step(6, path_sim_mover,
                                                  null_mover)
        self.null_mover_change_key = [(None, str([path_sim_mover, [None]]))]

        acceptance_empty = MoveAcceptanceAnalysis(self.scheme)

        acceptance = MoveAcceptanceAnalysis(self.scheme)
        acceptance.add_steps(self.steps)

        acceptance_null = MoveAcceptanceAnalysis(self.scheme)
        acceptance_null.add_steps(self.steps + [self.null_mover_6])

        self.analysis = {
            'empty': acceptance_empty,
            'normal': acceptance,
            'with_null': acceptance_null
        }
def unidirectional_tis_network():
    r"""Fixture for unidirectional TIS with the default (RETIS) scheme.

    This has states defined as initial state :math:`x < 0` and final state
    :math:`x \ge 10`. The interfaces are at :math:`x=0`, :math:`x=3`, and
    :math:`x=6`.
    """
    paths.InterfaceSet._reset()
    state_A = paths.CVDefinedVolume(DEFAULT_CV, float("-inf"), 0)
    state_B = paths.CVDefinedVolume(DEFAULT_CV, 10, float("inf"))
    interfaces = paths.VolumeInterfaceSet(DEFAULT_CV, float("-inf"), [0, 3, 6])
    network = paths.MISTISNetwork([(state_A, interfaces, state_B)])
    return network
Exemple #9
0
 def test_bad_network(self):
     # raises error if more than one transition shares a minus ensemble
     # (flux cannot be calculated with multiple interface set minus move)
     state_C = paths.CVDefinedVolume(self.cv_x, 0.5, 0.7)
     trans_AB = self.mistis.transitions[(self.state_A, self.state_B)]
     trans_BA = self.mistis.transitions[(self.state_B, self.state_A)]
     interfaces_AB = trans_AB.interfaces
     interfaces_BA = trans_BA.interfaces
     interfaces_AC = trans_AB.interfaces
     bad_mistis = paths.MISTISNetwork([
         (self.state_A, interfaces_AB, self.state_B),
         (self.state_B, interfaces_BA, self.state_A),
         (self.state_A, interfaces_AC, state_C)
     ])
     scheme = paths.DefaultScheme(bad_mistis)
     scheme.build_move_decision_tree()
     minus_flux = MinusMoveFlux(scheme)
Exemple #10
0
    def setup(self):
        paths.InterfaceSet._reset()
        self.cv_inc = paths.FunctionCV(name="inc", f=lambda s: s.xyz[0][0])
        self.cv_dec = paths.FunctionCV(name="dec",
                                       f=lambda s: 1.0 - s.xyz[0][0])
        self.lambdas = [0.0, 0.1, 0.2, 0.3]
        self.interfaces_inc = paths.VolumeInterfaceSet(cv=self.cv_inc,
                                                       minvals=float("-inf"),
                                                       maxvals=self.lambdas)
        self.interfaces_dec = paths.VolumeInterfaceSet(cv=self.cv_dec,
                                                       minvals=float("-inf"),
                                                       maxvals=self.lambdas)
        self.stateA = paths.CVDefinedVolume(self.cv_inc, float("-inf"),
                                            0.0).named("A")
        self.stateB = paths.CVDefinedVolume(self.cv_dec, float("-inf"),
                                            0.0).named("B")
        self.network = paths.MISTISNetwork([
            (self.stateA, self.interfaces_inc, self.stateB),
            (self.stateB, self.interfaces_dec, self.stateA)
        ])
        self.volumes = [
            self.interfaces_inc.new_interface(0.5),
            self.interfaces_dec.new_interface(0.4)
        ]

        self.ms_outer_explicit = paths.MSOuterTISInterface(
            interface_sets=[self.interfaces_inc, self.interfaces_dec],
            volumes=self.volumes,
            lambdas=[0.5, 0.4])

        self.ms_outer = paths.MSOuterTISInterface.from_lambdas({
            self.interfaces_inc:
            0.5,
            self.interfaces_dec:
            0.4
        })

        # TODO: temporary hack until networks working; remove after
        self.post_network = paths.MSOuterTISInterface.from_lambdas({
            t.interfaces: {
                self.cv_inc: 0.5,
                self.cv_dec: 0.4
            }[t.interfaces.cv]
            for t in self.network.sampling_transitions
        })
 def setup(self):
     # create the network
     paths.InterfaceSet._reset()
     xval = paths.FunctionCV(name="xA", f=lambda s: s.xyz[0][0])
     self.stateA = paths.CVDefinedVolume(xval, -1.0, -0.5).named("A")
     self.stateB = paths.CVDefinedVolume(xval, 0.5, float("inf")).named("B")
     ifacesA = paths.VolumeInterfaceSet(xval, float(-1.0),
                                        [-0.5, -0.4, -0.3, -0.2])
     self.network = paths.MISTISNetwork([(self.stateA, ifacesA, self.stateB)
                                         ])
     transition = self.network.transitions[(self.stateA, self.stateB)]
     ensembles = transition.ensembles
     self.xval = xval
     self.ifacesA = ifacesA
     # create the biases
     bias_table = {}
     bias_table[ensembles[0]] = 1.0
     bias_table[ensembles[1]] = 0.5
     bias_table[ensembles[2]] = 0.2
     self.bias = BiasEnsembleTable.ratios_from_dictionary(bias_table)
     # samples, moves, changes
     traj = make_1d_traj(
         [-0.55, -0.45, -0.35, -0.25, -0.15, -0.26, -0.36, -0.46, -0.56])
     s0 = paths.Sample(replica=0, ensemble=ensembles[0], trajectory=traj)
     s1 = paths.Sample(replica=1, ensemble=ensembles[1], trajectory=traj)
     s2 = paths.Sample(replica=2, ensemble=ensembles[2], trajectory=traj)
     self.sample_set = paths.SampleSet([s0, s1, s2])
     self.sample_set.sanity_check()
     move_01 = paths.EnsembleHopMover(ensembles[0], ensembles[1])
     move_02 = paths.EnsembleHopMover(ensembles[0], ensembles[2])
     move_12 = paths.EnsembleHopMover(ensembles[1], ensembles[2])
     move_21 = paths.EnsembleHopMover(ensembles[2], ensembles[1])
     move_20 = paths.EnsembleHopMover(ensembles[2], ensembles[0])
     move_10 = paths.EnsembleHopMover(ensembles[1], ensembles[0])
     # NOTE: all changes here are accepted
     self.change_01 = move_01.move(self.sample_set)
     self.change_02 = move_02.move(self.sample_set)
     self.change_12 = move_12.move(self.sample_set)
     self.change_21 = move_21.move(self.sample_set)
     self.change_20 = move_20.move(self.sample_set)
     self.change_10 = move_10.move(self.sample_set)
     # convenience lists for changes going outward vs. inward
     self.out_changes = [self.change_01, self.change_02, self.change_12]
     self.in_changes = [self.change_10, self.change_20, self.change_21]
    def test_bias_from_network(self):
        # force the TCP in
        network = paths.MISTISNetwork([(self.stateA, self.ifacesA, self.stateB)
                                       ])
        network.sampling_transitions[0].tcp = self.tcp_A
        bias = paths.SRTISBiasFromNetwork(network)
        transition = list(network.transitions.values())[0]  # only one

        # check reciprocal of symmetric partners
        for i in range(4):
            for j in range(i, 4):
                assert_equal(bias.dataframe.loc[i, j],
                             old_div(1.0, bias.dataframe.loc[j, i]))

        for i in range(len(transition.ensembles) - 1):
            ens_to = transition.ensembles[i]
            ens_from = transition.ensembles[i + 1]
            assert_equal(bias.bias_value(ens_from, ens_to), 0.5)

        for i in range(len(transition.ensembles) - 2):
            ens_to = transition.ensembles[i]
            ens_from = transition.ensembles[i + 2]
            assert_equal(bias.bias_value(ens_from, ens_to), 0.25)
 def test_fail_without_tcp(self):
     network = paths.MISTISNetwork([(self.stateA, self.ifacesA, self.stateB)
                                    ])
     bias = paths.SRTISBiasFromNetwork(network)
    def test_add_biases(self):
        # this is where we combine multiple biases into one
        ifacesA = self.ifacesA[:-1]
        xval2 = paths.FunctionCV(name="xB", f=lambda s: 0.5 - s.xyz[0][0])
        ifacesB = paths.VolumeInterfaceSet(xval2, float("-inf"),
                                           [0.0, 0.1, 0.2])
        xval3 = paths.FunctionCV(name="xC", f=lambda s: s.xyz[0][0] - 2.0)
        stateC = paths.CVDefinedVolume(self.xval, -3.0, 2.0)
        ifacesC = paths.VolumeInterfaceSet(xval3, -1.0, [0.0, 0.1, 0.2, 0.3])
        network = paths.MISTISNetwork(
            [(self.stateA, ifacesA, self.stateB),
             (self.stateB, ifacesB, self.stateA),
             (stateC, ifacesC, self.stateA)],
            ms_outers=paths.MSOuterTISInterface.from_lambdas({
                ifacesA: -0.2,
                ifacesB: 0.3
            }))
        ens_A = network.transitions[(self.stateA, self.stateB)].ensembles
        ens_B = network.transitions[(self.stateB, self.stateA)].ensembles
        ens_C = network.transitions[(stateC, self.stateA)].ensembles
        ms_outer = list(network.special_ensembles['ms_outer'].keys())[0]
        dict_A = {ens_A[0]: 1.0, ens_A[1]: 0.5, ens_A[2]: 0.2, ms_outer: 0.1}
        dict_B = {ens_B[0]: 1.0, ens_B[1]: 0.6, ens_B[2]: 0.3, ms_outer: 0.15}
        dict_C = {ens_C[0]: 1.0, ens_C[1]: 0.8, ens_C[2]: 0.2}

        bias_A = BiasEnsembleTable.ratios_from_dictionary(dict_A)
        bias_B = BiasEnsembleTable.ratios_from_dictionary(dict_B)
        bias_C = BiasEnsembleTable.ratios_from_dictionary(dict_C)
        bias_AB = bias_A + bias_B
        # check the ensembles_to_ids
        assert_equal(len(bias_AB.ensembles_to_ids), 7)
        for ens in ens_A:
            assert_in(bias_AB.ensembles_to_ids[ens], [0, 1, 2])
        for ens in ens_B:
            assert_in(bias_AB.ensembles_to_ids[ens], [3, 4, 5])
        assert_equal(bias_AB.ensembles_to_ids[ms_outer], 6)

        # check values
        df_A = bias_A.dataframe
        df_B = bias_B.dataframe
        df_AB = bias_AB.dataframe
        col_A_msouter = bias_A.ensembles_to_ids[ms_outer]
        col_B_msouter = bias_B.ensembles_to_ids[ms_outer]
        col_AB_msouter = bias_AB.ensembles_to_ids[ms_outer]

        for ens1 in ens_A:
            idx_A = bias_A.ensembles_to_ids[ens1]
            idx_AB = bias_AB.ensembles_to_ids[ens1]
            for ens2 in ens_A:
                col_A = bias_A.ensembles_to_ids[ens2]
                col_AB = bias_AB.ensembles_to_ids[ens2]
                val_A = df_A.loc[idx_A, col_A]
                val_AB = df_AB.loc[idx_AB, col_AB]
                assert_equal(val_A, val_AB)
            for ens2 in ens_B:
                col_AB = bias_AB.ensembles_to_ids[ens2]
                assert_equal(np.isnan(df_AB.loc[idx_AB, col_AB]), True)
            assert_equal(df_A.loc[idx_A, col_A_msouter],
                         df_AB.loc[idx_AB, col_AB_msouter])
            assert_equal(df_A.loc[col_A_msouter, idx_A],
                         df_AB.loc[col_AB_msouter, idx_AB])

        for ens1 in ens_B:
            idx_B = bias_B.ensembles_to_ids[ens1]
            idx_AB = bias_AB.ensembles_to_ids[ens1]
            for ens2 in ens_B:
                col_B = bias_B.ensembles_to_ids[ens2]
                col_AB = bias_AB.ensembles_to_ids[ens2]
                val_B = df_B.loc[idx_B, col_B]
                val_AB = df_AB.loc[idx_AB, col_AB]
                assert_equal(val_B, val_AB)
            for ens2 in ens_A:
                col_AB = bias_AB.ensembles_to_ids[ens2]
                assert_equal(np.isnan(df_AB.loc[idx_AB, col_AB]), True)
            assert_equal(df_B.loc[idx_B, col_B_msouter],
                         df_AB.loc[idx_AB, col_AB_msouter])
            assert_equal(df_B.loc[col_B_msouter, idx_B],
                         df_AB.loc[col_AB_msouter, idx_AB])

        # just to make sure no errors raise when there are NaNs in table
        bias_ABC = bias_A + bias_B + bias_C
def tis_network(cv_and_states):
    cv, state_A, state_B = cv_and_states
    interfaces = paths.VolumeInterfaceSet(cv, float("-inf"), [0.0, 0.1, 0.2])
    network = paths.MISTISNetwork([(state_A, interfaces, state_B)])
    return network
Exemple #16
0
min_unbound = 0.90  # nanometers, minimum unbound state separation distance

print('Creating interfaces...')
ninterfaces = 100
bound = paths.CVDefinedVolume(cv, lambda_min=0.0, lambda_max=max_bound)
unbound = paths.CVDefinedVolume(cv,
                                lambda_min=min_unbound,
                                lambda_max=float("inf"))
interfaces = paths.VolumeInterfaceSet(cv,
                                      minvals=0.0,
                                      maxvals=np.linspace(
                                          max_bound, min_unbound - 0.01,
                                          ninterfaces))

print('Creating network...')
mistis = paths.MISTISNetwork([(bound, interfaces, unbound)])

initial_trajectory_method = 'bootstrap'
if initial_trajectory_method == 'high-temperature':
    # We are starting in the bound state, so
    # generate high-temperature trajectory that reaches the unbound state
    print('Generating high-temperature trajectory...')
    #ensemble = not (paths.ExitsXEnsemble(bound) & paths.EntersXEnsemble(unbound))
    unbinding_ensemble = paths.AllOutXEnsemble(unbound)
    bridging_ensemble = paths.AllOutXEnsemble(bound) & paths.AllOutXEnsemble(
        unbound)
    initial_trajectories = list()
    minus_trajectories = list()
    tmp_network = paths.TPSNetwork(bound, unbound)
    attempt = 0
    while (len(initial_trajectories) == 0) or (len(minus_trajectories) == 0):