Skip to content

Commit 2321251

Browse files
IAlibayatravitz
andcommitted
Update md notebook for v1.7 (#238)
* Update md inputs for v1.7 * bumping colab version to 1.7.0, plus rerunning locally --------- Co-authored-by: Alyssa Travitz <alyssa.travitz@omsf.io> Co-authored-by: Alyssa Travitz <31974495+atravitz@users.noreply.github.com>
1 parent 6e6a906 commit 2321251

File tree

1 file changed

+85
-34
lines changed

1 file changed

+85
-34
lines changed

openmm_md/plain_md.ipynb

Lines changed: 85 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"id": "7266db2c-37e5-419a-9015-929ea1635d98",
1414
"metadata": {},
1515
"source": [
16-
"In this notebook we run an MD simulation of benzene bound to T4-lysozyme L99A.![image](assets/t4lyso.png)"
16+
"In this notebook we run an MD simulation of benzene bound to T4-lysozyme L99A.\n",
17+
"\n",
18+
"<img src=\"assets/t4lyso.png\" width=\"400\">"
1719
]
1820
},
1921
{
@@ -76,7 +78,7 @@
7678
},
7779
{
7880
"cell_type": "code",
79-
"execution_count": null,
81+
"execution_count": 1,
8082
"id": "6559bc05",
8183
"metadata": {},
8284
"outputs": [],
@@ -87,12 +89,12 @@
8789
"if \"COLAB_RELEASE_TAG\" in os.environ:\n",
8890
" !pip install -q condacolab\n",
8991
" import condacolab\n",
90-
" condacolab.install_from_url(\"https://github.com/OpenFreeEnergy/ExampleNotebooks/releases/download/april-2025/OpenFEforge-1.5.0.dev0-Linux-x86_64.sh\")"
92+
" condacolab.install_from_url(\"https://github.com/OpenFreeEnergy/openfe/releases/download/v1.7.0/OpenFEforge-1.7.0-Linux-x86_64.sh\")"
9193
]
9294
},
9395
{
9496
"cell_type": "code",
95-
"execution_count": null,
97+
"execution_count": 2,
9698
"id": "eb1368ca",
9799
"metadata": {},
98100
"outputs": [],
@@ -134,7 +136,7 @@
134136
},
135137
{
136138
"cell_type": "code",
137-
"execution_count": 1,
139+
"execution_count": 3,
138140
"id": "20fc8142-c618-4d50-b903-5a04f6a34d5c",
139141
"metadata": {},
140142
"outputs": [],
@@ -186,7 +188,7 @@
186188
},
187189
{
188190
"cell_type": "code",
189-
"execution_count": 2,
191+
"execution_count": 4,
190192
"id": "b27e54cc-fd6a-4afc-ab22-4dde0561938c",
191193
"metadata": {},
192194
"outputs": [],
@@ -200,12 +202,13 @@
200202
"# Setting the production length and checkpoint interval to 20 ps to match the trajectory write interval, so one frame will be written\n",
201203
"settings.simulation_settings.production_length = 0.02 * unit.nanosecond # setting the npt production length to 20 ps\n",
202204
"settings.output_settings.checkpoint_interval = 0.02 * unit.nanosecond # setting the checkpoint interval to 20 ps\n",
203-
"settings.engine_settings.compute_platform = 'CPU' # running the simulation on the cpu"
205+
"settings.engine_settings.compute_platform = 'CPU' # running the simulation on the cpu\n",
206+
"settings.solvation_settings.solvent_padding = 1.0 * unit.nanometer # set the solvent padding to 1 nm to reduce the number of waters"
204207
]
205208
},
206209
{
207210
"cell_type": "code",
208-
"execution_count": 3,
211+
"execution_count": 5,
209212
"id": "b69668c9-2e74-421e-a9ea-b7f3bc6c6e5a",
210213
"metadata": {},
211214
"outputs": [
@@ -220,18 +223,20 @@
220223
" 'amber/tip3p_HFE_multivalent.xml',\n",
221224
" 'amber/phosaa10.xml'],\n",
222225
" 'hydrogen_mass': 3.0,\n",
223-
" 'nonbonded_cutoff': <Quantity(1.0, 'nanometer')>,\n",
226+
" 'nonbonded_cutoff': {'unit': 'nanometer', 'val': 0.9},\n",
224227
" 'nonbonded_method': 'PME',\n",
225228
" 'rigid_water': True,\n",
226-
" 'small_molecule_forcefield': 'openff-2.1.1'},\n",
227-
" 'integrator_settings': {'barostat_frequency': <Quantity(25.0, 'timestep')>,\n",
229+
" 'small_molecule_forcefield': 'openff-2.2.1'},\n",
230+
" 'integrator_settings': {'barostat_frequency': {'unit': 'timestep',\n",
231+
" 'val': 25.0},\n",
228232
" 'constraint_tolerance': 1e-06,\n",
229-
" 'langevin_collision_rate': <Quantity(1.0, '1 / picosecond')>,\n",
233+
" 'langevin_collision_rate': {'unit': '1 / picosecond',\n",
234+
" 'val': 1.0},\n",
230235
" 'n_restart_attempts': 20,\n",
231236
" 'reassign_velocities': False,\n",
232237
" 'remove_com': False,\n",
233-
" 'timestep': <Quantity(4.0, 'femtosecond')>},\n",
234-
" 'output_settings': {'checkpoint_interval': <Quantity(20.0, 'picosecond')>,\n",
238+
" 'timestep': {'unit': 'femtosecond', 'val': 4.0}},\n",
239+
" 'output_settings': {'checkpoint_interval': {'unit': 'nanosecond', 'val': 0.02},\n",
235240
" 'checkpoint_storage_filename': 'checkpoint.chk',\n",
236241
" 'equil_npt_structure': 'equil_npt.pdb',\n",
237242
" 'equil_nvt_structure': 'equil_nvt.pdb',\n",
@@ -241,26 +246,38 @@
241246
" 'output_indices': 'not water',\n",
242247
" 'preminimized_structure': 'system.pdb',\n",
243248
" 'production_trajectory_filename': 'simulation.xtc',\n",
244-
" 'trajectory_write_interval': <Quantity(20.0, 'picosecond')>},\n",
249+
" 'trajectory_write_interval': {'unit': 'picosecond',\n",
250+
" 'val': 20.0}},\n",
245251
" 'partial_charge_settings': {'nagl_model': None,\n",
246252
" 'number_of_conformers': None,\n",
247253
" 'off_toolkit_backend': 'ambertools',\n",
248254
" 'partial_charge_method': 'am1bcc'},\n",
249255
" 'protocol_repeats': 1,\n",
250-
" 'simulation_settings': {'equilibration_length': <Quantity(0.01, 'nanosecond')>,\n",
251-
" 'equilibration_length_nvt': <Quantity(0.01, 'nanosecond')>,\n",
256+
" 'simulation_settings': {'equilibration_length': {'unit': 'nanosecond',\n",
257+
" 'val': 0.01},\n",
258+
" 'equilibration_length_nvt': {'unit': 'nanosecond',\n",
259+
" 'val': 0.01},\n",
252260
" 'minimization_steps': 5000,\n",
253-
" 'production_length': <Quantity(0.02, 'nanosecond')>},\n",
254-
" 'solvation_settings': {'box_shape': 'cube',\n",
261+
" 'production_length': {'unit': 'nanosecond',\n",
262+
" 'val': 0.02}},\n",
263+
" 'solvation_settings': {'box_shape': 'dodecahedron',\n",
255264
" 'box_size': None,\n",
256265
" 'box_vectors': None,\n",
257266
" 'number_of_solvent_molecules': None,\n",
258267
" 'solvent_model': 'tip3p',\n",
259-
" 'solvent_padding': <Quantity(1.2, 'nanometer')>},\n",
268+
" 'solvent_padding': {'unit': 'nanometer', 'val': 1.0}},\n",
260269
" 'thermo_settings': {'ph': None,\n",
261-
" 'pressure': <Quantity(0.986923267, 'standard_atmosphere')>,\n",
270+
" 'pressure': {'unit': 'bar', 'val': 1},\n",
262271
" 'redox_potential': None,\n",
263-
" 'temperature': <Quantity(298.15, 'kelvin')>}}\n"
272+
" 'temperature': {'unit': 'kelvin', 'val': 298.15}}}\n"
273+
]
274+
},
275+
{
276+
"name": "stderr",
277+
"output_type": "stream",
278+
"text": [
279+
"/Users/atravitz/micromamba/envs/openfe-conda/lib/python3.11/site-packages/gufe/settings/models.py:30: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/\n",
280+
" pprint.pprint(self.dict())\n"
264281
]
265282
}
266283
],
@@ -282,7 +299,7 @@
282299
},
283300
{
284301
"cell_type": "code",
285-
"execution_count": 4,
302+
"execution_count": 6,
286303
"id": "3b0f5a26-b23b-4ab2-9f1e-293d98ed5bcd",
287304
"metadata": {},
288305
"outputs": [],
@@ -303,7 +320,7 @@
303320
},
304321
{
305322
"cell_type": "code",
306-
"execution_count": 5,
323+
"execution_count": 7,
307324
"id": "987cceda-1253-417b-8cca-bc750ac0aa1e",
308325
"metadata": {},
309326
"outputs": [],
@@ -342,7 +359,7 @@
342359
},
343360
{
344361
"cell_type": "code",
345-
"execution_count": 6,
362+
"execution_count": 8,
346363
"id": "7689c7ba-39a2-49ea-b82b-e3b198354c5b",
347364
"metadata": {},
348365
"outputs": [],
@@ -353,7 +370,7 @@
353370
"md_dir.mkdir(exist_ok=True)\n",
354371
"\n",
355372
"# then we write out the transformation\n",
356-
"nontransformation.dump(md_dir / f\"{nontransformation.name}.json\")"
373+
"nontransformation.to_json(md_dir / f\"{nontransformation.name}.json\")"
357374
]
358375
},
359376
{
@@ -381,7 +398,7 @@
381398
},
382399
{
383400
"cell_type": "code",
384-
"execution_count": 7,
401+
"execution_count": 9,
385402
"id": "544d037d-3a53-4390-91b8-3104c00694f0",
386403
"metadata": {
387404
"editable": true,
@@ -395,9 +412,36 @@
395412
"name": "stderr",
396413
"output_type": "stream",
397414
"text": [
398-
"/Users/hannahbaumann/miniforge3/envs/openfe_dev/lib/python3.12/site-packages/openfe/protocols/openmm_utils/omm_compute.py:76: UserWarning: Non-CUDA platform selected: CPU, this may significantly impact simulation performance\n",
415+
"INFO:openfe.utils.system_probe.log:SYSTEM CONFIG DETAILS:\n",
416+
"INFO:openfe.utils.system_probe.log.hostname:hostname: 'Alyssas-Macbook-Pro.local'\n",
417+
"INFO:openfe.utils.system_probe.log.gpu:CUDA-based GPU not found\n",
418+
"INFO:openfe.utils.system_probe.log:Memory used: 20.7G (63.6%)\n",
419+
"INFO:openfe.utils.system_probe.log:scratch_PlainMDProtocolUnit-52e66ff618014bb3877c15dc0d137171_attempt_0: 43% full (530.3G free)\n",
420+
"INFO:gufekey.openfe.protocols.openmm_md.plain_md_methods.PlainMDProtocolUnit:Creating system\n",
421+
"INFO:openmmforcefields.generators.template_generators:Requested to generate parameters for residue <Residue 0 (UNK) of chain 0>\n",
422+
"INFO:openmmforcefields.generators.template_generators:Generating a residue template for [H][c]1[c]([H])[c]([H])[c]([H])[c]([H])[c]1[H] using openff-2.2.1\n",
423+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 0\n",
424+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 1\n",
425+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 2\n",
426+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 3\n",
427+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 4\n",
428+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 5\n",
429+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 6\n",
430+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 7\n",
431+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 8\n",
432+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 9\n",
433+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 10\n",
434+
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 11\n",
435+
"/Users/atravitz/micromamba/envs/openfe-conda/lib/python3.11/site-packages/openfe/protocols/openmm_utils/omm_compute.py:76: UserWarning: Non-CUDA platform selected: CPU, this may significantly impact simulation performance\n",
399436
" warnings.warn(wmsg)\n",
400-
"WARNING:root:Non-CUDA platform selected: CPU, this may significantly impact simulation performance\n"
437+
"WARNING:root:Non-CUDA platform selected: CPU, this may significantly impact simulation performance\n",
438+
"INFO:openfe.protocols.openmm_md.plain_md_methods:minimizing systems\n",
439+
"INFO:openfe.protocols.openmm_md.plain_md_methods:Running NVT equilibration\n",
440+
"INFO:openfe.protocols.openmm_md.plain_md_methods:Completed NVT equilibration in 19.77936577796936 seconds\n",
441+
"INFO:openfe.protocols.openmm_md.plain_md_methods:Running NPT equilibration\n",
442+
"INFO:openfe.protocols.openmm_md.plain_md_methods:Completed NPT equilibration in 22.49833083152771 seconds\n",
443+
"INFO:openfe.protocols.openmm_md.plain_md_methods:running production phase\n",
444+
"INFO:openfe.protocols.openmm_md.plain_md_methods:Completed simulation in 45.916950941085815 seconds\n"
401445
]
402446
}
403447
],
@@ -430,21 +474,20 @@
430474
},
431475
{
432476
"cell_type": "code",
433-
"execution_count": 9,
477+
"execution_count": 10,
434478
"id": "16fbf816-8d3d-4121-ab0e-5cd7741788d6",
435479
"metadata": {},
436480
"outputs": [
437481
{
438482
"name": "stdout",
439483
"output_type": "stream",
440484
"text": [
441-
"checkpoint.chk equil_npt.pdb minimized.pdb simulation.xtc\n",
442-
"db.json equil_nvt.pdb simulation.log system.pdb\n"
485+
"ls: shared_PlainMDProtocolUnit-6b85013e6cb94120baf447540650643b_attempt_0/: No such file or directory\n"
443486
]
444487
}
445488
],
446489
"source": [
447-
"!ls shared_PlainMDProtocolUnit-256e9093d8f3443b9949b95e7ddbb64e_attempt_0/"
490+
"!ls shared_PlainMDProtocolUnit-6b85013e6cb94120baf447540650643b_attempt_0/"
448491
]
449492
},
450493
{
@@ -455,6 +498,14 @@
455498
"### Performance consideration for gas phase MD simulations\n",
456499
"For gas phase MD simulations, we suggest setting `OPENMM_CPU_THREADS` to `1` to obtain good performance."
457500
]
501+
},
502+
{
503+
"cell_type": "code",
504+
"execution_count": null,
505+
"id": "b7f8de97-95b6-4c83-b5ef-17fae1614557",
506+
"metadata": {},
507+
"outputs": [],
508+
"source": []
458509
}
459510
],
460511
"metadata": {
@@ -473,7 +524,7 @@
473524
"name": "python",
474525
"nbconvert_exporter": "python",
475526
"pygments_lexer": "ipython3",
476-
"version": "3.12.8"
527+
"version": "3.11.14"
477528
},
478529
"widgets": {
479530
"application/vnd.jupyter.widget-state+json": {

0 commit comments

Comments
 (0)