An open, extensible Python framework for GPU-accelerated alchemical free energy calculations.
choderalab, updated
🕥
2023-03-30 08:25:19

YANK
An open, extensible Python framework for GPU-accelerated alchemical free energy calculations
Documentation
Documentation, tutorials, and best practices can be found at getyank.org.
Getting Started
See the Quickstart instructions.
Examples
Examples are available in the yank-examples
repository:
bash
git clone https://github.com/choderalab/yank-examples.git
Maintainers
Contributors
- Kim Branson (Stanford)
- Kyle A. Beauchamp (MSKCC)
- Peter M. Eastman (Stanford)
- Mark Friedrichs (Stanford)
- Imran Haque (Stanford)
- Patrick B. Grinaway (MSKCC)
- Christoph Klein (University of Virginia)
- Rosa Luirink (VU Amsterdam)
- Daniel L. Parton (MSKCC)
- Randy Radmer (Stanford)
- Arien Sebastian Rustenburg (MSKCC)
- Michael Shirts (University of Colorado Boulder)
- Kai Wang (University of Virginia)
Issues
opened on 2023-03-30 05:55:27 by davidcooper7

As you can see in this image the ligand has basically exploded outside of the binding pocket or this transmembrane protein in which it is supposed to be. This image is from a .dcd that was extracted from the 0th state of the simulation of the netcdf complex file using the YANK method yank.analyze.extract_trajectory(). There are not the same issues with the input AMBER files. YANK doesn't have any issue running, or any noticeable warnings in the log file. I've tried many different options and such and got the same results. Any help would be great.
yaml:
experiments:
protocol: absolute-binding
restraint:
type: FlatBottom
restrained_receptor_atoms: resid 328 or resid 116 or resid 299 or resid 150
restrained_ligand_atoms: all
spring_constant: 10.0kilocalories_per_mole/(angstrom2)
well_radius: 12.0angstroms
system: rec-lig
options:
default_nsteps_per_iteration: 1000
default_number_of_iterations: 1
default_timestep: 1.0femtosecond
minimize: no
number_of_equilibration_iterations: 0
output_dir: /media/volume/sdb/yank/morphine/morphine_test
platform: fastest
pressure: 1.0atmosphere
resume_simulation: yes
temperature: 300kelvin
verbose: yes
protocols:
absolute-binding:
complex:
alchemical_path:
lambda_electrostatics: [1.00, 1.00, 1.00, 1.00, 1.00, 0.90, 0.80, 0.70, 0.60, 0.50, 0.40, 0.30, 0.20, 0.10, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00]
lambda_sterics: [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 0.90, 0.80, 0.70, 0.60, 0.50, 0.40, 0.30, 0.20, 0.10, 0.00]
lambda_restraints: [0.00, 0.25, 0.50, 0.75, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00]
solvent:
alchemical_path:
lambda_electrostatics: [1.00, 0.90, 0.80, 0.70, 0.60, 0.50, 0.40, 0.30, 0.20, 0.10, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00]
lambda_sterics: [1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 0.90, 0.80, 0.70, 0.60, 0.50, 0.40, 0.30, 0.20, 0.10, 0.00]
solvents:
PME:
nonbonded_cutoff: 8.0angstroms
nonbonded_method: PME
systems:
rec-lig:
ligand_dsl:resname UNL
phase1_path:
- /media/volume/sdb/yank/morphine/morphine_complex.inpcrd
-/media/volume/sdb/yank/morphine/morphine_complex.prmtop
phase2_path:
- /media/volume/sdb/yank/morphine/morphine_solvent.inpcrd
- /media/volume/sdb/yank/morphine/morphine_solvent.prmtop
solvent: PME
opened on 2023-03-24 00:25:30 by smutao
Hello developers, I have a dumb question about the 'restrained_receptor_atoms' variable for restraint.
If the receptor has more than one chain, will YANK automatically identify which chain is of interest? Or we have to specify 'chainid'?
Thank you.
opened on 2023-03-17 06:32:50 by VirtualChemist
Hi,
When i tried to the yank-example file. I got the following error.
2023-03-17 15:28:45,037: Running _compute_replica_energies serially.
Traceback (most recent call last):
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/cache.py", line 445, in get_context
context = self._lru[context_id]
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/cache.py", line 147, in getitem
entry = self._data.pop(key)
KeyError: (8749923509185095026, -2790907321978132361)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/medicina/anaconda3/envs/fep/bin/yank", line 11, in
load_entry_point('yank==0.25.2', 'console_scripts', 'yank')()
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/yank/cli.py", line 73, in main
dispatched = getattr(commands, command).dispatch(command_args)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/yank/commands/script.py", line 155, in dispatch
yaml_builder.run_experiments(write_status=write_status)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/yank/experiment.py", line 751, in run_experiments
completed[exp_index] = self._run_experiment(exp, write_status=write_status)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/yank/experiment.py", line 3251, in _run_experiment
built_experiment.run(n_iterations=switch_experiment_interval)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/yank/experiment.py", line 427, in run
alchemical_phase.run(n_iterations=iterations_to_run)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/yank/yank.py", line 1207, in run
self._sampler.run(n_iterations=n_iterations)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/multistate/multistatesampler.py", line 652, in run
raise e
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/multistate/multistatesampler.py", line 642, in run
self._compute_energies()
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/utils.py", line 87, in _wrapper
return func(args, kwargs)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/multistate/multistatesampler.py", line 1319, in _compute_energies
send_results_to=0)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/mpiplus/mpiplus.py", line 512, in distribute
all_results = [task(job_args, other_args, kwargs) for job_args in distributed_args]
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/mpiplus/mpiplus.py", line 512, in
all_results = [task(job_args, *other_args, kwargs) for job_args in distributed_args]
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/multistate/multistatesampler.py", line 1351, in _compute_replica_energies
context, integrator = cache.global_context_cache.get_context(compatible_group[0])
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/cache.py", line 447, in get_context
context = thermodynamic_state.create_context(integrator, self._platform, self._platform_properties)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/openmmtools/states.py", line 1174, in create_context
return openmm.Context(system, integrator, platform)
File "/home/medicina/anaconda3/envs/fep/lib/python3.7/site-packages/simtk/openmm/openmm.py", line 18608, in init
this = _openmm.new_Context(*args)
Exception: Error launching CUDA compiler: 256
nvcc fatal : Value 'sm_86' is not defined for option 'gpu-architecture'
Can anyone tell how to fix this issue.
I have install the package using "conda install -c omnia yank"
I am using Yank=0.25.2 version.
My CUDA version is 11.4.
Thanks
opened on 2022-12-08 21:52:21 by j-wags
I saw that there was a patch made in July to pin to pymbar 3 (https://github.com/choderalab/yank/pull/1285) - Are there plans to also support pymbar 4?
opened on 2022-11-03 19:27:02 by RishalAggarwal
getting the following error when running yank analyze report --store=experiments --output=yank_output.ipynb --format ipynb
:
```
Warning: importing 'simtk.openmm' is deprecated. Import 'openmm' instead.
Rendering notebook as a .ipynb file...
Processing notebook now, this may take a while...
Traceback (most recent call last):
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/bin/yank", line 10, in
sys.exit(main())
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/yank/cli.py", line 73, in main
dispatched = getattr(commands, command).dispatch(command_args)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/yank/commands/analyze.py", line 123, in dispatch
return dispatch_report(args)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/yank/commands/analyze.py", line 322, in dispatch_report
run_notebook(store, output, notebook_serial_file, analyzer_kwargs)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/yank/commands/analyze.py", line 281, in run_notebook
processed_notebook, resources = ep.preprocess(loaded_notebook, resource_data)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbconvert/preprocessors/execute.py", line 91, in preprocess
self.preprocess_cell(cell, resources, index)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbconvert/preprocessors/execute.py", line 112, in preprocess_cell
cell = self.execute_cell(cell, index, store_history=True)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbclient/util.py", line 85, in wrapped
return just_run(coro(*args, kwargs))
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbclient/util.py", line 60, in just_run
return loop.run_until_complete(coro)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nest_asyncio.py", line 90, in run_until_complete
return f.result()
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/asyncio/futures.py", line 201, in result
raise self._exception.with_traceback(self._exception_tb)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/asyncio/tasks.py", line 232, in __step
result = coro.send(None)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbclient/client.py", line 1019, in async_execute_cell
await self._check_raise_for_error(cell, cell_index, exec_reply)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbclient/client.py", line 913, in _check_raise_for_error
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
from matplotlib import pyplot as plt
from yank.reports import notebook
%matplotlib inline
report = notebook.HealthReportData(store_directory, **analyzer_kwargs)
report.report_version()
TypeError Traceback (most recent call last)
Cell In [2], line 4
2 from yank.reports import notebook
3 get_ipython().run_line_magic('matplotlib', 'inline')
----> 4 report = notebook.HealthReportData(store_directory, **analyzer_kwargs)
5 report.report_version()
File ~/.conda/envs/myenv/lib/python3.10/site-packages/yank/analyze.py:299, in ExperimentAnalyzer.init(self, store_directory, **analyzer_kwargs)
297 raise RuntimeError(err_msg)
298 with open(analysis_script_path, 'r') as f:
--> 299 analysis = yaml.load(f)
300 phases_names = []
301 signs = {}
TypeError: load() missing 1 required positional argument: 'Loader'
TypeError: load() missing 1 required positional argument: 'Loader'
2022-11-03 15:14:21,028: CRITICAL - mpiplus.mpiplus - MPI node 1/1 raised an exception and called Abort()! The exception traceback follows
Traceback (most recent call last):
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/bin/yank", line 10, in
sys.exit(main())
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/yank/cli.py", line 73, in main
dispatched = getattr(commands, command).dispatch(command_args)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/yank/commands/analyze.py", line 123, in dispatch
return dispatch_report(args)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/yank/commands/analyze.py", line 322, in dispatch_report
run_notebook(store, output, notebook_serial_file, analyzer_kwargs)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/yank/commands/analyze.py", line 281, in run_notebook
processed_notebook, resources = ep.preprocess(loaded_notebook, resource_data)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbconvert/preprocessors/execute.py", line 91, in preprocess
self.preprocess_cell(cell, resources, index)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbconvert/preprocessors/execute.py", line 112, in preprocess_cell
cell = self.execute_cell(cell, index, store_history=True)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbclient/util.py", line 85, in wrapped
return just_run(coro(*args, kwargs))
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbclient/util.py", line 60, in just_run
return loop.run_until_complete(coro)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nest_asyncio.py", line 90, in run_until_complete
return f.result()
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/asyncio/futures.py", line 201, in result
raise self._exception.with_traceback(self._exception_tb)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/asyncio/tasks.py", line 232, in __step
result = coro.send(None)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbclient/client.py", line 1019, in async_execute_cell
await self._check_raise_for_error(cell, cell_index, exec_reply)
File "/net/pulsar/home/koes/rishal/.conda/envs/myenv/lib/python3.10/site-packages/nbclient/client.py", line 913, in _check_raise_for_error
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
from matplotlib import pyplot as plt
from yank.reports import notebook
%matplotlib inline
report = notebook.HealthReportData(store_directory, **analyzer_kwargs)
report.report_version()
TypeError Traceback (most recent call last)
Cell In [2], line 4
2 from yank.reports import notebook
3 get_ipython().run_line_magic('matplotlib', 'inline')
----> 4 report = notebook.HealthReportData(store_directory, **analyzer_kwargs)
5 report.report_version()
File ~/.conda/envs/myenv/lib/python3.10/site-packages/yank/analyze.py:299, in ExperimentAnalyzer.init(self, store_directory, **analyzer_kwargs)
297 raise RuntimeError(err_msg)
298 with open(analysis_script_path, 'r') as f:
--> 299 analysis = yaml.load(f)
300 phases_names = []
301 signs = {}
TypeError: load() missing 1 required positional argument: 'Loader'
TypeError: load() missing 1 required positional argument: 'Loader'
```
opened on 2022-10-31 23:41:00 by moradza
Hi,
I am computing free energy of solvation for charged ligand in implicit water. I am curious to know how charged neutrality is enforced in vacuum. I am getting FES of -53 KCal which seems to me a large value.
Releases
0.25.2 - Bugfix release 2019-11-10 17:06:58
Bugfixes
- Fixed a bug that causes YANK to crash in when thermodynamic trailblazing is interrupted and then resumed with the option
bidirectional_redistribution
set (#1195).
0.25.1 - Bugfix and more robust yank status command 2019-11-09 22:02:54
Bugfixes
- The command
yank status
now handles gracefully the case where it attempts to open a locked netcdf file (#855).
- Fix bug causing YANK to crash sometimes when the option
bidirectional_redistribution
was activated (#1192).
0.25.0 - Moved multistate and mpi modules and new trailblaze algorithm 2019-11-08 16:15:34
API-breaking changes
- The
yank.mpi
module and the objects in the yank.multistate
package, which were deprecated in 0.24.0, have now been removed, and they can be found in the mpiplus
and openmmtools
libraries respectively.
- The function
yank.pipeline.trailblaze_alchemical_protocol
has been renamed yank.pipeline.run_thermodynamic_trailblazing
(#1180).
New features
- The thermodynamic trailblazing algorithm used for the authomatic generation of the alchemical path is now capable of resuming after an unexpected interruption or crash. The samples generated during the process are used to initialize the replicas of the replica exchange or SAMS free energy calculation. This behavior can be controlled through the
start_from_trailblaze_samples
YAML option (#1176, #1180).
- It is possible to control more options of the thermodynamic trailblazing algorithm and to discretize an alchemical path given through mathematical expressions enslaved to a generic variable (#1180).
- Added a
--setup-only
flag in the yank script
CLI command to run the automatic setup pipeline without running the free energy calculation (#1178).
Bugfixes
- Fix a bug in which a list of
experiments: [exp1, exp2]
in the YAML file containing an unknown experiment name would fail silently without error (#1178).
- Fixed a problem that would prevent YANK to work with Cerberus >= 1.2 (#1180).
- Fixed the error message displayed when the anisotropic dispersion correction cutoff was too big for the box dimension (#1181).
Enhancements
- By default, the automatic determination of the alchemical path now starts with the harmonic/flat-bottom restraint turned off and activate it in intermediate states instead of keeping the restraint activated throughout the calculation and reweighting in the analysis stage (#1176).
Known issues
- Using parallel MPI processes causes poor mixing of the odd thermodynamic states while the mixing of the even states is normal. We're still investigating whether the issue is caused by a change in the MPI library or an internal bug. For now, we recommend running calculations using only 1 GPU (choderalab/openmmtools#449 and #1130).
- Simulations restored from a checkpoint file have their velocities reset to zero (#1115).
- Forward and backward convergence analysis free energy traces in the Jupter notebook are incorrect (#971).
- Setup will fail if .mol2 atom substructure ID matches filename (#703).
0.24.1 - Bugfix release 2019-06-01 15:34:18
Bugfixes
- Fixed import of
logsumexp()
which was moved from scipy.misc
to scipy.special
(#1162).
- Fixed a bug in which validation of molecules and system file paths did not consider paths relative to the YAML script path (#1164).
- Improve the robustness of opening the netcdf file on resuming of the multi-state samplers by setting the environment variable
HDF5_USE_FILE_LOCKING
to 'FALSE'
after 4 failed attempts (#1168).
- Fixed a bug causing a crash during exception handling (#1168).
- Fixed a bug causing a crash in selftest.py when loading OpenEye (#1170).
Enhancements
- The class
yank.utils.TLeap
can now create octahedral boxes. This is not exposed in the YAML script yet, however (#1160).
0.24.0 - Experimental support for online status files 2019-02-26 09:20:28
- Added an experimental feature that allows
--status
to be provided with yank script
invocations to emit a status.pkl
file in the experiment directory at the conclusion of each experiment switch interval (#1135). This feature is experimental, and its invocation may be changed in a future release.
- This release requires OpenMMTools >= 0.17.0, which includes a much faster way of implementing exact treatment of PME during alchemical calculations (#1136).
- Some NetCDF robustness improvements.
- SAMS improvements:
- SAMS now properly restores
t0
and stage
, which should correctly persist the stage across phase switches and resumes.
- Added SAMS
logZ_history
plot to notebook reports.
- SAMS
self._stage
is now an integer to more easily store this in storage (0 is initial, 1 is asymptotic phase).
- Suppress some verbose outputs.
- If an asymptotically optimal stage is present in a SAMS simulation, the initial stage is discarded to equilibration and automatic equilibration detection is applied to the asymptotically optimal weight adjustment region only.
- Jupyter notebook reports now show SAMS weight convergence if present.
- The
yank.multistate
package was deprecated. In the future, this package will be available in OpenMMTools (#1146).
Known issues
- The use of more than one process per experiment via MPI has known issues that are being debugged (#1130).
- Simulations restored from a checkpoint file have their velocities reset to zero (#1115).
- Forward and backward convergence analysis free energy traces in the Jupter notebook are incorrect (#971).
- Peptide ligands are not currently supported (#376).
- Setup will fail if
.mol2
atom substructure ID matches filename (#703).
0.23.7 - Bugfix release 2018-10-05 15:35:27
Fix bug where resuming a simulation caused the checkpoint iteration to crash (#1103).