Metadynamics is a way of overcoming energetic barriers in molecular simulation (Laio & Parrinello, 2002). It’s part of a class of algorithms that focus on making rare-events more frequent in simulations. It’s been getting quite popular: it even has it’s own wikipedia page. One problem with the method is that it has systematic errors at boundaries and this was recently fixed via a method introduced by Michael McGovern and Juan de Pablo (McGovern & de Pablo, 2013). I’m recording the equations here in, since I use an implementation of it and the derivatives weren’t shown in the manuscript, which are necessary for the implementation. Perhaps one of the handful of other people in the world that would care about this may stumble upon my blog one day. I should also say that the method has been very useful in my own research and I’m a big fan.

The equation for the bias added with the McGovern-de Pablo Hills is

$V(\vec{s}) = \frac{W e^{\sum_i^N\frac{-(x_i - s_i)^2}{2\sigma_i^2}}}{\prod_i^N C_i \left[\erf\left(\frac{s_i - L_i}{\sqrt{2}\sigma_i}\right) + \erf\left(\frac{U_i - s_i}{\sqrt{2}\sigma_i}\right)\right]}$
$C_i = \sqrt{\frac{\pi}{2}}\frac{\sigma_i}{U_i - L_i}$

where $W$ is the hill height parameter, $s_i$ is the observed sample in the $i$th collective variable, $\sigma_i$ is collective variable width, $L_i$ is the lower boundary of the $i$th collective variable and $U_i$ is the upper boundary. We can break up the equation into component pieces like so

$V(\vec{s}) = \frac{f(\vec{s})}{\prod_i^N g_i(\vec{s})}$
$f(\vec{s}) = W e^{\sum_i^N\frac{-(x_i - s_i)^2}{2\sigma_i^2}}$
$g_i(s_i) = C_i \left[\erf\left(\frac{s_i - L_i}{\sqrt{2}\sigma_i}\right) + \erf\left(\frac{U_i - s_i}{\sqrt{2}\sigma_i}\right)\right]$

Finally, the derivative, which is not shown in the manuscript, is

$\frac{\partial V(\vec{s})}{\partial s_j} = \frac{\frac{\partial f(\vec{s})}{\partial s_j} - \frac{f(\vec{s})}{g_j(s_j)}\frac{\partial g_j(s_j)}{\partial s_j}}{\prod_i^N g(\vec{s})}$
$\frac{\partial f(\vec{s})}{\partial s_j} = -\frac{W(x_j - s_j)}{\sigma^2}e^{\sum_i \frac{-(x_i - s_i)^2}{2\sigma_i^2}}$
$\frac{\partial g_i(s_i)}{\partial s_i} = \frac{C_i}{2\sigma_i}\sqrt{\frac{2}{\pi}}\; \left[e^{-\frac{(s_i - L_i)^2}{2\sigma_i^2}} - e^{-\frac{(U_i - s_i)^2}{2\sigma_i^2}} \right]$

# Cited References

1. Laio, A., & Parrinello, M. (2002). Escaping free-energy minima. Proceedings of the National Academy of Sciences of the United States of America, 99(20), 12562–6. http://doi.org/10.1073/pnas.202427399
2. McGovern, M., & de Pablo, J. (2013). A boundary correction algorithm for metadynamics in multiple dimensions. The Journal of Chemical Physics, 139(8), 084102. http://doi.org/10.1063/1.4818153