OpenMM
Platform Class Reference

A Platform defines an implementation of all the kernels needed to perform some calculation. More...

Inherits _object.

List of all members.

Public Member Functions

def __init__
def registerPlatform
 Register a new Platform.
def getNumPlatforms
 getNumPlatforms() -> int
def getPlatform
 getPlatform(index) -> Platform
def getPluginLoadFailures
 getPluginLoadFailures() -> vectorstring
def getPlatformByName
 getPlatformByName(name) -> Platform
def findPlatform
 findPlatform(kernelNames) -> Platform
def loadPluginLibrary
 Load a dynamic library (DLL) which contains an OpenMM plugin.
def loadPluginsFromDirectory
 loadPluginsFromDirectory(directory) -> vectorstring
def getDefaultPluginsDirectory
 getDefaultPluginsDirectory() -> std::string const &
def getOpenMMVersion
 getOpenMMVersion() -> std::string const &
def getName
 getName(self) -> std::string const &
def getSpeed
 getSpeed(self) -> double
def supportsDoublePrecision
 supportsDoublePrecision(self) -> bool
def getPropertyNames
 getPropertyNames(self) -> vectorstring
def getPropertyValue
 getPropertyValue(self, context, property) -> std::string const &
def setPropertyValue
 Set the value of a Platform-specific property for a Context.
def getPropertyDefaultValue
 getPropertyDefaultValue(self, property) -> std::string const &
def setPropertyDefaultValue
 Set the default value of a Platform-specific property.
def supportsKernels
 supportsKernels(self, kernelNames) -> bool

Static Public Attributes

tuple registerPlatform = staticmethod(registerPlatform)
tuple getNumPlatforms = staticmethod(getNumPlatforms)
tuple getPlatform = staticmethod(getPlatform)
tuple getPluginLoadFailures = staticmethod(getPluginLoadFailures)
tuple getPlatformByName = staticmethod(getPlatformByName)
tuple findPlatform = staticmethod(findPlatform)
tuple loadPluginLibrary = staticmethod(loadPluginLibrary)
tuple loadPluginsFromDirectory = staticmethod(loadPluginsFromDirectory)
tuple getDefaultPluginsDirectory = staticmethod(getDefaultPluginsDirectory)
tuple getOpenMMVersion = staticmethod(getOpenMMVersion)

Detailed Description

A Platform defines an implementation of all the kernels needed to perform some calculation.

More precisely, a Platform object acts as a registry for a set of KernelFactory objects which together implement the kernels. The Platform class, in turn, provides a static registry of all available Platform objects.

To get a Platform object, call

 Platform& platform = Platform::findPlatform(kernelNames);
 

passing in the names of all kernels that will be required for the calculation you plan to perform. It will return the fastest available Platform which provides implementations of all the specified kernels. You can then call createKernel() to construct particular kernels as needed.


Constructor & Destructor Documentation

def __init__ (   self,
  args,
  kwargs 
)

Member Function Documentation

def findPlatform (   kernelNames)

findPlatform(kernelNames) -> Platform

Find a Platform which can be used to perform a calculation.

Parameters:
kernelNames(vector< std::string >) the names of all kernels which will be needed for the calculation
Returns:
(Platform) the fastest registered Platform which supports all of the requested kernels. If no Platform exists which supports all of them, this will throw an exception.

getDefaultPluginsDirectory() -> std::string const &

Get the default directory from which to load plugins. If the environment variable OPENMM_PLUGIN_DIR is set, this returns its value. Otherwise, it returns a platform specific default location.

Returns:
(string) the path to the default plugin directory
def getName (   self)

getName(self) -> std::string const &

Get the name of this platform. This should be a unique identifier which can be used to recognized it.

def getNumPlatforms ( )

getNumPlatforms() -> int

Get the number of Platforms that have been registered.

getOpenMMVersion() -> std::string const &

Get a string containing the version number of the OpenMM library.

def getPlatform (   index)

getPlatform(index) -> Platform

Get a registered Platform by index.

def getPlatformByName (   name)

getPlatformByName(name) -> Platform

