Author: bugman Date: Mon Apr 7 16:29:16 2008 New Revision: 5363 URL: http://svn.gna.org/viewcvs/relax?rev=5363&view=rev Log: The centre of mass function now works if the sequence does not exist in the current data pipe. The spin_num and spin_name have been renamed to atom_num and atom_name respectively in the function as well. Modified: 1.3/generic_fns/structure/mass.py Modified: 1.3/generic_fns/structure/mass.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/mass.py?rev=5363&r1=5362&r2=5363&view=diff ============================================================================== --- 1.3/generic_fns/structure/mass.py (original) +++ 1.3/generic_fns/structure/mass.py Mon Apr 7 16:29:16 2008 @@ -59,7 +59,9 @@ M = 0.0 # Loop over all atoms. - for mol_name, res_num, res_name, spin_num, spin_name, pos in cdp.structure.atom_loop(pos=True): + for mol_name, res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(pos=True): + print `(mol_name, res_num, res_name, atom_num, atom_name, pos)` + # Get the corresponding molecule container. if mol_name == None: mol_cont = cdp.mol[0] @@ -67,7 +69,7 @@ mol_cont = return_molecule('#' + mol_name) # Deselected molecules. - if not mol_cont.select: + if mol_cont and not mol_cont.select: continue # Get the corresponding residue container. @@ -77,17 +79,17 @@ res_cont = return_residue(':' + `res_num`) # Deselected residues. - if not res_cont.select: + if res_cont and not res_cont.select: continue # Get the corresponding spin container. - if spin_name == None and spin_num == None: + if atom_name == None and atom_num == None: spin_cont = res_cont.spin[0] else: - spin_cont = return_spin('@' + `spin_num`) + spin_cont = return_spin('@' + `atom_num`) # Deselected spins. - if not spin_cont.select: + if spin_cont and not spin_cont.select: continue # Atomic mass.