Skip to content

Commit aba2508

Browse files
authored
Merge pull request #221 from OpenFreeEnergy/adapt_septop_restraint_settings
Adapt host min/max distance restraints + fix broken notebook
2 parents 8afe723 + 43049c6 commit aba2508

4 files changed

Lines changed: 90 additions & 66 deletions

File tree

abfe_tutorial/abfe_json/toluene.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

abfe_tutorial/abfe_tutorial.ipynb

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"name": "stderr",
134134
"output_type": "stream",
135135
"text": [
136-
"Generating charges: 100%|█████████████████████████| 1/1 [00:00<00:00, 1.53it/s]\n"
136+
"Generating charges: 100%|█████████████████████████| 1/1 [00:00<00:00, 1.42it/s]\n"
137137
]
138138
}
139139
],
@@ -231,17 +231,33 @@
231231
},
232232
{
233233
"cell_type": "code",
234-
"execution_count": 10,
234+
"execution_count": 7,
235235
"id": "c31c712b-4844-477b-8aa4-ded6f0c8ca5f",
236236
"metadata": {},
237-
"outputs": [],
237+
"outputs": [
238+
{
239+
"name": "stderr",
240+
"output_type": "stream",
241+
"text": [
242+
"/Users/hannahbaumann/miniforge3/envs/openfe_dev/lib/python3.12/site-packages/Bio/Application/__init__.py:39: BiopythonDeprecationWarning: The Bio.Application modules and modules relying on it have been deprecated.\n",
243+
"\n",
244+
"Due to the on going maintenance burden of keeping command line application\n",
245+
"wrappers up to date, we have decided to deprecate and eventually remove these\n",
246+
"modules.\n",
247+
"\n",
248+
"We instead now recommend building your command line and invoking it directly\n",
249+
"with the subprocess module.\n",
250+
" warnings.warn(\n"
251+
]
252+
}
253+
],
238254
"source": [
239255
"from openfe.protocols.openmm_afe import AbsoluteBindingProtocol;"
240256
]
241257
},
242258
{
243259
"cell_type": "code",
244-
"execution_count": 11,
260+
"execution_count": 8,
245261
"id": "fb839094",
246262
"metadata": {},
247263
"outputs": [],
@@ -251,7 +267,7 @@
251267
},
252268
{
253269
"cell_type": "code",
254-
"execution_count": 12,
270+
"execution_count": 9,
255271
"id": "8b99f77f-c70c-436d-b4eb-fb462a4b043e",
256272
"metadata": {
257273
"scrolled": true
@@ -262,7 +278,7 @@
262278
"output_type": "stream",
263279
"text": [
264280
"{'alchemical_settings': {},\n",
265-
" 'complex_equil_output_settings': {'checkpoint_interval': <Quantity(250.0, 'picosecond')>,\n",
281+
" 'complex_equil_output_settings': {'checkpoint_interval': <Quantity(1.0, 'nanosecond')>,\n",
266282
" 'checkpoint_storage_filename': 'checkpoint.chk',\n",
267283
" 'equil_npt_structure': 'equil_npt_structure.pdb',\n",
268284
" 'equil_nvt_structure': 'equil_nvt_structure.pdb',\n",
@@ -367,7 +383,7 @@
367383
" 0.9,\n",
368384
" 0.95,\n",
369385
" 1.0]},\n",
370-
" 'complex_output_settings': {'checkpoint_interval': <Quantity(250.0, 'picosecond')>,\n",
386+
" 'complex_output_settings': {'checkpoint_interval': <Quantity(1.0, 'nanosecond')>,\n",
371387
" 'checkpoint_storage_filename': 'complex_checkpoint.nc',\n",
372388
" 'forcefield_cache': 'db.json',\n",
373389
" 'output_filename': 'complex.nc',\n",
@@ -424,11 +440,11 @@
424440
" 'dssp_filter': True,\n",
425441
" 'guest_atoms': None,\n",
426442
" 'host_atoms': None,\n",
427-
" 'host_max_distance': <Quantity(3, 'nanometer')>,\n",
428-
" 'host_min_distance': <Quantity(1, 'nanometer')>,\n",
443+
" 'host_max_distance': <Quantity(3.0, 'nanometer')>,\n",
444+
" 'host_min_distance': <Quantity(1.0, 'nanometer')>,\n",
429445
" 'host_selection': 'backbone',\n",
430446
" 'rmsf_cutoff': <Quantity(0.1, 'nanometer')>},\n",
431-
" 'solvent_equil_output_settings': {'checkpoint_interval': <Quantity(250.0, 'picosecond')>,\n",
447+
" 'solvent_equil_output_settings': {'checkpoint_interval': <Quantity(1.0, 'nanosecond')>,\n",
432448
" 'checkpoint_storage_filename': 'checkpoint.chk',\n",
433449
" 'equil_npt_structure': 'equil_npt_structure.pdb',\n",
434450
" 'equil_nvt_structure': 'equil_nvt_structure.pdb',\n",
@@ -485,7 +501,7 @@
485501
" 0.77,\n",
486502
" 0.85,\n",
487503
" 1.0]},\n",
488-
" 'solvent_output_settings': {'checkpoint_interval': <Quantity(250.0, 'picosecond')>,\n",
504+
" 'solvent_output_settings': {'checkpoint_interval': <Quantity(1.0, 'nanosecond')>,\n",
489505
" 'checkpoint_storage_filename': 'solvent_checkpoint.nc',\n",
490506
" 'forcefield_cache': 'db.json',\n",
491507
" 'output_filename': 'solvent.nc',\n",
@@ -534,19 +550,19 @@
534550
},
535551
{
536552
"cell_type": "code",
537-
"execution_count": 13,
553+
"execution_count": 11,
538554
"id": "55067780-d228-4661-8c1e-5cb0217fd2dc",
539555
"metadata": {},
540556
"outputs": [],
541557
"source": [
542558
"from openff.units import unit\n",
543559
"\n",
544-
"# change the values\n",
560+
"# Run only a single repeat\n",
545561
"settings.protocol_repeats = 1\n",
546-
"settings.solvent_simulation_settings.equilibration_length = 10 * unit.picosecond\n",
547-
"settings.solvent_simulation_settings.production_length = 500 * unit.picosecond\n",
548-
"settings.complex_simulation_settings.equilibration_length = 10 * unit.picosecond\n",
549-
"settings.complex_simulation_settings.production_length = 500 * unit.picosecond\n",
562+
"# Change the min and max distance between protein and ligand atoms for Boresch restraints to avoid periodicity issues\n",
563+
"settings.restraint_settings.host_min_distance = 0.5 * unit.nanometer\n",
564+
"settings.restraint_settings.host_max_distance = 1.5 * unit.nanometer\n",
565+
"\n",
550566
"settings.engine_settings.compute_platform = 'CUDA'"
551567
]
552568
},
@@ -561,7 +577,7 @@
561577
},
562578
{
563579
"cell_type": "code",
564-
"execution_count": 14,
580+
"execution_count": 12,
565581
"id": "23f6322b-0336-4aa9-b9d0-ebe533dc5753",
566582
"metadata": {},
567583
"outputs": [],
@@ -595,7 +611,7 @@
595611
},
596612
{
597613
"cell_type": "code",
598-
"execution_count": 15,
614+
"execution_count": 13,
599615
"id": "1231fad8-b37d-4008-a851-5ad546386286",
600616
"metadata": {},
601617
"outputs": [],
@@ -619,10 +635,19 @@
619635
},
620636
{
621637
"cell_type": "code",
622-
"execution_count": 16,
638+
"execution_count": 14,
623639
"id": "b69efbcd-b888-4afc-a33e-01860889f408",
624640
"metadata": {},
625-
"outputs": [],
641+
"outputs": [
642+
{
643+
"name": "stderr",
644+
"output_type": "stream",
645+
"text": [
646+
"/Users/hannahbaumann/miniforge3/envs/openfe_dev/lib/python3.12/site-packages/gufe/transformations/transformation.py:124: DeprecationWarning: use of this method is deprecated; instead use `to_json`\n",
647+
" warnings.warn(\n"
648+
]
649+
}
650+
],
626651
"source": [
627652
"import pathlib\n",
628653
"# first we create the directory\n",
@@ -667,7 +692,7 @@
667692
},
668693
{
669694
"cell_type": "code",
670-
"execution_count": 17,
695+
"execution_count": 15,
671696
"id": "44ba94ca",
672697
"metadata": {},
673698
"outputs": [],
@@ -702,7 +727,7 @@
702727
},
703728
{
704729
"cell_type": "code",
705-
"execution_count": 18,
730+
"execution_count": 16,
706731
"id": "6dbedb47-46b9-4c22-ad74-a580174a359c",
707732
"metadata": {},
708733
"outputs": [],
@@ -713,7 +738,7 @@
713738
},
714739
{
715740
"cell_type": "code",
716-
"execution_count": 19,
741+
"execution_count": 17,
717742
"id": "be690ef1-3243-4114-b56f-5babbb660af6",
718743
"metadata": {
719744
"scrolled": true
@@ -828,7 +853,7 @@
828853
},
829854
{
830855
"cell_type": "code",
831-
"execution_count": 22,
856+
"execution_count": 18,
832857
"id": "f62f69a1-09c0-4a4a-9b37-9663b51a75ac",
833858
"metadata": {},
834859
"outputs": [],
@@ -846,7 +871,7 @@
846871
},
847872
{
848873
"cell_type": "code",
849-
"execution_count": 23,
874+
"execution_count": 19,
850875
"id": "3b459b28-a4dc-4fa9-a961-b106c45d79ce",
851876
"metadata": {},
852877
"outputs": [
@@ -859,22 +884,14 @@
859884
" 'pint_unit_registry': 'openff_units'}"
860885
]
861886
},
862-
"execution_count": 23,
887+
"execution_count": 19,
863888
"metadata": {},
864889
"output_type": "execute_result"
865890
}
866891
],
867892
"source": [
868893
"estimate"
869894
]
870-
},
871-
{
872-
"cell_type": "code",
873-
"execution_count": null,
874-
"id": "4ca58949-6e5c-46df-a281-812636ac797f",
875-
"metadata": {},
876-
"outputs": [],
877-
"source": []
878895
}
879896
],
880897
"metadata": {

cookbook/choose_protocol.ipynb

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
" 'softcore_alpha': 0.85,\n",
184184
" 'turn_off_core_unique_exceptions': False,\n",
185185
" 'use_dispersion_correction': False},\n",
186-
" 'engine_settings': {'compute_platform': None},\n",
186+
" 'engine_settings': {'compute_platform': None, 'gpu_device_index': None},\n",
187187
" 'forcefield_settings': {'constraints': 'hbonds',\n",
188188
" 'forcefields': ['amber/ff14SB.xml',\n",
189189
" 'amber/tip3p_standard.xml',\n",
@@ -194,20 +194,22 @@
194194
" 'nonbonded_method': 'PME',\n",
195195
" 'rigid_water': True,\n",
196196
" 'small_molecule_forcefield': 'openff-2.1.1'},\n",
197-
" 'integrator_settings': {'barostat_frequency': <Quantity(25, 'timestep')>,\n",
197+
" 'integrator_settings': {'barostat_frequency': <Quantity(25.0, 'timestep')>,\n",
198198
" 'constraint_tolerance': 1e-06,\n",
199199
" 'langevin_collision_rate': <Quantity(1.0, '1 / picosecond')>,\n",
200200
" 'n_restart_attempts': 20,\n",
201201
" 'reassign_velocities': False,\n",
202202
" 'remove_com': False,\n",
203-
" 'timestep': <Quantity(4, 'femtosecond')>},\n",
203+
" 'timestep': <Quantity(4.0, 'femtosecond')>},\n",
204204
" 'lambda_settings': {'lambda_functions': 'default', 'lambda_windows': 11},\n",
205-
" 'output_settings': {'checkpoint_interval': <Quantity(250, 'picosecond')>,\n",
205+
" 'output_settings': {'checkpoint_interval': <Quantity(1.0, 'nanosecond')>,\n",
206206
" 'checkpoint_storage_filename': 'checkpoint.chk',\n",
207207
" 'forcefield_cache': 'db.json',\n",
208208
" 'output_filename': 'simulation.nc',\n",
209209
" 'output_indices': 'not water',\n",
210-
" 'output_structure': 'hybrid_system.pdb'},\n",
210+
" 'output_structure': 'hybrid_system.pdb',\n",
211+
" 'positions_write_frequency': <Quantity(100.0, 'picosecond')>,\n",
212+
" 'velocities_write_frequency': None},\n",
211213
" 'partial_charge_settings': {'nagl_model': None,\n",
212214
" 'number_of_conformers': None,\n",
213215
" 'off_toolkit_backend': 'ambertools',\n",
@@ -218,13 +220,17 @@
218220
" 'minimization_steps': 5000,\n",
219221
" 'n_replicas': 11,\n",
220222
" 'production_length': <Quantity(5.0, 'nanosecond')>,\n",
221-
" 'real_time_analysis_interval': <Quantity(250, 'picosecond')>,\n",
222-
" 'real_time_analysis_minimum_time': <Quantity(500, 'picosecond')>,\n",
223+
" 'real_time_analysis_interval': <Quantity(250.0, 'picosecond')>,\n",
224+
" 'real_time_analysis_minimum_time': <Quantity(500.0, 'picosecond')>,\n",
223225
" 'sampler_method': 'repex',\n",
224226
" 'sams_flatness_criteria': 'logZ-flatness',\n",
225227
" 'sams_gamma0': 1.0,\n",
226-
" 'time_per_iteration': <Quantity(1, 'picosecond')>},\n",
227-
" 'solvation_settings': {'solvent_model': 'tip3p',\n",
228+
" 'time_per_iteration': <Quantity(1.0, 'picosecond')>},\n",
229+
" 'solvation_settings': {'box_shape': 'cube',\n",
230+
" 'box_size': None,\n",
231+
" 'box_vectors': None,\n",
232+
" 'number_of_solvent_molecules': None,\n",
233+
" 'solvent_model': 'tip3p',\n",
228234
" 'solvent_padding': <Quantity(1.2, 'nanometer')>},\n",
229235
" 'thermo_settings': {'ph': None,\n",
230236
" 'pressure': <Quantity(0.986923267, 'standard_atmosphere')>,\n",
@@ -327,6 +333,10 @@
327333
" solvation_settings=equil_rfe_settings.OpenMMSolvationSettings(\n",
328334
" solvent_model='tip3p', # Solvent model to generate starting coords\n",
329335
" solvent_padding=1.2 * unit.nm, # Total distance between periodic image starting coords\n",
336+
" box_shape = 'cube', # Cubic water box\n",
337+
" box_size = None, # Size of the water box\n",
338+
" box_vectors = None, # Box vectors\n",
339+
" number_of_solvent_molecules = None, # Number of solvent molecules\n",
330340
" ),\n",
331341
" partial_charge_settings=equil_rfe_settings.OpenFFPartialChargeSettings(\n",
332342
" partial_charge_method='am1bcc', # Partial charge method applied - am1bcc\n",
@@ -394,7 +404,9 @@
394404
" checkpoint_storage_filename='checkpoint.chk', # Filename for simulation checkpoints\n",
395405
" forcefield_cache='db.json', # Cache for small molecule residue templates\n",
396406
" output_indices='not water', # Do not save water positions\n",
397-
" checkpoint_interval=250 * unit.ps, # Save a checkpoint every 250 picoseconds\n",
407+
" checkpoint_interval=1 * unit.ns, # Save a checkpoint every 1 nanoseconds\n",
408+
" positions_write_frequency=100.0 * unit.picosecond, # Save position every 100 picoseconds\n",
409+
" velocities_write_frequency = None, # Don't save velocities\n",
398410
" ),\n",
399411
")"
400412
]
@@ -472,7 +484,7 @@
472484
"name": "python",
473485
"nbconvert_exporter": "python",
474486
"pygments_lexer": "ipython3",
475-
"version": "3.12.4"
487+
"version": "3.12.10"
476488
},
477489
"widgets": {
478490
"application/vnd.jupyter.widget-state+json": {

0 commit comments

Comments
 (0)