Commit 15b4880d authored by cmaffeo2's avatar cmaffeo2
Browse files

Misc. small edits

1) Fixed lattice_type setting for cadnano structures, affecting ENM
2) Raise exception for circular segments (sites that loop such as RNA stem loops remain problematic)
3) Made translate and rotate functions return if nothing is selected by filter
parent 5baef287
......@@ -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]
......
......@@ -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
......
......@@ -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
......
Supports Markdown
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