Hands-on tutorials: Enhanced sampling methods using GROMACS

Welcome to the course on enhanced sampling methods using GROMACS! This course aims to equip you the ability and confidence to approach real-world problems using enhanced sampling methods – a powerful extension of molecular dynamics that enables much more efficient sampling in the phase space of complex systems. Through a series of hands-on tutorials in this course, you will dive into both the theory and practice of some of the most popular enhanced sampling methods, comprehending their usefulness in gaining thermodynamic and structural insights into the system of interest, such as the solvation free energy of a molecule or the binding ensemble of a binding complex. We design the tutorials such that some of them focus on the same system or research problem to allow comparison across different methods, while each chapter remains as self-contained as possible so that you can explore any topic that interests you. Check out the scope/outline and prerequisites of this course below!

Scope/Outline

In this course, we will first introduce the motivation for enhnaced sampling techniques and discuss key terminologies in Chapter 0. Subsequently, we will explore several kinds of enhanced sampling methods, including

  • Methods that use collective variables
  • Generalized ensemble methods
  • Hybrid methods


Each of these chapters is accompanied by a hands-on tutorial that guides you through the implementation of the method in GROMACS and the analysis of the simulation data. The tutorials are hosted in our course repository on GitHub. In addition to the listed sampling methods, relevant free energy estimators, such as WHAM, TI, BAR, and MBAR, will also be introduced. Importantly, we do not aim to review all the enhanced sampling methods or free energy estimators exhaustively. For a more comprehensive survey of enhanced sampling methods, the interested readers are referred to an excellent review by Hénin et al.1

Notably, Chapters 1, 2, and 6 use NaCl as the system of interest, with the common goal of computing its free energy as a function of the ion-pair distance. Chatpers 3, 4, 5, and 7 either compute free energies as a function of temperature, or perform alchemical free energy calculations. For more details about the system of interest for each chapter, please refer to the corresponding chapter.

Prerequisites

Background knowledge

This course assumes that students have a basic understanding of the following.
  • Bash commands and scripting: The students should be comfortable with navigating and manipulating the file system through command lines (e.g., cd, ls, pwd, cp, mv, and rm) and writing simple scripts to automate tasks.
  • Python scripting: The students should be experienced with Python data types, control flow structures (e.g., condition statements, loop statements, and function calls), and using functions and modules. Familiarity with common Python libraries such as NumPy, Matplotlib, and Pandas would be benecial.
  • Parallel computing: To grasp methods that involve parallelism (Chapters 3, 4, and 6), the student needs to understand basic terminologies relevant to parallel computing, including node, core, rank, socket, and MPI process. The student should also be comfortable using MPI executables such as mpirun or mpiexec. If not, I recommend checking this video up to 04:33. If you are interested in running multiple MD simulations in parallel with mpirun or mpiexec, consider watching the video up to 22:41.
  • Statistical mechanics: While we will have a quick review of the basics of statistical mechanics in Chapter 1, a basic understanding of the subject is important to understand the theory of enhanced sampling methods.
  • Molecular dynamics and GROMACS: The student should have a basic understanding of molecular dynamics and be able to perform standard molecular dynamics in GROMACS. If not, I recommend reviewing Lemkul’s tutorials on LiveCoMS2 up to Section 3.2.

Note that familiarity with git commands is not strictly required, but the student should at least know how to clone the course repository that stores all relevant files and codes for the course, using the following command:

git https://github.com/wehs7661/enhanced_sampling_tutorials.git

Software requirements

The course mainly relies on [GROMACS](https://www.gromacs.org/) for running the simulations and Python for data analysis. Some chapters require MPI-enabled GROMACS for parallel computing or [PLUMED](https://www.plumed.org/) for specific enhanced sampling functionalities. To minimize the complexity of setting up the environment for the course, we have designed the tutorials to be run on [Binder](https://mybinder.org/), a cloud-based platform that allows you to run Jupyter notebooks without installing any software. For now, all tutorials on Binder use MPI-enabled GROMACS 2021.4 patched with PLUMED 2.8.0.

Note, however, that the tutorials can also be run on your local machine if you have the required software installed. Specifically, below we tabulate whether MPI-enabled GROMACS or PLUMED is required for each chapter. For Chapters not requiring MPI-enabled GROMACS, a GROMACS build based on thread-MPI (tMPI) can be used. Alchemical metadynamics introduced in [Chapter 7](alchemical_metad) only works with GROMACS 2020/PLUMED 2.8, or newer versions of each. If you want to follow all chapters without the need to build different versions of GROMACS/PLUMED, we would having MPI-enabled GROMACS 2020 patched with PLUMED 2.8, or newer versions of each. If you don't have GROMACS/PLUMED installed, please refer to the corresponding reference manuals for the installation guide. Lastly, this course also requires the student to have working versions of MPI executables such as `mpirun` or `mpiexec` for the chapters where MPI-enabled GROMACS is required. Python packages required for data analysis of MD simulations will be introduced in each chapter, if any.

ChapterTopicMPI-enabled GROMACS required?PLUMED required?
1Umbrella sampling
2Metadynamics
3Temperature replica exchange
4Hamiltonian replica exchange
5Expanded ensemble
6Replica exchange umbrella sampling
7Alchemical metadynamics

Hardware requirements

To make the course accessible to as many students as possible, we have designed the tutorials to be computationally affordable such that a PC or desktop should suffice in the case where students want to run the tutorials on their local machines. On Binder, each tutorial should take less than 30 minutes to complete. Still, if you have supercomputing resources available (such as access to [Bridges-2](https://www.psc.edu/resources/bridges-2/)), the simulations will take even less time and you can play around with different parallelism configurations to get more insights for some of the chapters.

Copyright (c) 2023, Wei-Tse Hsu (wehs7661@colorado.edu), University of Colorado, Boulder



  1. HéninJ.; LelièvreT.; Shirts, M. R.; Valsson, O.; Delemotte, L. Enhanced Sampling Methods for Molecular Dynamics Simulations [Article V1.0]. Living Journal of Computational Molecular Science 2022, 4 (1). https://doi.org/10.33011/livecoms.4.1.1583↩︎

  2. Lemkul, J. From Proteins to Perturbed Hamiltonians: A Suite of Tutorials for the GROMACS-2018 Molecular Simulation Package [Article V1.0]. Living Journal of Computational Molecular Science 2019, 1 (1). https://doi.org/10.33011/livecoms.1.1.5068↩︎