|
13 | 13 | "id": "2b11a786-0fab-4990-a2aa-242067f89287", |
14 | 14 | "metadata": {}, |
15 | 15 | "source": [ |
16 | | - "The final setup step is to compile all the different bits of information into a description of a single simulation campaign. This description takes the form of an [Alchemical Network]. Similarly to `LigandNetwork`, the `AlchemicalNetwork` class is a graph of all the transformations in the campaign; however, in an `AlchemicalNetwork`, these transformations include all the information needed to perform the transformation. By contrast, a `LigandNetwork` includes only the ligands themselves.\n", |
| 16 | + "The final setup step is to compile all the different bits of information into a description of a single simulation campaign. This description takes the form of an [Alchemical Network].\n", |
| 17 | + "Similar to `LigandNetwork`, the `AlchemicalNetwork` class is a graph of all the transformations in the campaign.\n", |
| 18 | + "\n", |
| 19 | + "However, in an `AlchemicalNetwork`, these transformations include all the information needed to perform the transformation. By contrast, a `LigandNetwork` includes only the ligands themselves.\n", |
| 20 | + "\n", |
| 21 | + "See the [User Guide: Alchemical Networks](https://docs.openfree.energy/en/stable/guide/setup/alchemical_network_model.html) for more background information.\n", |
17 | 22 | "\n", |
18 | 23 | "[Alchemical Network]: https://docs.openfree.energy/en/stable/reference/api/generated/openfe.AlchemicalNetwork.html" |
19 | 24 | ] |
|
28 | 33 | "tags": [] |
29 | 34 | }, |
30 | 35 | "source": [ |
31 | | - "## Setup" |
32 | | - ] |
33 | | - }, |
34 | | - { |
35 | | - "cell_type": "code", |
36 | | - "execution_count": 1, |
37 | | - "id": "ba6d0d2f-03df-463f-8976-c15a2bdf65e5", |
38 | | - "metadata": {}, |
39 | | - "outputs": [], |
40 | | - "source": [ |
41 | | - "import openfe, rdkit.Chem\n", |
42 | | - "from openff.units import unit\n", |
43 | | - "from openfe.protocols.openmm_rfe import RelativeHybridTopologyProtocol" |
| 36 | + "## Start with a `LigandNetwork`" |
44 | 37 | ] |
45 | 38 | }, |
46 | 39 | { |
47 | 40 | "cell_type": "markdown", |
48 | 41 | "id": "6bfee4c7-0aaf-49a6-b35a-bdbe99444bab", |
49 | 42 | "metadata": {}, |
50 | 43 | "source": [ |
51 | | - "This cookbook assumes you've already loaded a `LigandNetwork`. For more information, see [Generate a Ligand Network Automatically]:\n", |
| 44 | + "This cookbook assumes you've already loaded a `LigandNetwork`.\n", |
52 | 45 | "\n", |
53 | | - "[Generate a Ligand Network Automatically]: https://docs.openfree.energy/en/stable/cookbook/generate_ligand_network.html" |
| 46 | + "To learn how to build a `LigandNetwork`, see [Planning a Ligand Network]:\n", |
| 47 | + "\n", |
| 48 | + "[Planning a Ligand Network]: https://docs.openfree.energy/en/stable/cookbook/generate_ligand_network.html" |
54 | 49 | ] |
55 | 50 | }, |
56 | 51 | { |
57 | 52 | "cell_type": "code", |
58 | | - "execution_count": 2, |
| 53 | + "execution_count": 1, |
59 | 54 | "id": "4512c4d6-720f-4008-af53-a0b56b2ee1e9", |
60 | 55 | "metadata": {}, |
61 | 56 | "outputs": [], |
62 | 57 | "source": [ |
| 58 | + "import openfe\n", |
| 59 | + "import rdkit.Chem\n", |
| 60 | + "from openff.units import unit\n", |
| 61 | + "from openfe.protocols.openmm_rfe import RelativeHybridTopologyProtocol\n", |
| 62 | + "\n", |
63 | 63 | "ligand_network = openfe.ligand_network_planning.generate_minimal_spanning_network(\n", |
64 | 64 | " ligands=[\n", |
65 | 65 | " openfe.SmallMoleculeComponent(mol) \n", |
|
85 | 85 | }, |
86 | 86 | { |
87 | 87 | "cell_type": "code", |
88 | | - "execution_count": 3, |
| 88 | + "execution_count": 2, |
89 | 89 | "id": "940e2e19-4e7d-4853-ab5e-54626b3384d8", |
90 | 90 | "metadata": {}, |
91 | 91 | "outputs": [], |
|
105 | 105 | }, |
106 | 106 | { |
107 | 107 | "cell_type": "code", |
108 | | - "execution_count": 4, |
| 108 | + "execution_count": 3, |
109 | 109 | "id": "d3054cfc-5040-4882-b3a3-92aba7ab5d1d", |
110 | 110 | "metadata": { |
111 | 111 | "slideshow": { |
|
149 | 149 | }, |
150 | 150 | { |
151 | 151 | "cell_type": "code", |
152 | | - "execution_count": 5, |
| 152 | + "execution_count": 4, |
153 | 153 | "id": "733dee64-d23a-4eb0-87cf-c03065b8d2a6", |
154 | 154 | "metadata": {}, |
155 | 155 | "outputs": [], |
|
181 | 181 | }, |
182 | 182 | { |
183 | 183 | "cell_type": "code", |
184 | | - "execution_count": 6, |
| 184 | + "execution_count": 5, |
185 | 185 | "id": "c49f36b1-c3c1-425e-b1de-24da25ed01c3", |
186 | 186 | "metadata": {}, |
187 | 187 | "outputs": [], |
188 | 188 | "source": [ |
189 | 189 | "# In an RBFE, each edge includes two \"legs\": \n", |
190 | 190 | "# one for the ligand complexed to the protein, \n", |
191 | 191 | "# and the other for the ligand free in solution\n", |
| 192 | + "\n", |
| 193 | + "\n", |
192 | 194 | "legs = {\n", |
193 | | - " \"solvent\": {\n", |
194 | | - " # Specify the components common to all systems in this leg\n", |
195 | | - " 'solvent': solvent,\n", |
196 | | - " },\n", |
197 | | - " \"complex\": {\n", |
198 | | - " # Specify the components common to all systems in this leg\n", |
199 | | - " 'solvent': solvent,\n", |
200 | | - " 'protein': protein,\n", |
201 | | - " }\n", |
202 | | - "}\n", |
203 | | - "transformations = []\n", |
| 195 | + " # Specify the components common to all systems in this leg\n", |
| 196 | + " \"solvent\": {'solvent': solvent},\n", |
| 197 | + " # Specify the components common to all systems in this leg\n", |
| 198 | + " \"complex\": {'solvent': solvent, 'protein': protein}\n", |
| 199 | + "}" |
| 200 | + ] |
| 201 | + }, |
| 202 | + { |
| 203 | + "cell_type": "code", |
| 204 | + "execution_count": 6, |
| 205 | + "id": "77d71229-5dcc-40cf-a9ae-0724a7327578", |
| 206 | + "metadata": {}, |
| 207 | + "outputs": [], |
| 208 | + "source": [ |
| 209 | + "# create a list of transformations\n", |
204 | 210 | "\n", |
| 211 | + "transformations = []\n", |
205 | 212 | "for mapping in ligand_network.edges:\n", |
206 | 213 | " for leg, common_components in legs.items():\n", |
207 | 214 | " system_a = openfe.ChemicalSystem(\n", |
|
229 | 236 | " name=f\"easy_rbfe_{system_a.name}_{system_b.name}\"\n", |
230 | 237 | " )\n", |
231 | 238 | " \n", |
232 | | - " transformations.append(transformation)" |
| 239 | + " transformations.append(transformation)\n" |
233 | 240 | ] |
234 | 241 | }, |
235 | 242 | { |
|
324 | 331 | "\n", |
325 | 332 | "for n, transformation in enumerate(alchemical_network.edges):\n", |
326 | 333 | " transformation_name = transformation.name or transformation.key\n", |
327 | | - " transformation.dump(transformations_dir / f\"{n}_{transformation_name}.json\")" |
| 334 | + " transformation.to_json(transformations_dir / f\"{n}_{transformation_name}.json\")" |
328 | 335 | ] |
| 336 | + }, |
| 337 | + { |
| 338 | + "cell_type": "code", |
| 339 | + "execution_count": null, |
| 340 | + "id": "28d7af7c-0e8e-4379-91c2-c9d291c3923b", |
| 341 | + "metadata": {}, |
| 342 | + "outputs": [], |
| 343 | + "source": [] |
329 | 344 | } |
330 | 345 | ], |
331 | 346 | "metadata": { |
|
344 | 359 | "name": "python", |
345 | 360 | "nbconvert_exporter": "python", |
346 | 361 | "pygments_lexer": "ipython3", |
347 | | - "version": "3.11.6" |
| 362 | + "version": "3.13.11" |
348 | 363 | }, |
349 | 364 | "widgets": { |
350 | 365 | "application/vnd.jupyter.widget-state+json": { |
|
0 commit comments