Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 85 additions & 34 deletions openmm_md/plain_md.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"id": "7266db2c-37e5-419a-9015-929ea1635d98",
"metadata": {},
"source": [
"In this notebook we run an MD simulation of benzene bound to T4-lysozyme L99A.![image](assets/t4lyso.png)"
"In this notebook we run an MD simulation of benzene bound to T4-lysozyme L99A.\n",
"\n",
"<img src=\"assets/t4lyso.png\" width=\"400\">"
]
},
{
Expand Down Expand Up @@ -76,7 +78,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "6559bc05",
"metadata": {},
"outputs": [],
Expand All @@ -87,12 +89,12 @@
"if \"COLAB_RELEASE_TAG\" in os.environ:\n",
" !pip install -q condacolab\n",
" import condacolab\n",
" condacolab.install_from_url(\"https://github.com/OpenFreeEnergy/ExampleNotebooks/releases/download/april-2025/OpenFEforge-1.5.0.dev0-Linux-x86_64.sh\")"
" condacolab.install_from_url(\"https://github.com/OpenFreeEnergy/openfe/releases/download/v1.7.0/OpenFEforge-1.7.0-Linux-x86_64.sh\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "eb1368ca",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -134,7 +136,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"id": "20fc8142-c618-4d50-b903-5a04f6a34d5c",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -186,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "b27e54cc-fd6a-4afc-ab22-4dde0561938c",
"metadata": {},
"outputs": [],
Expand All @@ -200,12 +202,13 @@
"# Setting the production length and checkpoint interval to 20 ps to match the trajectory write interval, so one frame will be written\n",
"settings.simulation_settings.production_length = 0.02 * unit.nanosecond # setting the npt production length to 20 ps\n",
"settings.output_settings.checkpoint_interval = 0.02 * unit.nanosecond # setting the checkpoint interval to 20 ps\n",
"settings.engine_settings.compute_platform = 'CPU' # running the simulation on the cpu"
"settings.engine_settings.compute_platform = 'CPU' # running the simulation on the cpu\n",
"settings.solvation_settings.solvent_padding = 1.0 * unit.nanometer # set the solvent padding to 1 nm to reduce the number of waters"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "b69668c9-2e74-421e-a9ea-b7f3bc6c6e5a",
"metadata": {},
"outputs": [
Expand All @@ -220,18 +223,20 @@
" 'amber/tip3p_HFE_multivalent.xml',\n",
" 'amber/phosaa10.xml'],\n",
" 'hydrogen_mass': 3.0,\n",
" 'nonbonded_cutoff': <Quantity(1.0, 'nanometer')>,\n",
" 'nonbonded_cutoff': {'unit': 'nanometer', 'val': 0.9},\n",
" 'nonbonded_method': 'PME',\n",
" 'rigid_water': True,\n",
" 'small_molecule_forcefield': 'openff-2.1.1'},\n",
" 'integrator_settings': {'barostat_frequency': <Quantity(25.0, 'timestep')>,\n",
" 'small_molecule_forcefield': 'openff-2.2.1'},\n",
" 'integrator_settings': {'barostat_frequency': {'unit': 'timestep',\n",
" 'val': 25.0},\n",
" 'constraint_tolerance': 1e-06,\n",
" 'langevin_collision_rate': <Quantity(1.0, '1 / picosecond')>,\n",
" 'langevin_collision_rate': {'unit': '1 / picosecond',\n",
" 'val': 1.0},\n",
" 'n_restart_attempts': 20,\n",
" 'reassign_velocities': False,\n",
" 'remove_com': False,\n",
" 'timestep': <Quantity(4.0, 'femtosecond')>},\n",
" 'output_settings': {'checkpoint_interval': <Quantity(20.0, 'picosecond')>,\n",
" 'timestep': {'unit': 'femtosecond', 'val': 4.0}},\n",
" 'output_settings': {'checkpoint_interval': {'unit': 'nanosecond', 'val': 0.02},\n",
" 'checkpoint_storage_filename': 'checkpoint.chk',\n",
" 'equil_npt_structure': 'equil_npt.pdb',\n",
" 'equil_nvt_structure': 'equil_nvt.pdb',\n",
Expand All @@ -241,26 +246,38 @@
" 'output_indices': 'not water',\n",
" 'preminimized_structure': 'system.pdb',\n",
" 'production_trajectory_filename': 'simulation.xtc',\n",
" 'trajectory_write_interval': <Quantity(20.0, 'picosecond')>},\n",
" 'trajectory_write_interval': {'unit': 'picosecond',\n",
" 'val': 20.0}},\n",
" 'partial_charge_settings': {'nagl_model': None,\n",
" 'number_of_conformers': None,\n",
" 'off_toolkit_backend': 'ambertools',\n",
" 'partial_charge_method': 'am1bcc'},\n",
" 'protocol_repeats': 1,\n",
" 'simulation_settings': {'equilibration_length': <Quantity(0.01, 'nanosecond')>,\n",
" 'equilibration_length_nvt': <Quantity(0.01, 'nanosecond')>,\n",
" 'simulation_settings': {'equilibration_length': {'unit': 'nanosecond',\n",
" 'val': 0.01},\n",
" 'equilibration_length_nvt': {'unit': 'nanosecond',\n",
" 'val': 0.01},\n",
" 'minimization_steps': 5000,\n",
" 'production_length': <Quantity(0.02, 'nanosecond')>},\n",
" 'solvation_settings': {'box_shape': 'cube',\n",
" 'production_length': {'unit': 'nanosecond',\n",
" 'val': 0.02}},\n",
" 'solvation_settings': {'box_shape': 'dodecahedron',\n",
" 'box_size': None,\n",
" 'box_vectors': None,\n",
" 'number_of_solvent_molecules': None,\n",
" 'solvent_model': 'tip3p',\n",
" 'solvent_padding': <Quantity(1.2, 'nanometer')>},\n",
" 'solvent_padding': {'unit': 'nanometer', 'val': 1.0}},\n",
" 'thermo_settings': {'ph': None,\n",
" 'pressure': <Quantity(0.986923267, 'standard_atmosphere')>,\n",
" 'pressure': {'unit': 'bar', 'val': 1},\n",
" 'redox_potential': None,\n",
" 'temperature': <Quantity(298.15, 'kelvin')>}}\n"
" 'temperature': {'unit': 'kelvin', 'val': 298.15}}}\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/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",
" pprint.pprint(self.dict())\n"
]
}
],
Expand All @@ -282,7 +299,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "3b0f5a26-b23b-4ab2-9f1e-293d98ed5bcd",
"metadata": {},
"outputs": [],
Expand All @@ -303,7 +320,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "987cceda-1253-417b-8cca-bc750ac0aa1e",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -342,7 +359,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "7689c7ba-39a2-49ea-b82b-e3b198354c5b",
"metadata": {},
"outputs": [],
Expand All @@ -353,7 +370,7 @@
"md_dir.mkdir(exist_ok=True)\n",
"\n",
"# then we write out the transformation\n",
"nontransformation.dump(md_dir / f\"{nontransformation.name}.json\")"
"nontransformation.to_json(md_dir / f\"{nontransformation.name}.json\")"
]
},
{
Expand Down Expand Up @@ -381,7 +398,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "544d037d-3a53-4390-91b8-3104c00694f0",
"metadata": {
"editable": true,
Expand All @@ -395,9 +412,36 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/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",
"INFO:openfe.utils.system_probe.log:SYSTEM CONFIG DETAILS:\n",
"INFO:openfe.utils.system_probe.log.hostname:hostname: 'Alyssas-Macbook-Pro.local'\n",
"INFO:openfe.utils.system_probe.log.gpu:CUDA-based GPU not found\n",
"INFO:openfe.utils.system_probe.log:Memory used: 20.7G (63.6%)\n",
"INFO:openfe.utils.system_probe.log:scratch_PlainMDProtocolUnit-52e66ff618014bb3877c15dc0d137171_attempt_0: 43% full (530.3G free)\n",
"INFO:gufekey.openfe.protocols.openmm_md.plain_md_methods.PlainMDProtocolUnit:Creating system\n",
"INFO:openmmforcefields.generators.template_generators:Requested to generate parameters for residue <Residue 0 (UNK) of chain 0>\n",
"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",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 0\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 1\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 2\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 3\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 4\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 5\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 6\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 7\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 8\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 9\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 10\n",
"INFO:openff.interchange.smirnoff._nonbonded:Preset charges applied to atom index 11\n",
"/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",
" warnings.warn(wmsg)\n",
"WARNING:root:Non-CUDA platform selected: CPU, this may significantly impact simulation performance\n"
"WARNING:root:Non-CUDA platform selected: CPU, this may significantly impact simulation performance\n",
"INFO:openfe.protocols.openmm_md.plain_md_methods:minimizing systems\n",
"INFO:openfe.protocols.openmm_md.plain_md_methods:Running NVT equilibration\n",
"INFO:openfe.protocols.openmm_md.plain_md_methods:Completed NVT equilibration in 19.77936577796936 seconds\n",
"INFO:openfe.protocols.openmm_md.plain_md_methods:Running NPT equilibration\n",
"INFO:openfe.protocols.openmm_md.plain_md_methods:Completed NPT equilibration in 22.49833083152771 seconds\n",
"INFO:openfe.protocols.openmm_md.plain_md_methods:running production phase\n",
"INFO:openfe.protocols.openmm_md.plain_md_methods:Completed simulation in 45.916950941085815 seconds\n"
]
}
],
Expand Down Expand Up @@ -430,21 +474,20 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"id": "16fbf816-8d3d-4121-ab0e-5cd7741788d6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"checkpoint.chk equil_npt.pdb minimized.pdb simulation.xtc\n",
"db.json equil_nvt.pdb simulation.log system.pdb\n"
"ls: shared_PlainMDProtocolUnit-6b85013e6cb94120baf447540650643b_attempt_0/: No such file or directory\n"
]
}
],
"source": [
"!ls shared_PlainMDProtocolUnit-256e9093d8f3443b9949b95e7ddbb64e_attempt_0/"
"!ls shared_PlainMDProtocolUnit-6b85013e6cb94120baf447540650643b_attempt_0/"
]
},
{
Expand All @@ -455,6 +498,14 @@
"### Performance consideration for gas phase MD simulations\n",
"For gas phase MD simulations, we suggest setting `OPENMM_CPU_THREADS` to `1` to obtain good performance."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b7f8de97-95b6-4c83-b5ef-17fae1614557",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -473,7 +524,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.8"
"version": "3.11.14"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
Loading