schrodinger.infra.mm module

Python-level wrappers for the SWIG-wrapped C and C++ functions.

This module exists to make use of pymmlibs a bit easier and provides access to all functions and constants present in that module.

It adds a layer of automatic error checking to the SWIG wrapped mmlib functions. Instead of returning function return values to the user, the values are checked for indication of failure. If a failure occurs, an MmException is raised. (The underlying return code can be accessed as the ‘rc’ attribute of an MmException.) If a failure does not occur, the caller will not see the mmlib function return value at all.

To access the mmlibs functions in their “pure” form (i.e. the basic SWIG wrapped functions without automatic error checking) use the pymmlibs module, which can be imported with ‘import pymmlibs’.

To call mmlibs functions from python, use input arguments of the appropriate type. Output arguments will be returned as function return values. In the event that there are multiple output arguments, a tuple of these values will be returned. (If you are using functions from the pymmlibs module, the first value in your return tuple will always be the return value of the C function.)

Some mmlibs debugging and profiling niceties are provided through this module. For debugging python calls to mmlibs, you can set SCHRODINGER_PYTHON_MMLIBS_TRACE to any non-null value to get a debug-level logger that prints every call to a wrapped mmlibs function. For assistance in profiling, set SCHRODINGER_PYTHON_CPROFILE to a non-null value. This will set up an additional wrapper with a unique name for each mmlib function so they can be attributed in profiles run via the cProfile module. Without SCHRODINGER_PYTHON_CPROFILE, all mmlibs calls will be attributed to the _Wrapper.__call__ method.

schrodinger.infra.mm.set_globals()