Loading OpenMM platform plugins

Hi, I've been having fun developing a plugin for ChimeraX and want to firstly thank everyone involved for such a great platform to build upon. I'm starting to introduce a molecular dynamics component and was excited to see that ChimeraX ships with OpenMM support. Unfortunately, the OpenMM Platform plugins (which add CPU, CUDA, OpenCL etc) functionality, do not seem to be loaded by default at least in ChimeraX 1.1 on macOS. I couldn't see any documentation about how to load these plugins, but for anyone running into this issue, the following code got things working for me: ------ import chimerax openmm_plugins_dir = os.path.join(chimerax.app_lib_dir, 'plugins') Platform.loadPluginsFromDirectory(openmm_plugins_dir) ------ Kind regards, Tom

Yes, this is a current limitation. At the moment, if ISOLDE is installed then everything gets set up automatically when ChimeraX starts. Essentially, the environment variable OPENMM_PLUGIN_DIR needs to be set before you `import openmm` for the first time. The easiest way to ensure this happens is to put the necessary code into your bundle's `initialize` method (which is guaranteed to be called on ChimeraX startup if you set `custom_init=true` in the BundleInfo tag in your bundle_info.xml). To see an example of this in ISOLDE: initialize_openmm() method: https://github.com/tristanic/isolde/blob/a9f976c34affbe917de9e1f6a6062ea423e... ... gets called by BundleAPI.initialize(): https://github.com/tristanic/isolde/blob/a9f976c34affbe917de9e1f6a6062ea423e... ... which is called because of the property set in bundle_info.xml: https://github.com/tristanic/isolde/blob/a9f976c34affbe917de9e1f6a6062ea423e.... Feel free to get in touch if you want any other tips about working with OpenMM in ChimeraX. On 2020-09-15 11:28, Thomas Mulvaney wrote:
Hi,
I've been having fun developing a plugin for ChimeraX and want to firstly thank everyone involved for such a great platform to build upon.
I'm starting to introduce a molecular dynamics component and was excited to see that
ChimeraX ships with OpenMM support.
Unfortunately, the OpenMM Platform plugins (which add CPU, CUDA, OpenCL etc) functionality, do
not seem to be loaded by default at least in ChimeraX 1.1 on macOS.
I couldn't see any documentation about how to load these plugins, but for anyone running into this issue, the following code got things working for me:
------
import chimerax openmm_plugins_dir = os.path.join(chimerax.app_lib_dir, 'plugins') Platform.loadPluginsFromDirectory(openmm_plugins_dir) ------
Kind regards,
Tom
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi Tristan, That's very helpful. Your repository has been a valuable resource for me already, yet somehow I overlooked your initialize hook. Using the loadPluginsDirectory() method I haven't had to worry *yet* about when I import openmm but doing it as early as possible, as you do, makes sense. I'm sure I'll have plenty of questions as I make headway. Cheers, Tom On Tue, Sep 15, 2020 at 11:50 AM Tristan Croll <tic20@cam.ac.uk> wrote:
Yes, this is a current limitation. At the moment, if ISOLDE is installed then everything gets set up automatically when ChimeraX starts. Essentially, the environment variable OPENMM_PLUGIN_DIR needs to be set before you `import openmm` for the first time. The easiest way to ensure this happens is to put the necessary code into your bundle's `initialize` method (which is guaranteed to be called on ChimeraX startup if you set `custom_init=true` in the BundleInfo tag in your bundle_info.xml). To see an example of this in ISOLDE:
initialize_openmm() method: https://github.com/tristanic/isolde/blob/a9f976c34affbe917de9e1f6a6062ea423e...
... gets called by BundleAPI.initialize(): https://github.com/tristanic/isolde/blob/a9f976c34affbe917de9e1f6a6062ea423e...
... which is called because of the property set in bundle_info.xml: https://github.com/tristanic/isolde/blob/a9f976c34affbe917de9e1f6a6062ea423e... .
Feel free to get in touch if you want any other tips about working with OpenMM in ChimeraX.
On 2020-09-15 11:28, Thomas Mulvaney wrote:
Hi,
I've been having fun developing a plugin for ChimeraX and want to firstly thank everyone involved for such a great platform to build upon.
I'm starting to introduce a molecular dynamics component and was excited to see that ChimeraX ships with OpenMM support.
Unfortunately, the OpenMM Platform plugins (which add CPU, CUDA, OpenCL etc) functionality, do not seem to be loaded by default at least in ChimeraX 1.1 on macOS.
I couldn't see any documentation about how to load these plugins, but for anyone running into this issue, the following code got things working for me:
------ import chimerax openmm_plugins_dir = os.path.join(chimerax.app_lib_dir, 'plugins') Platform.loadPluginsFromDirectory(openmm_plugins_dir) ------
Kind regards,
Tom
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
participants (2)
-
Thomas Mulvaney
-
Tristan Croll