Description
When performing a replica exchange simulation between walkers with different hamiltonians (e.g., different umbrellas in umbrella sampling), the hamiltonian is actually not swapped when the move is attempted. This results in the new and old hamiltonian being the same and the swap move is always accepted, even if each walker keeps feeling the same hamiltonian.
In the basic example hereafter, the two walkers have very far quadratic bias centers so they should never swap. Yet, a swap is observed (on average) once every 1000 steps and the dynamics of t 5929 he trajectories are not altered at all.
# define walkers
walkers = []
for center in [5.4, 7.6]:
bias = PlumedHamiltonian(get_plumed_input(center))
hamiltonian = model + bias
walker = Walker(
initial_structure,
hamiltonian,
temperature=623,
pressure=None,
timestep=0.5,
)
walkers.append(walker)
# replica exchange
replica_exchange(
walkers,
trial_frequency=1000,
rescale_kinetic=False,
)
When saving the trajectories, psiflow does correctly take into account the swaps to generate the final xyz files. So the issue seems to be exclusively related to the attribution of the new hamiltonian to the current structure.