blues icon indicating copy to clipboard operation
blues copied to clipboard

v0.3.0 API changes for OpenMMTools compatibility

Open nathanmlim opened this issue 6 years ago • 2 comments

Description

Significant changes to the overall BLUES API, where much of the refactoring is to follow similar structure to the openmmtools toolkit.

"Move" classes are now what carry out the actual simulation and modification of the openmm.Integrator/openmm.Context objects.

  • Running the NCMC+MD simulation now relies on using the LangevinDynamicsMove class which I've modified to ReportLangevinDynamicsMove to allow storing coordinates over the MD simulation phase.
  • NCMCMove provides the base class for perturbing atom coordinates. Every subsequent move we develop should inherit from this class and override the _propose_positions() function which simply takes a positions array and outputs the proposed positions (as opposed to modifying the context itself).
  • The RandomLigandRotationMove has been refactored to utilize this framework.
  • This redesign should allow us to draw from the openmmtools library of monte carlo moves which perturb atom coordinates and turn them into a move which uses the NCMC protocol. For example:
from openmmtools.mcmc import MCDisplacementMove
class NCMCDisplacementMove(MCDisplacementMove, NCMCMove):        
    def _get_integrator(self, thermodynamic_state):
        return NCMCMove._get_integrator(self,thermodynamic_state)

BLUESSampler replaces what was the BLUESSimulation class, drawing inspiration from the openmmtools.mcmc.MCMCSampler class.

  • Instead of handling openmm.Simulation objects, we now make use of the openmmtools.ThermodynamicState/SamplerState objects.
  • The BLUESSampler class ties together the States and Moves in order to execute the NCMC+MD simulation.

Reporters have been changed to Storage to avoid confusion with reporters designed to work with openmm.Simulations. Our reporters have been modified to NetCDF4Storage and BLUESStateDateStorage. These now take openmm.States and openmm.Integrators as their input, instead of the openmm.Simualtion and openmm.Context.

Todos

Notable points that this PR has either accomplished or will accomplish.

  • [x] Re-implementation of random rotation
  • [x] Test toluene/T4-lysozyme system
  • [x] Module refactoring
  • [x] Code clean-up
  • [x] Unit testing
  • [x] Docstrings
  • [x] ReadTheDocs

Status

  • [x] Ready to go

nathanmlim avatar Jun 18 '19 16:06 nathanmlim

Codecov Report

Merging #163 into master will increase coverage by 13.71%. The diff coverage is 80.81%.

@@             Coverage Diff             @@
##           master     #163       +/-   ##
===========================================
+ Coverage    61.5%   75.22%   +13.71%     
===========================================
  Files           7        6        -1     
  Lines        1478      795      -683     
  Branches      266      141      -125     
===========================================
- Hits          909      598      -311     
+ Misses        460      120      -340     
+ Partials      109       77       -32
Impacted Files Coverage Δ
blues/__init__.py 100% <ø> (ø) :arrow_up:
blues/integrators.py 80.89% <100%> (-10.12%) :arrow_down:
blues/storage.py 57.29% <62.69%> (ø)
blues/ncmc.py 82.88% <82.88%> (ø)
blues/systemfactory.py 92.75% <92.75%> (ø)
blues/utils.py 88.37% <96.15%> (+39.29%) :arrow_up:
... and 1 more

codecov[bot] avatar Jun 27 '19 18:06 codecov[bot]

A couple notes from discussing with Nathan:

  • He accidentally merged an earlier version of this, then forced a roll back. So it looks like a 0.2.5 version was merged, but it was reverted.
  • The branch is called 0.2.5 but we're renaming the PR because of the need to release an interim version number before sorting this out

davidlmobley avatar Oct 20 '20 22:10 davidlmobley