Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
e49bc83f
"csrc/vscode:/vscode.git/clone" did not exist on "4b535e6465a8f4f90198a9616a44b4a36ba71a8e"
Commit
e49bc83f
authored
Feb 28, 2011
by
Peter Eastman
Browse files
Renamed simtk.chem.openmm to simtk.openmm
parent
076f8d7b
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10796 additions
and
188 deletions
+10796
-188
wrappers/python/CMakeLists.txt
wrappers/python/CMakeLists.txt
+5
-5
wrappers/python/setup.py
wrappers/python/setup.py
+4
-18
wrappers/python/simtk/openmm/__init__.py
wrappers/python/simtk/openmm/__init__.py
+37
-0
wrappers/python/simtk/openmm/openmm.py
wrappers/python/simtk/openmm/openmm.py
+10749
-0
wrappers/python/simtk/vec3.py
wrappers/python/simtk/vec3.py
+0
-164
wrappers/python/src/swig_doxygen/buildSwigWrapper.sh
wrappers/python/src/swig_doxygen/buildSwigWrapper.sh
+1
-1
No files found.
wrappers/python/CMakeLists.txt
View file @
e49bc83f
...
...
@@ -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
)
...
...
wrappers/python/setup.py
View file @
e49bc83f
...
...
@@ -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
,
...
...
wrappers/python/simtk/openmm/__init__.py
0 → 100644
View file @
e49bc83f
#
#
#
"""
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
wrappers/python/simtk/openmm/openmm.py
0 → 100644
View file @
e49bc83f
This diff is collapsed.
Click to expand it.
wrappers/python/simtk/vec3.py
deleted
100644 → 0
View file @
076f8d7b
#!/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__
])
wrappers/python/src/swig_doxygen/buildSwigWrapper.sh
View file @
e49bc83f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment