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)