Skip to content

HREX does not evaluate custom biases properly? #1326

@Clownshift

Description

@Clownshift

Dear Devs,

TL;DR: I believe that custom biases are not passed on properly between replicas and therefore the acceptance probably cannot be calculated properly.

Context:
I want to run Hamiltonian Replica Exchange (HREX) with Gromacs, through plumed. Specifically, I am using gromacs-2024.2 with plumed-2.9.2. I do not want to go into too much detail here, but the idea is to have really different custom bias potentials in the different replicas. Essentially, I want to do bias exchange simulations, but not with metadynamics, or harmonic potentials, but with custom functional form.

If I do "regular replica exchange" with my custom potentials I do see exchanges, also with some exchange probability that is somewhere between [0,1], so not everything is accepted, but only conformations that are favorable. So there everything behaves as expected. However, I am aware that if I omit the -hrex flag for mdrun, a different acceptance function is evaluated, which does not yield the correct ensemble.

Now, if I use the -hrex flag I always get zero acceptance probability, even if the custom bias function is identical in all replicas. Also, the dplumed energies are enormously high. I think this is a bug, but I do not quite understand what is going on there.

This is a somewhat non-sensical example that already produces the problem. I have three replicas in paths r0 r1 r2 and they all use the same plumed.dat file. In this case, I actually set all biases to zero (for demonstration).

#These will be different custom potentials actually.
l0: CONSTANT VALUE=0.0  # DEBUG
l1: CONSTANT VALUE=0.0  # DEBUG
l2: CONSTANT VALUE=0.0  # DEBUG

#This is hack to use different custom potentials in different replicas
f0: COMBINE ARG=l0 PERIODIC=NO COEFFICIENTS=@replicas:1,0,0
f1: COMBINE ARG=l1 PERIODIC=NO COEFFICIENTS=@replicas:0,1,0
f2: COMBINE ARG=l2 PERIODIC=NO COEFFICIENTS=@replicas:0,0,1

all_f: COMBINE ARG=f0,f1,f2 PERIODIC=NO
b: BIASVALUE ARG=all_f

#plumed output file
PRINT ARG=l0,l1,l2,b.bias, STRIDE=1000 FILE=COLVAR.tsv

if I run this with gromacs:

mpirun -np 3 gmx_mpi mdrun -deffnm npt \
               -multidir r{0..2} -hrex -replex 500 \
               -plumed ../plumed.dat  # use the same plumed file for all

for all exchanges I get exchange attempts like this one:

Replica exchange at step 500 time 1.00000
Repl 0 <-> 1  dE_term = -0.000e+00 (kT)
  dpV = -0.000e+00  d =  0.000e+00
dplumed =  2.624e+05  dE_Term =  2.624e+05 (kT)
Repl ex  0    1    2
Repl pr   .00     

in the colvar file, as expected, everything is always zero (all l0,l1,l2,b.bias)

Am I missing something, or is this really a bug?

In case you need any further info, I am happy to help.
Thanks for your help!


Some additional info, just for completeness.

At the beginning of the simulation, gromacs sets Changing nstlist from 20 to 100, to thats still fine for -replex=500.

With the dummy example I provided above, if I omit the -hrex flag, all exchanges are (as expected) always accepted

Replica exchange at step 500 time 1.00000
Repl 0 <-> 1  dE_term = -0.000e+00 (kT)
  dpV = -0.000e+00  d = -0.000e+00
dplumed =  0.000e+00  dE_Term =  0.000e+00 (kT)
Repl ex  0 x  1    2
Repl pr   1.0     

I also tried setting up my folder structure with a shared plumed file + separate files in the different replica paths, like described here, in this way, I would get rid of the hack with @replicas:1,0,0, but simply have a different definition of f and of b in the different paths. While I generally think setting up the files like that is more elegant, it doesn't make a difference here. It led to the same results for me (as it should).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions