|
| 1 | +import click |
| 2 | +from paths_cli.parameters import (INPUT_FILE, OUTPUT_FILE, ENGINE, STATES, |
| 3 | + N_STEPS_MC, INIT_SNAP) |
| 4 | +from paths_cli.commands.visit_all import visit_all_main |
| 5 | +from paths_cli.commands.equilibrate import equilibrate_main |
| 6 | +from paths_cli.commands.pathsampling import path_sampling_main |
| 7 | + |
| 8 | + |
| 9 | +@click.command("one-pot-tps", |
| 10 | + short_help="Start from a single frame and end with full TPS") |
| 11 | +@INPUT_FILE.clicked(required=True) |
| 12 | +@OUTPUT_FILE.clicked(required=True) |
| 13 | +@STATES.clicked(required=True) |
| 14 | +@ENGINE.clicked(required=False) |
| 15 | +@click.option("--engine-hot", required=False, |
| 16 | + help="high temperature engine for initial trajectory") |
| 17 | +@INIT_SNAP.clicked(required=False) |
| 18 | +@N_STEPS_MC |
| 19 | +def one_pot_tps(input_file, output_file, state, nsteps, engine, engine_hot, |
| 20 | + init_frame): |
| 21 | + storage = INPUT_FILE.get(input_file) |
| 22 | + engine = ENGINE.get(storage, engine) |
| 23 | + engine_hot = engine if engine_hot is None else ENGINE.get(storage, |
| 24 | + engine_hot) |
| 25 | + one_pot_tps_main(output_storage=OUTPUT_FILE.get(output_file), |
| 26 | + states=STATES.get(storage, state), |
| 27 | + engine=engine, |
| 28 | + engine_hot=engine_hot, |
| 29 | + initial_frame=INIT_SNAP.get(storage, init_frame), |
| 30 | + nsteps=nsteps) |
| 31 | + |
| 32 | + |
| 33 | +def one_pot_tps_main(output_storage, states, engine, engine_hot, |
| 34 | + initial_frame, nsteps): |
| 35 | + import openpathsampling as paths |
| 36 | + network = paths.TPSNetwork.from_states_all_to_all(states) |
| 37 | + scheme = paths.OneWayShootingMoveScheme(network=network, |
| 38 | + selector=paths.UniformSelector(), |
| 39 | + engine=engine) |
| 40 | + trajectory, _ = visit_all_main(None, states, engine_hot, initial_frame) |
| 41 | + equil_multiplier = 1 |
| 42 | + equil_extra = 0 |
| 43 | + equil_set, _ = equilibrate_main(None, scheme, trajectory, |
| 44 | + equil_multiplier, equil_extra) |
| 45 | + return path_sampling_main(output_storage, scheme, equil_set, nsteps) |
| 46 | + |
| 47 | +CLI = one_pot_tps |
| 48 | +SECTION = "Workflow" |
| 49 | +REQUIRES_OPS = (1, 2) |
0 commit comments