Author: bugman Date: Fri Feb 15 10:28:40 2008 New Revision: 5003 URL: http://svn.gna.org/viewcvs/relax?rev=5003&view=rev Log: Merged in r4999 to r5002 from the N_state_model branch as they should have gone into the 1.3 line! The command used was: svn merge -r4998:5002 svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/N_state_model Modified: 1.3/generic_fns/structure.py 1.3/relax_errors.py Modified: 1.3/generic_fns/structure.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure.py?rev=5003&r1=5002&r2=5003&view=diff ============================================================================== --- 1.3/generic_fns/structure.py (original) +++ 1.3/generic_fns/structure.py Fri Feb 15 10:28:40 2008 @@ -188,6 +188,13 @@ def centre_of_mass(return_mass=False): """Calculate and return the centre of mass of the structure.""" + # Alias the current data pipe. + cdp = relax_data_store[relax_data_store.current_pipe] + + # Test if a structure has been loaded. + if not hasattr(cdp.structure, 'structures'): + raise RelaxNoPdbError + # Print out. print "Calculating the centre of mass." Modified: 1.3/relax_errors.py URL: http://svn.gna.org/viewcvs/relax/1.3/relax_errors.py?rev=5003&r1=5002&r2=5003&view=diff ============================================================================== --- 1.3/relax_errors.py (original) +++ 1.3/relax_errors.py Fri Feb 15 10:28:40 2008 @@ -140,8 +140,11 @@ # No PDB loaded. class RelaxNoPdbError(BaseError): - def __init__(self, pipe): - self.text = "No PDB file has been loaded for the data pipe " + `pipe` + "." + def __init__(self, pipe=None): + if pipe != None: + self.text = "No PDB file has been loaded for the data pipe " + `pipe` + "." + else: + self.text = "No PDB file has been loaded." if Debug: self.save_state()