def setup(self):
     pes = paths.engines.toy.Gaussian(1, [1.0, 1.0], [0.0, 0.0])
     integ = paths.engines.toy.LangevinBAOABIntegrator(0.01, 0.1, 2.5)
     topology = paths.engines.toy.Topology(n_spatial=2,
                                           n_atoms=1,
                                           masses=[1.0],
                                           pes=pes)
     self.engine = paths.engines.toy.Engine(
         options={
             'n_frames_max': 1000,
             'n_steps_per_frame': 10,
             'integ': integ
         },
         topology=topology).named("engine")
     self.other_engine = paths.engines.toy.Engine(options={
         'n_frames_max': 5000,
         'n_steps_per_frame': 1,
         'integ': integ
     },
                                                  topology=topology)
     self.cv = paths.FunctionCV("x", lambda x: x.xyz[0][0])
     self.state_A = paths.CVDefinedVolume(self.cv, float("-inf"),
                                          0).named("A")
     self.state_B = paths.CVDefinedVolume(self.cv, 10,
                                          float("inf")).named("B")
     self.network = paths.TPSNetwork(self.state_A,
                                     self.state_B).named('network')
     self.scheme = paths.OneWayShootingMoveScheme(
         self.network, paths.UniformSelector(), self.engine).named("scheme")
     self.other_scheme = paths.OneWayShootingMoveScheme(
         self.network, paths.UniformSelector(), self.other_engine)
     self.tempdir = tempfile.mkdtemp()
def tps_fixture(flat_engine, tps_network_and_traj):
    network, traj = tps_network_and_traj
    scheme = paths.OneWayShootingMoveScheme(network=network,
                                            selector=paths.UniformSelector(),
                                            engine=flat_engine)
    init_conds = scheme.initial_conditions_from_trajectories(traj)
    return (scheme, network, flat_engine, init_conds)
def one_pot_tps_main(output_storage, states, engine, engine_hot, initial_frame,
                     nsteps):
    import openpathsampling as paths
    network = paths.TPSNetwork.from_states_all_to_all(states)
    scheme = paths.OneWayShootingMoveScheme(network=network,
                                            selector=paths.UniformSelector(),
                                            engine=engine)
    trajectory, _ = visit_all_main(None, states, engine_hot, initial_frame)
    equil_multiplier = 1
    equil_extra = 0
    equil_set, _ = equilibrate_main(None, scheme, trajectory, equil_multiplier,
                                    equil_extra)
    return pathsampling_main(output_storage, scheme, equil_set, nsteps)
Пример #4
0
def tps_main(engine, states, init_traj, output_storage, n_steps):
    network = paths.TPSNetwork(initial_states=states, final_states=states)
    scheme = paths.OneWayShootingMoveScheme(network, engine=engine)
    initial_conditions = \
            scheme.initial_conditions_from_trajectories(init_traj)
    simulation = paths.PathSampling(
        storage=output_storage,
        move_scheme=scheme,
        sample_set=initial_conditions
    )
    simulation.run(n_steps)
    output_storage.tags['final_conditions'] = simulation.sample_set
    return simulation.sample_set, simulation
Пример #5
0
#
# 1. Create a `network`
# 2. Create a `move_scheme`
# 3. Set up `initial_conditions`
# 4. Create the `PathSampling` object and run it.
#
# Since we already created all the input to these when we set up the first trajectory, we can load use the versions we loaded above.

# In[5]:

network = paths.TPSNetwork(C_7eq, alpha_R)

# In[6]:

scheme = paths.OneWayShootingMoveScheme(network,
                                        selector=paths.UniformSelector(),
                                        engine=engine)

# In[7]:

initial_conditions = scheme.initial_conditions_from_trajectories(traj)

# In[8]:

storage = paths.Storage("alanine_dipeptide_tps.nc", "w", template)
sampler = paths.PathSampling(storage=storage,
                             move_scheme=scheme,
                             sample_set=initial_conditions)

# Note: 10000 steps will take a long time. If you just want to run a little bit, reduce this number.
Пример #6
0
     'n_steps_per_frame': 10}, topology)
template = toys.Snapshot(coordinates=np.array([[0.0, 0.0]]),
                         velocities=np.array([[0.0, 0.0]]),
                         engine=engine)

def val(snapshot, index):
    return snapshot.xyz[0][index]

cv_x = paths.FunctionCV("xval", val, index=0)
cv_y = paths.FunctionCV("yval", val, index=1)

stateA = paths.CVDefinedVolume(cv_x, float("-inf"), -0.6).named("A")
stateB = paths.CVDefinedVolume(cv_x, 0.6, float("inf")).named("B")

network = paths.TPSNetwork(stateA, stateB)
scheme = paths.OneWayShootingMoveScheme(network=network, engine=engine)

# I'll fake an initial trajectory
trajectory = paths.Trajectory([
    toys.Snapshot(coordinates=np.array([[-.65+k*0.1, 0.0]]),
                  velocities=np.array([[0.1, 0.0]]),
                  engine=engine)
    for k in range(14)
])

initial_conditions = scheme.initial_conditions_from_trajectories(trajectory)

# use this for debugging the equilibration
# equil_store = paths.Storage('equil.nc', 'w')
equil_store = None