Get the registered Platform with a particular name. If no Platform with that name has been registered, this throws an exception.

getPluginLoadFailures() -> vectorstring

Get any failures caused during the last call to loadPluginsFromDirectory

def getPropertyDefaultValue (   self,
  property 
)

getPropertyDefaultValue(self, property) -> std::string const &

Get the default value of a Platform-specific property. This is the value that will be used for newly created Contexts.

Parameters:
property(string) the name of the property to get
Returns:
(string) the default value of the property
def getPropertyNames (   self)

getPropertyNames(self) -> vectorstring

Get the names of all Platform-specific properties this Platform supports.

def getPropertyValue (   self,
  context,
  property 
)

getPropertyValue(self, context, property) -> std::string const &

Get the value of a Platform-specific property for a Context.

Parameters:
context(Context) the Context for which to get the property
property(string) the name of the property to get
Returns:
(string) the value of the property
def getSpeed (   self)

getSpeed(self) -> double

Get an estimate of how fast this Platform class is. This need not be precise. It only is expected to return an order or magnitude estimate of the relative performance of different Platform classes. An unoptimized reference implementation should return 1.0, and all other Platforms should return a larger value that is an estimate of how many times faster they are than the reference implementation.

def loadPluginLibrary (   file)

Load a dynamic library (DLL) which contains an OpenMM plugin.

Typically, each Platform is distributed as a separate dynamic library. This method can then be called at runtime to load each available library. Each library should contain an initializer function to register any Platforms and KernelFactories that it contains.

If the file does not exist or cannot be loaded, an exception is thrown.

Parameters:
file(string) the path to the dynamic library file. This is interpreted using the operating system's rules for loading libraries. Typically it may be either an absolute path or relative to a set of standard locations.
def loadPluginsFromDirectory (   directory)

loadPluginsFromDirectory(directory) -> vectorstring

Load multiple dynamic libraries (DLLs) which contain OpenMM plugins from a single directory. This method loops over every file contained in the specified directory and calls loadPluginLibrary() for each one. If an error occurs while trying to load a particular file, that file is simply ignored. You can retrieve a list of all such errors by calling getPluginLoadFailures().

Parameters:
directory(string) the path to the directory containing libraries to load
Returns:
(vector< std::string >) the names of all files which were successfully loaded as libraries
def registerPlatform (   platform)

Register a new Platform.

def setPropertyDefaultValue (   self,
  property,
  value 
)

Set the default value of a Platform-specific property.

This is the value that will be used for newly created Contexts.

Parameters:
property(string) the name of the property to set
value(string) the value to set for the property
def setPropertyValue (   self,
  context,
  property,
  value 
)

Set the value of a Platform-specific property for a Context.

Parameters:
context(Context) the Context for which to set the property
property(string) the name of the property to set
value(string) the value to set for the property
def supportsDoublePrecision (   self)

supportsDoublePrecision(self) -> bool

Get whether this Platform supports double precision arithmetic. If this returns false, the platform is permitted to represent double precision values internally as single precision.

def supportsKernels (   self,
  kernelNames 
)

supportsKernels(self, kernelNames) -> bool

Determine whether this Platforms provides implementations of a set of kernels.

Parameters:
kernelNames(vector< std::string >) the names of the kernels of interests
Returns:
(bool) true if this Platform provides implementations of all the kernels in the list, false if there are any which it does not support

Member Data Documentation

tuple findPlatform = staticmethod(findPlatform) [static]
tuple getNumPlatforms = staticmethod(getNumPlatforms) [static]
tuple getOpenMMVersion = staticmethod(getOpenMMVersion) [static]
tuple getPlatform = staticmethod(getPlatform) [static]
tuple getPlatformByName = staticmethod(getPlatformByName) [static]
tuple getPluginLoadFailures = staticmethod(getPluginLoadFailures) [static]
tuple loadPluginLibrary = staticmethod(loadPluginLibrary) [static]
tuple loadPluginsFromDirectory = staticmethod(loadPluginsFromDirectory) [static]
tuple registerPlatform = staticmethod(registerPlatform) [static]

The documentation for this class was generated from the following file:
 All Classes Functions Variables