__init__.py 977 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
#
#

"""
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())