Applications of nonequilibrium candidate Monte Carlo (NCMC) to ligand binding mode sampling
Branch: master
Clone or download
nathanmlim Update
Remove merge conflict
Latest commit 44677cf Sep 5, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Changes for 0.2.3 release (#154) Sep 1, 2018
blues Update Sep 4, 2018
devdocs updated class diagram with acceptReject Jun 20, 2017
docs Fix typo in openmmtools Sep 4, 2018
examples Changes for 0.2.3 release (#154) Sep 1, 2018
images Changes for 0.2.3 release (#154) Sep 1, 2018
.codecov.yml Changes for 0.2.3 release (#154) Sep 1, 2018
.coveragerc Changes for 0.2.3 release (#154) Sep 1, 2018
.gitattributes Changes for 0.2.3 release (#154) Sep 1, 2018
.gitignore Changes for 0.2.3 release (#154) Sep 1, 2018
.readthedocs.yml Changes for 0.2.3 release (#154) Sep 1, 2018
.travis.yml Release 0.2.3 (#155) Sep 2, 2018
LICENSE tried to address some issues on git Nov 9, 2016 Changes for 0.2.3 release (#154) Sep 1, 2018 Fix typo in openmmtools Sep 4, 2018
oe_license.txt.enc Changes for 0.2.3 release (#154) Sep 1, 2018
setup.cfg Changes for 0.2.3 release (#154) Sep 1, 2018 Fix some typos and add links for ReadTheDocs Sep 4, 2018 Changes for 0.2.3 release (#154) Sep 1, 2018

BLUES: Binding modes of Ligands Using Enhanced Sampling

This package takes advantage of non-equilibrium candidate Monte Carlo moves (NCMC) to help sample between different ligand binding modes.

Latest release: Build Status Documentation Status codecov Anaconda-Server Badge DOI





  • blues/ - Source code and example scripts for BLUES toolkit
  • devdocs/ - Class diagrams for developers
  • devtools/ - Developer tools and documentation for conda, travis, and issuing a release
  • images/ - Images/logo for repository
  • notebooks - Jupyter notebooks for testing/development


BLUES is compatible with MacOSX/Linux with Python>=3.5 (blues<=1.1 still works with Python 2.7) Install miniconda according to your system.


Starting from v1.2, you will need the OpenEye toolkits and related tools:

conda install -c openeye/label/Orion -c omnia oeommtools packmol

# Requires OpenEye License
conda install -c openeye openeye-toolkits


ReadTheDocs: Installation

Recommended: Install releases from conda

conda install -c mobleylab blues

Development builds: contains latest commits/PRs not yet issued in a point release

conda install -c mobleylab/label/dev blues

Install from source (NOT RECOMMENDED)

# Clone the BLUES repository
git clone

# Install some dependencies
conda install -c omnia -c conda-forge openmmtools=0.15.0 openmm=7.2.2 numpy cython

# Install BLUES package from the top directory
pip install -e .

# To validate your BLUES installation run the tests.
pip instal -e .[tests]
pytest -v -s


For documentation on the BLUES modules see ReadTheDocs: Modules For a tutorial on how to use BLUES see ReadTheDocs: Tutorial


This package takes advantage of non-equilibrium candidate Monte Carlo moves (NCMC) to help sample between different ligand binding modes using the OpenMM simulation package. One goal for this package is to allow for easy additions of other moves of interest, which will be covered below.

Example Use

An example of how to set up a simulation sampling the binding modes of toluene bound to T4 lysozyme using NCMC and a rotational move can be found in examples/

Actually using BLUES

The integrator of BLUES contains the framework necessary for NCMC. Specifically, the integrator class calculates the work done during a NCMC move. It also controls the lambda scaling of parameters. The integrator that BLUES uses inherits from openmmtools.integrators.AlchemicalNonequilibriumLangevinIntegrator to keep track of the work done outside integration steps, allowing Monte Carlo (MC) moves to be incorporated together with the NCMC thermodynamic perturbation protocol. Currently the openmmtools.alchemy package is used to generate the lambda parameters for the ligand, allowing alchemical modification of the sterics and electrostatics of the system. The Simulation class in blues/ serves as a wrapper for running NCMC simulations.

Implementing Custom Moves

Users can implement their own MC moves into NCMC by inheriting from an appropriate blues.moves.Move class and constructing a custom move() method that only takes in an Openmm context object as a parameter. The move() method will then access the positions of that context, change those positions, then update the positions of that context. For example if you would like to add a move that randomly translates a set of coordinates the code would look similar to this pseudocode:

from blues.moves import Move
class TranslationMove(Move):
   	def __init__(self, atom_indices):
   		self.atom_indices = atom_indices
   	def move(context):
   	"""pseudocode for move"""
   		positions = context.context.getState(getPositions=True).getPositions(asNumpy=True)
   		#get positions from context
   		#use some function that translates atom_indices
   		newPositions = RandomTranslation(positions[self.atom_indices])
   		return context

Combining Moves

Note: This feature has not been tested, use at your own risk. If you're interested in combining moves together sequentially–say you'd like to perform a rotation and translation move together–instead of coding up a new Move class that performs that, you can instead leverage the functionality of existing Moves using the CombinationMove class. CombinationMove takes in a list of instantiated Move objects. The CombinationMove's move() method perfroms the moves in either listed or reverse order. Replicating a rotation and translation move on t, then, can effectively be done by passing in an instantiated TranslationMove (from the pseudocode example above) and RandomLigandRotation. One important non-obvious thing to note about the CombinationMove class is that to ensure detailed balance is maintained, moves are done half the time in listed order and half the time in the reverse order.


  • Version 0.0.1: Basic BLUES functionality/package
  • Version 0.0.2: Maintenance release fixing a critical bug and improving organization as a package.
  • Version 0.0.3: Refactored BLUES functionality and design.
  • Version 0.0.4: Minor bug fixes plus a functionality problem on some GPU configs.
  • Version 0.1.0: Refactored move proposals, added Monte Carlo functionality, Smart Darting moves, and changed alchemical integrator.
  • Version 0.1.1: Features to boost move acceptance such as freezing atoms in the NCMC simulation and adding extra propagation steps in the alchemical integrator.
  • Version 0.1.2: Incorporation of SideChainMove functionality (Contributor: Kalistyn Burley)
  • Version 0.1.3: Improvements to simulation logging functionality and parameters for extra propagation.
  • Version 0.2.0: YAML support, API changes, custom reporters.
  • Version 0.2.1: Bug fix in alchemical correction term
  • Version 0.2.2: Bug fixes for OpenEye tests and restarting from the YAML; enhancements to the Logger and package installation.
  • Version 0.2.3: Improvements to Travis CI, fix in velocity synicng, and add tests for checking freezing selection.


We would like to thank Patrick Grinaway and John Chodera for their basic code framework for NCMC in OpenMM (see, and John Chodera and Christopher Bayly for their helpful discussions.