Overview¶
This OpenMM plugin implements a sliced variant of OpenMM’s NonbondedForce class. By partitioning all particles among $n$ disjoint subsets, the total potential energy becomes a linear combination of contributions from pairs of subsets like
where each slice is defined by subsets I and J, superscripts vdW and elec denote van der Waals and electrostatic contributions, \(E_{I,J}\) is the potential energy of all particle pairs formed by one particle in subset I and one in subset J, and \(\lambda_{I,J}\) is a scaling parameter.
By default, all scaling parameters are constant and equal to 1. However, the user can turn selected
scaling parameters into variables and store their values in openmm.Context global parameters. Derivatives
with respect to these variables can be requested and used, for instance, to report individual energy
slice contributions or sums thereof via openmm.Context’s getState method with options
getEnergy=True and getParameterDerivatives=True. Derivatives are only computed along with
the energy: without getEnergy=True, they are NaN.
A global parameter can scale the electrostatic contributions, the van der Waals contributions, or both, of any number of slices. Since the energy is linear in the scaling parameters, the derivative with respect to a parameter \(\lambda\) is the sum of the unscaled contributions it multiplies:
where \(S^{elec}_\lambda\) and \(S^{vdW}_\lambda\) are the sets of slices whose electrostatic and van der Waals contributions are scaled by \(\lambda\). This derivative does not depend on the values of the scaling parameters. For instance, a parameter that scales both contributions of a single slice I, J yields its full energy \(E^{vdW}_{I,J}+E^{elec}_{I,J}\), while one that scales the electrostatic contributions of several slices yields their sum.
Installation¶
The plugin is distributed on conda-forge:
mamba install -c conda-forge openmm-nonbonded-slicing
Building from Source¶
Requirements:
OpenMM 8.4 or later
CMake 3.17 or later and a C++ compiler
SWIG, the same version that built your OpenMM (OpenMM’s conda-forge builds 8.4 and 8.5/8.6 used SWIG 4.4 and 4.5, respectively)
Optional: OpenCL headers for the OpenCL platform, and a CUDA toolkit with NVRTC and cuFFT for the CUDA platform
In a conda environment where OpenMM is installed:
mkdir build && cd build
cmake ..
make install
make PythonInstall
Useful CMake options:
Option |
Default |
Meaning |
|---|---|---|
|
|
Where OpenMM is installed |
|
detected with |
OpenMM version, if Python cannot import it |
|
|
Where to install the plugin |
|
|
Build the OpenCL platform |
|
|
Build the CUDA platform (set |
|
downloaded at configure time |
Directory containing |
Test Cases¶
From the build directory, run the C++ tests with make test (or ctest) and the Python tests with make PythonTest.