Introduction to Performing Metadynamics Simulations with Desmond
Tutorial Created with Software Release: 2026-2
Topics: Biologics Drug Discovery , Small Molecule Drug Discovery , Structure Prediction & Target Enablement
Products Used: Desmond , Force Field Bundle ,
|
500 MB |
Abstract:
In this tutorial, you will learn how to set up metadynamics simulations and analyze their results.
Tutorial Content
- Introduction to Metadynamics Simulations
- Importing and Preparing Structures
- Metadynamics for Conformational Sampling
- Obtaining a potential energy surface for nucleotide unstacking with well-tempered metadynamics
- Conclusion and References
1. Introduction to Metadynamics Simulations
A key limitation of molecular dynamics (MD) simulations is that getting the simulated system out of a local energy minimum to explore more of its conformational space requires extensive (and in the case of large systems, prohibitively costly) sampling over long simulation times. Metadynamics simulations enable a greater sampling of the conformational space of a molecule in a shorter amount of computer time compared to unbiased molecular dynamics.
In molecular dynamics simulations, the total force is calculated from a potential energy function built up of simplified representations of the forces between the atoms (i.e. the force field terms), and then Newton’s equations of motions are used to push the atoms through time over a specified change in time. Metadynamics simulations artificially alter the potential energy function to discourage the system from remaining in conformations which were already explored during the simulation. This is achieved by adding artificial inverse Gaussian functions to the potential energy, which increase the total potential energy of the molecule. As the overlapping Gaussian potentials accumulate during the course of the simulation, they allow the molecule to overcome barriers between local minima and explore the energy landscape. To make these simulations feasible, you need to choose collective variables (CVs) which describe the degree(s) of freedom you wish to bias your system towards exploring.
Metadynamics simulations are therefore useful tools for generating diverse conformers or accurately mapping out free energy landscapes. In this tutorial, you will explore several applications of metadynamics to simple example systems. You will perform a simulation of the small-molecule drug zopolrestat in water for generating diverse conformers. In a second example, you will perform well-tempered metadynamics with two collective variables to explore the stacking-unstacking equilibrium in the ApA dinucleotide.
2. Importing and Preparing Structures
Download and extract the zip file here to your working directory to obtain the inputs and reference outputs for this tutorial: schrodinger.com/sites/default/files/s3/release/current/Tutorials/zip/metadynamics.zip
The input structure provided for zopolrestat has already been prepared using LigPrep and the System Builder was used to place it into a simulation box with water and one sodium counterion.
To learn how to perform these steps yourself, you can follow the instructions below with the zopolrestat.sdf structure provided in the tutorial zip archive or your own example system.
The input structure provided for the dinucleotide system was built using Build Biopolymer from Sequence, and prepared for simulation using the System Builder. As usual when simulating nucleic acids, we have added sodium and chloride ions equivalent to a 0.15M salt concentration in addition to neutralizing the system.
When setting the dimensions for the simulation box of a metadynamics simulation, keep in mind that the biasing potentials on the CVs can significantly distort the system geometry during the course of the simulation. To prevent your solute from interacting with its periodic copies, choose box dimensions based on an estimation of the maximum extent of your system rather than just the initial structure.
3. Metadynamics for Conformational Sampling
In this section, you will use metadynamics to generate conformers for a small molecule drug (zopolrestat, an aldose reductase inhibitor currently in phase II trials). While commonly used conformer generation models such as MacroModel and ConfGen use torsional sampling and rudimentary energetics to quickly return reasonably low-energy conformers, using MD-based sampling has the advantage of an explicit solvent model and more natural sampling. Unbiased MD can however get stuck in local minima or only sample very low-energy conformations, potentially missing the bioactive conformation completely.
Here, metadynamics can be helpful to speed up and extend the sampling. This type of metadynamics simulation is also quite straightforward to set up and analyze, as the CV definition is simple and there’s no need to carefully converge the PES to obtain accurate energetics if the goal is to obtain a diverse set of conformations.
3.1 Setting up a standard metadynamics simulation for a small molecule in water
In this simple example, you will use a distance CV between two atoms in the zopolrestat molecule to sample multiple torsional degrees of freedom at once. This approach is not suited to obtain a converged and accurate PES, but can efficiently explore the conformational space available to the molecule in solution.
Help, my metadynamics job crashed!?
Metadynamics simulations crashing is a common occurrence, as the biases in a metadynamics simulation can distort the system geometry enough that the resulting forces ‘blow up’ the structure. A telltale sign of this happening are error messages containing ke_ is nan or forces / momenta going to nan or inf.
In fact, every naive metadynamics simulation will eventually crash in this way due to the infinitely accumulating biases. For this example, we have deliberately kept the simulation duration very low to reduce the likelihood of crashes like this. However, as any MD has a stochastical element, you may see this example crash even if you use the same settings as we have.
This is why we recommend using well-tempered metadynamics in all but the shortest exploratory simulations. ‘Well-tempering’ refers to scaling down the strength of biases as they accumulate to fill local minima, so that it becomes far less likely that they overshoot the energy basin and distort geometry to a degree that blows up the simulation. See section 4 of this tutorial for more information on well-tempered metadynamics.
Further causes for metadynamics simulations crashing in this way can be e.g. too ‘spiky’ biasing potentials (i.e. narrow but high gaussians), badly-chosen CVs, or contradictory CVs and restraints. If a well-tempered metadynamics simulation crashes in this way, consider making the biases milder, reevaluate your CV choices, and check if restraints are really needed.
3.2 Extracting conformations from the metadynamics trajectory
You can now use the usual tools for trajectory analysis to view, extract, or cluster the conformers sampled during the simulation. For a general introduction on how to interact with MD trajectories in Maestro, see the Introduction to MD Trajectory Analysis with Desmond tutorial.
Here, you will briefly check the trajectory and visualize the sampling for the relevant torsional degrees of freedom. Then, you will extract the ligand structures from the trajectory and cluster them to identify representative ligand conformations for further use.
Comparing the clusters with the bioactive conformation of zopolrestat (e.g. from the 2HVO crystal structure), you can see that about half of the clusters cover conformations similar to the bioactive one. Note that due to the biasing potentials in the metadynamics simulations, the cluster sizes are not indicative of the relative energies of the conformers.
Sidenote: Clustering tools in the Schrödinger suite
There are several panels in the Schrödinger suite with which you can perform clustering. They perform similar calculations in the backend, but provide different options for featurization and clustering methods. Feel free to explore the panels and their documentation pages to find which one is best suited to your needs:
- Conformer Cluster Panel – straightforward to configure for geometry-based clustering of small molecules.
- Canvas Similarity and Clustering Panel – provides GUI access to most types of featurizations and clustering methods.
- Trajectory Frame Clustering Panel
- Spectral Clustering Panel
- Clustering Based on Volume Overlap Panel
4. Obtaining a potential energy surface for nucleotide unstacking with well-tempered metadynamics
In this section, we will explore the energetics of the stacking-unstacking equilibrium in a rudimentary dinucleotide system. We’ll set up the simulation parameters to allow accurate mapping of the potential energy surface. After the simulation, we will confirm the convergence and view the resulting energy landscape.
4.1 Setting up a well-tempered metadynamics simulation with two collective variables
For this system, two collective variables will be needed to obtain meaningful and interpretable results: the center-of-mass distance between the nucleobases, and the torsion around the glycosidic bond to capture their relative angles. In order to obtain a well-converged potential energy surface for this system, we will enable well-tempered metadynamics by providing the biasing parameter kTemp.
Sidenote: Building custom CVs, restraints, and metadynamics methods
Do you want to define your own custom collective variables beyond those supported in the .msj file, use custom restraint potentials, or implement complex simulation workflows (e.g. bias exchange or parallel bias metadynamics)?
You can use the enhanced sampling plugin integrated with Desmond to take full control over your metadynamics simulations. Learn more in the Custom Enhanced Sampling documentation.
4.2 Analyzing the convergence and results of the metadynamics simulation
Due to the flexible nature of the metadynamics approach, the analysis and interpretation steps will usually be tailored to the specific scientific questions of the project. Here, we will focus on confirming that the simulation has converged enough for its results to be meaningfully interpretable, and highlight how to visualize the resulting potential energy surface.
Accessing command line tools in the Schrödinger suite
Depending on your operating system, the commands to use utilities from the Schrödinger suite will look slightly different. On Linux or Mac systems, make sure the $SCHRODINGER environment variable is set appropriately. On Windows, use the Schrödinger Command Prompt or Schrödinger Powershell and omit the $SCHRODINGER prefix for any commands. See Running Schrödinger Applications from the Command Line for more details.
In addition to the usual Desmond output files, a metadynamics simulation includes files which log the values for the CVs and energy (<jobname>.cvseq) and the added biasing potentials (<jobname>.kerseq) along the trajectory. These files provide the information needed to reconstruct the PES and check whether the simulation converged.
The metadynamics_convergence_analysis.py script was written to perform the analysis steps common to most metadynamics simulations, namely various checks for convergence of the potential energy surface. In a future release, this script will be shipped with the Schrödinger suite, but for now, you can find it directly in the results folder for the metadynamics_ApA job.
First, use the metadynamics_convergence_analysis.py script included with the Schrödinger suite installation to obtain a report on a few key convergence criteria.
- Open a terminal window with a properly configured
$SCHRODINGERenvironment in the directory with the metadynamics_ApA results. -
Type
$SCHRODINGER/runmetadynamics_convergence_analysis.pymetadynamics_ApA-out.cfg metadynamics_ApA.kerseq metadynamics_ApA_convergence -bins 10and press Enter.- This script should run in 5-10 minutes.
- The results will be written to the job directory as a pdf report.
- You can also find a pre-calculated report for this job as reference_metadynamics_ApA_convergence_report.pdf in the tutorial zip archive.
-
Find the
metadynamics_ApA_convergence_report.pdfand open it in a PDF viewer of your choice. - Scroll through to see the plots and their explanations.
In a well-converged simulation like this one, you should see the PES stop noticeably changing, i.e. the differences between PESs for two consecutive chunks of time should go to zero as the simulation progresses. The script tracks time by counting how many biasing potentials were applied – in our simulation, the interval between bias updates was 0.09 ps, so 111111 hills = 10 ns.
As we performed well-tempered metadynamics, the height of the biasing potentials should also decay to a very low number at the end of the simulation. In our simulation, this metric also looks good.
If in your own simulations, you see the hill height spike up again after significantly decreasing, this indicates that the system has found a new area of the PES to explore. This may be desirable if you are still exploring areas of your PES relevant to your CVs or undesirable if your system has started changing “orthogonally”, i.e. independently of your CVs. In this case, you will need to perform further system-specific analysis to understand what is happening (e.g. plot CVs and RMSDs along the trajectory).
Finally, you will see the free energy surface for your CVs as a function of time. This can give you a visual intuition for how much the PES is still changing between one analysis chunk and the next.
More information on the metadynamics_convergence_analysis.py script
In a nutshell, this script splits the productive stage of the simulation into chunks and compares various properties between consecutive chunks. The smaller the differences between consecutive chunks, the more converged we consider the simulation.
The arguments we passed to the script were, in order:
-
The output configuration file (
<jobname>-out.cfg), containing the metadynamics settings. -
The kernel sequence file (
<jobname>.kerseq), logging all biasing potentials which were applied during the simulation. - The output file name for the report.
-
The assignment of the analysis chunks. We specified this as the number of
-binsinto which to split the simulation equidistantly. Keep the size of the chunks large enough to allow for decent sampling within each chunk and reduce statistical noise — approximately 10 ns per chunk is a good size to aim for.
This script is limited to simulations with one or two collective variables defined in the .msj file, with or without well-tempering. It also works on simulations which have crashed rather than finished cleanly. Simulations with custom .pot files are not supported.
The default analysis stage which automatically runs after a metadynamics simulation calculates and plots the total PES, which you can find as <jobname>_meta.fes (and the similarly named .png) in the job directory. To customize the plotting options, you can either use the Metadynamics Analysis panel (for simulations with up to two CVs) in Maestro or write your own script to process the <jobname>_meta.fes file and plot any properties you are interested in.
- Find and open Metadynamics Analysis from Tasks.
-
For Input file, click Browse and choose
metadynamics_ApA-out.cfgin the metadynamics_ApA job directory.- Wait a few minutes for the plot to be generated.
- Use the plot options to adjust the visualization settings to your preferences, e.g. show the snapshots as dots in the graph to visualize the sampling.
- Click the Save icon to export the plot.
Note: You can hover over the snapshots in the plot to see which frame from the trajectory they correspond to.
The PES shows two wells. The larger and deeper well corresponds to the stacked state of the dinucleotide.
5. Conclusion and References
In this tutorial, you learned how to set up and analyze metadynamics simulations for conformer exploration and obtaining accurate potential energy surfaces with well-tempered metadynamics.
For further learning:
Many workflows and products in the Schrödinger suite use custom metadynamics protocols for specific purposes. These products and workflows are robust, validated, and easier to run and analyze than custom metadynamics simulations. You can find a few examples here:
For further reading:
- Desmond User Manual, in particular the section on Metadynamics simulations
- Metadynamics panel documentation


