Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alchemical Transfer Method #327

Merged
merged 96 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
2516e40
Initial commit, still WIP
mb2055 Jan 3, 2024
be8dc09
Added multi-simulation support
mb2055 Jan 10, 2024
8e79065
STILL WIP.
mb2055 Jan 11, 2024
b874012
Removed redundant print statements
mb2055 Jan 12, 2024
c0afe3c
Introduces the master lambda lever, set using a num_lambda argument.
mb2055 Jan 15, 2024
e6b63dd
Added processrunner support
mb2055 Jan 15, 2024
590089f
Added fallback for systems with no carbon atoms, and exposed platform…
mb2055 Feb 6, 2024
dd83473
More sensible default for distance restraint weight
mb2055 Feb 7, 2024
5c7cd18
Adds support for annealing within AToM free energy protocols, aiming …
mb2055 Feb 14, 2024
e360d60
Begins to add support for COM restraints
mb2055 Feb 26, 2024
9023a48
Adds constants for COM restraint to atom protocol
mb2055 Feb 26, 2024
9ed4178
Adds CM restraint to atom utils and openmm processes
mb2055 Feb 27, 2024
5c87109
Re-factoring of annealing, removed the need for the anneal_options di…
mb2055 Mar 5, 2024
d9224d1
Adds bespoke protocols for minimisation, equilibration and annealing …
mb2055 Mar 7, 2024
6dacf1d
Refactoring of AToM production, removing it from openmm process to it…
mb2055 Mar 8, 2024
b5c62a6
Standardises units thorughout
mb2055 Mar 11, 2024
72ff6d8
Bugfixes for production scripts
mb2055 Mar 12, 2024
b860627
Merge branch 'devel' into feature_AToM
mb2055 Mar 14, 2024
ea33d2d
Switches positional restraints in AToM processes to flat-bottom restr…
mb2055 Mar 18, 2024
0937c59
Added position restraint width argument that sets the width of the po…
mb2055 Mar 19, 2024
973fee5
A few bugfixes
mb2055 Apr 26, 2024
eeee0f0
Adds energy trajectory reporting, achieved through the report_interva…
mb2055 Apr 29, 2024
97e4136
Changed default work directories to None
mb2055 Apr 30, 2024
3b35a86
Fixed bug with automatic ligand translation
mb2055 Apr 30, 2024
a0781cc
Bugfixes for setting window-dependent variables from list
mb2055 May 1, 2024
4413b9e
Switched to gallachio lab repo (wip)
mb2055 May 10, 2024
4397c5d
adds support for pre-prepared systems with multiple molecules in the …
mb2055 May 20, 2024
e28f10b
Brings softcore constants of production in line with values used in G…
mb2055 May 21, 2024
43d5503
Merge remote-tracking branch 'origin/devel' into feature_AToM
mb2055 May 21, 2024
ddc56b1
Updated and clarified unit checking for various parameters.
mb2055 May 21, 2024
209df7e
Fixed issue with incorrect window index in python scripts
mb2055 May 24, 2024
fcda8ed
Added in-house analysis based on code from both the Gallachio lab rep…
mb2055 May 28, 2024
5d31596
remove redundant print statement
mb2055 May 28, 2024
d05337d
fixed issue with setting protein index
mb2055 May 28, 2024
eb022e3
Removes redundant print statement
mb2055 May 28, 2024
d56b676
Switched print statements to proper warnings
mb2055 May 28, 2024
a409e17
Remove redundant imports
mb2055 Jun 3, 2024
f8c7762
WIP First stage of refactor, moves AToM make functionality to a new A…
mb2055 Jun 12, 2024
e4a42f7
WIP AToM refactoring and testing
mb2055 Jun 17, 2024
a6eb090
Continued refactor.
mb2055 Jun 24, 2024
9c29ac6
Deleted redundant functionality
mb2055 Jun 24, 2024
8d9315c
fixed imports
mb2055 Jun 27, 2024
fe9a655
Continued refactor, includes single-point energy testing to ensure pa…
mb2055 Jul 12, 2024
c950d13
Merge branch 'devel' into feature_AToM
mb2055 Jul 12, 2024
44872d7
WIP. Adds support for MBAR analysis, also updates openMM scripts to a…
mb2055 Jul 16, 2024
803139f
Testing for various analysis methods
mb2055 Jul 23, 2024
709137b
Cleaned up API documentation
mb2055 Jul 31, 2024
2659abe
Adds explanation of AToM functionality to FreeEnergy docs
mb2055 Aug 1, 2024
4084fd5
Adds ignore_lower input to UWHAM analysis, allowing the first N sampl…
mb2055 Aug 1, 2024
63023f6
Fixed docs for annealing and production protocols
mb2055 Aug 2, 2024
2e20d08
Merge branch 'devel' into feature_AToM
mb2055 Aug 2, 2024
7f2e181
Adds support for safely resarting simulaitons from checkpoints
mb2055 Aug 2, 2024
b264c47
Fixes for using BioSimSpace runner to run production, as well as fixe…
mb2055 Aug 5, 2024
ab054a8
Runner fix
mb2055 Aug 6, 2024
532b97c
Remove analysis methods used for testing
mb2055 Aug 6, 2024
491868e
Alters UWHAM analysis to bring it more in line with GL code
mb2055 Aug 7, 2024
c342199
Doc fixes
mb2055 Aug 7, 2024
27fe39e
Switch to os.path for tests
mb2055 Aug 8, 2024
2643b30
Blacken
mb2055 Aug 8, 2024
993c825
Switch to CPU platform for single point energy test, shortened length…
mb2055 Aug 8, 2024
f2b412a
Remove debug print statement from analysis [ci skip]
mb2055 Aug 8, 2024
77e4bf7
Adds ignore_upper option to UWHAM analysis [ci skip]
mb2055 Aug 12, 2024
1309f8c
Makes atm file naming consistent, simplifies openmm protocol if state…
mb2055 Aug 20, 2024
d60c008
First stage of variable name standardisation, in this case the COM di…
mb2055 Aug 21, 2024
e5de595
Next part of protocol renaming, this time for the alignment restraint…
mb2055 Aug 21, 2024
f9675db
Next set of changes for protocol variable naming, this time the soft …
mb2055 Aug 21, 2024
07e8407
Simplifies protocol check in atm_utils
mb2055 Aug 21, 2024
9b925d3
Corrects spelling of Gallicchio
mb2055 Aug 21, 2024
c942857
Make imports in ddg private
mb2055 Aug 21, 2024
1235970
Change name of atm protocol test to bring in line with other test names
mb2055 Aug 21, 2024
326c463
UWHAM analysis now returns energy in kcal/mol
mb2055 Aug 21, 2024
5290442
Changed Runtimerror to warning when UWHAM weights don't add to 1
mb2055 Aug 27, 2024
7d51ad4
Swaps the protein keywork with receptor when creating ATM systems (ne…
mb2055 Sep 2, 2024
dd8d999
Makes openMM import private [ci skip]
mb2055 Sep 2, 2024
5ec3f46
Updates view rigid cores with labelling and colour coding
mb2055 Sep 17, 2024
852711e
Switches naming of ligand1 and ligand2 to ligand_bound and ligand_free
mb2055 Sep 17, 2024
db26eed
Formatting
mb2055 Sep 18, 2024
6df63fc
Formatting tweaks.
lohedges Oct 4, 2024
b0f8e83
Make carbon atom search more robust.
lohedges Oct 4, 2024
ebdd4ee
Make variable name consistent.
lohedges Oct 4, 2024
7aef73c
Docstring formatting tweaks.
lohedges Oct 4, 2024
ca8bfda
Refactor AToM code.
lohedges Oct 4, 2024
fa894af
Merge branch 'devel' into feature_AToM
lohedges Oct 7, 2024
f2ec42d
First draft of ATM tutorial
mb2055 Oct 11, 2024
8ea5dec
Squash thermodynamic cycle image.
lohedges Oct 14, 2024
aedf76c
Example input URLs now added and formatting tweaks.
lohedges Oct 14, 2024
22612af
Enhancements to the ATM tutorial.
mb2055 Oct 21, 2024
0b9b29f
Rotate perturbable and non-perturbable molecules independently.
lohedges Oct 22, 2024
0e1933f
Fix indexing of tutorials.
lohedges Oct 24, 2024
d4e7ed0
Fix sections.
lohedges Oct 24, 2024
dc9548a
Move API docs before examples.
lohedges Oct 24, 2024
c1d8eb3
Improve sectioning.
lohedges Oct 24, 2024
24f8825
Switch from AToM to ATM.
lohedges Oct 24, 2024
f5b9429
Merge remote-tracking branch 'origin/fix_354' into feature_AToM
lohedges Oct 24, 2024
c2665ab
Make class attributes private.
lohedges Oct 24, 2024
613c58c
Blacken.
lohedges Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions doc/source/api/index_Align.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ BioSimSpace.Align
=================

The *Align* package provides functionality for aligning and merging molecules.

.. automodule:: BioSimSpace.Align

.. toctree::
:maxdepth: 1

Molecules are aligned using a Maximum Common Substructure (MCS) search, which
is used to find mappings between atom indices in the two molecules.
Functionality is provided for sorting the mappings according to a scoring
Expand Down Expand Up @@ -34,8 +40,3 @@ Some examples:
# The resulting "merged-molecule" can be used in free energy perturbation
# simulations.
merged = BSS.Align.merge(mol0, mol1, mappings)

.. automodule:: BioSimSpace.Align

.. toctree::
:maxdepth: 1
86 changes: 80 additions & 6 deletions doc/source/api/index_FreeEnergy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ BioSimSpace.FreeEnergy
The *FreeEnergy* package contains tools to configure, run, and analyse
*relative* free energy simulations.

.. automodule:: BioSimSpace.FreeEnergy

.. toctree::
:maxdepth: 1

As well as the :class:`protocol <BioSimSpace.Protocol.FreeEnergy>` used for production

Free-energy perturbation simulations require a
:class:`System <BioSimSpace._SireWrappers.System>` containing a *merged*
molecule that can be *perturbed* between two molecular end states by use
Expand All @@ -28,6 +35,9 @@ perturbable molecule created by merging two ligands, ``ligA`` and ``ligB``,
perturbable molecule. We assume that each molecule/system has been
appropriately minimised and equlibrated.

Relative binding free-energy (RBFE)
-----------------------------------

To setup, run, and analyse a binding free-energy calculation:

.. code-block:: python
Expand Down Expand Up @@ -130,16 +140,80 @@ the path to a working directory to :class:`FreeEnergy.Relative.analyse <BioSimSp

pmf_vacuum, overlap_vacuum = BSS.FreeEnergy.Relative.analyse("ligA_ligB/vacuum")

.. automodule:: BioSimSpace.FreeEnergy

.. toctree::
:maxdepth: 1

As well as the :class:`protocol <BioSimSpace.Protocol.FreeEnergy>` used for production
simulations, it is also possible to use
:class:`FreeEnergy.Relative <BioSimSpace.FreeEnergy.Relative>` to setup and run simulations
for minimising or equilibrating structures for each lambda window. See the
:class:`FreeEnergyMinimisation <BioSimSpace.Protocol.FreeEnergyMinimisation>` and
:class:`FreeEnergyEquilibration <BioSimSpace.Protocol.FreeEnergyEquilibration>`
protocols for details. At present, these protocols are only supported when not
using :class:`SOMD <BioSimSpace.Process.Somd>` as the simulation engine.

Alchemical Transfer Method (ATM)
--------------------------------

This package contains tools to configure, run, and analyse *relative* free
energy simulations using the *alchemical transfer method* developed by the
`Gallicchio lab <https://www.compmolbiophysbc.org/atom-openmm>`.

Only available in the *OpenMM* engine, the *alchemical transfer method*
replaces the conventional notion of perturbing between two end states with
a single system containing both the free and bound ligand. The relative free
energy of binding is then associated with the swapping of the bound and free
ligands.

The *alchemical transfer method* has a few advantages over the conventional
approach, mainly arising from its relative simplicity and flexibility. The
method is particularly well-suited to the study of difficult ligand
transformations, such as scaffold-hopping and charge change perturbations.
The presence of both ligands in the same system also replaces the conventional
idea of _legs_, combining free, bound, forward and reverse legs into a
single simulation.

In order to perform a relative free energy calculation using the
*alchemical transfer method*, the user requires a protein and two ligands, as
well as knowledge of any common core shared between the two ligands.
ATM-compatible systems can be created from these elements using the
:class:`FreeEnergy.ATM <BioSimSpace.FreeEnergy.ATMSetup>` class.

.. code-block:: python

from BioSimSpace.FreeEnergy import ATMSetup

...

# Create an ATM setup object. 'protein', 'ligand1' and 'ligand2' must be
# BioSimSpace Molecule objects.
# 'ligand1' is bound in the lambda=0 state, 'ligand2' is bound in the lambda=1 state.
atm_setup = ATMSetup(protein=protein, ligand1=ligand1, ligand2=ligand2)

# Now create the BioSimSpace system. Here is where knowledge of the common core is required.
# ligand1_rigid_core and ligand2_rigid_core are lists of integers, each of length three,
# which define the indices of the common core atoms in the ligands.
# Displacement is the desired distance between the centre of masses of the two ligands.
system, data = atm_setup.prepare(
ligand1_rigid_core=[1, 2, 3],
ligand2_rigid_core=[1, 2, 3],
displacement=22.0
)

# The prepare function returns two objects: a prepared BioSimSpace system that is ready
# for ATM simulation, and a data dictionary containing information relevant to ATM calculations.
# This dictionary does not need to be kept, as the information is also encoded in the system
# object, but it may be useful for debugging.


Preparing the system for production runs is slightly more complex than in
the conventional approach, as the system will need to be annealed to an
intermediate lambda value, and then equilibrated at that value. The
:ref:`protocol <ref_protocols>` sub-module contains functionality for
equilibrating and annealing systems for ATM simulations.

Once the production simulations have been completed, the user can analyse
the data using the :func:`analyse <BioSimSpace.FreeEnergy.ATM.analyse>` function.

.. code-block:: python

from BioSimSpace.FreeEnergy import ATM

# Analyse the simulation data to get the free energy difference and associated error.
ddg, error = ATM.analyse("path/to/working/directory")
6 changes: 3 additions & 3 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ Tutorials
=========

.. toctree::
:maxdepth: 2
:maxdepth: 1

tutorials/index

Detailed Guides
===============

.. toctree::
:maxdepth: 2
:maxdepth: 1

guides/index

Expand All @@ -93,7 +93,7 @@ Support
Contributing
============
.. toctree::
:maxdepth: 2
:maxdepth: 1

contributing/index
contributors
Expand Down
Loading
Loading