diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index fbc85aea..b54ccfb2 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -19,13 +19,14 @@ jobs: fail-fast: false matrix: cfg: - - { os: ubuntu-latest, python-version: 3.7, docs: true, openmm: latest } - - { os: macos-latest, python-version: 3.7, docs: true, openmm: latest } - - { os: ubuntu-latest, python-version: 3.8, docs: false, openmm: latest } - - { os: ubuntu-latest, python-version: 3.7, docs: false, openmm: nightly } - - { os: ubuntu-latest, python-version: 3.8, docs: false, openmm: nightly } - - { os: ubuntu-latest, python-version: 3.7, docs: false, openmm: conda-forge } - - { os: ubuntu-latest, python-version: 3.8, docs: false, openmm: conda-forge } + - { os: ubuntu-latest, python-version: "3.8", docs: true, openmm: latest } + - { os: macos-latest, python-version: "3.8", docs: true, openmm: latest } + - { os: ubuntu-latest, python-version: "3.9", docs: false, openmm: latest } + - { os: ubuntu-latest, python-version: "3.8", docs: false, openmm: nightly } + - { os: ubuntu-latest, python-version: "3.9", docs: false, openmm: nightly } + - { os: ubuntu-latest, python-version: "3.8", docs: false, openmm: conda-forge } + - { os: ubuntu-latest, python-version: "3.9", docs: false, openmm: conda-forge } + - { os: ubuntu-latest, python-version: "3.10", docs: false, openmm: conda-forge } env: OPENMM: ${{ matrix.cfg.openmm }} @@ -33,7 +34,7 @@ jobs: PACKAGENAME: yank steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Additional info about the build shell: bash @@ -42,15 +43,12 @@ jobs: df -h ulimit -a - # More info on options: https://github.com/conda-incubator/setup-miniconda - - uses: conda-incubator/setup-miniconda@v2 + - name: Set up conda environment + uses: mamba-org/provision-with-micromamba@main with: - python-version: ${{ matrix.cfg.python-version }} environment-file: devtools/conda-envs/test_env.yaml - activate-environment: test - auto-update-conda: true - auto-activate-base: false - show-channel-urls: true + extra-specs: | + python=${{ matrix.cfg.python-version }} - name: Refine test environment shell: bash -l {0} @@ -58,19 +56,19 @@ jobs: case ${{ matrix.cfg.openmm }} in latest) echo "Using latest release OpenMM." - conda install --quiet -c omnia openmm;; + micromamba install --quiet -c omnia openmm;; rc) echo "Using OpenMM rc" - conda install --quiet -c omnia/label/rc openmm;; + micromamba install --quiet -c omnia/label/rc openmm;; beta) echo "Using OpenMM beta" - conda install --quiet -c omnia/label/beta openmm;; + micromamba install --quiet -c omnia/label/beta openmm;; nightly) echo "Using OpenMM nightly dev build." - conda install --quiet -c omnia-dev openmm;; + micromamba install --quiet -c omnia-dev openmm;; conda-forge) echo "Using OpenMM conda-forge testing build." - conda install --quiet -c conda-forge/label/test openmm;; + micromamba install --quiet -c conda-forge/label/test openmm;; esac - name: Install package diff --git a/.gitignore b/.gitignore index 57e49b3e..569fa80b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ # C extensions *.so +# macOS +.DS_Store + # Packages *.egg *.egg-info diff --git a/Yank/analyze.py b/Yank/analyze.py index 4191b822..5262d322 100644 --- a/Yank/analyze.py +++ b/Yank/analyze.py @@ -30,7 +30,10 @@ import mpiplus import numpy as np -import simtk.unit as units +try: + import openmm.unit as units +except ImportError: # OpenMM < 7.6 + import simtk.unit as units import openmmtools as mmtools from pymbar import timeseries diff --git a/Yank/commands/analyze.py b/Yank/commands/analyze.py index 4d03d0bc..c1f16eb8 100644 --- a/Yank/commands/analyze.py +++ b/Yank/commands/analyze.py @@ -151,7 +151,10 @@ def single_run(): def extract_analyzer_kwargs(args, quantities_as_strings=False): - import simtk.unit as unit + try: + import openmm.unit as unit + except ImportError: # OpenMM < 7.6 + import simtk.unit as unit """Return a dictionary with the keyword arguments to pass to the analyzer.""" analyzer_kwargs = {} diff --git a/Yank/commands/platforms.py b/Yank/commands/platforms.py index 8b5e3eee..f9a07df9 100644 --- a/Yank/commands/platforms.py +++ b/Yank/commands/platforms.py @@ -34,7 +34,10 @@ def dispatch(args): - from simtk import openmm + try: + import openmm + except ImportError: # OpenMM < 7.6 + from simtk import openmm print("Available OpenMM platforms:") for platform_index in range(openmm.Platform.getNumPlatforms()): print("{0:5d} {1:s}".format(platform_index, openmm.Platform.getPlatform(platform_index).getName())) diff --git a/Yank/commands/selftest.py b/Yank/commands/selftest.py index 1828311a..27475db0 100644 --- a/Yank/commands/selftest.py +++ b/Yank/commands/selftest.py @@ -52,7 +52,10 @@ def dispatch(args): import doctest import pkgutil import subprocess - import simtk.openmm as mm + try: + import openmm as mm + except ImportError: # OpenMM < 7.6 + import simtk.openmm as mm from .. import version from . import platforms diff --git a/Yank/experiment.py b/Yank/experiment.py index 2b266403..78b774d8 100644 --- a/Yank/experiment.py +++ b/Yank/experiment.py @@ -32,8 +32,13 @@ import openmmtools as mmtools import openmoltools as moltools import yaml -from simtk import unit, openmm -from simtk.openmm.app import PDBFile, AmberPrmtopFile +try: + import openmm + from openmm import unit + from openmm.app import PDBFile, AmberPrmtopFile +except ImportError: # OpenMM < 7.6 + from simtk import unit, openmm + from simtk.openmm.app import PDBFile, AmberPrmtopFile from . import utils, pipeline, restraints, schema from .yank import AlchemicalPhase, Topography @@ -2243,7 +2248,7 @@ def _configure_platform(cls, platform_name, platform_precision): Returns ------- - platform : simtk.openmm.Platform + platform : openmm.Platform The configured platform. Raises diff --git a/Yank/pipeline.py b/Yank/pipeline.py index 41bbe935..efab2dbb 100644 --- a/Yank/pipeline.py +++ b/Yank/pipeline.py @@ -33,8 +33,13 @@ import openmoltools as moltools import yaml from pdbfixer import PDBFixer -from simtk import openmm, unit -from simtk.openmm.app import PDBFile +try: + import openmm + from openmm import unit + from openmm.app import PDBFile +except ImportError: # OpenMM < 7.6 + from simtk import openmm, unit + from simtk.openmm.app import PDBFile from . import utils @@ -175,12 +180,12 @@ def compute_radius_of_gyration(positions): Parameters ---------- - positions : simtk.unit.Quantity with units compatible with angstrom + positions : openmm.unit.Quantity with units compatible with angstrom The coordinate set (natoms x 3) for which the radius of gyration is to be computed. Returns ------- - radius_of_gyration : simtk.unit.Quantity with units compatible with angstrom + radius_of_gyration : openmm.unit.Quantity with units compatible with angstrom The radius of gyration """ @@ -209,7 +214,7 @@ def compute_net_charge(system, atom_indices): Parameters ---------- - system : simtk.openmm.System + system : openmm.System The system object containing the atoms of interest. atom_indices : list of int Indices of the atoms of interest. @@ -245,7 +250,7 @@ def find_alchemical_counterions(system, topography, region_name): Parameters ---------- - system : simtk.openmm.System + system : openmm.System The system object containing the atoms of interest. topography : yank.Topography The topography object holding the indices of the ions and the @@ -328,7 +333,7 @@ def get_leap_recommended_pbradii(implicit_solvent): -------- >>> get_leap_recommended_pbradii('OBC2') 'mbondi2' - >>> from simtk.openmm.app import HCT + >>> from openmm.app import HCT >>> get_leap_recommended_pbradii(HCT) 'mbondi' @@ -347,7 +352,7 @@ def create_system(parameters_file, box_vectors, create_system_args, system_optio Parameters ---------- - parameters_file : simtk.openmm.app.AmberPrmtopFile or GromacsTopFile + parameters_file : openmm.app.AmberPrmtopFile or GromacsTopFile The file used to create they system. box_vectors : list of Vec3 The default box vectors of the system will be set to this value. @@ -358,7 +363,7 @@ def create_system(parameters_file, box_vectors, create_system_args, system_optio Returns ------- - system : simtk.openmm.System + system : openmm.System The system created. """ @@ -432,7 +437,7 @@ def read_system_files(positions_file_path, parameters_file_path, system_options, Returns ------- - system : simtk.openmm.System + system : openmm.System The OpenMM System built from the given files. topology : openmm.app.Topology The OpenMM Topology built from the given files. @@ -512,7 +517,7 @@ def read_system_files(positions_file_path, parameters_file_path, system_options, create_system_args = set(inspect.getargspec(openmm.app.CharmmPsfFile.createSystem).args) system_options['params'] = params system = create_system(parameters_file, box_vectors, create_system_args, system_options) - + # Unsupported file format. else: raise ValueError('Unsupported format for parameter file {}'.format(parameters_file_extension)) diff --git a/Yank/reports/notebook.py b/Yank/reports/notebook.py index fd888a2f..d9223896 100644 --- a/Yank/reports/notebook.py +++ b/Yank/reports/notebook.py @@ -16,7 +16,10 @@ from matplotlib import gridspec from pymbar import MBAR import seaborn as sns -from simtk import unit as units +try: + from openmm import unit as units +except ImportError: # OpenMM < 7.6 + from simtk import unit as units from openmmtools import multistate from .. import analyze diff --git a/Yank/restraints.py b/Yank/restraints.py index 13599f3b..189c87c3 100644 --- a/Yank/restraints.py +++ b/Yank/restraints.py @@ -32,7 +32,11 @@ import mdtraj as md import openmmtools as mmtools from openmmtools.states import GlobalParameterState -from simtk import openmm, unit +try: + import openmm + from openmm import unit +except ImportError: # OpenMM < 7.6 + from simtk import openmm, unit from . import pipeline from .utils import methoddispatch, generate_development_feature @@ -663,7 +667,7 @@ def _create_restraint_force(self, particles1, particles2): Returns ------- - force : simtk.openmm.Force + force : openmm.Force The created restraint force. """ @@ -798,7 +802,7 @@ def _closest_atom_to_centroid(positions, indices=None, masses=None): positions of object to identify atom closes to centroid indices : list of int, optional, default=None List of atoms indices for which closest atom to centroid is to be computed. - masses : simtk.unit.Quantity of natoms with units compatible with amu + masses : openmm.unit.Quantity of natoms with units compatible with amu Masses of particles used to weight distance calculation, if not None (default: None) Returns @@ -871,7 +875,7 @@ class Harmonic(RadiallySymmetricRestraint): Parameters ---------- - spring_constant : simtk.unit.Quantity, optional + spring_constant : openmm.unit.Quantity, optional The spring constant K (see energy expression above) in units compatible with joule/nanometer**2/mole (default is None). restrained_receptor_atoms : iterable of int, int, or str, optional @@ -958,7 +962,7 @@ def _create_restraint_force(self, particles1, particles2): Returns ------- - force : simtk.openmm.Force + force : openmm.Force The created restraint force. """ @@ -1041,10 +1045,10 @@ class FlatBottom(RadiallySymmetricRestraint): Parameters ---------- - spring_constant : simtk.unit.Quantity, optional + spring_constant : openmm.unit.Quantity, optional The spring constant K (see energy expression above) in units compatible with joule/nanometer**2/mole (default is None). - well_radius : simtk.unit.Quantity, optional + well_radius : openmm.unit.Quantity, optional The distance r0 (see energy expression above) at which the harmonic restraint is imposed in units of distance (default is None). restrained_receptor_atoms : iterable of int, int, or str, optional @@ -1137,7 +1141,7 @@ def _create_restraint_force(self, particles1, particles2): Returns ------- - force : simtk.openmm.Force + force : openmm.Force The created restraint force. """ @@ -1319,22 +1323,22 @@ class BoreschLike(ReceptorLigandRestraint, ABC): This can temporarily be left undefined, but ``determine_missing_parameters()`` must be called before using the Restraint object. The same if a DSL expression or Topography region is provided (default is None). - K_r : simtk.unit.Quantity, optional + K_r : openmm.unit.Quantity, optional The spring constant for the restrained distance ``|r3 - l1|`` (units compatible with kilocalories_per_mole/angstrom**2). - r_aA0 : simtk.unit.Quantity, optional + r_aA0 : openmm.unit.Quantity, optional The equilibrium distance between r3 and l1 (units of length). - K_thetaA, K_thetaB : simtk.unit.Quantity, optional + K_thetaA, K_thetaB : openmm.unit.Quantity, optional The spring constants for ``angle(r2, r3, l1)`` and ``angle(r3, l1, l2)`` (units compatible with kilocalories_per_mole/radians**2). - theta_A0, theta_B0 : simtk.unit.Quantity, optional + theta_A0, theta_B0 : openmm.unit.Quantity, optional The equilibrium angles of ``angle(r2, r3, l1)`` and ``angle(r3, l1, l2)`` (units compatible with radians). - K_phiA, K_phiB, K_phiC : simtk.unit.Quantity, optional + K_phiA, K_phiB, K_phiC : openmm.unit.Quantity, optional The spring constants for ``dihedral(r1, r2, r3, l1)``, ``dihedral(r2, r3, l1, l2)`` and ``dihedral(r3,l1,l2,l3)`` (units compatible with kilocalories_per_mole/radians**2). - phi_A0, phi_B0, phi_C0 : simtk.unit.Quantity, optional + phi_A0, phi_B0, phi_C0 : openmm.unit.Quantity, optional The equilibrium torsion of ``dihedral(r1,r2,r3,l1)``, ``dihedral(r2,r3,l1,l2)`` and ``dihedral(r3,l1,l2,l3)`` (units compatible with radians). @@ -1717,7 +1721,7 @@ def _is_collinear(positions, atoms, threshold=0.9): Parameters ---------- - positions : n_atoms x 3 simtk.unit.Quantity + positions : n_atoms x 3 openmm.unit.Quantity Reference positions to use for imposing restraints (units of length). atoms : iterable of int The indices of the atoms to test. @@ -2019,22 +2023,22 @@ class Boresch(BoreschLike): This can temporarily be left undefined, but ``determine_missing_parameters()`` must be called before using the Restraint object. The same if a DSL expression or Topography region is provided (default is None). - K_r : simtk.unit.Quantity, optional + K_r : openmm.unit.Quantity, optional The spring constant for the restrained distance ``|r3 - l1|`` (units compatible with kilocalories_per_mole/angstrom**2). - r_aA0 : simtk.unit.Quantity, optional + r_aA0 : openmm.unit.Quantity, optional The equilibrium distance between r3 and l1 (units of length). - K_thetaA, K_thetaB : simtk.unit.Quantity, optional + K_thetaA, K_thetaB : openmm.unit.Quantity, optional The spring constants for ``angle(r2, r3, l1)`` and ``angle(r3, l1, l2)`` (units compatible with kilocalories_per_mole/radians**2). - theta_A0, theta_B0 : simtk.unit.Quantity, optional + theta_A0, theta_B0 : openmm.unit.Quantity, optional The equilibrium angles of ``angle(r2, r3, l1)`` and ``angle(r3, l1, l2)`` (units compatible with radians). - K_phiA, K_phiB, K_phiC : simtk.unit.Quantity, optional + K_phiA, K_phiB, K_phiC : openmm.unit.Quantity, optional The spring constants for ``dihedral(r1, r2, r3, l1)``, ``dihedral(r2, r3, l1, l2)`` and ``dihedral(r3,l1,l2,l3)`` (units compatible with kilocalories_per_mole/radians**2). - phi_A0, phi_B0, phi_C0 : simtk.unit.Quantity, optional + phi_A0, phi_B0, phi_C0 : openmm.unit.Quantity, optional The equilibrium torsion of ``dihedral(r1,r2,r3,l1)``, ``dihedral(r2,r3,l1,l2)`` and ``dihedral(r3,l1,l2,l3)`` (units compatible with radians). @@ -2291,22 +2295,22 @@ class PeriodicTorsionBoresch(Boresch): This can temporarily be left undefined, but ``determine_missing_parameters()`` must be called before using the Restraint object. The same if a DSL expression or Topography region is provided (default is None). - K_r : simtk.unit.Quantity, optional + K_r : openmm.unit.Quantity, optional The spring constant for the restrained distance ``|r3 - l1|`` (units compatible with kilocalories_per_mole/angstrom**2). - r_aA0 : simtk.unit.Quantity, optional + r_aA0 : openmm.unit.Quantity, optional The equilibrium distance between r3 and l1 (units of length). - K_thetaA, K_thetaB : simtk.unit.Quantity, optional + K_thetaA, K_thetaB : openmm.unit.Quantity, optional The spring constants for ``angle(r2, r3, l1)`` and ``angle(r3, l1, l2)`` (units compatible with kilocalories_per_mole/radians**2). - theta_A0, theta_B0 : simtk.unit.Quantity, optional + theta_A0, theta_B0 : openmm.unit.Quantity, optional The equilibrium angles of ``angle(r2, r3, l1)`` and ``angle(r3, l1, l2)`` (units compatible with radians). - K_phiA, K_phiB, K_phiC : simtk.unit.Quantity, optional + K_phiA, K_phiB, K_phiC : openmm.unit.Quantity, optional The spring constants for ``dihedral(r1, r2, r3, l1)``, ``dihedral(r2, r3, l1, l2)`` and ``dihedral(r3,l1,l2,l3)`` (units compatible with kilocalories_per_mole/radians**2). - phi_A0, phi_B0, phi_C0 : simtk.unit.Quantity, optional + phi_A0, phi_B0, phi_C0 : openmm.unit.Quantity, optional The equilibrium torsion of ``dihedral(r1,r2,r3,l1)``, ``dihedral(r2,r3,l1,l2)`` and ``dihedral(r3,l1,l2,l3)`` (units compatible with radians). @@ -2412,9 +2416,9 @@ class RMSD(OpenMM73, ReceptorLigandRestraint): If no selection is given, all ligand atoms will be restrained. If an empty list is provided, no receptor atoms will be restrained. (default is None). - K_RMSD : simtk.unit.Quantity, optional, default=0.6*kilocalories_per_mole/angstrom**2 + K_RMSD : openmm.unit.Quantity, optional, default=0.6*kilocalories_per_mole/angstrom**2 The spring constant (units compatible with kilocalories_per_mole/angstrom**2). - RMSD0 : simtk.unit.Quantity, optional, default=2.0*angstrom + RMSD0 : openmm.unit.Quantity, optional, default=2.0*angstrom The RMSD at which the restraint becomes nonzero. reference_sampler_state : openmmtools.states.SamplerState or None, Optional Reference sampler state with coordinates to use as the structure to align the RMSD to. diff --git a/Yank/schema/validator.py b/Yank/schema/validator.py index 7ad030ca..c1343f5c 100644 --- a/Yank/schema/validator.py +++ b/Yank/schema/validator.py @@ -8,8 +8,12 @@ import cerberus import cerberus.errors -import simtk.unit as unit -from simtk.openmm import app +try: + import openmm.unit as unit + from openmm import app +except ImportError: # OpenMM < 7.6 + import simtk.unit as unit + from simtk.openmm import app import openmmtools as mmtools from openmoltools.utils import unwrap_py2 diff --git a/Yank/tests/test_analyze.py b/Yank/tests/test_analyze.py index 4e633973..1c243f94 100644 --- a/Yank/tests/test_analyze.py +++ b/Yank/tests/test_analyze.py @@ -20,7 +20,10 @@ import openmmtools as mmtools import pymbar from pymbar.utils import ParameterError -from simtk import unit +try: + from openmm import unit +except ImportError: # OpenMM < 7.6 + from simtk import unit from openmmtools.multistate import (MultiStateReporter, MultiStateSampler, ReplicaExchangeSampler, SAMSSampler, utils) diff --git a/Yank/tests/test_experiment.py b/Yank/tests/test_experiment.py index 840737ae..7b35e21b 100644 --- a/Yank/tests/test_experiment.py +++ b/Yank/tests/test_experiment.py @@ -708,7 +708,7 @@ def test_validation_wrong_solvents(): {'nonbonded_method': 'PME', 'clearance': '3*angstroms', 'implicit_solvent': 'OBC2'}), ("blabla:\n- unknown field", {'nonbonded_method': 'NoCutoff', 'blabla': '3*nanometers'}), - ("''implicit_solvent'' cannot be coerced: module ''simtk.openmm.app'' has no\n attribute ''OBX2'''", + ("''implicit_solvent'' cannot be coerced: module ''openmm.app'' has no\n attribute ''OBX2'''", {'nonbonded_method': 'NoCutoff', 'implicit_solvent': 'OBX2'}), ("''implicit_solvent_salt_conc'' cannot be coerced: Units of 1.0\*angstrom", {'implicit_solvent': 'OBC2', 'implicit_solvent_salt_conc': '1.0*angstrom'}) diff --git a/Yank/tests/test_restraints.py b/Yank/tests/test_restraints.py index 27bd9cc9..6795ca5a 100644 --- a/Yank/tests/test_restraints.py +++ b/Yank/tests/test_restraints.py @@ -18,7 +18,11 @@ import copy import numpy as np -from simtk import openmm, unit +try: + import openmm + from openmm import unit +except ImportError: # OpenMM < 7.6 + from simtk import openmm, unit import openmmtools as mmtools from openmmtools import testsystems, states, multistate import nose diff --git a/Yank/tests/test_utils.py b/Yank/tests/test_utils.py index 39236dba..64f7238c 100644 --- a/Yank/tests/test_utils.py +++ b/Yank/tests/test_utils.py @@ -13,7 +13,11 @@ import textwrap import openmoltools as omt -from simtk import openmm, unit +try: + import openmm + from openmm import unit +except ImportError: # OpenMM < 7.6 + from simtk import openmm, unit from nose import tools from yank.utils import * # TODO: Don't use 'import *' diff --git a/Yank/utils.py b/Yank/utils.py index a431d2c8..e667852a 100644 --- a/Yank/utils.py +++ b/Yank/utils.py @@ -31,14 +31,22 @@ import itertools import contextlib import subprocess -import collections + +try: + from collections import MutableMapping, Mapping +except ImportError: + # Support python 3.10 + from collections.abc import MutableMapping, Mapping from pkg_resources import resource_filename import mdtraj import parmed import numpy as np -from simtk import unit +try: + from openmm import unit +except ImportError: # OpenMM < 7.6 + from simtk import unit import openmmtools as mmtools @@ -276,7 +284,7 @@ def __repr__(self): return "Combinatorial({})".format(super(CombinatorialLeaf, self).__repr__()) -class CombinatorialTree(collections.MutableMapping): +class CombinatorialTree(MutableMapping): """A tree that can be expanded in a combinatorial fashion. Each tree node with its subnodes is represented as a nested dictionary. Nodes can be @@ -618,7 +626,7 @@ def recursive_find_leaves(node): leaf_paths = [] leaf_vals = [] for child_key, child_val in node.items(): - if isinstance(child_val, collections.Mapping): + if isinstance(child_val, Mapping): subleaf_paths, subleaf_vals = recursive_find_leaves(child_val) # prepend child key to path leaf_paths.extend([(child_key,) + subleaf for subleaf in subleaf_paths]) @@ -760,7 +768,7 @@ def update_nested_dict(original, updated): """ new = original.copy() for key, value in updated.items(): - if isinstance(value, collections.Mapping): + if isinstance(value, Mapping): replacement = update_nested_dict(new.get(key, {}), value) new[key] = replacement else: @@ -841,13 +849,13 @@ def quantity_from_string(expression, compatible_units=None): """Create a Quantity object from a string expression. All the functions in the standard module math are available together - with most of the methods inside the ``simtk.unit`` module. + with most of the methods inside the ``openmm.unit`` module. Parameters ---------- expression : str The mathematical expression to rebuild a Quantity as a string. - compatible_units : simtk.unit.Unit, optional + compatible_units : openmm.unit.Unit, optional If given, the result is checked for compatibility against the specified units, and an exception raised if not compatible. @@ -987,7 +995,7 @@ def validate_parameters(parameters, template_parameters, check_unknown=False, contained in ``template_parameters``. process_units_str: bool If True, the function will attempt to convert the strings whose template - type is simtk.unit.Quantity. + type is openmm.unit.Quantity. float_to_int : bool If True, floats in parameters whose template type is int are truncated. ignore_none : bool @@ -1791,7 +1799,7 @@ def generate_development_feature(feature_dict): require instantiation. Function names are all given the `dev_` prefix to avoid clashes with other names its a part of its psudo-mixin properties """ - base_err = ('This feature cannot be used because it has been marked as "Developmental" and ' + base_err = ('This feature cannot be used because it has been marked as "Developmental" and ' 'the following conditions have not been met:\n') valid = True # Assume valid until proven otherwise check_dict = {} diff --git a/Yank/yank.py b/Yank/yank.py index b117365a..1b729a17 100644 --- a/Yank/yank.py +++ b/Yank/yank.py @@ -30,7 +30,11 @@ import numpy as np import openmmtools as mmtools import pandas -from simtk import unit, openmm +try: + import openmm + from openmm import unit +except ImportError: # OpenMM < 7.6 + from simtk import unit, openmm from . import pipeline from .restraints import RestraintState, RestraintParameterError, V0 @@ -56,7 +60,7 @@ class Topography(object): Parameters ---------- - topology : mdtraj.Topology or simtk.openmm.app.Topology + topology : mdtraj.Topology or openmm.app.Topology The topology object specifying the system. ligand_atoms : iterable of int or str, optional The atom indices of the ligand. A string is interpreted as an mdtraj @@ -707,7 +711,7 @@ def minimize(self, tolerance, max_iterations): Parameters ---------- - tolerance : simtk.unit.Quantity + tolerance : openmm.unit.Quantity Minimization tolerance (units of energy/mole/length, default is ``1.0 * unit.kilojoules_per_mole / unit.nanometers``). max_iterations : int @@ -897,7 +901,7 @@ def create(self, thermodynamic_state, sampler_states, topography, protocol, restraint : ReceptorLigandRestraint, optional Restraint to add between protein and ligand. This must be specified for ligand-receptor systems in non-periodic boxes. - anisotropic_dispersion_cutoff : simtk.openmm.Quantity, 'auto', or None, optional, default None + anisotropic_dispersion_cutoff : openmm.Quantity, 'auto', or None, optional, default None If specified, this is the cutoff at which to reweight long range interactions of the end states to correct for anisotropic dispersions. @@ -1097,7 +1101,7 @@ def minimize(self, tolerance=1.0*unit.kilojoules_per_mole/unit.nanometers, Parameters ---------- - tolerance : simtk.unit.Quantity, optional + tolerance : openmm.unit.Quantity, optional Minimization tolerance (units of energy/mole/length, default is ``1.0 * unit.kilojoules_per_mole / unit.nanometers``). max_iterations : int, optional @@ -1151,7 +1155,7 @@ def randomize_ligand(self, sigma_multiplier=2.0, close_cutoff=1.5*unit.angstrom) The ligand will be placed close to a random receptor atom at a distance that is normally distributed with standard deviation ``sigma_multiplier * receptor_radius_of_gyration`` (default is 2.0). - close_cutoff : simtk.unit.Quantity, optional + close_cutoff : openmm.unit.Quantity, optional Each random placement proposal will be rejected if the ligand ends up being closer to the receptor than this cutoff (units of length, default is ``1.5*unit.angstrom``). diff --git a/devtools/conda-envs/test_env.yaml b/devtools/conda-envs/test_env.yaml index df4a45f9..0c69f67c 100644 --- a/devtools/conda-envs/test_env.yaml +++ b/devtools/conda-envs/test_env.yaml @@ -1,7 +1,6 @@ name: test channels: - conda-forge - - defaults - omnia - openeye - salilab @@ -10,25 +9,26 @@ dependencies: - python - pip - pandas - - numpy >=1.14 + - numpy >=1.20 - scipy - - openmm >=7.3 - - mdtraj >=1.7.2 + - openmm >=7.6 + - mdtraj >=1.9 - openmmtools >=0.18.3 - pymbar <4 - - ambermini >=16.16.0 + - ambermini >=16.16.0 # ? - docopt - openmoltools >=0.7.5 - mpiplus - pyyaml - clusterutils - sphinxcontrib-bibtex - - cerberus ==1.1 # yank uses buggy cerberus 1.1 behavior as a feature ¯\_(ツ)_/¯ + - cerberus ==1.3.4 #==1.1 # yank uses buggy cerberus 1.1 behavior as a feature ¯\_(ツ)_/¯ - matplotlib - jupyter - pdbfixer - openeye-toolkits - modeller + - parmed # test - nose - nose-timer diff --git a/docs/yamlpages/mcmc.rst b/docs/yamlpages/mcmc.rst index 1ce965fc..330ee48e 100644 --- a/docs/yamlpages/mcmc.rst +++ b/docs/yamlpages/mcmc.rst @@ -33,7 +33,7 @@ keyword is ``type``. YANK supports all the ``MCMCMove`` classes defined in the * ``SequenceMove``: Container MCMC move describing a sequence of other moves. * ``LangevinSplittingDynamicsMove``: High-quality Langevin integrator family based on symmetric Strang splittings, using g-BAOAB :cite:`LeimkuhlerMatthews2016` as default -* ``LangevinDynamicsMove``: Leapfrog Langevin dynamics integrator from OpenMM (``simtk.openmm.LangevinIntegrator``); not recommended +* ``LangevinDynamicsMove``: Leapfrog Langevin dynamics integrator from OpenMM (``openmm.LangevinIntegrator``); not recommended * ``GHMCMove``: Metropolized Langevin integrator, when exact sampling is required; not recommended for large systems * ``HMCMove``: Hybrid Monte Carlo integrator, when exact sampling is required; not recommended for large systems * ``MonteCarloBarostatMove``: Explicit Monte Carlo barostat; not recommended, since this can be incorporated within Langevin dynamics moves instead diff --git a/docs/yamlpages/options.rst b/docs/yamlpages/options.rst index 0a4eb616..26e3b812 100644 --- a/docs/yamlpages/options.rst +++ b/docs/yamlpages/options.rst @@ -873,6 +873,6 @@ Valid Options: [yes]/no .. [1] Quantity strings are of the format: `` * `` where ```` is any valid unit specified in the "Valid Options" for an option. e.g. "" indicates any measure of length may be used for such as nanometer or angstrom. Compound units are also parsed such as ``kilogram / meter**3`` for density. - Only full unit names as they appear in the simtk.unit package (part of OpenMM) are allowed; so "nm" and "A" will be rejected. + Only full unit names as they appear in the openmm.unit package (part of OpenMM) are allowed; so "nm" and "A" will be rejected. | diff --git a/docs/yamlpages/solvents.rst b/docs/yamlpages/solvents.rst index f5d1ca17..c5cd8f16 100644 --- a/docs/yamlpages/solvents.rst +++ b/docs/yamlpages/solvents.rst @@ -11,7 +11,7 @@ In the examples, these user defined names are marked as ``{UserDefinedSolvent}`` You can define as many ``{UserDefinedSolvent}`` as you like. These solvents will be used in other YAML headers. Most of the solvent options are tied directly to OpenMM options of the same name in the primary function -``simtk.openmm.app.amberprmtopfile.AmberPrmtopFile.createSystem()``, however, there are other options tied to LEaP preparation instructions. +``openmm.app.amberprmtopfile.AmberPrmtopFile.createSystem()``, however, there are other options tied to LEaP preparation instructions. Similarly, the ``solvents`` section is where you specify Periodic Boundary Conditions (PBC) and long range electrostatic treatments. Each of the arguments in this category is optional and the default option will be assumed if not specified. @@ -358,7 +358,7 @@ Valid Options (0 * molar): [1]_ .. [1] Quantity strings are of the format: `` * `` where ```` is any valid unit specified in the "Valid Options" for an option. e.g. "" indicates any measure of length may be used for such as nanometer or angstrom. Compound units are also parsed such as ``kilogram / meter**3`` for density. - Only full unit names as they appear in the simtk.unit package (part of OpenMM) are allowed; so "nm" and "A" will be rejected. + Only full unit names as they appear in the openmm.unit package (part of OpenMM) are allowed; so "nm" and "A" will be rejected. diff --git a/docs/yank-yaml-cookbook/combinatorial-experiment.yaml b/docs/yank-yaml-cookbook/combinatorial-experiment.yaml index 97240428..d52d6db8 100644 --- a/docs/yank-yaml-cookbook/combinatorial-experiment.yaml +++ b/docs/yank-yaml-cookbook/combinatorial-experiment.yaml @@ -106,7 +106,7 @@ molecules: # Here we specify the parameters of our solvent. The list of # configuration here is not 100% complete. In general, all parameters -# of simtk.openmm.app.amberprmtopfile.AmberPrmtopFile.createSystem() +# of openmm.app.amberprmtopfile.AmberPrmtopFile.createSystem() # can be specified in this section. # ----------------------------------------------------------------- solvents: