Author: bugman Date: Tue Nov 12 19:54:20 2013 New Revision: 21410 URL: http://svn.gna.org/viewcvs/relax?rev=21410&view=rev Log: Created the pipe_control.mol_res_spin.pseudoatom_loop() function. This is used to loop over the spin containers corresponding to a given pseudo-atom. Modified: trunk/pipe_control/mol_res_spin.py Modified: trunk/pipe_control/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/mol_res_spin.py?rev=21410&r1=21409&r2=21410&view=diff ============================================================================== --- trunk/pipe_control/mol_res_spin.py (original) +++ trunk/pipe_control/mol_res_spin.py Tue Nov 12 19:54:20 2013 @@ -2379,6 +2379,25 @@ return seq +def pseudoatom_loop(spin=None): + """Loop over the atoms of the given pseudo-atom spin container. + + @keyword spin: The pseudo-atom spin container. + @type spin: SpinContainer instance + @return: The spins of the pseudo-atom. + @rtype: SpinContainer instance + """ + + # Check for the 'members' data structure. + if not hasattr(spin, 'members'): + return + + # Loop over the members. + for spin_id in spin.members: + # Yield the spin containers. + yield return_spin(spin_id=spin_id) + + def residue_loop(selection=None, pipe=None, full_info=False, return_id=False): """Generator function for looping over all the residues of the given selection.