How to set awh1-dim1-diffusion and awh1-error-init properly

GROMACS version: 2023.3
GROMACS modification: No
I have been trying out the AWH accelerated sampling for gromacs to better sample the conformational space of a protein. I followed the AWH tutorial for gromacs using more or less the same mdp parameters just adjusted to fit my system. And while watching the bioexcel videos on AWH sampling I found, that from my understanding, the awh1-dim1-diffusion and awh1-error-init control how quickly the system convergences or reaches a stable state. awh1-dim1-diffusion is the initial update size and awh1-error-init helps adjust the update size. Bigger values make your system converge more quickly and vice versa. But anyway what I wanted to ask is how do you know what are appropriate values for your system? I started off with setting the values to


awh1-dim1-diffusion = 5e-5
awh1-error-init = 5

But these values slow down my simulation a lot. I got 5 ns/day. Snails crawl

Then I tried setting these values to


awh1-dim1-diffusion = 0.005
awh1-error-init = 10

Which got my simulation to 11ns/day. Snails walk

But it gave me this error


-------------------------------------------------------

Program: gmx mdrun, version 2023.3

Source file: src/gromacs/applied_forces/awh/pointstate.h (line 355)

Function: gmx::PointState::updateFreeEnergy(const gmx::BiasParams&, double)::<lambda()>

Assertion failed:

Condition: std::abs(freeEnergy_) < detail::c_largePositiveExponent

Very large free energy differences or badly normalized free energy in AWH

update.

For more information and tips for troubleshooting, please check the GROMACS

website at http://www.gromacs.org/Documentation/Errors

-------------------------------------------------------

So I was wondering if there is a method to madness or do I just mess around with my parameters until I find the right ones for my system?

Firstly, the awh1-dim1-diffusion and awh1-error-init should not affect the performance (in ns/day) of your simulations. They only affect the initial AWH update size. I would guess that there was something else that caused the 5 vs 11 ns/day performance difference.

Secondly, “Bigger values make your system converge more quickly and vice versa” is not quite true. If you choose it too large the free energy barriers may be overestimated and it may take a long time to sample them down to the “real” values.

There are no clear rules to how to set these values, but on the other hand, reasonable estimates are usually enough. Keep in mind that the difference in update size between your two examples is a factor 400, so that is quite a large difference. It seems like that second setting, with a larger initial update size, was too large. But it is a bit difficult to say for sure without knowing the rest of your settings.

The default values (1e-5 and 10, respectively) are usually good enough (slightly smaller update size than your first setting), but you might want to try 1e-4 and 10 when you first test that everything works fine.

I see, so if awh1-dim1-diffusion and awh1-error-init aren’t what’s causing the slow performance then what is? Is it because I’m running a free energy simulation? On a system of this size I get anywhere from 47-55 ns/day depending on the forcefield I’m using for standard simulations.

Yes, free energy simulations are significantly slower. This is especially noticeable if you are running on GPUs, since the non-bonded free-energy kernel can (so far) only run on CPU. If you are also using the sd integrator (recommended if one of the alchemical end states is fully, or near-fully, decoupled) then it will be even slower.

But a factor 10 slower is quite a lot. What is your nstcalcenergy setting? If you calculate energies very often, the speed loss from the free-energy kernel is more apparent.

I wasn’t sure how to set nstcalcenergy value or really what it was. I heard of it when I ran grompp it gave me a note that said

NOTE 2 [file md.mdp]:
  Setting nstcalcenergy (100) equal to nstdhdl (10)

but I didn’t know what it was for. I’m still kind of new AWH and Free energy simulations in general.