OpenMM CPP Forces Plugin
This OpenMM plugin contains platform-agnostic forces. They are computed in C++ on the
host through OpenMM's CustomCPPForceImpl, and OpenMM's own platforms (Reference, CPU, CUDA,
and OpenCL) move positions and forces to and from the device. The plugin therefore has no GPU
kernels, and the same build works on every platform.
| Force | Description |
|---|---|
| CompositeRMSDForce | Deviation of multiple corotating bodies from their reference structures |
Composite RMSD
The CompositeRMSDForce class computes the root-mean-square deviation (RMSD) of a set of
particle groups from a reference structure, where each group can translate independently but all
groups rotate together. For $m$ groups $\mathbf{g}_j$ with $n_j$ particles each and centroids
$\mathbf{c}_j$, the composite RMSD is
d_{\rm crms}(\mathbf{r}) = \sqrt{
\frac{1}{n} \min_{\substack{\mathbf{q} \in \mathbb{R}^4 \\ \|\mathbf{q}\| = 1}}
\sum_{j=1}^{m} \sum_{i \in \mathbf{g}_j} \left\|
\mathbf{A}(\mathbf{q})\left(\mathbf{r}_i - \mathbf{c}_j\right)
- \mathbf{r}_i^{\rm ref} + \mathbf{c}_j^{\rm ref}
\right\|^2
}
where $n = \sum_{j=1}^{m} n_j$, $\mathbf{r}_i^{\rm ref}$ and $\mathbf{c}_j^{\rm ref}$ are reference
positions and centroids, and $\mathbf{A}(\mathbf{q})$ is the rotation matrix of the unit quaternion
$\mathbf{q}$. A single rotation aligns all groups, so their relative orientations matter but their
relative positions do not. The energy of the force equals $d_{\rm crms}$, which makes it a
collective variable for a CustomCVForce.
Documentation
Documentation for this plugin is available at GitHub Pages, including its Python API.
Installation
The plugin requires OpenMM 8.4 or later. It is distributed on the mdtools conda channel:
mamba install -c conda-forge -c mdtools openmm-cpp-forces
and on PyPI, for Linux x86_64 and macOS (Apple Silicon and Intel) with Python 3.10–3.14:
pip install openmm-cpp-forces
Each PyPI release is published once per supported OpenMM version. pip installs the newest one,
upgrading OpenMM if needed; to keep an older OpenMM, pin it in the same command, for example
pip install "openmm==8.5.*" openmm-cpp-forces:
| PyPI release | OpenMM |
|---|---|
X.Y.Z |
8.4 |
X.Y.Z.post1 |
8.5 |
X.Y.Z.post2 |
8.6 |
On Intel Macs, OpenMM 8.6 from PyPI only works with Python 3.10, so pip installs the OpenMM 8.5 release there for Python 3.11 and later.
The PyPI wheels work with every OpenMM platform. To run on NVIDIA GPUs, also install the OpenMM
CUDA add-on that matches your driver, openmm-cuda-12 or openmm-cuda-13.
To build from source, install OpenMM, CMake, SWIG, numpy, and a C++ compiler, then run:
mkdir build && cd build
cmake .. -DOPENMM_DIR=/path/to/openmm # defaults to $CONDA_PREFIX
make install
make PythonInstall
Usage
The example below restrains the composite RMSD of two groups of particles with a harmonic potential:
import numpy as np
import openmm as mm
import openmmcppforces as mmcpp
# A toy system: 10 particles split into two groups
num_particles = 10
system = mm.System()
for _ in range(num_particles):
system.addParticle(1.0)
reference = np.random.default_rng(1234).normal(size=(num_particles, 3))
rmsd = mmcpp.CompositeRMSDForce(reference)
rmsd.addGroup(list(range(5)))
rmsd.addGroup(list(range(5, 10)))
restraint = mm.CustomCVForce("0.5*k*rmsd^2")
restraint.addGlobalParameter("k", 1000.0) # kJ/mol/nm^2
restraint.addCollectiveVariable("rmsd", rmsd)
system.addForce(restraint)
context = mm.Context(system, mm.VerletIntegrator(0.001))
# Translating each group as a whole leaves the composite RMSD at zero
shift = np.array([[1.0, 0.0, 0.0]] * 5 + [[0.0, 2.0, 0.0]] * 5)
context.setPositions(reference + shift)
print(f"{restraint.getCollectiveVariableValues(context)[0]:.4f} nm") # 0.0000 nm
# A deformation does not
noise = np.random.default_rng(5678).normal(scale=0.1, size=(num_particles, 3))
context.setPositions(reference + noise)
print(f"{restraint.getCollectiveVariableValues(context)[0]:.4f} nm") # 0.1326 nm
Copyright
Copyright (c) 2024, Redesign Science
Metadata
Release files for openmm-cpp-forces 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 3.4 MB
Release files / openmm_cpp_forces-0.2.0-cp314-cp314-manylinux_2_34_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp314-cp314-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 500.4 kB |
| Tags | CPython 3.14 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
c99a5eba9abd1904ca767ce7d88fd0612814f745332d30a323078772d24a8b63
|
|
BLAKE2b-256 checksum How to use checksums |
6bcd88e698405a3259aabce977a387257b106536ab3bd4b851cdb816e1df148b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.0 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8c1e4c7533136e223ed8cc46744bd412eb514c7c5425f1d090277b720137fa49
|
|
BLAKE2b-256 checksum How to use checksums |
7065ba1dadc7df18f21bd9231c1cb8acf601ad686f8286dc0fa3c253bdb48c20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp314-cp314-macosx_10_13_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp314-cp314-macosx_10_13_x86_64.whl |
|---|---|
| Size | 100.5 kB |
| Tags | CPython 3.14 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
b8c3b568ca18ddcc1c032eee8c79520a219c3f35df99291ebaee4fbc8ea49e7c
|
|
BLAKE2b-256 checksum How to use checksums |
132e3c3e33c7907f64d63ac53de4d951a3a92523f2f17f5716c70981360e3419
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 501.2 kB |
| Tags | CPython 3.13 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
f0599b5760dab26c00d0b0e29782d77cf2c896fa5f4f830a36a668bb345e91b3
|
|
BLAKE2b-256 checksum How to use checksums |
1174b4eb36b977fc8650b2d22cff087667ab80c00cc692c69ee07e2a8bfeafc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.0 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b5d7de66bd56b112a8b989caf969de973d3304b73abf1994294ec01eca94e29a
|
|
BLAKE2b-256 checksum How to use checksums |
cf784975549435bbcfc5223a40f60a6dd116c435ac6c229c8132fe34af84ad4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl |
|---|---|
| Size | 100.5 kB |
| Tags | CPython 3.13 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
240721f4111f40963aed2235e1f5e2dea71ca8eb8857e08f6ba72b7b4c9ec88f
|
|
BLAKE2b-256 checksum How to use checksums |
406ec15ba97c0c2de5ebaa883f0be6bb266dababa6e6f65e5e7ea860a01311ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 499.8 kB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
52007319721f001fe021e02bfdf0460391618e7dc138e00d64d5c86a268c342c
|
|
BLAKE2b-256 checksum How to use checksums |
0677265e331c841f94dcb3a291455c64ffbdcdea508a36038a5e37c4e70d1a68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.3 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
96b10f1149ed5dc0e078252fd1a848946cacfbee3107a29dc3b50e8d9f6275ac
|
|
BLAKE2b-256 checksum How to use checksums |
85dae4bc2890f185dc006784c75a811f7cc3fe7035c196010624db3cd2076b4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp312-cp312-macosx_10_13_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp312-cp312-macosx_10_13_x86_64.whl |
|---|---|
| Size | 100.7 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
8d9600dbc3cbe1ef57afa37d502947bb1fd740c51862c47a73c98f2c2e4da971
|
|
BLAKE2b-256 checksum How to use checksums |
eb8f2c90d3cc68c6788d3d5872f62a63f4ade63826dabbd388066249087f4dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 487.1 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
51e80e075d75e8de823d2181b29baef82dcf62750c73f79b6c3c1d05119612b5
|
|
BLAKE2b-256 checksum How to use checksums |
b4d9f8884e5118d6f90a8561b5772595d5bde36cd9aff00b17c6d1231132bf27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.1 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5f491e7f2762512e84f4465b01dee07f6ac4d82872f7d9ff6df0e9b4aaf2bfc7
|
|
BLAKE2b-256 checksum How to use checksums |
042a51de4016e555864c0c47a20a8e5a75382cd6016c1e17bcd60a620c6b0761
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp311-cp311-macosx_10_13_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp311-cp311-macosx_10_13_x86_64.whl |
|---|---|
| Size | 100.3 kB |
| Tags | CPython 3.11 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
8863348aa462dd6040de1a1fbb4314962f4bb8a5356ba7d0b2719022c06e84d8
|
|
BLAKE2b-256 checksum How to use checksums |
faee0f9af4e4db6cbdeff7fec7c460a9fab5b6046bf2598ff90422e20eb59206
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 480.8 kB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
f6e689be54c493a0f895c342eedd00536f3cceac81ada0898e44c0679dc28e0d
|
|
BLAKE2b-256 checksum How to use checksums |
a8605893df3c15b37cfa21a59a1af841fc616022923107351ad2d8e78c0a9dae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.1 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
28cb2bfcb37e0309a030bad9032091cd3c4bedb6e116d00cd3c7f4d924486d77
|
|
BLAKE2b-256 checksum How to use checksums |
3c86826e90450edd9e02f977304fa931351a7a3ce4bbda7dd41cb31ac435ee85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / openmm_cpp_forces-0.2.0-cp310-cp310-macosx_10_13_x86_64.whl
| Download URL | openmm_cpp_forces-0.2.0-cp310-cp310-macosx_10_13_x86_64.whl |
|---|---|
| Size | 100.3 kB |
| Tags | CPython 3.10 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
ae7b6dfed93b8ca95b2b21c712002b01ceb7b9928f78855d7f745d828e294981
|
|
BLAKE2b-256 checksum How to use checksums |
400a5f2502f2a5b0154880c643fad510a7e86402280153d9b4dd8af532ae6d10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logSecurity for openmm-cpp-forces 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 15 files in this release have been uploaded with provenance metadata.
Attestation for openmm_cpp_forces-0.2.0-cp314-cp314-manylinux_2_34_x86_64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.