From 2896df2140b6993beed0f31956dd7b7356ab6104 Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Thu, 4 Jan 2018 17:16:31 -0500
Subject: [PATCH] avoid that occasional neighbor lists requested from commands
 linger around for too long and thus cause segementation faults

---
 src/create_bonds.cpp | 4 ++++
 src/delete_atoms.cpp | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp
index c62c6df91c..2f6624f011 100644
--- a/src/create_bonds.cpp
+++ b/src/create_bonds.cpp
@@ -306,6 +306,10 @@ void CreateBonds::many()
               nadd_bonds,atom->nbonds);
     }
   }
+  // trigger clearing the list of available neighbor list requests
+  // and a full rebuild of them during the next run setup.
+  // otherwise the request from this command may linger around.
+  neighbor->init();
 }
 
 /* ---------------------------------------------------------------------- */
diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp
index 489c5bf5d5..a4219dbecb 100644
--- a/src/delete_atoms.cpp
+++ b/src/delete_atoms.cpp
@@ -407,6 +407,10 @@ void DeleteAtoms::delete_overlap(int narg, char **arg)
       break;
     }
   }
+  // trigger clearing the list of available neighbor list requests
+  // and a full rebuild of them during the next run setup.
+  // otherwise the request from this command may linger around.
+  neighbor->init();
 }
 
 /* ----------------------------------------------------------------------
-- 
GitLab