Skip to content

Commit

Permalink
Update BRD4 notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Sep 3, 2024
1 parent 9c73bf8 commit 4dcd398
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
complex.*
complex_pointenergy.mdp
receptor.*
ligand.*
protein.pdb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
"repo_url = (\n",
" \"https://raw.githubusercontent.com/MobleyLab/benchmarksets/master/input_files/\"\n",
")\n",
"\n",
"sources = {\n",
" \"receptor.pdb\": repo_url + \"BRD4/pdb/BRD4.pdb\",\n",
" \"ligand.pdb\": repo_url + \"BRD4/pdb/ligand-1.pdb\",\n",
" \"ligand.sdf\": repo_url + \"BRD4/sdf/ligand-1.sdf\",\n",
" \"receptor.pdb\": f\"{repo_url}BRD4/pdb/BRD4.pdb\",\n",
" \"ligand.pdb\": f\"{repo_url}BRD4/pdb/ligand-1.pdb\",\n",
" \"ligand.sdf\": f\"{repo_url}BRD4/sdf/ligand-1.sdf\",\n",
"}\n",
"for filename, url in sources.items():\n",
" r = requests.get(url)\n",
Expand All @@ -40,44 +41,20 @@
"metadata": {},
"outputs": [],
"source": [
"from openff.toolkit import ForceField, Molecule, Topology"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Later we will use `Interchange.__add__`, which is an experimental feature. It needs to be turned on by setting the environment variable below, and by doing so we accept [some stability and accuracy risks](https://docs.openforcefield.org/projects/interchange/en/stable/using/experimental.html)."
"from openff.toolkit import ForceField, Molecule, Quantity, Topology"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"env: INTERCHANGE_EXPERIMENTAL=1\n"
]
}
],
"source": [
"%env INTERCHANGE_EXPERIMENTAL=1"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2f3b86c392c24705b86721395cf43ea4",
"model_id": "48226cb62a2849029c42d579843ef0f7",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -90,8 +67,8 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/jeffreywagner/projects/OpenForceField/openff-interchange/openff/interchange/_experimental.py:35: UserWarning: Interchange object combination is experimental and likely to produce strange results. Any workflow using this method is not guaranteed to be suitable for production. Use with extreme caution and thoroughly validate results!\n",
" return func(*args, **kwargs)\n"
"/Users/mattthompson/micromamba/envs/openff-toolkit-test/lib/python3.10/site-packages/openff/interchange/operations/_combine.py:52: InterchangeCombinationWarning: Interchange object combination is complex and likely to produce strange results outside of a limited set of use cases it has been tested in. Any workflow using this method is not guaranteed to be suitable for production or stable between versions. Use with extreme caution and thoroughly validate results!\n",
" warnings.warn(\n"
]
}
],
Expand All @@ -107,32 +84,32 @@
"\n",
"receptor = ff14sb.create_interchange(topology=receptor_topology)\n",
"\n",
"complex_system = receptor.combine(ligand)\n",
"\n",
"# TODO\n",
"# complex.box = pdbfile box vectors ...\n",
"# complex.positions = np.vstack([receptor.positions, ligand.positions])"
"# Interchange.combine works nicely for some cases but hasn't been tested for all - use caution\n",
"# if adapting this for more novel workflows!\n",
"complex_system = receptor.combine(ligand)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Export to OpenMM"
"### Export to OpenMM\n",
"\n",
"See [docs](https://docs.openforcefield.org/projects/interchange/en/stable/using/output.html#openmm) for more options."
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<openmm.openmm.System; proxy of <Swig Object of type 'OpenMM::System *' at 0x14380adf0> >"
"<openmm.openmm.System; proxy of <Swig Object of type 'OpenMM::System *' at 0x14ba376f0> >"
]
},
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -147,31 +124,35 @@
"tags": []
},
"source": [
"### Export to Amber"
"### Export to Amber\n",
"\n",
"See [docs](https://docs.openforcefield.org/projects/interchange/en/stable/using/output.html#amber) for more options."
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# TODO: Fix inferring residue information with mixed topology\n",
"if False:\n",
" complex_system.to_inpcrd(\"complex.inpcrd\")\n",
" complex_system.to_prmtop(\"complex.prmtop\")"
"complex_system.to_inpcrd(\"complex.inpcrd\")\n",
"complex_system.to_prmtop(\"complex.prmtop\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Export to GROMACS"
"### Export to GROMACS\n",
"\n",
"See [docs](https://docs.openforcefield.org/projects/interchange/en/stable/using/output.html#gromacs) for more options.\n",
"\n",
"GROMACS does not support vacuum simulations. In this example, we didn't add solvent and the original PDB file didn't have box vectors. We'll just arbitrarily add a 4 nm cubic box around the receptor-ligand complex."
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {
"tags": []
},
Expand All @@ -180,14 +161,16 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/jeffreywagner/projects/OpenForceField/openff-interchange/openff/interchange/interop/gromacs/export/_export.py:48: UserWarning: WARNING: System defined with no box vectors, which GROMACS does not offically support in versions 2020 or newer (see https://gitlab.com/gromacs/gromacs/-/issues/3526). Setting box vectors to a 5 nm cube.\n",
" self._write_gro(gro, decimal)\n"
"/Users/mattthompson/micromamba/envs/openff-toolkit-test/lib/python3.10/site-packages/openff/interchange/components/mdconfig.py:471: UserWarning: Ambiguous failure while processing constraints. Constraining h-bonds as a stopgap.\n",
" warnings.warn(\n"
]
}
],
"source": [
"complex_system.to_gro(\"complex.gro\")\n",
"complex_system.to_top(\"complex.top\")"
"complex_system.box = Quantity([4, 4, 4], \"nanometer\")\n",
"\n",
"# This step might be slow, writing some large proteins is not yet optimized\n",
"complex_system.to_gromacs(\"complex\")"
]
}
],
Expand All @@ -208,7 +191,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
"version": "3.10.14"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 4dcd398

Please sign in to comment.