From 73694323f4519c8172d8d986cf0263115e6bf1ba Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Thu, 17 Aug 2023 14:15:54 -0600 Subject: [PATCH] Fix atom index mapping in atomswap class (#267) Indices of the selected subsets were not mapped back to the atom indices before the swap. This affects the trajectory - but not the converged observables - for simulations that swap all with all, but messes up completely the case in which only a subset is actually considered --- ipi/engine/motion/atomswap.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ipi/engine/motion/atomswap.py b/ipi/engine/motion/atomswap.py index fe7bf3068..df22ffe6d 100644 --- a/ipi/engine/motion/atomswap.py +++ b/ipi/engine/motion/atomswap.py @@ -111,6 +111,10 @@ def step(self, step=None): while self.beads.names[axlist[i]] == self.beads.names[axlist[j]]: j = self.prng.rng.randint(lenlist) # makes sure we pick a real exchange + # map the "subset" indices back to the "absolute" atom indices + i = axlist[i] + j = axlist[j] + old_energy = self.forces.pot # swap the atom positions self.dbeads.q[:] = self.beads.q[:]