Commit 2191911b authored by cmaffeo2's avatar cmaffeo2
Browse files

Added some code for debugging

parent 8d210e3b
......@@ -317,6 +317,9 @@ class SegmentParticle(PointParticle):
orientation = np.eye(3)
o.position = self.position + orientation.dot( np.array((Segment.orientation_bond.r0,0,0)) )
def __repr__(self):
return "<SegmentParticle {} on {}[{:.2f}]>".format( self.name, self.parent, self.contour_position)
## TODO break this class into smaller, better encapsulated pieces
class Segment(ConnectableElement, Group):
......@@ -724,14 +727,12 @@ class Segment(ConnectableElement, Group):
# conn_locs = self.get_contour_sorted_connections_and_locations()
# locs = [A for c,A,B in conn_locs]
# existing_beads = [l.particle for l in locs if l.particle is not None]
# if self.name == "31-2":
# pdb.set_trace()
# if self.name == "S001":
# pdb.set_trace()
existing_beads = {l.particle for l in self.locations if l.particle is not None}
existing_beads = sorted( list(existing_beads), key=lambda b: b.get_contour_position(self) )
existing_beads0 = {l.particle for l in self.locations if l.particle is not None}
existing_beads = sorted( list(existing_beads0), key=lambda b: b.get_contour_position(self) )
if len(existing_beads) != len(set(existing_beads)):
pdb.set_trace()
for b in existing_beads:
assert(b.parent is not None)
......@@ -1329,6 +1330,7 @@ class SegmentModel(ArbdModel):
def _get_potential(self, type_, kSpring, d, max_potential = None):
key = (type_, kSpring, d, max_potential)
if key not in self._bonded_potential:
assert( kSpring >= 0 )
if type_ == "bond":
self._bonded_potential[key] = HarmonicBond(kSpring,d, rRange=(0,1200), max_potential=max_potential)
elif type_ == "angle":
......@@ -1484,9 +1486,15 @@ class SegmentModel(ArbdModel):
if len(beads) <= 1:
pdb.set_trace()
""" Get positions """
positions = bead_coordinates[ids,:].T
# print("BEADS NOT IN {}:".format(s))
# for b,c in filter(lambda z: z[0] not in s.beads, zip(beads,contours)):
# print(" {}[{:03f}]: {:0.3f}".format(b.parent.name, b.contour_position, c) )
ret = interpolate.splprep( positions, u=contours, s=0, k=1, full_output=1 )
tck = ret[0][0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment