From 17a5cd2f4b1e9b603e15b7718e937155a74c2d26 Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Tue, 25 Sep 2018 06:23:54 -0500
Subject: [PATCH] More robust clear_all; removes other.particle

---
 mrdna/segmentmodel.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mrdna/segmentmodel.py b/mrdna/segmentmodel.py
index fa10c4d..36fa2c7 100644
--- a/mrdna/segmentmodel.py
+++ b/mrdna/segmentmodel.py
@@ -530,6 +530,7 @@ class Segment(ConnectableElement, Group):
         self.beads = []
         for c,loc,other in self.get_connections_and_locations():
             loc.particle = None
+            other.particle = None
 
     def contour_to_nt_pos(self, contour_pos, round_nt=False):
         nt = contour_pos*(self.num_nt) - 0.5
@@ -1613,7 +1614,7 @@ class SegmentModel(ArbdModel):
             for c,A,B in s.get_connections_and_locations():
                 for l in (A,B):
                     if l.particle is not None:
-                        locParticles.append(A.particle)
+                        locParticles.append(l.particle)
         assert( len(locParticles) == 0 )
         assert( len([b for s in self.segments for b in s.beads]) == 0 )
 
-- 
GitLab