mailr19819 - /branches/relax_disp/lib/dispersion/cr72.py


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

Header


Content

Posted by edward on May 31, 2013 - 11:36:
Author: bugman
Date: Fri May 31 11:36:02 2013
New Revision: 19819

URL: http://svn.gna.org/viewcvs/relax?rev=19819&view=rev
Log:
The CR72 dispersion model equations are now more robust against math domain 
errors.

This is for the trigonometric functions which cannot handle certain input 
values.


Modified:
    branches/relax_disp/lib/dispersion/cr72.py

Modified: branches/relax_disp/lib/dispersion/cr72.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/cr72.py?rev=19819&r1=19818&r2=19819&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/cr72.py (original)
+++ branches/relax_disp/lib/dispersion/cr72.py Fri May 31 11:36:02 2013
@@ -112,5 +112,16 @@
         etapos = etapos_part / cpmg_frqs[i]
         etaneg = etaneg_part / cpmg_frqs[i]
 
+        # Catch large values of etapos going into the cosh function.
+        if etapos > 100:
+            back_calc[i] = 1e100
+            continue
+
+        # Part of the equation (catch values < 1 to prevent math domain 
errors).
+        part = Dpos * cosh(etapos) - Dneg * cos(etaneg)
+        if part < 1:
+            back_calc[i] = 1e100
+            continue
+
         # The full formula.
-        back_calc[i] = r20 + 0.5*kex - cpmg_frqs[i] * acosh(Dpos * 
cosh(etapos) - Dneg * cos(etaneg))
+        back_calc[i] = r20 + 0.5*kex - cpmg_frqs[i] * acosh(part)




Related Messages


Powered by MHonArc, Updated Fri May 31 12:00:02 2013