Commit bd20f326 authored by cmaffeo2's avatar cmaffeo2
Browse files

Fixed some small bugs; updated intrahelical iteration to use linked-list...

Fixed some small bugs; updated intrahelical iteration to use linked-list scheme; updated bead generation
parent 7eb2c616
......@@ -177,13 +177,16 @@ class Parent():
class Child():
def __init__(self, parent=None):
self.parent = parent
if parent is not None:
assert( isinstance(parent, Parent) )
parent.children.append(self)
def __getattr__(self, name):
"""
Try to get attribute from the parent
"""
# if self.parent is not None:
if "parent" not in self.__dict__ or self.__dict__["parent"] is None:
if "parent" not in self.__dict__ or self.__dict__["parent"] is None or name is "children":
raise AttributeError("'{}' object has no attribute '{}'".format(type(self).__name__, name))
# if ismethod(ret):
# raise AttributeError("Is Method!")
......@@ -245,6 +248,7 @@ class ParticleType():
excludedAttributes = ("idx","type_",
"position",
"children",
"parent", "excludedAttributes",
)
......@@ -294,7 +298,10 @@ class ParticleType():
class PointParticle(Transformable, Child):
def __init__(self, type_, position, name="A", segname="A", **kwargs):
Child.__init__(self, parent=None)
parent = None
if 'parent' in kwargs:
parent = kwargs['parent']
Child.__init__(self, parent=parent)
Transformable.__init__(self,position)
self.type_ = type_
......@@ -420,7 +427,7 @@ class PdbModel(Transformable, Parent):
data = dict(
idx = idx,
segname = "A",
resid = "%d%c%c" % (idx," "," "), # TODO: work with large indeces
resid = "%d%c%c" % (idx," "," "), # TODO: work with large indices
name = p.type_.name[:1],
resname = p.type_.name[:3],
type = p.type_.name[:1],
......
This diff is collapsed.
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