mailr14366 - /1.3/physical_constants.py


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

Header


Content

Posted by edward on August 11, 2011 - 17:13:
Author: bugman
Date: Thu Aug 11 17:13:28 2011
New Revision: 14366

URL: http://svn.gna.org/viewcvs/relax?rev=14366&view=rev
Log:
The dipolar_constant() and pcs_constant() functions now catch division by 
zero problems.


Modified:
    1.3/physical_constants.py

Modified: 1.3/physical_constants.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/physical_constants.py?rev=14366&r1=14365&r2=14366&view=diff
==============================================================================
--- 1.3/physical_constants.py (original)
+++ 1.3/physical_constants.py Thu Aug 11 17:13:28 2011
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2007-2009 Edward d'Auvergne                                  
 #
+# Copyright (C) 2007-2011 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -29,6 +29,7 @@
 from string import ascii_letters, digits, upper
 
 # relax module imports.
+from float import nan
 from relax_errors import RelaxError
 
 
@@ -101,6 +102,10 @@
     @type r:    float
     """
 
+    # Catch zero bond lengths, returning NaN.
+    if r == 0:
+        return nan
+
     # Calculate and return the value.
     return - mu0 / (4.0*pi) * gx * gh * h_bar / r**3
 
@@ -132,6 +137,10 @@
     @param r:   The distance between the two nuclei.
     @type r:    float
     """
+
+    # Catch zero bond lengths, returning NaN.
+    if r == 0:
+        return nan
 
     # Calculate and return the value.
     return mu0 / (4.0*pi) * 15.0 * kB * T / Bo**2 / r**3




Related Messages


Powered by MHonArc, Updated Thu Aug 11 17:40:02 2011