Support both OpenMM 6.2 and 6.3

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Andrea Zonca
Posts: 17
Joined: Tue Aug 19, 2014 1:32 pm

Support both OpenMM 6.2 and 6.3

Post by Andrea Zonca » Mon Jun 15, 2015 1:30 pm

Hi,

the signature for the function `computeNeighborListVoxelHash` changed in 6.3, it now requires the periodic box vectors instead of the box size.
what is the easiest way for plugins to support both versions of this function?

thanks!

User avatar
Peter Eastman
Posts: 2588
Joined: Thu Aug 09, 2007 1:25 pm

Re: Support both OpenMM 6.2 and 6.3

Post by Peter Eastman » Tue Jun 16, 2015 12:57 pm

The simplest approach is probably just to use an #ifdef to control what arguments you pass based on the version you're compiling for.

Peter

User avatar
Andrea Zonca
Posts: 17
Joined: Tue Aug 19, 2014 1:32 pm

Re: Support both OpenMM 6.2 and 6.3

Post by Andrea Zonca » Tue Jun 16, 2015 1:23 pm

Thanks, how do I extract the current version of OpenMM at compilation time of a plugin?

User avatar
Peter Eastman
Posts: 2588
Joined: Thu Aug 09, 2007 1:25 pm

Re: Support both OpenMM 6.2 and 6.3

Post by Peter Eastman » Tue Jun 16, 2015 1:53 pm

When OpenMM itself is compiled, the build script defines a set of constants for the version number (OPENMM_MAJOR_VERSION and OPENMM_MINOR_VERSION). You can do something similar when compiling your plugin: define constants to tell it what version to compile for.

Peter

User avatar
Andrea Zonca
Posts: 17
Joined: Tue Aug 19, 2014 1:32 pm

Re: Support both OpenMM 6.2 and 6.3

Post by Andrea Zonca » Wed Jun 24, 2015 10:15 am

I wonder if it would be reasonable to rely on the Python wrapper, something like:

Code: Select all

python -c "from simtk import openmm; print(openmm.version.short_version)"

User avatar
Jason Swails
Posts: 47
Joined: Mon Jan 07, 2013 5:11 pm

Re: Support both OpenMM 6.2 and 6.3

Post by Jason Swails » Wed Jun 24, 2015 10:33 am

Assuming you can rely on the simtk.openmm package belonging to the same installation as the OpenMM build whose libraries you are linking, that should work fine.

A word of caution here, though, is that it's easy to install multiple versions of the OpenMM libraries on the same machine, but more difficult to keep corresponding versions of the Python bindings for all of them. The standard workflow of "configure, install to a prefix" will dump the Python libraries in the site-packages for Python. So if you compile 6.2, then 6.3 and don't take care to specially handle the simtk packages, then you will be left with only a single set of Python bindings for OpenMM corresponding to version 6.3 (even if you try to link to 6.2 libraries).

So long story short, this is OK if you have only one OpenMM build on your system or if you have a robust way of keeping different Python bindings for different versions separate and properly loaded with each of the OpenMM versions you have installed. Otherwise, you may run into problems.

User avatar
Andrea Zonca
Posts: 17
Joined: Tue Aug 19, 2014 1:32 pm

Re: Support both OpenMM 6.2 and 6.3

Post by Andrea Zonca » Wed Jun 24, 2015 1:14 pm

Thanks Jason,
I was actually more concerned about users that only use OpenMM C++ and don't even install the Python wrapper, do you have a feeling of what fraction of OpenMM users use only C++?

User avatar
Peter Eastman
Posts: 2588
Joined: Thu Aug 09, 2007 1:25 pm

Re: Support both OpenMM 6.2 and 6.3

Post by Peter Eastman » Wed Jun 24, 2015 1:38 pm

I think "what you're building for" and "what you have installed" are two different questions. For example, you may have OpenMM 6.3 installed on your computer, but still want to build separate binaries that are compatible with both 6.2 and 6.3.

Peter

POST REPLY