"platforms/reference/include/ReferenceNoseHooverChain.h" did not exist on "a783b996fc42d023ebfd17c5591508da01dde03a"
Commit e49bc83f authored by Peter Eastman's avatar Peter Eastman
Browse files

Renamed simtk.chem.openmm to simtk.openmm

parent 076f8d7b
......@@ -10,7 +10,7 @@ set(OPENMM_PYTHON_STAGING_DIR "${CMAKE_BINARY_DIR}/python"
mark_as_advanced(OPENMM_PYTHON_STAGING_DIR)
# Create package directory structure
file(MAKE_DIRECTORY ${OPENMM_PYTHON_STAGING_DIR}/simtk/chem/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}/src/swig_doxygen/swig_lib/python)
......@@ -172,10 +172,10 @@ if(OPENMM_PYTHON_BUILD_SWIG)
# Run swig
add_custom_command(
OUTPUT "${SWIG_OPENMM_DIR}/OpenMMSwig.cxx" "${OPENMM_PYTHON_STAGING_DIR}/simtk/chem/openmm/openmm.py"
OUTPUT "${SWIG_OPENMM_DIR}/OpenMMSwig.cxx" "${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm/openmm.py"
COMMAND ${SWIG_EXECUTABLE}
-python -c++
-outdir "${OPENMM_PYTHON_STAGING_DIR}/simtk/chem/openmm"
-outdir "${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm"
-o OpenMMSwig.cxx
OpenMM.i
WORKING_DIRECTORY "${SWIG_OPENMM_DIR}"
......@@ -187,11 +187,11 @@ if(OPENMM_PYTHON_BUILD_SWIG)
)
add_custom_target(RunSwig DEPENDS
"${SWIG_OPENMM_DIR}/OpenMMSwig.cxx"
"${OPENMM_PYTHON_STAGING_DIR}/simtk/chem/openmm/openmm.py")
"${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm/openmm.py")
set (STAGING_OUTPUT_FILES ${STAGING_OUTPUT_FILES}
"${OPENMM_PYTHON_STAGING_DIR}/src/swig_doxygen/OpenMMSwig.cxx"
"${OPENMM_PYTHON_STAGING_DIR}/simtk/chem/openmm/openmm.py")
"${OPENMM_PYTHON_STAGING_DIR}/simtk/openmm/openmm.py")
else(OPENMM_PYTHON_BUILD_SWIG)
add_custom_target(RunSwig)
endif(OPENMM_PYTHON_BUILD_SWIG)
......
......@@ -51,7 +51,7 @@ def uninstall(verbose=True):
if item!='.' and item!=os.getcwd():
sys.path.append(item)
try:
import simtk.chem.openmm as openmm
import simtk.openmm as openmm
removePackage(openmm, verbose)
except ImportError:
pass
......@@ -81,13 +81,11 @@ def buildKeywordDictionary(major_version_num=MAJOR_VERSION_NUM,
setupKeywords["download_url"] = "https://simtk.org/home/openmm"
setupKeywords["packages"] = ["simtk",
"simtk.unit",
"simtk.chem",
"simtk.chem.openmm"]
"simtk.openmm"]
setupKeywords["data_files"] = []
setupKeywords["package_data"] = {"simtk" : [],
"simtk.unit" : [],
"simtk.chem" : [],
"simtk.chem.openmm" : []}
"simtk.openmm" : []}
setupKeywords["platforms"] = ["Linux", "Mac OS X", "Windows"]
setupKeywords["description"] = \
"Python wrapper for OpenMM (a C++ MD package)"
......@@ -123,13 +121,9 @@ def buildKeywordDictionary(major_version_num=MAJOR_VERSION_NUM,
if not openmm_lib_path:
reportError("Set OPENMM_LIB_PATH to point to the lib directory for OpenMM")
runtime_library_dirs=[]
extra_compile_args=[]
extra_link_args=[]
if platform.system() == "Windows":
libPrefix = ""
libExtList = ["dll", "lib"]
libExtPython = "pyd"
define_macros.append( ('WIN32', None) )
define_macros.append( ('_WINDOWS', None) )
define_macros.append( (' _MSC_VER', None) )
......@@ -141,21 +135,13 @@ def buildKeywordDictionary(major_version_num=MAJOR_VERSION_NUM,
os.environ['MACOSX_DEPLOYMENT_TARGET']='10.5'
extra_compile_args.append("-m32")
extra_link_args.append('-Wl,-rpath,@loader_path/OpenMM')
libPrefix = "lib"
libExtList = ["dylib"]
libExtPython = "so"
else:
runtime_library_dirs.append('$ORIGIN/OpenMM')
libPrefix = "lib"
libExtList = ["so"]
libExtPython = "so"
library_dirs=[openmm_lib_path]
include_dirs=openmm_include_path.split(';')
setupKeywords["ext_modules"] = [
Extension(name = "simtk.chem.openmm._openmm",
Extension(name = "simtk.openmm._openmm",
sources = ["src/swig_doxygen/OpenMMSwig.cxx"],
include_dirs = include_dirs,
define_macros = define_macros,
......
#
#
#
"""
Package simtk.openmm
This package wraps the simtk.openmm.openmm module.
When imported, it loads the swig module and then does some magic
to make the POSIX function "dlopen" work on Linux.
It also tries to load any plugin modules it can find.
"""
__author__ = "Randall J. Radmer"
__version__ = "1.0"
import os, sys, glob
if sys.platform == "win32":
libPrefix=""
libExt="dll"
elif sys.platform == 'darwin':
libPrefix="lib"
libExt="dylib"
else:
libPrefix="lib"
libExt="so"
# The following is an evil incantation that is needed to permit
# the POSIX "dlopen" function to work. I do not understand
# it. If a better solution is known, please forward to the
# PyOpenMM code maintainers.
import ctypes
flags = sys.getdlopenflags()
sys.setdlopenflags(flags | ctypes.RTLD_GLOBAL)
from simtk.openmm.openmm import Platform
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(Platform.getDefaultPluginsDirectory())
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
#!/bin/env python
"""
vec3.py: Used for managing vectors of lenght three.
"""
__author__ = "Christopher M. Bruns"
__version__ = "1.0"
import sys
import simtk.unit
class Vec3(object):
"""
Vec3 represents a three-dimensional point or displacement in space.
Examples
>>> v = Vec3((1, 2, 3))
>>> print v.dot(v)
14
>>> print abs(v)
3.74165738677
>>> v += Vec3((3,2,1))
>>> print v
[4, 4, 4]
>>> print v**2
48.0
>>> print v**1
6.92820323028
>>> print v
[4, 4, 4]
"""
def __init__(self, xyz):
"""
Create a new Vec3 object, specifying its three elements.
Examples:
>>> v = Vec3((1,2,3))
>>> print v
[1, 2, 3]
"""
x = xyz[0]
y = xyz[1]
z = xyz[2]
self.data = [x, y, z]
def __repr__(self):
"""
Create a string containing a python code representation of this Vec3.
Examples
>>> v = Vec3([1,2,3])
>>> v
Vec3([1, 2, 3])
"""
return self.__class__.__name__ + \
'([' + repr(self[0]) + ", " + repr(self[1]) + ", " + repr(self[2]) + '])'
def __len__(self):
"""
Returns the number of elements in this Vec3. Always 3.
Examples
>>> v = Vec3((1, 2, 3))
>>> len(v)
3
"""
return 3
def __iter__(self):
"""
Examples
>>> v = Vec3((1,2,3))
>>> for c in v:
... print c
...
1
2
3
"""
for coord in self.data:
yield coord
def __getitem__(self, key):
return self.data[key]
def __setitem__(self, key, value):
self.data[key] = value
def __abs__(self):
return pow(self.dot(self), 0.5)
def __neg__(self):
return self.__class__([-self[0], -self[1], -self[2]])
def __pos__(self):
return self
def __add__(self, other):
return self.__class__([self[0] + other[0], self[1] + other[1], self[2] + other[2]])
def __radd__(self, other):
return self.__class__([other[0] + self[0], other[1] + self[1], other[2] + self[2]])
def __sub__(self, other):
return self.__class__([self[0] - other[0], self[1] - other[1], self[2] - other[2]])
def __rsub__(self, other):
return self.__class__([other[0] - self[0], other[1] - self[1], other[2] - self[2]])
def __mul__(self, other):
"""
Returns NotImplemented if the right hand side is a simtk.unit.Unit,
so the Unit class can return a proper Quantity unit.
Example
>>> import simtk.unit
>>> Vec3([1,2,3]) * simtk.unit.meter
Quantity(Vec3([1, 2, 3]), meter)
"""
# If other is a Unit, delegate to Unit.__rmul__ multiplication
if simtk.unit.is_unit(other):
return NotImplemented
return self.__class__([self[0] * other, self[1] * other, self[2] * other])
def __rmul__(self, other):
return self.__class__([other * self[0], other * self[1], other * self[2]])
def __div__(self, other):
# If other is a Unit, delegate to Unit.__rmul__ multiplication
if simtk.unit.is_unit(other):
return NotImplemented
return self.__class__([self[0] / other, self[1] / other, self[2] / other])
def __rdiv__(self, other):
return self.__class__([other / self[0], other / self[1], other / self[2]])
def __str__(self):
return "["+str(self[0])+", "+str(self[1])+", "+str(self[2])+"]"
def __pow__(self, exponent):
return pow(self.dot(self), exponent * 0.5)
def dot(self, other):
assert len(other) == 3
return self[0] * other[0] + self[1] * other[1] + self[2] * other[2]
# run module directly for testing
if __name__=='__main__':
# Test the examples in the docstrings
import doctest, sys
doctest.testmod(sys.modules[__name__])
......@@ -7,7 +7,7 @@ rm -f *.cxx
SWIG_REV_FILE_OPENMM=RevisionNumber_OpenMM.txt
SWIG_REV_FILE_PYOPENMM=RevisionNumber_pyopenmm.txt
PYTHON_PACKAGE_DIR=../../simtk/chem/openmm
PYTHON_PACKAGE_DIR=../../simtk/openmm
if [ -n "$OPENMM_SVN_PATH" ] ; then
......
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