Exploration of the conformational space using MD simulations can waste lots of simulation time sampling the same conformational regions which does not provide any new knowledge.
Instead it would be desirable to explore more under-sampled regions of the conformational space, to overcome energetic barriers and eventually reach the desired conformation (folded protein / bound ligand etc.)
In adaptive sampling, instead of launching thousands of simulations at once from a small set of initial structures as in naive high-throughput MD, simulations are launched in sequential batches called epochs utilizing knowledge of the conformational space obtained from all previous epochs.
The starting points of the simulations in each epoch are chosen based on some criteria; in this case, it selects conformations from the most under-sampled conformational regions detected in all previous simulations. This is done by using Markov state models which discretize the conformational space into a set of most metastable states. Then the starting conformations are sampled based on a distribution related to the population of each state.
S. Doerr and G. De Fabritiis, On-the-fly learning and sampling of ligand binding by high-throughput molecular simulations, J. Chem. Theory Comput. 10 (5), pp 2064–2069(2014).
S. Doerr, M. J. Harvey, Frank Noé, and G. De Fabritiis, HTMD: High-Throughput Molecular Dynamics for Molecular Discovery J. Chem. Theory Comput. 2016 12 (4), 1845-1852
Unit of execution#
Each simulation in adaptive is associated to a single directory which contains all files to run it. To run a project it is therefore necessary to provide one or more initial simulation directories, called generators.
How to start#
Adaptive creates multiple directories which it uses to organize the simulations. The user only needs to provide a generators folder containing one sub-folder for each starting conformation containing all files needed to execute that simulation. For example:
└── generators/ ├── gen1/ │ ├── structure.pdb │ ├── input │ └── ... ├── gen2/ │ ├── structure.pdb │ ├── input │ └── ...
Then the adaptive will generate an
data and later a
filtered folder as well, looking like this:
├── data/ # Contains the completed simulations (automatically created) ├── filtered/ # Contains the completed simulations without water atoms (automatically created) ├── generators/ # Contains the initial generators provided by the user └── input/ # Contains the files needed to start all simulations of all epochs (automatically created)
Adaptive uses a naming scheme for simulations which follows the pattern:
e4s3_e2s1p0f45. This name tells us that this simulation was
generated in epoch 4 as the 3rd simulation of the batch. The starting
conformation was taken from simulation 1 of epoch 2 from the first piece
of the simulation [*] and from frame 45 of that simulation piece.
The length of each simulation is really system dependent.
It could be anything like tens of nanoseconds to hundred of nanoseconds.
As a rule of thumb use twice the expected lag time for your molecular process (e.g. for binding anything between 30 and 100 ns).
As only the coordinates files are seeded for every new epoch, simulations cannot use a velocity file. Velocities are therefore reinitialized to the Maxwell Boltzmann distribution at the given temperature.
E.g. if setting up the simulations with the
from htmd.protocols.production_v6 import Production md = Production() md.adaptive = True [...]
or directly modifying the ACEMD
input file of the simulations and
removing the binvelocities line.
Adaptive script example#
The power of adaptive sampling is accessible on HTMD through the
from htmd.ui import * app = LocalGPUQueue() app.datadir = './data' md = AdaptiveMD() md.nmin=5 md.nmax=10 md.nepochs = 30 md.app = app md.projection = MetricDistance('name CA', '(resname BEN) and ((name C7) or (name C6))', periodic='selections', metric='contacts') md.ticadim = 3 md.updateperiod = 14400 # execute every 4 hours md.run()
Execution in a notebook#
It is possible to run the adaptive scheme syncronosly or asyncrounsly.
updateperiodcontrols this behaviour.
The default is to run and exit, so
updateperiodneeds to be specified if adaptive should be run synchronously
Setting a simple cron job#
This is useful for having the script execute automatically every x hours.
Do not set
updateperiodthen, or set it to zero such that the program will execute and exit
#!/bin/bash -login # cron.sh file # use crontab -e to add this line: # 0 */4 * * * cd /pathtomydir/; ./cron.sh # python conf.py
Visualizing the starting conformations#
If we want to look at what structures were chosen as the starting conformations of a given epoch we can use a code snippet like the following:
for s in glob('input/e28s*'): # Visualize all starting conf of epoch 28 mol = Molecule(s+'/structure.pdb') mol.read(s+'/input.coor') mol.view()