Skip to content

Commit

Permalink
Fixed a bug and improved debug outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ceriottm committed Aug 17, 2023
1 parent 1b9cf2e commit 818a006
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions ipi/engine/motion/atomswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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)

0 comments on commit 818a006

Please sign in to comment.