Metadynamics .pot Files
- Overview
- Examples
Metadynamics is built on the enhanced sampling plugin, and can be customized and run in the same way that has been detailed for any enhanced sampling calculation. It is entirely possible to run a metadynamics calculation without the use of a .pot file. However using one may make certain calculations easier to implement, and allow for more advanced interactions with the system.
The declare_meta keyword is used in the .pot file to specify the calculation as a metadynamics one, and allows for user-specification of parameters like the dimensionality (how many collective variables), and settings like frequency and the output filename. Note that the arguments to declare_meta largely overlap with those of the multisim meta parameter; multisim translates those to Desmond in the same way it would a .pot file.
The syntax for declare_meta is declare_meta(dimension, cutoff, first, interval, name), where dimension defines the dimension of the collective variable space, cutoff is the cutoff number of kernel widths collective variables can be from the center of a kernel (otherwise the kernel is not computed), first is the first time at which a Gaussian is added, interval determines the time between Gaussian drops, name is the name of the output kernel sequence file, and initial gives the location of a file containing kernels to be added at the beginning of a simulation.
The meta keywords is used in the body of the .pot file, and is used to update the specified metadynamics accumulator with a new Guassian function. It also evaluates the accumulator at the specified position. The return value forms part of the biasing potential returned by the .pot file.
The syntax is meta(meta_acc, height_width, collective_vars), where meta_acc is the index of the desired accumulator in the overall set of metadynamics accumulators, height_width is an array of height and widths to use for newly-inserted kernels, and collective_vars is an expression for the collective variable. The length of the collective variables array is equal to the dimension of the accumulator, and the length of the height_width array is one more than the dimension of the accumulator. The height is the value of the kernel at its center. The height_width array is only evaluated when a kernel is added to the potential.
Metadynamics for a Dihedral Angle
This example demonstrates the use of metadynamics on dihedral angles. In this case, the sine and cosine of the angle are biased to avoid the derivative singularities associated with inverse trigonometry.
Biasing angles based on sine and cosine can be understood in the following way. For a Gaussian centered at sin(ɸ) and cos(ɸ) with width w, we have:
In the case that the width is small, this function is approximately a Gaussian in the angles with width w. This function differs only by normalization from the normal distribution on the circle, also known as the von Mises distribution.
declare_meta( dimension = 2, # for sine and cosine
cut = 9, # in units for widths
first = 0.0, # begin dropping immediately
interval = 0.200, # wait .2 picoseconds between drops
name = "kerseq", # log kernels to kerseq
initial = ""); # no initial kernel file
p = atomsel("index 14 15 16 17");
# height is 0.2 and widths are both .1
meta(0, array(0.2, 0.1, 0.1), dihedral_gid(p[0], p[1], p[2], p[3]));
Well-Tempered Metadynamics
This example will use well-tempered metadynamics to demonstrate metadynamics with dynamically varying heights.
For well-tempered metadynamics, the height of a Gaussian added at time t is given by
where h0 is the initial height, Vt(x) is the metadynamics potential at the center position, and T1 is a user-specified temperature. Since the metadynamics potential must be known before the Gaussian is added, a small trick is used. To evaluate the metadynamics potential without changing the potential, metadynamics is called with a height of 0.0. In this case, Gaussian kernels are added by this evaluation, but they do not contribute to the potential. They are, however, present in the kernel sequence file.
declare_meta( dimension = 1, cutoff = 9, first = 0.0, interval = 0.200, name="kerseq", initial="");
p = atomsel("index 0 1");
h_0 = 0.020; # initial height of gaussians
w = 0.1; # width of gaussians
kT1 = 0.6; # sampling temperature
cv = dist(p[1], p[0]); #collective variable is interatomic distance
meta(0, array(h_0 * exp( meta(0, array(0, 0), cv) / -kT1), w), cv);
Metadynamics with a Wall
This example demonstrates the use of a wall to prevent metadynamics from driving the collective coordinates too far. The form of this wall is h_wall / ( 1 + exp( (x_0 - c) / w_wall) ), where h_wall is the wall height, x_0 is the location of the wall, c is the collective variable, and w_wall is the width of the wall. The wall potential is added as an umbrella potential to the enhanced sampling symbolic expression.
declare_meta( dimension=1, cutoff=9, first=0.0, interval=0.200, name="kerseq", initial="");
p = atomsel("index 0 1");
cv = dist(p[1], p[0]); # collective variable
x0 = 14; # wall location
w_wall = 0.2; # wall width
h_wall = 1000; # wall height
wall = h_wall / (1 + exp( (x0-cv) / w_wall) );
wall + meta(0, array(0.2, 0.1), cv);