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
        )
 def test_initial_max_length(self):
     engine = CalvinistDynamics([-0.5, -0.4, -0.3, -0.2, -0.1, 0.1, -0.1])
     bootstrap_AB_maxlength = paths.FullBootstrapping(transition=self.tisAB,
                                                      snapshot=self.snapA,
                                                      initial_max_length=3,
                                                      engine=engine)
     bootstrap_AB_maxlength.output_stream = open(os.devnull, "w")
     gs = bootstrap_AB_maxlength.run(build_attempts=1)
示例#3
0
 def ratcheter(self, interfaces, direction="out_in"):
     if direction == "in_out":
         stateA = self.DFG_in
         stateB = self.DFG_out
     elif direction == "out_in":
         stateA = self.DFG_out
         stateB = self.DFG_in
     else:
         raise RuntimeError("direction is " + str(direction) +
                            ": must be 'in_out' or 'out_in'.")
     transition = paths.TISTransition(stateA, stateB, interfaces, self.cv)
     ratcheter = paths.FullBootstrapping(
         transition=transition,
         snapshot=self.engine.current_snapshot,
         storage=self.storage,
         engine=self.engine)
     return ratcheter
def bootstrap(sampling_transition, init_frame, forbidden_states, engine,
              ms_outers):
    my_state = sampling_transition.stateA
    print("Ratcheting initial conditions for state " + my_state.name)
    my_interfaces = sampling_transition.interfaces
    try:
        outer_interface = ms_outers.volume_for_interface_set(my_interfaces)
    except KeyError:
        extra_interfaces = None
    else:
        extra_interfaces = [outer_interface]

    ratchet = paths.FullBootstrapping(
        transition=sampling_transition,
        snapshot=init_frame,
        engine=engine,
        forbidden_states=forbidden_states,
        extra_interfaces=extra_interfaces
    )
    init_conds = ratchet.run()
    init_outer = init_conds[max([s.replica for s in init_conds.samples])]
    init_inner = init_conds[0]
    return init_inner.trajectory, init_outer.trajectory
示例#5
0
            print(distances)
        attempt += 1
        print('')

        # Create a network to study unbinding paths
        # note the list/tuple structure: that's because this is normally a list of tuples,
        # each tuple representing a transition to study
        scheme = paths.DefaultScheme(mistis, engine=engine)
        sset = scheme.initial_conditions_from_trajectories(
            initial_trajectories + minus_trajectories)
        print scheme.initial_conditions_report(sset)

elif initial_trajectory_method == 'bootstrap':
    print('Bootstrapping initial trajectory...')
    bootstrap = paths.FullBootstrapping(
        transition=mistis.transitions[(bound, unbound)],
        snapshot=initial_snapshot,
        engine=engine_hot)
    #storage.save(bootstrap) # Causes Dataframe error
    initial_sample_set = bootstrap.run()
    initial_trajectories = [s.trajectory for s in initial_sample_set]
    print(initial_trajectories)

    # Set of initial move scheme and total sample set for normal temperature engine
    scheme = paths.DefaultScheme(mistis, engine=engine)
    sset = scheme.initial_conditions_from_trajectories(
        trajectories=initial_trajectories,
        # this strategy is useful for MSTIS Networks and similar ones when generating
        # from a single long trajectory that could contain MinusInterface samples
        strategies=[
            # 1. split and pick shortest and exclude for MinusInterfaceEnsembles
            ('split', {