mailr5144 - /1.3/generic_fns/selection.py


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

Header


Content

Posted by edward on March 22, 2008 - 18:36:
Author: bugman
Date: Sat Mar 22 18:36:01 2008
New Revision: 5144

URL: http://svn.gna.org/viewcvs/relax?rev=5144&view=rev
Log:
Created the new function generic_fns.selection.return_spin_from_index().


Modified:
    1.3/generic_fns/selection.py

Modified: 1.3/generic_fns/selection.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/selection.py?rev=5144&r1=5143&r2=5144&view=diff
==============================================================================
--- 1.3/generic_fns/selection.py (original)
+++ 1.3/generic_fns/selection.py Sat Mar 22 18:36:01 2008
@@ -845,6 +845,36 @@
     return spin_container
 
 
+def return_spin_from_index(global_index=None, pipe=None):
+    """Function for returning the spin data container corresponding to the 
global index.
+
+    @param global_index:    The global spin index, spanning the molecule and 
residue containers.
+    @type global_index:     int
+    @param pipe:            The data pipe containing the spin.  Defaults to 
the current data pipe.
+    @type pipe:             str
+    @return:                The spin specific data container.
+    @rtype:                 instance of the SpinContainer class.
+    """
+
+    # The data pipe.
+    if pipe == None:
+        pipe = relax_data_store.current_pipe
+
+    # Test the data pipe.
+    pipes.test(pipe)
+
+    # Loop over the spins.
+    spin_num = 0
+    for spin in spin_loop():
+        # Match to the global index.
+        if spin_num == global_index:
+            # Return the spin.
+            return spin
+
+        # Increment the spin number.
+        spin_num = spin_num + 1
+
+
 def return_single_molecule_info(molecule_token):
     """Return the single molecule name corresponding to the molecule token.
 




Related Messages


Powered by MHonArc, Updated Sat Mar 22 18:40:15 2008