From d17a1b56c71ac9cd0cdf08c08398f60dae90b2d7 Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Mon, 8 Apr 2019 10:32:56 -0500
Subject: [PATCH] Bug fix for previous commit

---
 mrdna/segmentmodel.py | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/mrdna/segmentmodel.py b/mrdna/segmentmodel.py
index 6250250..9434d4b 100644
--- a/mrdna/segmentmodel.py
+++ b/mrdna/segmentmodel.py
@@ -2399,7 +2399,7 @@ class SegmentModel(ArbdModel):
 
             sign = 1 if b1_on_fwd_strand else -1
 
-            # if b1.parent.name == "D72" or b2.parent.name == "D72":
+            # if b1.parent.name == "8-1" or b2.parent.name == "8-1":
             #     print()
             #     print(b1.parent.name, b2.parent.name, b1_on_fwd_strand)
             #     import pdb
@@ -2494,7 +2494,7 @@ class SegmentModel(ArbdModel):
 
         """ Functions for adding crossover potentials  """
         def add_ss_crossover_potentials(connection,A,B, add_bond=True):
-            b1,b2 = [loc.particle for loc in (c.A,c.B)]
+            b1,b2 = [loc.particle for loc in (A,B)]
 
             if (b1,b2,A.on_fwd_strand,B.on_fwd_strand) in processed_crossovers:
                 return
@@ -2524,7 +2524,7 @@ class SegmentModel(ArbdModel):
 
         def add_crossover_potentials(connection,A,B):
             ## TODO: use a better description here
-            b1,b2 = [loc.particle for loc in (c.A,c.B)]
+            b1,b2 = [loc.particle for loc in (A,B)]
             if (b1,b2,A.on_fwd_strand,B.on_fwd_strand) in processed_crossovers:
                 return
 
@@ -2542,8 +2542,8 @@ class SegmentModel(ArbdModel):
 
             """ Add parallel helices potential, possibly """
             ## Add potential to provide a particular orinetation
-            nt1,nt2 = [l.get_nt_pos() for l in (c.A,c.B)]
-            is_end1, is_end2 = [nt in (0,l.container.num_nt-1) for nt,l in zip((nt1,nt2),(c.A,c.B))]
+            nt1,nt2 = [l.get_nt_pos() for l in (A,B)]
+            is_end1, is_end2 = [nt in (0,l.container.num_nt-1) for nt,l in zip((nt1,nt2),(A,B))]
             is_T_junction = (is_end1 and not is_end2) or (is_end2 and not is_end1)
 
             if (not is_end1) and (not is_end2):
@@ -2558,41 +2558,41 @@ class SegmentModel(ArbdModel):
                 if is_T_junction:
                     """ Special case: one helix extends away from another in T-shaped junction """
                     if is_end1:
-                        b1_forward = c.A.on_fwd_strand if nt1 == 0 else not c.A.on_fwd_strand
-                        add_local_tee_orientation_potential(b1,b2, b1_forward, c.B.on_fwd_strand)
+                        b1_forward = A.on_fwd_strand if nt1 == 0 else not A.on_fwd_strand
+                        add_local_tee_orientation_potential(b1,b2, b1_forward, B.on_fwd_strand)
                     else:
-                        add_local_crossover_strand_orientation_potential(b1,b2, c.A.on_fwd_strand)
+                        add_local_crossover_strand_orientation_potential(b1,b2, A.on_fwd_strand)
 
                     if is_end2:
-                        b2_forward = c.B.on_fwd_strand if nt2 == 0 else not c.B.on_fwd_strand
-                        add_local_tee_orientation_potential(b2,b1, b2_forward, c.A.on_fwd_strand)
+                        b2_forward = B.on_fwd_strand if nt2 == 0 else not B.on_fwd_strand
+                        add_local_tee_orientation_potential(b2,b1, b2_forward, A.on_fwd_strand)
                     else:
-                        add_local_crossover_strand_orientation_potential(b2,b1, c.B.on_fwd_strand)
+                        add_local_crossover_strand_orientation_potential(b2,b1, B.on_fwd_strand)
 
                 else:
                     """ Normal case: add orientation potential """
-                    add_local_crossover_strand_orientation_potential(b1,b2, c.A.on_fwd_strand)
-                    add_local_crossover_strand_orientation_potential(b2,b1, c.B.on_fwd_strand)
+                    add_local_crossover_strand_orientation_potential(b1,b2, A.on_fwd_strand)
+                    add_local_crossover_strand_orientation_potential(b2,b1, B.on_fwd_strand)
             
 
         """ Add connection potentials """
         processed_crossovers = set()
         # pdb.set_trace()
         for c,A,B in self.get_connections("sscrossover"):
-            p1,p2 = [loc.container for loc in (c.A,c.B)]
+            p1,p2 = [loc.container for loc in (A,B)]
 
             assert(any([isinstance(p,SingleStrandedSegment) for p in (p1,p2)]))
             add_ss_crossover_potentials(c,A,B)
 
         for c,A,B in self.get_connections("intrahelical"):
-            ps = [loc.container for loc in (c.A,c.B)]
+            ps = [loc.container for loc in (A,B)]
 
             if any([isinstance(p,SingleStrandedSegment) for p in ps]) and \
                any([isinstance(p,DoubleStrandedSegment) for p in ps]):
                 add_ss_crossover_potentials(c,A,B, add_bond=False)
 
         for c,A,B in sum([self.get_connections(term) for term in ("crossover","terminal_crossover")],[]):
-            p1,p2 = [loc.container for loc in (c.A,c.B)]
+            p1,p2 = [loc.container for loc in (A,B)]
 
             if any([isinstance(p,SingleStrandedSegment) for p in (p1,p2)]):
                 add_ss_crossover_potentials(c,A,B)
-- 
GitLab