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
...@@ -212,7 +212,7 @@ script: ...@@ -212,7 +212,7 @@ script:
else else
make PythonInstall; make PythonInstall;
fi; fi;
python -m simtk.testInstallation; python -m openmm.testInstallation;
(cd python/tests && py.test -v); (cd python/tests && py.test -v);
fi fi
......
...@@ -6,5 +6,5 @@ python devtools/run-ctest.py --job-duration=120 --timeout 300 --in-order -R 'Tes ...@@ -6,5 +6,5 @@ python devtools/run-ctest.py --job-duration=120 --timeout 300 --in-order -R 'Tes
# Build & test Python # Build & test Python
make PythonInstall make PythonInstall
python -m simtk.testInstallation python -m openmm.testInstallation
cd python/tests && py.test -v cd python/tests && py.test -v
...@@ -54,7 +54,7 @@ then ...@@ -54,7 +54,7 @@ then
echo "Installation is complete. You should now test your installation to make sure" echo "Installation is complete. You should now test your installation to make sure"
echo "it is working correctly by typing the following command:" echo "it is working correctly by typing the following command:"
echo echo
echo "python -m simtk.testInstallation" echo "python -m openmm.testInstallation"
else else
echo echo
echo "INSTALLATION FAILED" echo "INSTALLATION FAILED"
......
...@@ -20,11 +20,11 @@ Representation and Manipulation ...@@ -20,11 +20,11 @@ Representation and Manipulation
:toctree: generated/ :toctree: generated/
:template: class.rst :template: class.rst
~simtk.openmm.app.topology.Topology ~openmm.app.topology.Topology
~simtk.openmm.app.topology.Chain ~openmm.app.topology.Chain
~simtk.openmm.app.topology.Residue ~openmm.app.topology.Residue
~simtk.openmm.app.topology.Atom ~openmm.app.topology.Atom
~simtk.openmm.app.modeller.Modeller ~openmm.app.modeller.Modeller
Simulation Simulation
~~~~~~~~~~ ~~~~~~~~~~
...@@ -32,8 +32,8 @@ Simulation ...@@ -32,8 +32,8 @@ Simulation
:toctree: generated/ :toctree: generated/
:template: class.rst :template: class.rst
~simtk.openmm.app.forcefield.ForceField ~openmm.app.forcefield.ForceField
~simtk.openmm.app.simulation.Simulation ~openmm.app.simulation.Simulation
Reporting Output Reporting Output
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import sys import sys
import os import os
import simtk.openmm.version import openmm.version
extensions = ['sphinx.ext.mathjax', 'sphinx.ext.ifconfig', 'sphinx.ext.autosummary', extensions = ['sphinx.ext.mathjax', 'sphinx.ext.ifconfig', 'sphinx.ext.autosummary',
'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'process-docstring', 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'process-docstring',
...@@ -18,8 +18,8 @@ master_doc = 'index' ...@@ -18,8 +18,8 @@ master_doc = 'index'
project = u'OpenMM' project = u'OpenMM'
copyright = u'2015, Stanford University and the Authors' copyright = u'2015, Stanford University and the Authors'
version = simtk.openmm.version.short_version version = openmm.version.short_version
release = simtk.openmm.version.full_version release = openmm.version.full_version
exclude_patterns = ['_build', '_templates'] exclude_patterns = ['_build', '_templates']
html_static_path = ['_static'] html_static_path = ['_static']
......
.. currentmodule:: simtk.openmm.openmm .. currentmodule:: openmm.openmm
OpenMM Python API OpenMM Python API
================= =================
......
...@@ -11,10 +11,10 @@ Core Objects ...@@ -11,10 +11,10 @@ Core Objects
:template: class.rst :template: class.rst
:nosignatures: :nosignatures:
~simtk.openmm.openmm.System ~openmm.openmm.System
~simtk.openmm.openmm.Context ~openmm.openmm.Context
~simtk.openmm.openmm.Platform ~openmm.openmm.Platform
~simtk.openmm.openmm.State ~openmm.openmm.State
Forces Forces
......
...@@ -8,8 +8,8 @@ from glob import glob ...@@ -8,8 +8,8 @@ from glob import glob
import inspect import inspect
import jinja2 import jinja2
import simtk.openmm import openmm
import simtk.openmm.app import openmm.app
...@@ -21,7 +21,7 @@ def library_template_variables(): ...@@ -21,7 +21,7 @@ def library_template_variables():
"""Create the data structure available to the Jinja2 renderer when """Create the data structure available to the Jinja2 renderer when
filling in the templates. filling in the templates.
This function extracts all of classes in ``simtk.openmm.openmm`` and returns This function extracts all of classes in ``openmm.openmm`` and returns
a dictionary with them grouped into three lists, the integrators, the forces, a dictionary with them grouped into three lists, the integrators, the forces,
and the remainder (library_extras). and the remainder (library_extras).
...@@ -35,31 +35,31 @@ def library_template_variables(): ...@@ -35,31 +35,31 @@ def library_template_variables():
'units': [], 'units': [],
} }
mm_klasses = inspect.getmembers(simtk.openmm, predicate=inspect.isclass) mm_klasses = inspect.getmembers(openmm, predicate=inspect.isclass)
# gather all Force subclasses # gather all Force subclasses
for name, klass in mm_klasses: for name, klass in mm_klasses:
if issubclass(klass, simtk.openmm.openmm.Force): if issubclass(klass, openmm.openmm.Force):
data['forces'].append(fullname(klass)) data['forces'].append(fullname(klass))
# gather all Integrator subclasses # gather all Integrator subclasses
for _, klass in mm_klasses: for _, klass in mm_klasses:
if issubclass(klass, simtk.openmm.openmm.Integrator): if issubclass(klass, openmm.openmm.Integrator):
data['integrators'].append(fullname(klass)) data['integrators'].append(fullname(klass))
# gather all extra subclasses in simtk.openmm.openmm # gather all extra subclasses in openmm.openmm
# core classes that are already included in library.rst.jinja2 # core classes that are already included in library.rst.jinja2
exclude = ['simtk.openmm.openmm.Platform', 'simtk.openmm.openmm.Context', exclude = ['openmm.openmm.Platform', 'openmm.openmm.Context',
'simtk.openmm.openmm.System', 'simtk.openmm.openmm.State'] 'openmm.openmm.System', 'openmm.openmm.State']
exclude.extend(data['forces']) exclude.extend(data['forces'])
exclude.extend(data['integrators']) exclude.extend(data['integrators'])
# these classes are useless and not worth documenting. # these classes are useless and not worth documenting.
exclude.extend([ exclude.extend([
'simtk.openmm.openmm.SwigPyIterator', 'openmm.openmm.SwigPyIterator',
'simtk.openmm.openmm.OpenMMException']) 'openmm.openmm.OpenMMException'])
for _, klass in mm_klasses: for _, klass in mm_klasses:
full = fullname(klass) full = fullname(klass)
...@@ -67,7 +67,7 @@ def library_template_variables(): ...@@ -67,7 +67,7 @@ def library_template_variables():
data['library_extras'].append(full) data['library_extras'].append(full)
# gather units related classes # gather units related classes
unit_klasses = inspect.getmembers(simtk.unit, predicate=inspect.isclass) unit_klasses = inspect.getmembers(openmm.unit, predicate=inspect.isclass)
for name, klass in unit_klasses: for name, klass in unit_klasses:
data['units'].append(fullname(klass)) data['units'].append(fullname(klass))
...@@ -78,7 +78,7 @@ def app_template_variables(): ...@@ -78,7 +78,7 @@ def app_template_variables():
"""Create the data structure available to the Jinja2 renderer when """Create the data structure available to the Jinja2 renderer when
filling in the templates. filling in the templates.
This function extracts all of classes in ``simtk.openmm.app`` and returns This function extracts all of classes in ``openmm.app`` and returns
a dictionary with them grouped into three lists, the reporters, the a dictionary with them grouped into three lists, the reporters, the
classes with the word "File" in the name, and the remainder. classes with the word "File" in the name, and the remainder.
...@@ -90,7 +90,7 @@ def app_template_variables(): ...@@ -90,7 +90,7 @@ def app_template_variables():
'fileclasses': [], 'fileclasses': [],
'app_extras': [], 'app_extras': [],
} }
app_klasses = inspect.getmembers(simtk.openmm.app, predicate=inspect.isclass) app_klasses = inspect.getmembers(openmm.app, predicate=inspect.isclass)
# gather all Reporters # gather all Reporters
for name, klass in app_klasses: for name, klass in app_klasses:
...@@ -102,14 +102,14 @@ def app_template_variables(): ...@@ -102,14 +102,14 @@ def app_template_variables():
if 'File' in name or 'CharmmParameterSet' in name: if 'File' in name or 'CharmmParameterSet' in name:
data['fileclasses'].append(fullname(klass)) data['fileclasses'].append(fullname(klass))
# gather all extra subclasses in simtk.openmm.app # gather all extra subclasses in openmm.app
exclude = ['simtk.openmm.app.topology.Topology', exclude = ['openmm.app.topology.Topology',
'simtk.openmm.app.topology.Chain', 'openmm.app.topology.Chain',
'simtk.openmm.app.topology.Residue', 'openmm.app.topology.Residue',
'simtk.openmm.app.topology.Atom', 'openmm.app.topology.Atom',
'simtk.openmm.app.modeller.Modeller', 'openmm.app.modeller.Modeller',
'simtk.openmm.app.forcefield.ForceField', 'openmm.app.forcefield.ForceField',
'simtk.openmm.app.simulation.Simulation'] 'openmm.app.simulation.Simulation']
exclude.extend(data['reporters']) exclude.extend(data['reporters'])
exclude.extend(data['fileclasses']) exclude.extend(data['fileclasses'])
......
...@@ -126,7 +126,7 @@ freely, subject to the following restrictions: ...@@ -126,7 +126,7 @@ freely, subject to the following restrictions:
OpenMM uses the PDBx/mmCIF parser written by John Westbrook. It is distributed OpenMM uses the PDBx/mmCIF parser written by John Westbrook. It is distributed
under the Creative Commons Attribution 3.0 Unported license. For details, see under the Creative Commons Attribution 3.0 Unported license. For details, see
https://creativecommons.org/licenses/by/3.0. This library was modified to move https://creativecommons.org/licenses/by/3.0. This library was modified to move
it inside the simtk.openmm.app.internal module. it inside the openmm.app.internal module.
7. irrXML 7. irrXML
......
...@@ -95,7 +95,7 @@ CUDA version it was compiled with. ...@@ -95,7 +95,7 @@ CUDA version it was compiled with.
4. Verify your installation by typing the following command: 4. Verify your installation by typing the following command:
:: ::
python -m simtk.testInstallation python -m openmm.testInstallation
This command confirms that OpenMM is installed, checks whether GPU acceleration This command confirms that OpenMM is installed, checks whether GPU acceleration
is available (via the OpenCL and/or CUDA platforms), and verifies that all is available (via the OpenCL and/or CUDA platforms), and verifies that all
...@@ -121,9 +121,9 @@ steps. ...@@ -121,9 +121,9 @@ steps.
.. samepage:: .. samepage::
:: ::
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout from sys import stdout
pdb = PDBFile('input.pdb') pdb = PDBFile('input.pdb')
...@@ -164,9 +164,9 @@ You can name your own scripts whatever you want. Let’s go through the script ...@@ -164,9 +164,9 @@ You can name your own scripts whatever you want. Let’s go through the script
by line and see how it works. by line and see how it works.
:: ::
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout from sys import stdout
These lines are just telling the Python interpreter about some libraries we will These lines are just telling the Python interpreter about some libraries we will
...@@ -299,9 +299,9 @@ found in OpenMM’s :file:`examples` folder with the name :file:`simulateAmber.p ...@@ -299,9 +299,9 @@ found in OpenMM’s :file:`examples` folder with the name :file:`simulateAmber.p
.. samepage:: .. samepage::
:: ::
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout from sys import stdout
prmtop = AmberPrmtopFile('input.prmtop') prmtop = AmberPrmtopFile('input.prmtop')
...@@ -392,9 +392,9 @@ with the name :file:`simulateGromacs.py`. ...@@ -392,9 +392,9 @@ with the name :file:`simulateGromacs.py`.
.. samepage:: .. samepage::
:: ::
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout from sys import stdout
gro = GromacsGroFile('input.gro') gro = GromacsGroFile('input.gro')
...@@ -456,9 +456,9 @@ on the :class:`CharmmPsfFile`. ...@@ -456,9 +456,9 @@ on the :class:`CharmmPsfFile`.
.. samepage:: .. samepage::
:: ::
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout, exit, stderr from sys import stdout, exit, stderr
psf = CharmmPsfFile('input.psf') psf = CharmmPsfFile('input.psf')
...@@ -824,7 +824,7 @@ Field Initiative small molecule force fields using the following example: ...@@ -824,7 +824,7 @@ Field Initiative small molecule force fields using the following example:
from openmmforcefields.generators import SMIRNOFFTemplateGenerator from openmmforcefields.generators import SMIRNOFFTemplateGenerator
smirnoff = SMIRNOFFTemplateGenerator(molecules=molecule) smirnoff = SMIRNOFFTemplateGenerator(molecules=molecule)
# Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions # Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions
from simtk.openmm.app import ForceField from openmm.app import ForceField
forcefield = ForceField('amber/protein.ff14SB.xml', 'amber/tip3p_standard.xml', 'amber/tip3p_HFE_multivalent.xml') forcefield = ForceField('amber/protein.ff14SB.xml', 'amber/tip3p_standard.xml', 'amber/tip3p_HFE_multivalent.xml')
# Register the SMIRNOFF template generator # Register the SMIRNOFF template generator
forcefield.registerTemplateGenerator(smirnoff.generator) forcefield.registerTemplateGenerator(smirnoff.generator)
...@@ -840,14 +840,14 @@ Alternatively, you can use the older `AMBER GAFF small molecule force field <htt ...@@ -840,14 +840,14 @@ Alternatively, you can use the older `AMBER GAFF small molecule force field <htt
from openmmforcefields.generators import GAFFTemplateGenerator from openmmforcefields.generators import GAFFTemplateGenerator
gaff = GAFFTemplateGenerator(molecules=molecule) gaff = GAFFTemplateGenerator(molecules=molecule)
# Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions # Create an OpenMM ForceField object with AMBER ff14SB and TIP3P with compatible ions
from simtk.openmm.app import ForceField from openmm.app import ForceField
forcefield = ForceField('amber/protein.ff14SB.xml', 'amber/tip3p_standard.xml', 'amber/tip3p_HFE_multivalent.xml') forcefield = ForceField('amber/protein.ff14SB.xml', 'amber/tip3p_standard.xml', 'amber/tip3p_HFE_multivalent.xml')
# Register the GAFF template generator # Register the GAFF template generator
forcefield.registerTemplateGenerator(gaff.generator) forcefield.registerTemplateGenerator(gaff.generator)
# You can now parameterize an OpenMM Topology object that contains the specified molecule. # You can now parameterize an OpenMM Topology object that contains the specified molecule.
# forcefield will load the appropriate GAFF parameters when needed, and antechamber # forcefield will load the appropriate GAFF parameters when needed, and antechamber
# will be used to generate small molecule parameters on the fly. # will be used to generate small molecule parameters on the fly.
from simtk.openmm.app import PDBFile from openmm.app import PDBFile
pdbfile = PDBFile('t4-lysozyme-L99A-with-benzene.pdb') pdbfile = PDBFile('t4-lysozyme-L99A-with-benzene.pdb')
system = forcefield.createSystem(pdbfile.topology) system = forcefield.createSystem(pdbfile.topology)
...@@ -864,8 +864,8 @@ small molecule force field you want to use: ...@@ -864,8 +864,8 @@ small molecule force field you want to use:
:: ::
# Define the keyword arguments to feed to ForceField # Define the keyword arguments to feed to ForceField
from simtk import unit from openmm import unit
from simtk.openmm import app from openmm import app
forcefield_kwargs = { 'constraints' : app.HBonds, 'rigidWater' : True, 'removeCMMotion' : False, 'hydrogenMass' : 4*unit.amu } forcefield_kwargs = { 'constraints' : app.HBonds, 'rigidWater' : True, 'removeCMMotion' : False, 'hydrogenMass' : 4*unit.amu }
# Initialize a SystemGenerator using the Open Force Field Initiative 1.2.0 force field (openff-1.2.0) # Initialize a SystemGenerator using the Open Force Field Initiative 1.2.0 force field (openff-1.2.0)
from openmmforcefields.generators import SystemGenerator from openmmforcefields.generators import SystemGenerator
...@@ -1787,9 +1787,9 @@ PDB file. ...@@ -1787,9 +1787,9 @@ PDB file.
.. samepage:: .. samepage::
:: ::
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
print('Loading...') print('Loading...')
pdb = PDBFile('input.pdb') pdb = PDBFile('input.pdb')
...@@ -3261,9 +3261,9 @@ This :code:`generator` function must conform to the following API: ...@@ -3261,9 +3261,9 @@ This :code:`generator` function must conform to the following API:
""" """
Parameters Parameters
---------- ----------
forcefield : simtk.openmm.app.ForceField forcefield : openmm.app.ForceField
The ForceField object to which residue templates and/or parameters are to be added. The ForceField object to which residue templates and/or parameters are to be added.
residue : simtk.openmm.app.Topology.Residue residue : openmm.app.Topology.Residue
The residue topology for which a template is to be generated. The residue topology for which a template is to be generated.
Returns Returns
......
...@@ -2598,14 +2598,14 @@ is set with the :code:`LD_LIBRARY_PATH` environment variable on Linux, ...@@ -2598,14 +2598,14 @@ is set with the :code:`LD_LIBRARY_PATH` environment variable on Linux,
:code:`DYLD_LIBRARY_PATH` on Mac, or :code:`PATH` on Windows. See :code:`DYLD_LIBRARY_PATH` on Mac, or :code:`PATH` on Windows. See
Chapter :ref:`installing-openmm` for details. Chapter :ref:`installing-openmm` for details.
The Python API is contained in the simtk.openmm package, while the units code is The Python API is contained in the openmm package, while the units code is
contained in the simtk.units package. (The application layer, described in the contained in the openmm.units package. (The application layer, described in the
Application Guide, is contained in the simtk.openmm.app package.) A program Application Guide, is contained in the openmm.app package.) A program
using it will therefore typically begin using it will therefore typically begin
:: ::
import simtk.openmm as mm import openmm as mm
import simtk.unit as unit import openmm.unit as unit
Creating and using OpenMM objects is then done exactly as in C++: Creating and using OpenMM objects is then done exactly as in C++:
:: ::
...@@ -2675,7 +2675,7 @@ quantity is “0.63 kilograms”. A Quantity is expressed as a combination of a ...@@ -2675,7 +2675,7 @@ quantity is “0.63 kilograms”. A Quantity is expressed as a combination of a
value (e.g., 0.63), and a Unit (e.g., kilogram). The same Quantity can be value (e.g., 0.63), and a Unit (e.g., kilogram). The same Quantity can be
expressed in different Units. expressed in different Units.
The set of BaseDimensions defined in the simtk.unit module includes: The set of BaseDimensions defined in the openmm.unit module includes:
* mass * mass
* length * length
...@@ -2687,8 +2687,8 @@ The set of BaseDimensions defined in the simtk.unit module includes: ...@@ -2687,8 +2687,8 @@ The set of BaseDimensions defined in the simtk.unit module includes:
These are not precisely the same list of base dimensions used in the SI unit These are not precisely the same list of base dimensions used in the SI unit
system. SI defines “current” (charge per time) as a base unit, while simtk.unit system. SI defines “current” (charge per time) as a base unit, while openmm.unit
uses “charge”. And simtk.unit treats angle as a dimension, even though angle uses “charge”. And openmm.unit treats angle as a dimension, even though angle
quantities are often considered dimensionless. In this case, we choose to err quantities are often considered dimensionless. In this case, we choose to err
on the side of explicitness, particularly because interconversion of degrees and on the side of explicitness, particularly because interconversion of degrees and
radians is a frequent source of unit headaches. radians is a frequent source of unit headaches.
...@@ -2696,16 +2696,16 @@ radians is a frequent source of unit headaches. ...@@ -2696,16 +2696,16 @@ radians is a frequent source of unit headaches.
Units examples Units examples
-------------- --------------
Many common units are defined in the simtk.unit module. Many common units are defined in the openmm.unit module.
:: ::
from simtk.unit import nanometer, angstrom, dalton from openmm.unit import nanometer, angstrom, dalton
Sometimes you don’t want to type the full unit name every time, so you can Sometimes you don’t want to type the full unit name every time, so you can
assign it a shorter name using the :code:`as` functionality: assign it a shorter name using the :code:`as` functionality:
:: ::
from simtk.unit import nanometer as nm from openmm.unit import nanometer as nm
New quantities can be created from a value and a unit. You can use either the New quantities can be created from a value and a unit. You can use either the
multiply operator (‘*’) or the explicit Quantity constructor: multiply operator (‘*’) or the explicit Quantity constructor:
...@@ -2743,7 +2743,7 @@ Multiplying or dividing two quantities creates a new quantity with a composite ...@@ -2743,7 +2743,7 @@ Multiplying or dividing two quantities creates a new quantity with a composite
dimension. For example, dividing a distance by a time results in a velocity. dimension. For example, dividing a distance by a time results in a velocity.
:: ::
from simtk.unit import kilogram, meter, second from openmm.unit import kilogram, meter, second
a = 9.8 * meter / second**2; # acceleration a = 9.8 * meter / second**2; # acceleration
m = 0.36 * kilogram; # mass m = 0.36 * kilogram; # mass
F = m * a; # force in kg*m/s**2:: F = m * a; # force in kg*m/s**2::
...@@ -2754,13 +2754,13 @@ Multiplication or division of two Units results in a composite Unit. ...@@ -2754,13 +2754,13 @@ Multiplication or division of two Units results in a composite Unit.
mps = meter / second mps = meter / second
Unlike amount (moles), angle (radians) is arguably dimensionless.  But simtk.unit Unlike amount (moles), angle (radians) is arguably dimensionless.  But openmm.unit
treats angle as another dimension.   Use the trigonometric functions from the treats angle as another dimension.   Use the trigonometric functions from the
simtk.unit module (not those from the Python math module!) when dealing with openmm.unit module (not those from the Python math module!) when dealing with
Units and Quantities. Units and Quantities.
:: ::
from simtk.unit import sin, cos, acos from openmm.unit import sin, cos, acos
x = sin(90.0*degrees) x = sin(90.0*degrees)
angle = acos(0.68); # returns an angle quantity (in radians) angle = acos(0.68); # returns an angle quantity (in radians)
...@@ -2776,10 +2776,10 @@ Quantities and Units. ...@@ -2776,10 +2776,10 @@ Quantities and Units.
The method :code:`sqrt()` is not as built-in as :code:`pow()`\ . Do not The method :code:`sqrt()` is not as built-in as :code:`pow()`\ . Do not
use the Python :code:`math.sqrt()` method with Units and Quantities. Use use the Python :code:`math.sqrt()` method with Units and Quantities. Use
the :code:`simtk.unit.sqrt()` method instead: the :code:`openmm.unit.sqrt()` method instead:
:: ::
from simtk.unit import sqrt from openmm.unit import sqrt
side_length = sqrt(4.0*meter**2) side_length = sqrt(4.0*meter**2)
...@@ -2787,7 +2787,7 @@ Atomic scale mass and energy units are “per amount” ...@@ -2787,7 +2787,7 @@ Atomic scale mass and energy units are “per amount”
--------------------------------------------------- ---------------------------------------------------
Mass and energy units at the atomic scale are specified “per amount” in the Mass and energy units at the atomic scale are specified “per amount” in the
simtk.unit module. Amount (mole) is one of the seven fundamental dimensions in openmm.unit module. Amount (mole) is one of the seven fundamental dimensions in
the SI unit system.   The atomic scale mass unit, dalton, is defined as grams the SI unit system.   The atomic scale mass unit, dalton, is defined as grams
per mole. The dimension of dalton is therefore mass/amount, instead of simply per mole. The dimension of dalton is therefore mass/amount, instead of simply
mass. Similarly, the atomic scale energy unit, kilojoule_per_mole (and mass. Similarly, the atomic scale energy unit, kilojoule_per_mole (and
...@@ -2812,11 +2812,11 @@ SI prefixes ...@@ -2812,11 +2812,11 @@ SI prefixes
----------- -----------
Many units with SI prefixes such as “milligram” (milli) and “kilometer” (kilo) Many units with SI prefixes such as “milligram” (milli) and “kilometer” (kilo)
are provided in the simtk.unit module. Others can be created by multiplying a are provided in the openmm.unit module. Others can be created by multiplying a
prefix symbol by a non-prefixed unit: prefix symbol by a non-prefixed unit:
:: ::
from simtk.unit import mega, kelvin from openmm.unit import mega, kelvin
megakelvin = mega * kelvin megakelvin = mega * kelvin
t = 8.3 * megakelvin t = 8.3 * megakelvin
...@@ -2831,13 +2831,13 @@ Use the :code:`Quantity.in_units_of()` method to create a new Quantity with ...@@ -2831,13 +2831,13 @@ Use the :code:`Quantity.in_units_of()` method to create a new Quantity with
different units. different units.
:: ::
from simtk.unit import nanosecond, fortnight from openmm.unit import nanosecond, fortnight
x = (175000*nanosecond).in_units_of(fortnight) x = (175000*nanosecond).in_units_of(fortnight)
When you want a plain number out of a Quantity, use the :code:`value_in_unit()` method: When you want a plain number out of a Quantity, use the :code:`value_in_unit()` method:
:: ::
from simtk.unit import femtosecond, picosecond from openmm.unit import femtosecond, picosecond
t = 5.0*femtosecond t = 5.0*femtosecond
t_just_a_number = t.value_in_unit(picoseconds) t_just_a_number = t.value_in_unit(picoseconds)
...@@ -2850,7 +2850,7 @@ Lists, tuples, vectors, numpy arrays, and Units ...@@ -2850,7 +2850,7 @@ Lists, tuples, vectors, numpy arrays, and Units
----------------------------------------------- -----------------------------------------------
Units can be attached to containers of numbers to create a vector quantity. The Units can be attached to containers of numbers to create a vector quantity. The
simtk.unit module overloads the :code:`__setitem__` and openmm.unit module overloads the :code:`__setitem__` and
:code:`__getitem__` methods for these containers to ensure that Quantities go :code:`__getitem__` methods for these containers to ensure that Quantities go
in and out. in and out.
:: ::
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# J. Chem. Phys. 129:124105 (2008) http://dx.doi.org/10.1063/1.2978177 # J. Chem. Phys. 129:124105 (2008) http://dx.doi.org/10.1063/1.2978177
from __future__ import print_function from __future__ import print_function
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
import numpy import numpy
# ============================================================================= # =============================================================================
......
from __future__ import print_function from __future__ import print_function
import simtk.openmm.app as app import openmm.app as app
import simtk.openmm as mm import openmm as mm
import simtk.unit as unit import openmm.unit as unit
import sys import sys
from datetime import datetime from datetime import datetime
import os import os
......
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout from sys import stdout
prmtop = AmberPrmtopFile('input.prmtop') prmtop = AmberPrmtopFile('input.prmtop')
......
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout, exit, stderr from sys import stdout, exit, stderr
# Read the PSF # Read the PSF
......
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout from sys import stdout
gro = GromacsGroFile('input.gro') gro = GromacsGroFile('input.gro')
......
from simtk.openmm.app import * from openmm.app import *
from simtk.openmm import * from openmm import *
from simtk.unit import * from openmm.unit import *
from sys import stdout from sys import stdout
pdb = PDBFile('input.pdb') pdb = PDBFile('input.pdb')
......
...@@ -8,6 +8,7 @@ set(OPENMM_PYTHON_STAGING_DIR "${CMAKE_BINARY_DIR}/python" ...@@ -8,6 +8,7 @@ set(OPENMM_PYTHON_STAGING_DIR "${CMAKE_BINARY_DIR}/python"
mark_as_advanced(OPENMM_PYTHON_STAGING_DIR) mark_as_advanced(OPENMM_PYTHON_STAGING_DIR)
# Create package directory structure # Create package directory structure
file(MAKE_DIRECTORY ${OPENMM_PYTHON_STAGING_DIR}/openmm)
file(MAKE_DIRECTORY ${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm) file(MAKE_DIRECTORY ${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm)
file(MAKE_DIRECTORY ${OPENMM_PYTHON_STAGING_DIR}/simtk/unit) file(MAKE_DIRECTORY ${OPENMM_PYTHON_STAGING_DIR}/simtk/unit)
file(MAKE_DIRECTORY ${OPENMM_PYTHON_STAGING_DIR}/src/swig_doxygen/swig_lib/python) file(MAKE_DIRECTORY ${OPENMM_PYTHON_STAGING_DIR}/src/swig_doxygen/swig_lib/python)
...@@ -37,14 +38,14 @@ execute_process( ...@@ -37,14 +38,14 @@ execute_process(
if(NOT rev_hash_str) if(NOT rev_hash_str)
set(rev_hash_str "Unknown") set(rev_hash_str "Unknown")
endif() endif()
file(WRITE "${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm/version.py" "git_revision = '${rev_hash_str}'\n") file(WRITE "${OPENMM_PYTHON_STAGING_DIR}/openmm/version.py" "git_revision = '${rev_hash_str}'\n")
# file(GLOB_RECURSE temp RELATIVE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/src/*.i") # file(GLOB_RECURSE temp RELATIVE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/src/*.i")
# foreach(f ${temp}) # foreach(f ${temp})
# set(temp2 "${temp2}\n${f}") # set(temp2 "${temp2}\n${f}")
# endforeach() # endforeach()
set(SUBDIRS src simtk tests) set(SUBDIRS src openmm simtk tests)
foreach(SUBDIR ${SUBDIRS}) foreach(SUBDIR ${SUBDIRS})
file(GLOB_RECURSE STAGING_INPUT_FILES1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" file(GLOB_RECURSE STAGING_INPUT_FILES1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*README.txt" "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*README.txt"
...@@ -189,10 +190,10 @@ INSTALL_FILES(/include/swig FILES "${SWIG_OPENMM_DIR}/OpenMMSwigHeaders.i" "${SW ...@@ -189,10 +190,10 @@ INSTALL_FILES(/include/swig FILES "${SWIG_OPENMM_DIR}/OpenMMSwigHeaders.i" "${SW
# Run swig # Run swig
add_custom_command( add_custom_command(
OUTPUT "${SWIG_OPENMM_DIR}/OpenMMSwig.cxx" "${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm/openmm.py" OUTPUT "${SWIG_OPENMM_DIR}/OpenMMSwig.cxx" "${OPENMM_PYTHON_STAGING_DIR}/openmm/openmm.py"
COMMAND ${SWIG_EXECUTABLE} COMMAND ${SWIG_EXECUTABLE}
-python -c++ -python -c++
-outdir "${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm" -outdir "${OPENMM_PYTHON_STAGING_DIR}/openmm"
-o OpenMMSwig.cxx -o OpenMMSwig.cxx
OpenMM.i OpenMM.i
WORKING_DIRECTORY "${SWIG_OPENMM_DIR}" WORKING_DIRECTORY "${SWIG_OPENMM_DIR}"
...@@ -204,11 +205,11 @@ add_custom_command( ...@@ -204,11 +205,11 @@ add_custom_command(
) )
add_custom_target(RunSwig DEPENDS add_custom_target(RunSwig DEPENDS
"${SWIG_OPENMM_DIR}/OpenMMSwig.cxx" "${SWIG_OPENMM_DIR}/OpenMMSwig.cxx"
"${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm/openmm.py") "${OPENMM_PYTHON_STAGING_DIR}/openmm/openmm.py")
set (STAGING_OUTPUT_FILES ${STAGING_OUTPUT_FILES} set (STAGING_OUTPUT_FILES ${STAGING_OUTPUT_FILES}
"${OPENMM_PYTHON_STAGING_DIR}/src/swig_doxygen/OpenMMSwig.cxx" "${OPENMM_PYTHON_STAGING_DIR}/src/swig_doxygen/OpenMMSwig.cxx"
"${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm/openmm.py") "${OPENMM_PYTHON_STAGING_DIR}/openmm/openmm.py")
################################################################################################## ##################################################################################################
### Make a list of all folders containing include files the wrappers must be compiled against. ### ### Make a list of all folders containing include files the wrappers must be compiled against. ###
......
...@@ -3,7 +3,7 @@ include *.py ...@@ -3,7 +3,7 @@ include *.py
include *.txt include *.txt
global-include README global-include README
recursive-include simtk *.txt *.py recursive-include simtk *.txt *.py
recursive-include OpenMM *.txt *.py *.so *.dll *.lib *.dylib *.h recursive-include openmm *.txt *.py *.so *.dll *.lib *.dylib *.h
recursive-include src *.txt *.py *.i *.c *.cxx *.h *.sh Doxyfile recursive-include src *.txt *.py *.i *.c *.cxx *.h *.sh Doxyfile
prune src/swig_doxygen/doxygen/html prune src/swig_doxygen/doxygen/html
prune src/swig_doxygen/doxygen/xml prune src/swig_doxygen/doxygen/xml
......
"""OpenMM is a toolkit for molecular simulation. It can be used either as a
stand-alone application for running simulations, or as a library you call
from your own code. It provides a combination of extreme flexibility
(through custom forces and integrators), openness, and high performance
(especially on recent GPUs) that make it truly unique among simulation codes.
"""
from __future__ import absolute_import
__author__ = "Peter Eastman"
import os, os.path
import sys
from . import version
if sys.platform == 'win32':
_path = os.environ['PATH']
os.environ['PATH'] = '%(lib)s;%(lib)s\plugins;%(path)s' % {
'lib': version.openmm_library_path, 'path': _path}
from openmm.openmm import *
from openmm.vec3 import Vec3
from openmm.mtsintegrator import MTSIntegrator, MTSLangevinIntegrator
from openmm.amd import AMDIntegrator, AMDForceGroupIntegrator, DualAMDIntegrator
if os.getenv('OPENMM_PLUGIN_DIR') is None and os.path.isdir(version.openmm_library_path):
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(os.path.join(version.openmm_library_path, 'plugins'))
else:
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(Platform.getDefaultPluginsDirectory())
if sys.platform == 'win32':
os.environ['PATH'] = _path
del _path
__version__ = Platform.getOpenMMVersion()
class OpenMMException(Exception):
"""This is the class used for all exceptions thrown by the C++ library."""
pass
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