Discontinuity in bias energy function for periodic collective variables

Hi devs,

I’m trying to understand how the biased simulations for techniques like umbrella sampling work in principle. When we add a bias to the potential function for, say a dihedral collective variable, U_b(\mathbf{x}) = 0.5 k (\phi(\mathbf{x}) - \phi_0)^2, I was confused about the nature of the bias function especially since the function is periodic. Say, \phi_0 is 178, and then you have a certain configuration for which \phi is 180, so your bias would be U_b = 0.5 K * 4. If the dihedral goes further in the next step of the simulation, say to 181, it wraps around to -179. Then the bias value gets a huge spike, U_b = 0.5 K (358)^2. This is a discontinuity in the bias function, introduced by a periodic collective variable. How does gromacs deal with this?

I did try to read up a bit on the gromacs documentation here, but the mod of the delta is taken over 2 * pi, which is 360. So even in the above case, since the delta is 358, mod of that w.r.t. 360 is still 358. This left me a bit confused. If anyone could provide clarity on how gromacs handles this bias for periodic CVs, it would be much appreciated. Thanks!

The deviation of the angle is defined such that it is always between -180 and 180 degrees. So there is a jump when the deviation is 180 degrees. But in practice umbrella potentials are so tight that you never get such large deviations.

The deviation of the angle is defined such that it is always between -180 and 180 degrees.

Is this done by adding 360 whenever it goes beyond -180, and subtracting 180 whenever it goes beyond 180?

But in practice umbrella potentials are so tight that you never get such large deviations.

Is the umbrella potential the same as the one shown here? I tried looking up some documentation but it has left me unsure of the exact functional form used in practice in gromacs. Could you please tell me the function used, and where I can read more about it? In theory, I would imagine that a small enough spring constant would result in the bias not being too tight.

Adding 360 when the deviation is below -180 and subtracting 360 when above 180.

The umbrella a plain harmonic potential: 0.5 k dev^2

Got it. This makes things a lot clearer. Thank you.