Skip to content
Prev Previous commit
Next Next commit
Updates ATM tutorial with cut-down minimisation and equilibration pro…
…tocols, allowing them to be run using minimal resources.
  • Loading branch information
mb2055 committed Nov 19, 2024
commit eb01633ea099080c7484705429b331feb0c67b58
80 changes: 59 additions & 21 deletions 04_fep/05_ATM/01-ATM.ipynb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be named with an underscore rather than a hyphen for consistency with the other notebooks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the notebook:

... BioSimSpace openMM runner.

Should be:

... BioSimSpace OpenMM process.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"# We also need to download the example output files\n",
"from get_tutorial import download\n",
"\n",
"download(\"05\")"
"download(\"01\")"
]
},
{
Expand Down Expand Up @@ -172,7 +172,7 @@
"id": "a6275c24-e28f-47a0-b7d2-055987be2cfd",
"metadata": {},
"source": [
"Although it might appear that the free ligand is too close to the protein, we only really need 3 layers of water (roughly 10 Angrstroms) between the two in order to have good separation, and so the separation in our system is more than enough. Also, the smaller the separation the smaller the water box we will need, and the faster our simulations will run.\n",
"Although it might appear that the free ligand is too close to the protein, we only really need 3 layers of water (roughly 10 Angrstroms) between the two in order to have good separation, and so the separation in our system should be enough. Also, the smaller the separation the smaller the water box we will need, and the faster our simulations will run.\n",
"\n",
"All that remains now is to solvate our protein-ligand-ligand system."
]
Expand Down Expand Up @@ -200,9 +200,9 @@
"id": "e921c870-cb23-4b9e-b358-260f64b6218b",
"metadata": {},
"source": [
"ATM simulations require a significant number of restraints, as well as the gradual introduction of the ATMForce itself. As such standard minimisation and equilibration protocols are not appropriate and a series of custom protocols is needed. \n",
"ATM simulations require a significant number of restraints, as well as the gradual introduction of the ATMForce itself. As such standard minimisation and equilibration protocols are not appropriate, and a series of custom protocols is needed. \n",
"\n",
"In this section we will cover a full minimisation and equilibration protocol for the ATM system we created above. We won't actually run any simulations as they would take far too long, but we will still cover each unique step in the protocol.\n",
"In this section we will cover a full minimisation and equilibration protocol for the ATM system we created above. The simulations we will run in this section are significantly cut down, real production simulations should minimise and equilibrate much more thoroughly than we will here.\n",
"\n",
"ATM simulations are best run with a series of restraints:\n",
"- __core alignment__; these are the the rigid core restraints that are applied to the atoms we found earlier.\n",
Expand Down Expand Up @@ -238,7 +238,11 @@
"outputs": [],
"source": [
"minimisation = BSS.Protocol.ATMMinimisation(\n",
" data=atm_data, core_alignment=True, restraint=ca, com_distance_restraint=True\n",
" steps=100,\n",
" data=atm_data,\n",
" core_alignment=True,\n",
" restraint=ca,\n",
" com_distance_restraint=True,\n",
")"
]
},
Expand Down Expand Up @@ -283,7 +287,7 @@
" core_alignment=True,\n",
" restraint=ca,\n",
" com_distance_restraint=True,\n",
" runtime=\"100ps\",\n",
" runtime=\"1ps\",\n",
")\n",
"equilibrate_process = BSS.Process.OpenMM(minimised, equilibration)\n",
"equilibrate_process.start()\n",
Expand Down Expand Up @@ -315,7 +319,7 @@
" core_alignment=True,\n",
" restraint=ca,\n",
" com_distance_restraint=True,\n",
" runtime=\"100ps\",\n",
" runtime=\"1ps\",\n",
" anneal_numcycles=10,\n",
")\n",
"annealing_process = BSS.Process.OpenMM(equilibrated, annealing, platform=\"CUDA\")\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assumes the code is executed on an instance with an available CUDA plaftorm. Update for the general case where the platform should be auto-detected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All instances of "CUDA" have now been removed

Expand Down Expand Up @@ -347,10 +351,10 @@
" use_atm_force=True,\n",
" lambda1=0.5,\n",
" lambda2=0.5,\n",
" runtime=\"100ps\",\n",
" runtime=\"1ps\",\n",
")\n",
"post_anneal_equilibration_process = BSS.Process.OpenMM(\n",
" annealed, post_anneal_equilibration, platform=\"CUDA\"\n",
" annealed, post_anneal_equilibration\n",
")\n",
"post_anneal_equilibration_process.start()\n",
"post_anneal_equilibration_process.wait()\n",
Expand All @@ -368,21 +372,32 @@
{
"cell_type": "code",
"execution_count": null,
"id": "98b75b96-56c4-481e-a50e-94a913fae7f7",
"id": "3dff69b1-b13f-43b9-87df-120ad0751760",
"metadata": {},
"outputs": [],
"source": [
"check = BSS.Stream.load(\"tyk2_atm/ready_for_production.bss\")\n",
"view = BSS.Notebook.View(check)\n",
"view = BSS.Notebook.View(min_eq_final)\n",
"view.system()"
]
},
{
"cell_type": "markdown",
"id": "646ed908-533c-4d48-a757-543ed6397942",
"id": "3502a7ca-9df3-4e93-b995-b8ac03e5bad3",
"metadata": {},
"source": [
"Everything appears to be in order - the ligands are well aligned and haven't changed position significantly. We should now be ready to run production simulations."
"The example outputs that we downloaded earlier contain a version of this system that has been properly minimised and equilibrated. Let's visualise it and compare it to the system we've prepared ourselves. Provided that these two systems look similar, and most importantly that the two ligands are still in alignment, we should now be ready for production."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "98b75b96-56c4-481e-a50e-94a913fae7f7",
"metadata": {},
"outputs": [],
"source": [
"check = BSS.Stream.load(\"tyk2_atm/ready_for_production.bss\")\n",
"view1 = BSS.Notebook.View(check)\n",
"view1.system()"
]
},
{
Expand Down Expand Up @@ -426,13 +441,28 @@
" num_lambda=22,\n",
" alpha=alpha,\n",
" uh=uh,\n",
")\n",
")"
]
},
{
"cell_type": "markdown",
"id": "c640be58-5713-40a8-8d59-62c11f2a6c34",
"metadata": {},
"source": [
"We won't actually run any production simulations here, as they would take far too long, but if we did want to run production we could do so with this command: "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f0c7147f-e921-464b-aaca-35952e3ea1c8",
"metadata": {},
"outputs": [],
"source": [
"# production_process = BSS.FreeEnergy.ATM(\n",
"# system=min_eq_final,\n",
"# protocol=production_atm,\n",
"# work_dir=output_directory,\n",
"# platform=\"CUDA\",\n",
"# setup_only=True\n",
"# system=min_eq_final,\n",
"# protocol=production_atm,\n",
"# work_dir=output_directory,\n",
"# )"
]
},
Expand All @@ -441,7 +471,7 @@
"id": "ddcaee9b",
"metadata": {},
"source": [
"Once production simulations are complete out `output_directory` will be populated by a series of folders, one for each lambda window. Within each of these folders should be a file called `openmm.csv` which contains the information we need to calculate the $\\Delta \\Delta G$ value for our system. \n",
"Once production simulations are complete `output_directory` will be populated by a series of folders, one for each lambda window. Within each of these folders should be a file called `openmm.csv` which contains the information we need to calculate the $\\Delta \\Delta G$ value for our system. In this case we will be analysing the pre-prepared outputs that we downloaded earlier.\n",
"\n",
"In-built BioSimSpace analysis will give us a $\\Delta \\Delta G$ value in kcal/mol, along with the error, also in kcal/mol."
]
Expand All @@ -456,6 +486,14 @@
"DDG = BSS.FreeEnergy.ATM.analyse(output_directory)\n",
"DDG"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2bd6a45f-99b9-424f-93da-e2c822302cde",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
2 changes: 1 addition & 1 deletion 04_fep/05_ATM/get_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import BioSimSpace as BSS

links = {
"05": (
"01": (
"tyk2_atm.tar.bz2",
os.path.join(BSS.tutorialUrl(), "tyk2_atm.tar.bz2"),
),
Expand Down