From 6395dcac85c201bf4c4bb41226d820691a7eaf22 Mon Sep 17 00:00:00 2001 From: Chris Maffeo <cmaffeo2@illinois.edu> Date: Mon, 25 Mar 2019 17:00:07 -0500 Subject: [PATCH] Slightly updated bead generation code to fix problems when a segment is 1 monomer long --- mrdna/readers/segmentmodel_from_lists.py | 1 + mrdna/segmentmodel.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mrdna/readers/segmentmodel_from_lists.py b/mrdna/readers/segmentmodel_from_lists.py index 4b993d4..b13fb9a 100644 --- a/mrdna/readers/segmentmodel_from_lists.py +++ b/mrdna/readers/segmentmodel_from_lists.py @@ -82,6 +82,7 @@ def set_splines(seg, coordinates, hid, hmap, hrank, fwd, orientation=None): assert( len(ids) == 1 ) q = quaternion_from_matrix( orientation[ids[0]] ) quats = [q, q] + coords[-1] = pos + orientation[ids[0]].dot(np.array((0,0,1))) else: coords,contours,quats = [[],[],[]] diff --git a/mrdna/segmentmodel.py b/mrdna/segmentmodel.py index 5212f95..afbc295 100644 --- a/mrdna/segmentmodel.py +++ b/mrdna/segmentmodel.py @@ -958,11 +958,15 @@ class Segment(ConnectableElement, Group): if len(existing_beads) == 0 or existing_beads[0][0].get_nt_position(self,0) >= 0.5: # if len(existing_beads) > 0: # assert(existing_beads[0].get_nt_position(self) >= 0.5) - b = self._generate_one_bead( self.nt_pos_to_contour(0), 0) + c = self.nt_pos_to_contour(0) + if self.num_nt == 1: c -= 0.4 + b = self._generate_one_bead(c, 0) existing_beads = [(b,0)] + existing_beads if existing_beads[-1][0].get_nt_position(self,1)-(self.num_nt-1) < -0.5 or len(existing_beads)==1: - b = self._generate_one_bead( self.nt_pos_to_contour(self.num_nt-1), 0) + c = self.nt_pos_to_contour(self.num_nt-1) + if self.num_nt == 1: c += 0.4 + b = self._generate_one_bead(c, 0) existing_beads.append( (b,1) ) assert(len(existing_beads) > 1) @@ -2142,7 +2146,7 @@ class SegmentModel(ArbdModel): # t.name = t.name + "%03d" % (t.nts*10**decimals) t.name = char + "%03d" % (beadtype_count[char]) t.mass = t.nts * 150 - t.diffusivity = 150 if t.nts == 0 else min( 50 / np.sqrt(t.nts/5), 150) + t.diffusivity = 120 if t.nts == 0 else min( 50 / np.sqrt(t.nts/5), 120) beadtype_count[char] += 1 if self.DEBUG: print( "{} --> {} ({})".format(num_nt0, bead.num_nt, t.name) ) beadtype_s[key] = bead.type_ = t -- GitLab