Skip to content

Commit

Permalink
Create alchemy subpackage (#721)
Browse files Browse the repository at this point in the history
* Create alchemy subpackage

* Fix docs dependencies

* Fix alchemy tests imports
  • Loading branch information
ijpulidos authored Nov 7, 2023
1 parent 0b4d42a commit 0bbef98
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ dependencies:
# docs
- numpydoc
- sphinxcontrib-bibtex
- sphinx-rtd-theme
22 changes: 22 additions & 0 deletions openmmtools/alchemy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
Alchemical factory for free energy calculations package that operates directly on OpenMM
System objects.
DESCRIPTION
This package contains enumerative factories for generating alchemically-modified System objects
usable for the calculation of free energy differences of hydration or ligand binding.
Provided classes include:
- :class:`openmmtools.alchemy.alchemy.AlchemicalFunction`
- :class:`openmmtools.alchemy.alchemy.AlchemicalState`
- :class:`openmmtools.alchemy.alchemy.AlchemicalRegion`
- :class:`openmmtools.alchemy.alchemy.AbsoluteAlchemicalFactory`
- :class:`openmmtools.alchemy.alchemy.AlchemicalStateError`
"""

# Automatically importing everything from the lower level alchemy module to avoid API breakage
from .alchemy import AlchemicalState, AlchemicalFunction, AlchemicalStateError, AlchemicalRegion, \
AbsoluteAlchemicalFactory
File renamed without changes.
12 changes: 9 additions & 3 deletions openmmtools/tests/test_alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

from __future__ import print_function

import copy
import logging
import os
import sys
import zlib
Expand All @@ -25,11 +27,15 @@

import nose
import scipy
import numpy as np
from nose.plugins.attrib import attr

from openmmtools import testsystems, forces
from openmmtools.constants import kB
from openmmtools.alchemy import *
import openmm
from openmm import unit
from openmmtools import forces, forcefactories, states, testsystems, utils
from openmmtools.constants import kB, ONE_4PI_EPS0
from openmmtools.alchemy import AlchemicalFunction, AlchemicalState, AbsoluteAlchemicalFactory, \
AlchemicalRegion, AlchemicalStateError
from openmmtools.multistate.pymbar import subsample_correlated_data, detect_equilibration, _pymbar_exp

logger = logging.getLogger(__name__)
Expand Down
3 changes: 0 additions & 3 deletions openmmtools/tests/test_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import numpy as np
import yaml
import unittest
from nose.plugins.attrib import attr
from nose.tools import assert_raises
try:
Expand Down Expand Up @@ -1445,8 +1444,6 @@ def test_storage_reporter_and_string(self):
energies_rep, _, _ = sampler._reporter.read_energies()
assert np.all(energies_str == energies_rep)

#@unittest.skip("This test needs to fixed, see https://github.com/choderalab/openmmtools/pull/705")
#@unittest.skipIf(os.getenv("RUNNER_OS") == "macOS", "Test doesn't work on OSX on GHA")
def test_online_analysis_works(self):
"""Test online analysis runs"""
thermodynamic_states, sampler_states, unsampled_states = copy.deepcopy(self.alanine_test)
Expand Down

0 comments on commit 0bbef98

Please sign in to comment.