mailr11185 - /1.3/specific_fns/n_state_model.py


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

Header


Content

Posted by edward on May 11, 2010 - 16:48:
Author: bugman
Date: Tue May 11 16:48:07 2010
New Revision: 11185

URL: http://svn.gna.org/viewcvs/relax?rev=11185&view=rev
Log:
Added some checks to properly inform the user as to what data is missing.


Modified:
    1.3/specific_fns/n_state_model.py

Modified: 1.3/specific_fns/n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/n_state_model.py?rev=11185&r1=11184&r2=11185&view=diff
==============================================================================
--- 1.3/specific_fns/n_state_model.py (original)
+++ 1.3/specific_fns/n_state_model.py Tue May 11 16:48:07 2010
@@ -48,7 +48,7 @@
 from maths_fns.potential import quad_pot
 from maths_fns.rotation_matrix import two_vect_to_R, euler_to_R_zyz
 from physical_constants import dipolar_constant, g1H, pcs_constant, 
return_gyromagnetic_ratio
-from relax_errors import RelaxError, RelaxInfError, RelaxModelError, 
RelaxNaNError, RelaxNoModelError, RelaxNoTensorError
+from relax_errors import RelaxError, RelaxInfError, RelaxModelError, 
RelaxNaNError, RelaxNoModelError, RelaxNoTensorError, RelaxNoValueError, 
RelaxProtonTypeError, RelaxSpinTypeError
 from relax_io import open_write_file
 from relax_warnings import RelaxWarning, RelaxDeselectWarning
 
@@ -888,6 +888,14 @@
             else:
                 unit_vect.append(vect)
 
+            # Checks.
+            if not hasattr(spin, 'heteronuc_type'):
+                raise RelaxSpinTypeError
+            if not hasattr(spin, 'proton_type'):
+                raise RelaxProtonTypeError
+            if not hasattr(spin, 'r'):
+                raise RelaxNoValueError("bond length")
+
             # Gyromagnetic ratios.
             gx = return_gyromagnetic_ratio(spin.heteronuc_type)
             gh = return_gyromagnetic_ratio(spin.proton_type)
@@ -907,6 +915,10 @@
             # Check.
             if unit_vect[i] != None and len(unit_vect[i]) != num:
                 raise RelaxError, "The number of bond vectors for all spins 
do no match:\n%s" % unit_vect
+
+        # Missing unit vectors.
+        if num == None:
+            raise RelaxError, "No bond vectors could be found."
 
         # Update None entries.
         for i in range(len(unit_vect)):




Related Messages


Powered by MHonArc, Updated Fri May 14 16:00:03 2010