From 9d72d7341ea00cdb7966e3d4b748dab3ab427a8c Mon Sep 17 00:00:00 2001
From: Rafael Ravedutti <rafaelravedutti@gmail.com>
Date: Thu, 13 Oct 2022 15:40:21 +0200
Subject: [PATCH] Fix exchange

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
---
 src/pairs/sim/comm.py       | 2 +-
 src/pairs/sim/simulation.py | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/pairs/sim/comm.py b/src/pairs/sim/comm.py
index a881d04..5bd9e47 100644
--- a/src/pairs/sim/comm.py
+++ b/src/pairs/sim/comm.py
@@ -263,7 +263,7 @@ class RemoveExchangedParticles_part1(Lowerable):
     @pairs_host_block
     def lower(self):
         self.sim.module_name("remove_exchanged_particles_pt1")
-        send_pos = self.sim.add_temp_var(self.sim.nlocal)
+        send_pos = self.sim.add_temp_var(self.sim.nlocal - 1)
         for i in For(self.sim, 0, self.comm.nsend_all):
             particle_id = self.comm.send_map[i]
             for need_copy in Branch(self.sim, particle_id < self.sim.nlocal - self.comm.nsend_all):
diff --git a/src/pairs/sim/simulation.py b/src/pairs/sim/simulation.py
index 8f2ab56..ca7d567 100644
--- a/src/pairs/sim/simulation.py
+++ b/src/pairs/sim/simulation.py
@@ -253,7 +253,6 @@ class Simulation:
 
         timestep = Timestep(self, self.ntimesteps, [
             (comm.exchange(), 20),
-            (EnforcePBC(self), 20),
             (comm.borders(), comm.synchronize(), 20),
             (CellListsBuild(self, self.cell_lists), 20),
             (NeighborListsBuild(self, self.neighbor_lists), 20),
-- 
GitLab