Author: bugman Date: Mon Jul 2 17:52:48 2012 New Revision: 17132 URL: http://svn.gna.org/viewcvs/relax?rev=17132&view=rev Log: The generic_fns.mol_res_spin.index_molecule() function now handles no molecule name given. If no name is given and only a single molecule is in the current data pipe, then the index of 0 will be returned. Modified: branches/interatomic/generic_fns/mol_res_spin.py Modified: branches/interatomic/generic_fns/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/branches/interatomic/generic_fns/mol_res_spin.py?rev=17132&r1=17131&r2=17132&view=diff ============================================================================== --- branches/interatomic/generic_fns/mol_res_spin.py (original) +++ branches/interatomic/generic_fns/mol_res_spin.py Mon Jul 2 17:52:48 2012 @@ -1809,10 +1809,14 @@ """Return the index of the molecule of the given name. @keyword mol_name: The name of the molecule. - @type mol_name: str + @type mol_name: str or None @return: The index of the molecule, if it exists. @rtype: int or None """ + + # Single molecule and no name given. + if mol_name == None and len(cdp.mol) == 1: + return 0 # Loop over the molecules. i = 0