Author: bugman Date: Tue Oct 7 17:47:01 2014 New Revision: 26195 URL: http://svn.gna.org/viewcvs/relax?rev=26195&view=rev Log: Removal of repetitive code in the relaxation dispersion model_loop() API method. The spin loop does not need to be called twice, instead the if statements have been modified to better direct the code execution. Modified: trunk/specific_analyses/relax_disp/api.py Modified: trunk/specific_analyses/relax_disp/api.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/api.py?rev=26195&r1=26194&r2=26195&view=diff ============================================================================== --- trunk/specific_analyses/relax_disp/api.py (original) +++ trunk/specific_analyses/relax_disp/api.py Tue Oct 7 17:47:01 2014 @@ -846,24 +846,7 @@ """ # Loop over individual spins for the R2eff model. - if hasattr(cdp, 'model_type'): - if cdp.model_type == MODEL_R2EFF: - # The spin loop. - for spin, spin_id in spin_loop(return_id=True): - # Skip deselected spins - if not spin.select: - continue - - # Yield the spin ID as a list. - yield [spin_id] - - # The cluster loop. - else: - for spin_ids in loop_cluster(skip_desel=False): - yield spin_ids - - # If no model is present, then set the values. - else: + if not hasattr(cdp, 'model_type') or cdp.model_type == MODEL_R2EFF: # The spin loop. for spin, spin_id in spin_loop(return_id=True): # Skip deselected spins @@ -872,6 +855,11 @@ # Yield the spin ID as a list. yield [spin_id] + + # The cluster loop. + else: + for spin_ids in loop_cluster(skip_desel=False): + yield spin_ids def model_statistics(self, model_info=None, spin_id=None, global_stats=None):