Collective Variable Package
Overview
Collective variables (CVs) are functions of the coordinates of a molecular system that project its conformational state onto a lower-dimensional space. Biasing the dynamics of a judiciously chosen set of CVs enhances the sampling of configuration space, including regions that are otherwise difficult to reach. The free energy of the system as a function of these CVs characterizes the relative stability of different states and the pathways connecting them.
CVPack provides ready-to-use CVs for the molecular dynamics engine OpenMM. Every CV is a subclass of OpenMM's Force class, so it can be added directly to a CustomCVForce or used to define a BiasVariable for Metadynamics. In addition, each CV:
- reports its value and its effective mass in OpenMM's MD unit system;
- can be serialized to and deserialized from YAML;
- can be reported during a simulation through
cvpack.reporting.StateDataReporter.
Collective Variables
| Collective Variable | Description |
|---|---|
| Angle | angle formed by three atoms |
| Atomic function | user-defined function of the coordinates of groups of atoms |
| Attraction strength | strength of the attraction between two groups of atoms |
| Centroid function | user-defined function of the centroids of groups of atoms |
| Composite RMSD | multibody RMSD with concerted-rotation alignment |
| Distance | distance between two atoms |
| Helix angle content | alpha-helix angle content of a sequence of residues |
| Helix H-bond content | alpha-helix hydrogen-bond content of a sequence of residues |
| Helix RMSD content | alpha-helix RMSD content of a sequence of residues |
| Helix torsion content | alpha-helix Ramachandran content of a sequence of residues |
| Meta-collective variable | function of other collective variables |
| Number of contacts | number of contacts between two groups of atoms |
| OpenMM force wrapper | potential energy of an OpenMM Force object, used as a CV |
| Path in CV space | progress along (or deviation from) a path in CV space |
| Path in RMSD space | progress along (or deviation from) a path in RMSD space |
| Radius of gyration | radius of gyration of a group of atoms |
| Radius of gyration squared | square of the radius of gyration of a group of atoms |
| Residue coordination | number of contacts between two disjoint groups of residues |
| RMSD | root-mean-square deviation with respect to a reference structure |
| Sheet RMSD content | beta-sheet RMSD content of a sequence of residues |
| Shortest distance | smooth approximation of the shortest distance between two groups of atoms |
| Torsion | torsion angle formed by four atoms |
| Torsion similarity | degree of similarity between pairs of torsion angles |
Installation
CVPack is available from the mdtools conda channel and from PyPI:
conda install -c conda-forge -c mdtools cvpack
pip install cvpack
CVPack requires OpenMM 8.4 or later. CompositeRMSD also requires version 0.2.0 or later of the
openmm-cpp-forces package, which is available from the mdtools channel for OpenMM 8.4 to 8.6
(Linux and macOS) and from PyPI. Earlier versions compute wrong forces for groups of different
sizes.
Quick Start
The example below computes the backbone dihedral angles of alanine dipeptide, using a test system from OpenMMTools:
import cvpack
import openmm
from openmmtools import testsystems
model = testsystems.AlanineDipeptideVacuum()
phi = cvpack.Torsion(4, 6, 8, 14, name="phi")
psi = cvpack.Torsion(6, 8, 14, 16, name="psi")
for cv in (phi, psi):
cv.addToSystem(model.system)
context = openmm.Context(model.system, openmm.VerletIntegrator(0.001))
context.setPositions(model.positions)
print(phi.getValue(context), psi.getValue(context))
addToSystem puts each CV in its own force group, which makes evaluating it cheap. Note that a
CV added to a system also contributes its value to the potential energy. To compute CVs without
biasing the dynamics, integrate only the force groups of the physical forces (see
openmm.Integrator.setIntegrationForceGroups).
Documentation
The documentation of the latest release and of the development version is available on GitHub Pages.
Related Packages
OpenMM-Colvars adds the Colvars library to OpenMM through a C++ Force with Python bindings.
Colvars has its own set of CVs and enhanced-sampling methods, and it is also available in NAMD,
LAMMPS, GROMACS, VMD and Tinker-HP.
Copyright
Copyright (c) 2023-2024 C. Abreu & Redesign Science
Acknowledgments
Initial project based on the CMS Cookiecutter version 1.1.
Metadata
Release files for cvpack 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cvpack-0.13.0.tar.gz | 87.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cvpack-0.13.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 204.3 kB
Release files / cvpack-0.13.0.tar.gz
| Download URL | cvpack-0.13.0.tar.gz |
|---|---|
| Size | 87.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee1f74df9e7fd7a52ff1cc70e888737762f6c6ca2c5c3fac22652d07ff6273ce
|
|
BLAKE2b-256 checksum How to use checksums |
89f460f1ca9945509d21bfc7fd0674df45f4e074918eae3c7c192bc6d8264ef9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / cvpack-0.13.0-py3-none-any.whl
| Download URL | cvpack-0.13.0-py3-none-any.whl |
|---|---|
| Size | 116.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ff21a3dced780205bf0a434874e6f0537f127106617dabc7cd00e6f13ea90bc
|
|
BLAKE2b-256 checksum How to use checksums |
339920e14bd04879f1b394f5f24761a66c66b1f69674e27966ff3c90abcd3b7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|