|
41 | 41 | "import openpathsampling as paths\n", |
42 | 42 | "import openpathsampling.engines.openmm as ops_openmm\n", |
43 | 43 | "\n", |
44 | | - "import mdtraj as md\n", |
45 | | - "\n", |
46 | | - "# Jupyter is raising deprecation warning from JSON now... ignore\n", |
47 | | - "import warnings\n", |
48 | | - "warnings.filterwarnings('ignore')" |
| 44 | + "import mdtraj as md" |
49 | 45 | ] |
50 | 46 | }, |
51 | 47 | { |
|
61 | 57 | "cell_type": "markdown", |
62 | 58 | "metadata": {}, |
63 | 59 | "source": [ |
64 | | - "The next cell shows you how to set up several things specific to OpenMM. We'll be running in the $NVT$ ensemble, with $T=300 K$. We're using the [Velocity Verlet with Velocity Randomization (VVVR) integrator](http://arxiv.org/abs/1301.3800), which simulates Langevin dynamics. Note that the integrator itself comes from [`openmmtools`](https://github.com/choderalab/openmmtools), a library that extends `OpenMM`.\n", |
| 60 | + "The next cell shows you how to set up several things specific to OpenMM. We'll be running in the $NVT$ ensemble, with $T=300 K$. We're using the [Velocity Verlet with Velocity Randomization (VVVR) integrator](http://arxiv.org/abs/1301.3800), which simulates Langevin dynamics. Note that the integrator itself comes from [`openmmtools`](https://github.com/choderalab/openmmtools), a library that extends OpenMM. You should always use a reversible integrator when performing path sampling simulations. The default integrators in OpenMM are leapfrog-based, and therefore not reversible.\n", |
65 | 61 | "\n", |
66 | 62 | "You can learn a lot more about setting up OpenMM simulations from the [OpenMM documentation](http://docs.openmm.org/). However, it is often even easier to use the [OpenMM Script Builder](http://builder.openmm.org/) to learn how to set up the simulation the way you'd like." |
67 | 63 | ] |
|
135 | 131 | "\n", |
136 | 132 | "We'll need the atom numbers for these (just as Gromacs put those atom numbers into an `idx` file). To find them, we'll use MDTraj's `Topology` object. First, we convert the OPS `Topology` object to an MDTraj `Topology` object.\n", |
137 | 133 | "\n", |
138 | | - "> NB: There are several types of `Topology` objects. See, for example, what you get from `type(engine.topology)` vs. `type(engine.simulation.topology)` and then `type(md_topology)` after you make it. The tricks discussed below are for the MDTraj topology objects." |
| 134 | + "> NB: There are several types of `Topology` objects. See, for example, what you get from `type(engine.topology)` vs. `type(engine.simulation.topology)` and then `type(md_topology)` after you make it. The atom selection language discussed below is only for MDTraj topology objects." |
139 | 135 | ] |
140 | 136 | }, |
141 | 137 | { |
|
259 | 255 | "network = paths.TPSNetwork(initial_states=C_7eq, final_states=alpha_R)\n", |
260 | 256 | "scheme = paths.OneWayShootingMoveScheme(network=network, \n", |
261 | 257 | " selector=paths.UniformSelector(),\n", |
262 | | - " engine=engine)" |
| 258 | + " engine=engine).named(\"tps_scheme\")" |
263 | 259 | ] |
264 | 260 | }, |
265 | 261 | { |
|
268 | 264 | "source": [ |
269 | 265 | "## Getting an initial trajectory\n", |
270 | 266 | "\n", |
271 | | - "In practice, getting the initial trajectory can be one of the hardest parts of path sampling. For this example, you could easily do it by running high temperature MD to get an unphysical path, and then equilibrate it for a while. However, for the purposes of this tutorial, I already did that for you. So we'll just load the equilibrated trajectory from a file." |
| 267 | + "In practice, getting the initial trajectory can be one of the hardest parts of path sampling. For this example, you could easily do it by running high temperature MD to get an unphysical path, and then equilibrate it for a while. However, for the purposes of this tutorial, I already did that for you. So we'll just load the equilibrated trajectory from a file.\n", |
| 268 | + "\n", |
| 269 | + "Note that this trajectory comes from an OPS NetCDF file. This should not be confused with the Amber NetCDF trajectory format. NetCDF is a storage backend that can handle arbitrary data. The way that data is organized for OPS is different from the way it is organized in Amber, so the file formats are not compatible." |
272 | 270 | ] |
273 | 271 | }, |
274 | 272 | { |
|
281 | 279 | "init_traj = init_traj_storage.trajectories[0]" |
282 | 280 | ] |
283 | 281 | }, |
| 282 | + { |
| 283 | + "cell_type": "markdown", |
| 284 | + "metadata": {}, |
| 285 | + "source": [ |
| 286 | + "The CVs you created act like functions when applied to a snapshot or trajectory. This allows us to easily plot the trajectory in $\\phi$ and $\\psi$, using `matplotlib`." |
| 287 | + ] |
| 288 | + }, |
284 | 289 | { |
285 | 290 | "cell_type": "code", |
286 | 291 | "execution_count": null, |
|
330 | 335 | "metadata": {}, |
331 | 336 | "outputs": [], |
332 | 337 | "source": [ |
333 | | - "storage = paths.Storage(\"tps_simulation_results.nc\", \"w\", template=init_traj[0])\n", |
| 338 | + "storage = paths.Storage(\"tps_simulation_results.nc\", \"w\", template=init_traj[0])" |
| 339 | + ] |
| 340 | + }, |
| 341 | + { |
| 342 | + "cell_type": "markdown", |
| 343 | + "metadata": {}, |
| 344 | + "source": [ |
| 345 | + "If you get a `PermissionError` when doing that, it probably means that you have already opened this file for writing. Use `storage.close()` to close the old file." |
| 346 | + ] |
| 347 | + }, |
| 348 | + { |
| 349 | + "cell_type": "code", |
| 350 | + "execution_count": null, |
| 351 | + "metadata": {}, |
| 352 | + "outputs": [], |
| 353 | + "source": [ |
334 | 354 | "sampler = paths.PathSampling(storage=storage,\n", |
335 | 355 | " move_scheme=scheme,\n", |
336 | 356 | " sample_set=initial_conditions)" |
|
378 | 398 | "name": "python", |
379 | 399 | "nbconvert_exporter": "python", |
380 | 400 | "pygments_lexer": "ipython3", |
381 | | - "version": "3.7.2" |
| 401 | + "version": "3.7.3" |
| 402 | + }, |
| 403 | + "toc": { |
| 404 | + "base_numbering": 1, |
| 405 | + "nav_menu": {}, |
| 406 | + "number_sections": true, |
| 407 | + "sideBar": true, |
| 408 | + "skip_h1_title": true, |
| 409 | + "title_cell": "Table of Contents", |
| 410 | + "title_sidebar": "Contents", |
| 411 | + "toc_cell": false, |
| 412 | + "toc_position": {}, |
| 413 | + "toc_section_display": true, |
| 414 | + "toc_window_display": false |
| 415 | + }, |
| 416 | + "varInspector": { |
| 417 | + "cols": { |
| 418 | + "lenName": 16, |
| 419 | + "lenType": 16, |
| 420 | + "lenVar": 40 |
| 421 | + }, |
| 422 | + "kernels_config": { |
| 423 | + "python": { |
| 424 | + "delete_cmd_postfix": "", |
| 425 | + "delete_cmd_prefix": "del ", |
| 426 | + "library": "var_list.py", |
| 427 | + "varRefreshCmd": "print(var_dic_list())" |
| 428 | + }, |
| 429 | + "r": { |
| 430 | + "delete_cmd_postfix": ") ", |
| 431 | + "delete_cmd_prefix": "rm(", |
| 432 | + "library": "var_list.r", |
| 433 | + "varRefreshCmd": "cat(var_dic_list()) " |
| 434 | + } |
| 435 | + }, |
| 436 | + "types_to_exclude": [ |
| 437 | + "module", |
| 438 | + "function", |
| 439 | + "builtin_function_or_method", |
| 440 | + "instance", |
| 441 | + "_Feature" |
| 442 | + ], |
| 443 | + "window_display": false |
382 | 444 | } |
383 | 445 | }, |
384 | 446 | "nbformat": 4, |
385 | | - "nbformat_minor": 2 |
| 447 | + "nbformat_minor": 4 |
386 | 448 | } |
0 commit comments