From 06d13dd40cde45c5eba4f0da1ff81050bf018b88 Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Tue, 4 Feb 2025 17:23:22 -0600
Subject: [PATCH] Fix specialization of bead types to ensure unique types

---
 mrdna/RELEASE-VERSION | 2 +-
 mrdna/segmentmodel.py | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/mrdna/RELEASE-VERSION b/mrdna/RELEASE-VERSION
index 62d0329..2b38856 100644
--- a/mrdna/RELEASE-VERSION
+++ b/mrdna/RELEASE-VERSION
@@ -1 +1 @@
-1.0a.dev178
+1.0a.dev180
diff --git a/mrdna/segmentmodel.py b/mrdna/segmentmodel.py
index 82a1985..dca9d3d 100644
--- a/mrdna/segmentmodel.py
+++ b/mrdna/segmentmodel.py
@@ -2045,7 +2045,8 @@ class SegmentModel(ArbdModel):
         assert( d > 0.2 )
         if key not in self._bonded_potential:
             kT = self.configuration.temperature * 0.0019872065 # kcal/mol
-            self._bonded_potential[key] = WLCSKBond( d, lp, kT, range_=(0,1200) )
+            _pot = WLCSKBond( d, lp, kT, range_=(0,1200) )
+            self._bonded_potential[key] = _pot
         return self._bonded_potential[key]
 
     def _get_wlc_sk_angle_potential(self, d):
@@ -2764,10 +2765,10 @@ class SegmentModel(ArbdModel):
             if key in beadtype_s:
                 bead.type_ = beadtype_s[key]
             else:
-                t = deepcopy(bead.type_)
+                newname = f'{char}{beadtype_count[char]:03d}'
+                kwargs = {k:v for k,v in bead.type_.__dict__.items() if k not in ParticleType.excludedAttributes}
+                t = ParticleType( name=newname, **kwargs )
                 t.__dict__["nts"] = bead.num_nt*2 if char in ("D","O") else bead.num_nt
-                # t.name = t.name + "%03d" % (t.nts*10**decimals)
-                t.name = char + "%03d" % (beadtype_count[char])
                 t.mass = t.nts * 150
                 t.diffusivity = 120 if t.nts == 0 else min( 50 / np.sqrt(t.nts/5), 120)
                 beadtype_count[char] += 1
-- 
GitLab