Skip to content

Commit

Permalink
Top level Python module is now "openmm" (openmm#3000)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
peastman authored Feb 1, 2021
1 parent eff1f26 commit e53bdc5
Show file tree
Hide file tree
Showing 183 changed files with 539 additions and 522 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ script:
else
make PythonInstall;
fi;
python -m simtk.testInstallation;
python -m openmm.testInstallation;
(cd python/tests && py.test -v);
fi

Expand Down
2 changes: 1 addition & 1 deletion devtools/ci/jenkins/install_and_test_cpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ python devtools/run-ctest.py --job-duration=120 --timeout 300 --in-order -R 'Tes

# Build & test Python
make PythonInstall
python -m simtk.testInstallation
python -m openmm.testInstallation
cd python/tests && py.test -v
2 changes: 1 addition & 1 deletion devtools/packaging/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ then
echo "Installation is complete. You should now test your installation to make sure"
echo "it is working correctly by typing the following command:"
echo
echo "python -m simtk.testInstallation"
echo "python -m openmm.testInstallation"
else
echo
echo "INSTALLATION FAILED"
Expand Down
14 changes: 7 additions & 7 deletions docs-source/api-python/app.rst.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ Representation and Manipulation
:toctree: generated/
:template: class.rst

~simtk.openmm.app.topology.Topology
~simtk.openmm.app.topology.Chain
~simtk.openmm.app.topology.Residue
~simtk.openmm.app.topology.Atom
~simtk.openmm.app.modeller.Modeller
~openmm.app.topology.Topology
~openmm.app.topology.Chain
~openmm.app.topology.Residue
~openmm.app.topology.Atom
~openmm.app.modeller.Modeller

Simulation
~~~~~~~~~~
.. autosummary::
:toctree: generated/
:template: class.rst

~simtk.openmm.app.forcefield.ForceField
~simtk.openmm.app.simulation.Simulation
~openmm.app.forcefield.ForceField
~openmm.app.simulation.Simulation


Reporting Output
Expand Down
6 changes: 3 additions & 3 deletions docs-source/api-python/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys
import os
import simtk.openmm.version
import openmm.version

extensions = ['sphinx.ext.mathjax', 'sphinx.ext.ifconfig', 'sphinx.ext.autosummary',
'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'process-docstring',
Expand All @@ -18,8 +18,8 @@
project = u'OpenMM'
copyright = u'2015, Stanford University and the Authors'

version = simtk.openmm.version.short_version
release = simtk.openmm.version.full_version
version = openmm.version.short_version
release = openmm.version.full_version

exclude_patterns = ['_build', '_templates']
html_static_path = ['_static']
Expand Down
2 changes: 1 addition & 1 deletion docs-source/api-python/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. currentmodule:: simtk.openmm.openmm
.. currentmodule:: openmm.openmm

OpenMM Python API
=================
Expand Down
8 changes: 4 additions & 4 deletions docs-source/api-python/library.rst.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Core Objects
:template: class.rst
:nosignatures:

~simtk.openmm.openmm.System
~simtk.openmm.openmm.Context
~simtk.openmm.openmm.Platform
~simtk.openmm.openmm.State
~openmm.openmm.System
~openmm.openmm.Context
~openmm.openmm.Platform
~openmm.openmm.State


Forces
Expand Down
44 changes: 22 additions & 22 deletions docs-source/api-python/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import inspect

import jinja2
import simtk.openmm
import simtk.openmm.app
import openmm
import openmm.app



Expand All @@ -21,7 +21,7 @@ def library_template_variables():
"""Create the data structure available to the Jinja2 renderer when
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,
and the remainder (library_extras).
Expand All @@ -35,39 +35,39 @@ def library_template_variables():
'units': [],
}

mm_klasses = inspect.getmembers(simtk.openmm, predicate=inspect.isclass)
mm_klasses = inspect.getmembers(openmm, predicate=inspect.isclass)


# gather all Force subclasses
for name, klass in mm_klasses:
if issubclass(klass, simtk.openmm.openmm.Force):
if issubclass(klass, openmm.openmm.Force):
data['forces'].append(fullname(klass))

# gather all Integrator subclasses
for _, klass in mm_klasses:
if issubclass(klass, simtk.openmm.openmm.Integrator):
if issubclass(klass, openmm.openmm.Integrator):
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
exclude = ['simtk.openmm.openmm.Platform', 'simtk.openmm.openmm.Context',
'simtk.openmm.openmm.System', 'simtk.openmm.openmm.State']
exclude = ['openmm.openmm.Platform', 'openmm.openmm.Context',
'openmm.openmm.System', 'openmm.openmm.State']
exclude.extend(data['forces'])
exclude.extend(data['integrators'])

# these classes are useless and not worth documenting.
exclude.extend([
'simtk.openmm.openmm.SwigPyIterator',
'simtk.openmm.openmm.OpenMMException'])
'openmm.openmm.SwigPyIterator',
'openmm.openmm.OpenMMException'])

for _, klass in mm_klasses:
full = fullname(klass)
if full not in exclude and not klass.__name__[0].islower():
data['library_extras'].append(full)

# 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:
data['units'].append(fullname(klass))

Expand All @@ -78,7 +78,7 @@ def app_template_variables():
"""Create the data structure available to the Jinja2 renderer when
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
classes with the word "File" in the name, and the remainder.
Expand All @@ -90,7 +90,7 @@ def app_template_variables():
'fileclasses': [],
'app_extras': [],
}
app_klasses = inspect.getmembers(simtk.openmm.app, predicate=inspect.isclass)
app_klasses = inspect.getmembers(openmm.app, predicate=inspect.isclass)

# gather all Reporters
for name, klass in app_klasses:
Expand All @@ -102,14 +102,14 @@ def app_template_variables():
if 'File' in name or 'CharmmParameterSet' in name:
data['fileclasses'].append(fullname(klass))

# gather all extra subclasses in simtk.openmm.app
exclude = ['simtk.openmm.app.topology.Topology',
'simtk.openmm.app.topology.Chain',
'simtk.openmm.app.topology.Residue',
'simtk.openmm.app.topology.Atom',
'simtk.openmm.app.modeller.Modeller',
'simtk.openmm.app.forcefield.ForceField',
'simtk.openmm.app.simulation.Simulation']
# gather all extra subclasses in openmm.app
exclude = ['openmm.app.topology.Topology',
'openmm.app.topology.Chain',
'openmm.app.topology.Residue',
'openmm.app.topology.Atom',
'openmm.app.modeller.Modeller',
'openmm.app.forcefield.ForceField',
'openmm.app.simulation.Simulation']
exclude.extend(data['reporters'])
exclude.extend(data['fileclasses'])

Expand Down
2 changes: 1 addition & 1 deletion docs-source/licenses/Licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ freely, subject to the following restrictions:
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
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
Expand Down
52 changes: 26 additions & 26 deletions docs-source/usersguide/application.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ CUDA version it was compiled with.
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
is available (via the OpenCL and/or CUDA platforms), and verifies that all
Expand All @@ -121,9 +121,9 @@ steps.
.. samepage::
::

from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout

pdb = PDBFile('input.pdb')
Expand Down Expand Up @@ -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.
::

from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout

These lines are just telling the Python interpreter about some libraries we will
Expand Down Expand Up @@ -299,9 +299,9 @@ found in OpenMM’s :file:`examples` folder with the name :file:`simulateAmber.p
.. samepage::
::

from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout

prmtop = AmberPrmtopFile('input.prmtop')
Expand Down Expand Up @@ -392,9 +392,9 @@ with the name :file:`simulateGromacs.py`.
.. samepage::
::

from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout

gro = GromacsGroFile('input.gro')
Expand Down Expand Up @@ -456,9 +456,9 @@ on the :class:`CharmmPsfFile`.
.. samepage::
::

from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout, exit, stderr

psf = CharmmPsfFile('input.psf')
Expand Down Expand Up @@ -824,7 +824,7 @@ Field Initiative small molecule force fields using the following example:
from openmmforcefields.generators import SMIRNOFFTemplateGenerator
smirnoff = SMIRNOFFTemplateGenerator(molecules=molecule)
# 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')
# Register the SMIRNOFF template generator
forcefield.registerTemplateGenerator(smirnoff.generator)
Expand All @@ -840,14 +840,14 @@ Alternatively, you can use the older `AMBER GAFF small molecule force field <htt
from openmmforcefields.generators import GAFFTemplateGenerator
gaff = GAFFTemplateGenerator(molecules=molecule)
# 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')
# Register the GAFF template generator
forcefield.registerTemplateGenerator(gaff.generator)
# You can now parameterize an OpenMM Topology object that contains the specified molecule.
# forcefield will load the appropriate GAFF parameters when needed, and antechamber
# 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')
system = forcefield.createSystem(pdbfile.topology)

Expand All @@ -864,8 +864,8 @@ small molecule force field you want to use:
::

# Define the keyword arguments to feed to ForceField
from simtk import unit
from simtk.openmm import app
from openmm import unit
from openmm import app
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)
from openmmforcefields.generators import SystemGenerator
Expand Down Expand Up @@ -1787,9 +1787,9 @@ PDB file.
.. samepage::
::

from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from openmm.app import *
from openmm import *
from openmm.unit import *

print('Loading...')
pdb = PDBFile('input.pdb')
Expand Down Expand Up @@ -3261,9 +3261,9 @@ This :code:`generator` function must conform to the following API:
"""
Parameters
----------
forcefield : simtk.openmm.app.ForceField
forcefield : openmm.app.ForceField
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.

Returns
Expand Down
Loading

0 comments on commit e53bdc5

Please sign in to comment.