mailr9001 - /1.3/generic_fns/structure/main.py


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

Header


Content

Posted by edward on March 26, 2009 - 01:04:
Author: bugman
Date: Thu Mar 26 00:42:14 2009
New Revision: 9001

URL: http://svn.gna.org/viewcvs/relax?rev=9001&view=rev
Log:
Modified the structure.vectors() user function to fail if no vectors are 
found.

This saves a lot of sanity when debugging a user script which fails. 


Modified:
    1.3/generic_fns/structure/main.py

Modified: 1.3/generic_fns/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/main.py?rev=9001&r1=9000&r2=9001&view=diff
==============================================================================
--- 1.3/generic_fns/structure/main.py (original)
+++ 1.3/generic_fns/structure/main.py Thu Mar 26 00:42:14 2009
@@ -340,6 +340,7 @@
         object_name = 'bond_vect'
 
     # Loop over the spins.
+    no_vectors = True
     for spin, mol_name, res_num, res_name in spin_loop(selection=spin_id, 
full_info=True):
         # Skip deselected spins.
         if not spin.select:
@@ -410,9 +411,16 @@
         # Set the vector.
         setattr(spin, object_name, vector)
 
+        # We have a vector!
+        no_vectors = False
+
         # Print out of modified spins.
         if verbosity:
             print "Extracted " + spin.name + "-" + attached_name + " vectors 
for " + `id` + '.'
+
+    # Right, catch the problem of missing vectors to prevent massive user 
confusion!
+    if no_vectors:
+        raise RelaxError, "No vectors could be extracted."
 
 
 def write_pdb(file=None, dir=None, model_num=None, force=False):




Related Messages


Powered by MHonArc, Updated Thu Mar 26 01:20:06 2009