Fork me on GitHub

Java Class Analogues of the OpenMM C++ API

Force Field X makes use of OpenMM via Java classes that are analogues of the OpenMM C++ API.

Lower level wrappers around the C API are automatically generated using Jnaerator and are available on Github in case they may be useful to others:

Java Wrappers for the OpenMM C API

Including the Library in a Maven Project

          
                <dependency>
                    <groupId>edu.uiowa.jopenmm</groupId>
                    <artifactId>jopenmm-fat</artifactId>
                    <version>7.5.0-v11</version>
                </dependency>
        

Loading the OpenMM Binary Library and Plugins

To use the Java OpenMM Wrappers within Java, please first initialize the library using the provided OpenMMUtils class:

OpenMMUtils.init();

This will extract the OpenMM binary libraries from the openmm-fat.jar file to a temporary directory and configure JNA to find them.

OpenMM plugins can be loaded from the directory OpenMMUtils.OPENMM_PLUGIN_DIR as follows:

PointerByReference plugins = OpenMM_Platform_loadPluginsFromDirectory(OpenMMUtils.OPENMM_PLUGIN_DIR);