mailr24148 - /branches/disp_spin_speed/lib/dispersion/b14.py


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

Header


Content

Posted by tlinnet on June 18, 2014 - 20:50:
Author: tlinnet
Date: Wed Jun 18 20:50:32 2014
New Revision: 24148

URL: http://svn.gna.org/viewcvs/relax?rev=24148&view=rev
Log:
Added additional math domain checking in B14.

This is when v1c is less than 1.0.

Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion 
models for Clustered analysis.

Modified:
    branches/disp_spin_speed/lib/dispersion/b14.py

Modified: branches/disp_spin_speed/lib/dispersion/b14.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/b14.py?rev=24148&r1=24147&r2=24148&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/b14.py      (original)
+++ branches/disp_spin_speed/lib/dispersion/b14.py      Wed Jun 18 20:50:32 
2014
@@ -149,6 +149,7 @@
     t_max_e = False
     t_v3_N_zero = False
     t_log_tog_neg = False
+    t_v1c_less_one = False
 
     # Catch parameter values that will result in no exchange, returning flat 
R2eff = R20 lines (when kex = 0.0, k_AB = 0.0).
     # Test if pA or kex is zero.
@@ -241,6 +242,13 @@
     # Real. The v_1c in paper.
     v1c = F0 * cosh(E0) - F2 * cos(E2)
 
+    # Catch math domain error of sqrt of negative.
+    # This is when v1c is less than 1.
+    mask_v1c_less_one = v1c < 1.0
+    if any(mask_v1c_less_one):
+        t_v1c_less_one = True
+        v1c[mask_v1c_less_one] = 1.0
+
     # Exact result for v2v3.
     v3 = sqrt(v1c**2 - 1.)
 
@@ -286,6 +294,10 @@
     if t_max_e:
         back_calc[mask_max_e.mask] = r20a[mask_max_e.mask]
 
+    # If v1c is less than 1.
+    if t_v1c_less_one:
+        back_calc[mask_v1c_less_one] = 1e100
+
     # If Tog_div is zero.
     if t_v3_N_zero:
         back_calc[mask_v3_N_zero] = 1e100




Related Messages


Powered by MHonArc, Updated Wed Jun 18 21:00:03 2014