mailr5000 - /branches/N_state_model/generic_fns/structure.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on February 15, 2008 - 10:03:
Author: bugman
Date: Fri Feb 15 10:03:09 2008
New Revision: 5000

URL: http://svn.gna.org/viewcvs/relax?rev=5000&view=rev
Log:
Added a test for a loaded structure to the 
generic_fns.structure.centre_of_mass() function.


Modified:
    branches/N_state_model/generic_fns/structure.py

Modified: branches/N_state_model/generic_fns/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/generic_fns/structure.py?rev=5000&r1=4999&r2=5000&view=diff
==============================================================================
--- branches/N_state_model/generic_fns/structure.py (original)
+++ branches/N_state_model/generic_fns/structure.py Fri Feb 15 10:03:09 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'):
+        raise RelaxNoPdbError
+
     # Print out.
     print "Calculating the centre of mass."
 
@@ -198,7 +205,7 @@
     M = 0.0
 
     # Loop over the structures.
-    for struct in 
relax_data_store[relax_data_store.current_pipe].structure.structures:
+    for struct in cdp.structure.structures:
         # Protein.
         if struct.peptide_chains:
             chains = struct.peptide_chains




Related Messages


Powered by MHonArc, Updated Fri Feb 15 10:20:54 2008