PLUMED Wrapper for OpenPathSampling

Authors: Alberto Pérez de Alba Ortíz

This module interfaces OpenPathSampling (OPS) with PLUMED, an open-source library with a rich catalogue of Collective Variables (CVs).

Special thanks to Gareth A. Tribello for facilitating the use of the PLUMED Cython wrapper.

Purpose of Module

Transition path sampling simulations and analysis rely on accurate state definitions. Such states are typically defined as volumes in a CV-space. OPS already supports a number of CVs, including the ones defined in the MDTraj Python library. PLUMED, an open-source C++ library, offers a wide variety of extra CVs, which are enabled in OPS by this module.

Many of PLUMED’s dozens of CVs have a biomolecular focus, but they are also general enough for other applications. PLUMED’s popularity (over 500 citations in 4 years after the release of PLUMED2) is greatly based on the fact that it works with many MD codes. OPS is now added to that list. The PLUMED code is well-maintained and documented for both users and developers. Several tutorials and a mailing list are available to address FAQs. For more information about the PLUMED code, visit:

In this module, the class PLUMEDInterface is a subclass of the Cython wrapper class Plumed contained in the PLUMED installation. For initialization, PLUMEDInterface requires an MDTrajTopology and accepts additional PLUMED settings:

  • pathtoplumed="" is the path to the PLUMED installation, where the script is run to set all relevant flags. By default, the string is empty and the currently sourced PLUMED is used.
  • timestep=1. is the time step size in PLUMED units (ps).
  • kbt=1. is $k_BT$ in PLUMED units (kJ/mol).
  • molinfo="" is a file to be used as STRUCTURE for the MOLINFO PLUMED command. It allows to provide extra information about the molecules. Consult:
  • logfile=plumed.log is the name of the log file written by the PLUMEDInterface.

The initialized PLUMEDInterface can be subsequently used to make functions that calculate CVs for a given Trajectory. This is done via the PLUMEDCV class, a subclass of CoordinateFunctionCV.

In PLUMED input files, a common syntax is: label: keywords. The class PLUMEDCV takes name and definition as arguments, which are respectively equivalent to PLUMED’s label and keywords. The PLUMEDCV class also takes the PLUMEDInterface as argument. This allows for a single PLUMEDInterface to contain the MDTrajTopology, additional PLUMED keywords and previously defined CVs that can be reused for the same system. Both PLUMEDInterface and PLUMEDCV are storable.

This module supports (as listed in PLUMED documentation):

  • Groups and Virtual Atoms: are directly set in the PLUMEDInterface via the PLUMEDInterface.set(name, definition) function. The PLUMEDInterface.get() function allows to consult the commands that have been already set. Some commands do not need a name, while some others must be run before any other command (e.g. UNITS).
  • CV Documentation: all CVs are created by calling PLUMEDCV(name, PLUMEDInterface, definition). The returned function can be applied to a Trajectory. CVs with components should specify the components=["c1", "c2", "c3", ...] keyword and the corresponding PLUMED keywords in the definition.
  • Distances from reference configurations: also created by calling PLUMEDCV(name, PLUMEDInterface, definition). Most of them require external files with reference configurations.
  • Functions: also created by calling PLUMEDCV(name, PLUMEDInterface, definition). They should be created using the same PLUMEDInterface that contains the previously defined CVs that are part of the function.
  • Multicolvar and Exploiting contact matrices are not tested.

For examples see the Examples section below.

For further PLUMED usage details see:

Background Information

This module builds on OpenPathSampling, a Python package for path sampling simulations. To learn more about OpenPathSampling, you might be interested in reading:


Tests in OpenPathSampling use the nose package.

The tests for this module can be run by downloading its source code (see the Source Code section below), installing its requirements, and running the command nosetests from the root directory of the repository.


Source Code

The source code for this module can be found in:

It can be installed by running pip install -e . from the root directory of the package.

It requires to have the PLUMED development version (with the Cython wrapper) installed from:; and to source the file /path/to/plumed2/

For details on PLUMED installation, see:

Before using this module, please test the Cython PLUMED wrapper by attempting to import plumed in Python. If this is not successful, please refer to PLUMED installation documentation (above), or to the mailing list:!forum/plumed-users