Skip to main content

Machine learning collective variables for enhanced sampling

Project description

Machine Learning Collective Variables for Enhanced Sampling

CODE Documentation Status GitHub Actions Build Status codecov license

PAPER paper preprint

The documentation is available at:


mlcolvar is a Python library aimed to help design data-driven collective-variables (CVs) for enhanced sampling simulations. The key features are:

  1. A unified framework to help test and use (some) of the CVs proposed in the literature.
  2. A modular interface to simplify the development of new approaches and the contamination between them.
  3. A streamlined distribution of CVs in the context of advanced sampling.

The library is built upon the PyTorch ML library as well as the Lightning high-level framework.


Some of the CVs which are implemented, organized by learning setting:

  • Unsupervised: PCA, (Variational) AutoEncoders [1,2]
  • Supervised: LDA [3], DeepLDA [4], DeepTDA [5]
  • Time-informed: TICA [6], DeepTICA/SRVs [7,8], VDE [9]

And many others can be implemented based on the building blocks or with simple modifications. Check out the tutorials and the examples section of the documentation.


Install with pip

The library is available on PyPi and can be installed with pip. This is the preferred choice for users as it automatically installs the package requirements.

pip install mlcolvar

Clone from GitHub

The library can also be installed cloning the repository from GitHub. This is the preferred choice for developers as it provides more flexibility and allows editable installation.

git clone https://github.com/luigibonati/mlcolvar.git
cd mlcolvar
pip -e install .

PLUMED interface: the resulting CVs can be deployed for enhancing sampling with the PLUMED package via the pytorch interface, available since version 2.9.


Notes: in early versions (v<=0.2.*) the library was called mlcvs. This is still accessible for compatibility with PLUMED masterclasses in the releases or by cloning the pre-lightning branch.


Copyright (c) 2023 Luigi Bonati, Enrico Trizio, Andrea Rizzi and Michele Parrinello. Structure of the project is based on Computational Molecular Science Python Cookiecutter.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlcolvar-1.3.0.tar.gz (351.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlcolvar-1.3.0-py3-none-any.whl (144.2 kB view details)

Uploaded Python 3

File details

Details for the file mlcolvar-1.3.0.tar.gz.

File metadata

  • Download URL: mlcolvar-1.3.0.tar.gz
  • Upload date:
  • Size: 351.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for mlcolvar-1.3.0.tar.gz
Algorithm Hash digest
SHA256 fdbe10fd8c4c48499faa1a6bd3b4e0c82414383537c5bde535795a8f0b0809ab
MD5 10a0980f89732228af35c279a04f1b3b
BLAKE2b-256 29d15882d8eabc49a907d7d889bef2255911911b7f56a51fa72902351c376591

See more details on using hashes here.

File details

Details for the file mlcolvar-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: mlcolvar-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 144.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for mlcolvar-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 755a827fc14b6e1e595a65da30e2c02d62b22e96c27259d025b27eb828ba7e73
MD5 f33c2bf968e4ba673e05d86679832754
BLAKE2b-256 6d7288655476b8ec073cb1b99b4980b4d580a3e2f44588983784d8aa98614336

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page