Author: bugman Date: Wed Jun 27 17:50:45 2012 New Revision: 17078 URL: http://svn.gna.org/viewcvs/relax?rev=17078&view=rev Log: The interatomic_loop() now skips deselected containers if the new 'selected' flag is True. This should speed up the function and simplify its usage. Modified: branches/interatomic/generic_fns/interatomic.py branches/interatomic/specific_fns/n_state_model.py Modified: branches/interatomic/generic_fns/interatomic.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/interatomic.py?rev=17078&r1=17077&r2=17078&view=diff ============================================================================== --- branches/interatomic/generic_fns/interatomic.py (original) +++ branches/interatomic/generic_fns/interatomic.py Wed Jun 27 17:50:45 2012 @@ -158,7 +158,7 @@ return True -def interatomic_loop(selection1=None, selection2=None, pipe=None): +def interatomic_loop(selection1=None, selection2=None, pipe=None, selected=True): """Generator function for looping over all the interatomic data containers. @keyword selection1: The optional spin ID selection of the first atom. @@ -167,6 +167,8 @@ @type selection2: str @keyword pipe: The data pipe containing the spin. Defaults to the current data pipe. @type pipe: str + @keyword selected: A flag which if True will only return selected interatomic data containers. + @type selected: bool """ # The data pipe. @@ -190,6 +192,10 @@ # Loop over the containers, yielding them. for i in range(len(dp.interatomic)): + # Skip deselected containers. + if selected and not dp.interatomic[i].select: + continue + # Aliases. interatom = dp.interatomic[i] mol_index1, res_index1, spin_index1 = cdp.mol._spin_id_lookup[interatom.spin_id1] Modified: branches/interatomic/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/specific_fns/n_state_model.py?rev=17078&r1=17077&r2=17078&view=diff ============================================================================== --- branches/interatomic/specific_fns/n_state_model.py (original) +++ branches/interatomic/specific_fns/n_state_model.py Wed Jun 27 17:50:45 2012 @@ -833,10 +833,6 @@ # Interatomic data container loop. rdc_index = 0 for interatom in interatomic_loop(): - # Skip deselected containers. - if not interatom.select: - continue - # Containers with RDC data. if rdc_flag and hasattr(interatom, 'rdc'): # Initialise the data structure if necessary.