Unverified Commit e53bdc5e authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Top level Python module is now "openmm" (#3000)

* Top level Python module is now "openmm"

* Updated module names in examples

* Updated module names in documentation

* Updated module in CI scripts

* Added deprecation warning
parent eff1f26e
......@@ -34,14 +34,14 @@ from __future__ import absolute_import
__author__ = "Peter Eastman"
__version__ = "1.0"
from simtk.openmm.app import Topology, PDBFile, ForceField
from simtk.openmm.app.forcefield import HAngles, AllBonds, CutoffNonPeriodic, CutoffPeriodic, _createResidueSignature, DrudeGenerator
from simtk.openmm.app.topology import Residue
from simtk.openmm.app.internal import compiled
from simtk.openmm.vec3 import Vec3
from simtk.openmm import System, Context, NonbondedForce, CustomNonbondedForce, HarmonicBondForce, HarmonicAngleForce, VerletIntegrator, LangevinIntegrator, LocalEnergyMinimizer
from simtk.unit import nanometer, molar, elementary_charge, amu, gram, liter, degree, sqrt, acos, is_quantity, dot, norm, kilojoules_per_mole
import simtk.unit as unit
from openmm.app import Topology, PDBFile, ForceField
from openmm.app.forcefield import HAngles, AllBonds, CutoffNonPeriodic, CutoffPeriodic, _createResidueSignature, DrudeGenerator
from openmm.app.topology import Residue
from openmm.app.internal import compiled
from openmm.vec3 import Vec3
from openmm import System, Context, NonbondedForce, CustomNonbondedForce, HarmonicBondForce, HarmonicAngleForce, VerletIntegrator, LangevinIntegrator, LocalEnergyMinimizer
from openmm.unit import nanometer, molar, elementary_charge, amu, gram, liter, degree, sqrt, acos, is_quantity, dot, norm, kilojoules_per_mole
import openmm.unit as unit
from . import element as elem
import gc
import os
......
......@@ -38,11 +38,11 @@ import math
import xml.etree.ElementTree as etree
from copy import copy
from datetime import date
from simtk.openmm import Vec3, Platform
from simtk.openmm.app.internal.pdbstructure import PdbStructure
from simtk.openmm.app.internal.unitcell import computeLengthsAndAngles
from simtk.openmm.app import Topology
from simtk.unit import nanometers, angstroms, is_quantity, norm, Quantity, dot
from openmm import Vec3, Platform
from openmm.app.internal.pdbstructure import PdbStructure
from openmm.app.internal.unitcell import computeLengthsAndAngles
from openmm.app import Topology
from openmm.unit import nanometers, angstroms, is_quantity, norm, Quantity, dot
from . import element as elem
try:
import numpy
......
......@@ -32,8 +32,8 @@ from __future__ import absolute_import
__author__ = "Peter Eastman"
__version__ = "1.0"
import simtk.openmm as mm
from simtk.openmm.app import PDBFile, PDBxFile
import openmm as mm
from openmm.app import PDBFile, PDBxFile
class PDBReporter(object):
"""PDBReporter outputs a series of frames from a Simulation to a PDB file.
......
......@@ -35,12 +35,12 @@ __version__ = "2.0"
import sys
import math
from simtk.openmm import Vec3, Platform
from openmm import Vec3, Platform
from datetime import date
from simtk.openmm.app.internal.pdbx.reader.PdbxReader import PdbxReader
from simtk.openmm.app.internal.unitcell import computePeriodicBoxVectors, computeLengthsAndAngles
from simtk.openmm.app import Topology, PDBFile
from simtk.unit import nanometers, angstroms, is_quantity, norm, Quantity, dot
from openmm.app.internal.pdbx.reader.PdbxReader import PdbxReader
from openmm.app.internal.unitcell import computePeriodicBoxVectors, computeLengthsAndAngles
from openmm.app import Topology, PDBFile
from openmm.unit import nanometers, angstroms, is_quantity, norm, Quantity, dot
from . import element as elem
try:
import numpy
......
......@@ -33,7 +33,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
__author__ = "Peter Eastman"
__version__ = "1.0"
import simtk.unit as unit
import openmm.unit as unit
import math
import random
from sys import stdout
......
......@@ -32,8 +32,8 @@ from __future__ import absolute_import
__author__ = "Peter Eastman"
__version__ = "1.0"
import simtk.openmm as mm
import simtk.unit as unit
import openmm as mm
import openmm.unit as unit
import sys
from datetime import datetime, timedelta
try:
......
......@@ -43,8 +43,8 @@ try:
have_gzip = True
except: have_gzip = False
import simtk.openmm as mm
import simtk.unit as unit
import openmm as mm
import openmm.unit as unit
import math
import time
......
......@@ -35,9 +35,9 @@ __version__ = "1.0"
from collections import namedtuple
import os
import xml.etree.ElementTree as etree
from simtk.openmm.vec3 import Vec3
from simtk.openmm.app.internal.singleton import Singleton
from simtk.unit import nanometers, sqrt, is_quantity
from openmm.vec3 import Vec3
from openmm.app.internal.singleton import Singleton
from openmm.unit import nanometers, sqrt, is_quantity
from copy import deepcopy
# Enumerated values for bond type
......
......@@ -32,7 +32,7 @@ from __future__ import absolute_import, division
__author__ = "Peter Eastman"
__version__ = "1.0"
from simtk.openmm import CustomIntegrator
from openmm import CustomIntegrator
class MTSIntegrator(CustomIntegrator):
"""MTSIntegrator implements the rRESPA multiple time step integration algorithm.
......@@ -169,7 +169,7 @@ class MTSLangevinIntegrator(CustomIntegrator):
import math
self.addGlobalVariable("a", math.exp(-friction*dt))
self.addGlobalVariable("b", math.sqrt(1-math.exp(-2*friction*dt)))
from simtk.unit import MOLAR_GAS_CONSTANT_R
from openmm.unit import MOLAR_GAS_CONSTANT_R
self.addGlobalVariable('kT', MOLAR_GAS_CONSTANT_R*temperature)
self.addPerDofVariable("x1", 0)
self.addUpdateContextState();
......
......@@ -5,14 +5,14 @@ import sys
# First make sure OpenMM is installed.
try:
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from openmm.app import *
from openmm import *
from openmm.unit import *
except ImportError as err:
simtk_import_failed = True
simtk_import_error = str(err)
import_failed = True
import_error = str(err)
else:
simtk_import_failed = False
import_failed = False
def run_tests():
......@@ -33,7 +33,7 @@ def run_tests():
print()
# Create a System for the tests.
data_dir = os.path.join(os.path.abspath(os.path.split(__file__)[0]), 'openmm', 'app', 'data')
data_dir = os.path.join(os.path.abspath(os.path.split(__file__)[0]), 'app', 'data')
pdb = PDBFile(os.path.join(data_dir, 'test.pdb'))
forcefield = ForceField('amber99sb.xml', 'tip3p.xml')
system = forcefield.createSystem(pdb.topology, nonbondedMethod=LJPME, nonbondedCutoff=1*nanometer, constraints=HBonds, ewaldErrorTolerance=1e-4)
......@@ -96,10 +96,10 @@ def run_tests():
def main():
if simtk_import_failed:
if import_failed:
print('Failed to import OpenMM packages; OpenMM will not work.\n'
'Make sure OpenMM is installed and the library path is set correctly.'
'\n\nError message: %s' % simtk_import_error,
'\n\nError message: %s' % import_error,
file=sys.stderr)
sys.exit(1)
......
"""
Physical quantities with units for dimensional analysis and automatic unit conversion.
"""
from __future__ import absolute_import
__docformat__ = "epytext en"
__author__ = "Christopher M. Bruns"
__copyright__ = "Copyright 2010, Stanford University and Christopher M. Bruns"
__credits__ = []
__license__ = "MIT"
__maintainer__ = "Christopher M. Bruns"
__email__ = "cmbruns@stanford.edu"
from .unit import Unit, is_unit
from .quantity import Quantity, is_quantity
from .unit_math import *
from .unit_definitions import *
from .constants import *
#!/bin/env python
"""
Module simtk.unit.basedimension
Module openmm.unit.basedimension
BaseDimension class for use by units and quantities.
BaseDimensions are things like "length" and "mass".
......@@ -61,8 +61,7 @@ class BaseDimension(object):
"""Create a new BaseDimension.
Each new BaseDimension is assumed to be independent of all other BaseDimensions.
Use the existing BaseDimensions in simtk.dimension instead of creating
new ones.
Use the existing BaseDimensions instead of creating new ones.
"""
self.name = name
if not self.name in BaseDimension._index_by_name.keys():
......
......@@ -2,7 +2,7 @@
"""
Module simtk.unit.baseunit
Module openmm.unit.baseunit
Contains BaseUnit class, which is a component of the Unit class.
......
#!/bin/env python
"""
Module simtk.unit.constants
Module openmm.unit.constants
This is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of
......
#!/bin/env python
"""
Module simtk.unit.doctests
Module openmm.unit.doctests
Lots of in-place doctests would no longer work after I rearranged
so that specific unit definitions are defined late. So those tests
......@@ -850,7 +850,7 @@ Examples
# Thanks to Kyle Beauchamp July 2010
>>> try:
... import numpy
... from simtk.unit.quantity import _is_string
... from openmm.unit.quantity import _is_string
... a = numpy.array([[1,2,3],[4,5,6]])
... assert isinstance("", str)
... assert _is_string("")
......
#!/bin/env python
"""
Module simtk.unit.prefix
Module openmm.unit.prefix
This is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of
......@@ -140,7 +140,7 @@ def define_prefixed_units(base_unit, module = sys.modules[__name__]):
Parameters
- base_unit (BaseUnit) existing base unit to use as a basis for prefixed units
- module (Module) module which will contain the new attributes. Defaults to simtk.unit module.
- module (Module) module which will contain the new attributes. Defaults to openmm.unit module.
"""
for prefix in si_prefixes:
new_base_unit = prefix * base_unit
......
#!/bin/env python
"""
Module simtk.unit.quantity
Module openmm.unit.quantity
Physical quantities with units, intended to produce similar functionality
to Boost.Units package in C++ (but with a runtime cost).
......@@ -9,14 +9,14 @@ but different internals to satisfy our local requirements.
In particular, there is no underlying set of 'canonical' base
units, whereas in Scientific.Physics.PhysicalQuantities all
units are secretly in terms of SI units. Also, it is easier
to add new fundamental dimensions to simtk.dimensions. You
to add new fundamental dimensions to basedimension. You
might want to make new dimensions for, say, "currency" or
"information".
Some features of this implementation:
* Quantities are a combination of a value and a unit. The value
part can be any python type, including numbers, lists, numpy
arrays, and anything else. The unit part must be a simtk.unit.Unit.
arrays, and anything else. The unit part must be a openmm.unit.Unit.
* Operations like adding incompatible units raises an error.
* Multiplying or dividing units/quantities creates new units.
* Users can create new Units and Dimensions, but most of the useful
......@@ -100,7 +100,7 @@ class Quantity(object):
Parameters
- value: (any type, usually a number) Measure of this quantity
- unit: (Unit) the physical unit, e.g. simtk.unit.meters.
- unit: (Unit) the physical unit, e.g. openmm.unit.meters.
"""
# When no unit is specified, bend over backwards to handle all one-argument possibilities
if unit is None: # one argument version, copied from UList
......
#!/bin/env python
"""
Module simtk.unit.standard_dimensions
Module openmm.unit.standard_dimensions
Definition of principal dimensions: mass, length, time, etc.
......
#!/bin/env python
"""
Module simtk.unit
Module openmm.unit
Contains classes Unit and ScaledUnit.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment