diff --git a/mrdna/readers/cadnano_segments.py b/mrdna/readers/cadnano_segments.py index 205ad5708de9b064284769a76713e85feea6e84d..689b138a88c81263da59501c711acabd805a5037 100644 --- a/mrdna/readers/cadnano_segments.py +++ b/mrdna/readers/cadnano_segments.py @@ -185,6 +185,11 @@ class cadnano_part(SegmentModel): local_twist = False ): self.part = part + try: + self.lattice_type = part.getGridType().name.lower() + except: + print("WARNING: unable to set cadnano lattice type") + self._cadnano_part_to_segments(part) # SegmentModel.__init__(self,...) # self.segments = [seg for hid,segs in self.helices.items() for seg in segs] diff --git a/mrdna/segmentmodel.py b/mrdna/segmentmodel.py index 245e206bd9f679f62d7edd519aa7fd973ce06000..00cb90546a96e64732561f8ee40667303649e1a6 100644 --- a/mrdna/segmentmodel.py +++ b/mrdna/segmentmodel.py @@ -191,6 +191,8 @@ class ConnectableElement(): self.connections.append(connection) if other is not self: other.connections.append(connection) + else: + raise NotImplementedError("Segments cannot yet be connected to themselves; if you are attempting to make a circular object, try breaking the object into multiple segments") l = A.container.locations if A not in l: l.append(A) l = B.container.locations @@ -265,6 +267,10 @@ class SegmentParticle(PointParticle): return seg.contour_to_nt_pos(pos) def get_contour_position(self,seg): + """ TODO: fix paradigm where a bead maps to exactly one location in a polymer + - One way: modify get_contour_position to take an optional argument that indicates where in the polymer you are looking from + """ + if seg == self.parent: return self.contour_position else: @@ -492,6 +498,7 @@ class Segment(ConnectableElement, Group): r = self.contour_to_position(u) ids = Segment.__filter_contours(u, r, position_filter, contour_filter) + if len(ids) == 0: return ## Translate r[ids,:] = r[ids,:] + dr[np.newaxis,:] @@ -502,6 +509,7 @@ class Segment(ConnectableElement, Group): r = self.contour_to_position(u) ids = Segment.__filter_contours(u, r, position_filter, contour_filter) + if len(ids) == 0: return if about is None: ## TODO: do this more efficiently @@ -2715,6 +2723,12 @@ class SegmentModel(ArbdModel): lattice_type = self.lattice_type except: lattice_type = "square" + else: + try: + if lattice_type != self.lattice_type: + print("WARNING: printing ENM with a lattice type ({}) that differs from model's lattice type ({})".format(lattice_type,self.lattice_type)) + except: + pass if lattice_type == "square": enmTemplate = enmTemplateSQ diff --git a/mrdna/simulate.py b/mrdna/simulate.py index c069b1db042d3225c92b9cfe18566c4e977fc07e..579d047ccf6b943ba1fec411db589da59fa62d00 100644 --- a/mrdna/simulate.py +++ b/mrdna/simulate.py @@ -4,9 +4,6 @@ from .coords import readArbdCoords, readAvgArbdCoords import shutil from . import get_resource_path -arbd="/home/cmaffeo2/development/cuda/arbd.dbg/src/arbd" # reduced the mem footprint cause vmd -namd="/home/cmaffeo2/development/namd-bin/NAMD_Git-2017-07-06_Linux-x86_64-multicore-CUDA/namd2" - ## TODO: implement replicas, initial conditions specified through some restart, and a custom simulation schedule