mailr16970 - /branches/interatomic/generic_fns/dipole_pair.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on June 19, 2012 - 20:13:
Author: bugman
Date: Tue Jun 19 20:13:18 2012
New Revision: 16970

URL: http://svn.gna.org/viewcvs/relax?rev=16970&view=rev
Log:
Fixes for the dipolar_pair.define user function backend.

The return_interatom() function now returns a list!


Modified:
    branches/interatomic/generic_fns/dipole_pair.py

Modified: branches/interatomic/generic_fns/dipole_pair.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/dipole_pair.py?rev=16970&r1=16969&r2=16970&view=diff
==============================================================================
--- branches/interatomic/generic_fns/dipole_pair.py (original)
+++ branches/interatomic/generic_fns/dipole_pair.py Tue Jun 19 20:13:18 2012
@@ -62,15 +62,24 @@
                 continue
 
             # Get the interatomic data object, if it exists.
-            interatom = return_interatom(id1, id2)
+            interatoms = return_interatom(id1, id2)
+
+            # Create the container if needed.
+            if not len(interatoms):
+                interatom = create_interatom(spin_id1=id1, spin_id2=id2)
+
+            # Check the single container and alias it.
+            else:
+                # The check.
+                if len(interatoms) > 1:
+                    raise RelaxError("Multiple interatomic data containers 
found.")
+
+                # Alias.
+                interatom = interatoms[0]
 
             # Check that this has not already been set up.
-            if hasattr(interatom, 'dipole_pair') and interatom.dipole_pair:
+            if interatom.dipole_pair:
                 raise RelaxError("The magnetic dipole-dipole interaction 
already exists between the spins '%s' and '%s'." % (id1, id2))
-
-            # Create the container if needed.
-            if not interatom:
-                interatom = create_interatom(spin_id1=id1, spin_id2=id2)
 
             # Set a flag indicating that a dipole-dipole interaction is 
present.
             interatom.dipole_pair = True




Related Messages


Powered by MHonArc, Updated Tue Jun 19 20:20:13 2012