Author: bugman Date: Wed Dec 3 22:03:42 2008 New Revision: 8114 URL: http://svn.gna.org/viewcvs/relax?rev=8114&view=rev Log: Fix for the centre_of_mass() function. When no element entry is present in the PDB file, a RelaxError is thrown. 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=8114&r1=8113&r2=8114&view=diff ============================================================================== --- 1.3/generic_fns/structure/mass.py (original) +++ 1.3/generic_fns/structure/mass.py Wed Dec 3 22:03:42 2008 @@ -27,7 +27,7 @@ from generic_fns.mol_res_spin import return_molecule, return_residue, return_spin from generic_fns import pipes from physical_constants import return_atomic_mass -from relax_errors import RelaxNoPdbError +from relax_errors import RelaxError, RelaxNoPdbError @@ -88,6 +88,10 @@ if spin_cont and not spin_cont.select: continue + # No element? + if element == None: + raise RelaxError, "The element corresponding to '%s' does not exist in the PDB file. Cannot calculate the centre of mass." % id + # Atomic mass. mass = return_atomic_mass(element)