From d00d4bcfb834c6a075ae26a3f056d35127b3b0d0 Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Wed, 10 Jun 2020 13:28:57 -0500
Subject: [PATCH] Added lazy lookup of attributes from parents for ParticleType
 objects

---
 mrdna/arbdmodel/__init__.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mrdna/arbdmodel/__init__.py b/mrdna/arbdmodel/__init__.py
index 1708211..b5d894b 100644
--- a/mrdna/arbdmodel/__init__.py
+++ b/mrdna/arbdmodel/__init__.py
@@ -341,7 +341,12 @@ class ParticleType():
     def __init__(self, name, charge=0, parent=None, **kargs):
         """ Parent type is used to fall back on for nonbonded interactions if this type is not specifically referenced """
 
-        self.name        = name
+        if parent is not None:
+            for k,v in parent.__dict__.items():
+                if k not in ParticleType.excludedAttributes:
+                    self.__dict__[k] = v
+
+        self.name   = name
         self.charge = charge
         self.parent = parent
 
-- 
GitLab