From 803f652a7b91f9e086a53cfacbd5dc5ddf4bab9b Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Thu, 6 Feb 2020 11:46:44 -0600
Subject: [PATCH] Distance between beads is now calculated more accurately

---
 mrdna/segmentmodel.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mrdna/segmentmodel.py b/mrdna/segmentmodel.py
index fd93c77..a11ea61 100644
--- a/mrdna/segmentmodel.py
+++ b/mrdna/segmentmodel.py
@@ -2285,8 +2285,10 @@ class SegmentModel(ArbdModel):
 
             parent = self._getParent(b1,b2)
 
-            ## TODO: could be sligtly smarter about sep
-            sep = 0.5*(b1.num_nt+b2.num_nt)
+            seg = b2.parent
+            c0 = b2.contour_position
+            sep = np.abs(b1.get_nt_position(seg,c0)-b2.get_nt_position(seg))
+
 
             is_dsdna = b1.type_.name[0] == "D" and b2.type_.name[0] == "D"
             if is_dsdna:
@@ -2348,9 +2350,11 @@ class SegmentModel(ArbdModel):
 
         if self.DEBUG: print("Adding intrahelical angle potentials")
         for b1,b2,b3 in self._get_intrahelical_angle_beads():
-            ## TODO: could be slightly smarter about sep
-            sep = 0.5*(0.5*b1.num_nt+b2.num_nt+0.5*b3.num_nt)
             parent = self._getParent(b1,b2,b3)
+            seg = b2.parent
+            c0 = b2.contour_position
+            sep = np.abs(b1.get_nt_position(seg,c0)-b2.get_nt_position(seg)) + np.abs(b3.get_nt_position(seg,c0)-b2.get_nt_position(seg))
+
 
             if b1.type_.name[0] == "D" and b2.type_.name[0] == "D" and b3.type_.name[0] == "D":
                 
-- 
GitLab