From 315bed03c28a912e7b98f8206f626d0228ac46b5 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Tue, 21 Oct 2025 13:35:32 +0100 Subject: [PATCH 1/2] Update md inputs for v1.7 --- openmm_md/plain_md.ipynb | 119 +++++++++++++++++++++++++++++---------- 1 file changed, 89 insertions(+), 30 deletions(-) diff --git a/openmm_md/plain_md.ipynb b/openmm_md/plain_md.ipynb index ffc5107..f7b8f21 100644 --- a/openmm_md/plain_md.ipynb +++ b/openmm_md/plain_md.ipynb @@ -137,7 +137,16 @@ "execution_count": 1, "id": "20fc8142-c618-4d50-b903-5a04f6a34d5c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/ialibay/software/mambaforge/install/envs/openfe/lib/python3.12/site-packages/openmoltools/utils.py:9: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.\n", + " from pkg_resources import resource_filename\n" + ] + } + ], "source": [ "import openfe\n", "from openfe import ChemicalSystem, ProteinComponent, SmallMoleculeComponent, SolventComponent\n", @@ -186,7 +195,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "b27e54cc-fd6a-4afc-ab22-4dde0561938c", "metadata": {}, "outputs": [], @@ -200,12 +209,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": 4, "id": "b69668c9-2e74-421e-a9ea-b7f3bc6c6e5a", "metadata": {}, "outputs": [ @@ -220,18 +230,20 @@ " 'amber/tip3p_HFE_multivalent.xml',\n", " 'amber/phosaa10.xml'],\n", " 'hydrogen_mass': 3.0,\n", - " 'nonbonded_cutoff': ,\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': ,\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': ,\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': },\n", - " 'output_settings': {'checkpoint_interval': ,\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", @@ -241,26 +253,38 @@ " 'output_indices': 'not water',\n", " 'preminimized_structure': 'system.pdb',\n", " 'production_trajectory_filename': 'simulation.xtc',\n", - " 'trajectory_write_interval': },\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': ,\n", - " 'equilibration_length_nvt': ,\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': },\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': },\n", + " 'solvent_padding': {'unit': 'nanometer', 'val': 1.0}},\n", " 'thermo_settings': {'ph': None,\n", - " 'pressure': ,\n", + " 'pressure': {'unit': 'bar', 'val': 1},\n", " 'redox_potential': None,\n", - " 'temperature': }}\n" + " 'temperature': {'unit': 'kelvin', 'val': 298.15}}}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/ialibay/software/mambaforge/install/envs/openfe/lib/python3.12/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" ] } ], @@ -282,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "3b0f5a26-b23b-4ab2-9f1e-293d98ed5bcd", "metadata": {}, "outputs": [], @@ -303,7 +327,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "987cceda-1253-417b-8cca-bc750ac0aa1e", "metadata": {}, "outputs": [], @@ -342,7 +366,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "id": "7689c7ba-39a2-49ea-b82b-e3b198354c5b", "metadata": {}, "outputs": [], @@ -353,7 +377,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\")" ] }, { @@ -381,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "id": "544d037d-3a53-4390-91b8-3104c00694f0", "metadata": { "editable": true, @@ -395,9 +419,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: 'sith'\n", + "INFO:openfe.utils.system_probe.log.gpu:CUDA-based GPU not found\n", + "INFO:openfe.utils.system_probe.log:Memory used: 7.3G (25.9%)\n", + "INFO:openfe.utils.system_probe.log:scratch_PlainMDProtocolUnit-6b85013e6cb94120baf447540650643b_attempt_0: 82% full (53.4G 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 \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", + "/home/ialibay/github/openfe/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 93.03289294242859 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 105.741370677948 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 216.3571000099182 seconds\n" ] } ], @@ -430,7 +481,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "id": "16fbf816-8d3d-4121-ab0e-5cd7741788d6", "metadata": {}, "outputs": [ @@ -438,13 +489,21 @@ "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" + "checkpoint.chk\tequil_npt.pdb minimized.pdb simulation.xtc\n", + "db.json\t\tequil_nvt.pdb simulation.log system.pdb\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/ialibay/software/mambaforge/install/envs/openfe/lib/python3.12/pty.py:95: DeprecationWarning: This process (pid=257465) is multi-threaded, use of forkpty() may lead to deadlocks in the child.\n", + " pid, fd = os.forkpty()\n" ] } ], "source": [ - "!ls shared_PlainMDProtocolUnit-256e9093d8f3443b9949b95e7ddbb64e_attempt_0/" + "!ls shared_PlainMDProtocolUnit-6b85013e6cb94120baf447540650643b_attempt_0/" ] }, { @@ -473,7 +532,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.11" }, "widgets": { "application/vnd.jupyter.widget-state+json": { From 32a226e7159ba180b4d3b8d074d73eead8860b97 Mon Sep 17 00:00:00 2001 From: Alyssa Travitz Date: Thu, 23 Oct 2025 15:35:17 -0700 Subject: [PATCH 2/2] bumping colab version to 1.7.0, plus rerunning locally --- openmm_md/plain_md.ipynb | 72 ++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/openmm_md/plain_md.ipynb b/openmm_md/plain_md.ipynb index f7b8f21..19e41f4 100644 --- a/openmm_md/plain_md.ipynb +++ b/openmm_md/plain_md.ipynb @@ -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", + "" ] }, { @@ -76,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "6559bc05", "metadata": {}, "outputs": [], @@ -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": [], @@ -134,19 +136,10 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "id": "20fc8142-c618-4d50-b903-5a04f6a34d5c", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/ialibay/software/mambaforge/install/envs/openfe/lib/python3.12/site-packages/openmoltools/utils.py:9: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.\n", - " from pkg_resources import resource_filename\n" - ] - } - ], + "outputs": [], "source": [ "import openfe\n", "from openfe import ChemicalSystem, ProteinComponent, SmallMoleculeComponent, SolventComponent\n", @@ -195,7 +188,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "b27e54cc-fd6a-4afc-ab22-4dde0561938c", "metadata": {}, "outputs": [], @@ -215,7 +208,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "b69668c9-2e74-421e-a9ea-b7f3bc6c6e5a", "metadata": {}, "outputs": [ @@ -283,7 +276,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/ialibay/software/mambaforge/install/envs/openfe/lib/python3.12/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", + "/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" ] } @@ -306,7 +299,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "3b0f5a26-b23b-4ab2-9f1e-293d98ed5bcd", "metadata": {}, "outputs": [], @@ -327,7 +320,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "id": "987cceda-1253-417b-8cca-bc750ac0aa1e", "metadata": {}, "outputs": [], @@ -366,7 +359,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "id": "7689c7ba-39a2-49ea-b82b-e3b198354c5b", "metadata": {}, "outputs": [], @@ -405,7 +398,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "id": "544d037d-3a53-4390-91b8-3104c00694f0", "metadata": { "editable": true, @@ -420,10 +413,10 @@ "output_type": "stream", "text": [ "INFO:openfe.utils.system_probe.log:SYSTEM CONFIG DETAILS:\n", - "INFO:openfe.utils.system_probe.log.hostname:hostname: 'sith'\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: 7.3G (25.9%)\n", - "INFO:openfe.utils.system_probe.log:scratch_PlainMDProtocolUnit-6b85013e6cb94120baf447540650643b_attempt_0: 82% full (53.4G free)\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 \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", @@ -439,16 +432,16 @@ "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", - "/home/ialibay/github/openfe/openfe/protocols/openmm_utils/omm_compute.py:76: UserWarning: Non-CUDA platform selected: CPU, this may significantly impact simulation performance\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", "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 93.03289294242859 seconds\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 105.741370677948 seconds\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 216.3571000099182 seconds\n" + "INFO:openfe.protocols.openmm_md.plain_md_methods:Completed simulation in 45.916950941085815 seconds\n" ] } ], @@ -489,16 +482,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "checkpoint.chk\tequil_npt.pdb minimized.pdb simulation.xtc\n", - "db.json\t\tequil_nvt.pdb simulation.log system.pdb\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/ialibay/software/mambaforge/install/envs/openfe/lib/python3.12/pty.py:95: DeprecationWarning: This process (pid=257465) is multi-threaded, use of forkpty() may lead to deadlocks in the child.\n", - " pid, fd = os.forkpty()\n" + "ls: shared_PlainMDProtocolUnit-6b85013e6cb94120baf447540650643b_attempt_0/: No such file or directory\n" ] } ], @@ -514,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": { @@ -532,7 +524,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.11" + "version": "3.11.14" }, "widgets": { "application/vnd.jupyter.widget-state+json": {