From 818a0061b3a43fb7f215609a3f7abfd2bc72980e Mon Sep 17 00:00:00 2001 From: Michele Ceriotti Date: Thu, 17 Aug 2023 10:18:23 -0700 Subject: [PATCH] Fixed a bug and improved debug outputs --- ipi/engine/motion/atomswap.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/ipi/engine/motion/atomswap.py b/ipi/engine/motion/atomswap.py index d0afec2ca..88dffebcf 100644 --- a/ipi/engine/motion/atomswap.py +++ b/ipi/engine/motion/atomswap.py @@ -173,6 +173,7 @@ def step(self, step=None): # pick actual atom indices i = axlist[i] j = axlist[j] + print(f"Trying {self.beads.names[i]} <--> {self.beads.names[j]}") # swap the atom positions if self.reference_lattice is None: @@ -223,24 +224,25 @@ def step(self, step=None): new_q[axlist[region_i[0]]] = self.region_lattice[j] + region_i[1] new_q[axlist[region_j[0]]] = self.region_lattice[i] + region_j[1] self.dbeads.q[:] = new_q.flatten() + + + for i in axlist[region_i[0]]: + mc = self.MinContact(i) + if mc<2: + print("XXXXX", end=" ") + print(mc, end=" ") + + for i in axlist[region_j[0]]: + mc = self.MinContact(i) + if mc<2: + print("XXXXX", end=" ") + print(mc, end=" ") + print(" << contacts") new_energy = self.dforces.pot pexchange = np.exp(-betaP * (new_energy - old_energy)) print(" ", pexchange) - for i in axlist[region_i[0]]: - mc = self.MinContact(i) - if mc<2: - print("XXXXX", end=" ") - print(mc, end=" ") - - for i in axlist[region_j[0]]: - mc = self.MinContact(i) - if mc<2: - print("XXXXX", end=" ") - print(mc, end=" ") - print(" << contacts") - # attemps the exchange, and actually propagate the exchange if something has happened if pexchange > self.prng.u: nexch += 1 @@ -257,8 +259,5 @@ def step(self, step=None): l_idx_j = self.lattice_idx[j] self.ealc += -(new_energy - old_energy) -<<<<<<< HEAD print("EXCHANGE!") -======= ->>>>>>> db008e1612f3cb407b44dd8dc169a249226cce3f print("attempts", ntries, nexch)