mailr13929 - /1.3/generic_fns/mol_res_spin.py


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

Header


Content

Posted by edward on July 27, 2011 - 16:15:
Author: bugman
Date: Wed Jul 27 16:15:41 2011
New Revision: 13929

URL: http://svn.gna.org/viewcvs/relax?rev=13929&view=rev
Log:
Modified the create_spin() function to overwrite the first spin if empty.


Modified:
    1.3/generic_fns/mol_res_spin.py

Modified: 1.3/generic_fns/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/mol_res_spin.py?rev=13929&r1=13928&r2=13929&view=diff
==============================================================================
--- 1.3/generic_fns/mol_res_spin.py (original)
+++ 1.3/generic_fns/mol_res_spin.py Wed Jul 27 16:15:41 2011
@@ -1074,11 +1074,19 @@
     if not res_cont:
         res_cont = cdp.mol[0].res[0]
 
-    # Add the spin.
-    res_cont.spin.add_item(spin_num=spin_num, spin_name=spin_name)
+    # Rename the spin, if only a single one exists and it is empty.
+    if len(res_cont.spin) == 1 and res_cont.spin[0].is_empty():
+        spin_cont = res_cont.spin[0]
+        spin_cont.name = spin_name
+        spin_cont.num = spin_num
+
+    # Otherwise add the spin.
+    else:
+        res_cont.spin.add_item(spin_num=spin_num, spin_name=spin_name)
+        spin_cont = res_cont.spin[-1]
 
     # Return the spin.
-    return res_cont.spin[-1]
+    return spin_cont
 
 
 def convert_from_global_index(global_index=None, pipe=None):




Related Messages


Powered by MHonArc, Updated Wed Jul 27 16:40:02 2011