Hi Troels,

I'm not sure about the kex >= 1e5 check.  You have to be careful,
because a number of the analytic models - CR72 possibly included - are
not defined for such timescales (of course this is dependant on the
alpha scale, hence dw has an effect).  So there are a series of models
where kex >= 1e5 does not return R20!

Note that if you force the return of R20 when kex >= 1e5 when this is
not valid, then you will introduce a discontinuity into the
chi-squared space
(https://en.wikipedia.org/wiki/Discontinuity_%28mathematics%29).
Discontinuities are 100% fatal for all the local optimisers in minfx
(https://gna.org/projects/minfx/).  Therefore it is best to avoid a
check of kex >= 1e5 to force a return of R20.

Cheers,

Edward



On 26 May 2014 13:38,  <[email protected]> wrote:
> Author: tlinnet
> Date: Mon May 26 13:38:09 2014
> New Revision: 23414
>
> URL: http://svn.gna.org/viewcvs/relax?rev=23414&view=rev
> Log:
> Critical fix for the math domain catching of model CR72.
>
> This was discovered with the added 8 unit tests demonstrating edge case 'no 
> Rex' failures.
>
> This follows from the ideas in the post 
> http://article.gmane.org/gmane.science.nmr.relax.devel/5858.
> This is related to: task #7793: (https://gna.org/task/?7793) Speed-up of 
> dispersion models.
>
> This is to implement catching of math domain errors, before they occur.
>
> When kex is large, ex: kex = 1e5, the values of:
> etapos = eta_scale * sqrt(Psi + sqrt_psi2_zeta2) / cpmg_frqs
>
> will exceed possible numerical representation.
>
> The cathing of these occurences needed to be re-written.
>
> Modified:
>     branches/disp_speed/lib/dispersion/cr72.py
>
> Modified: branches/disp_speed/lib/dispersion/cr72.py
> URL: 
> http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/dispersion/cr72.py?rev=23414&r1=23413&r2=23414&view=diff
> ==============================================================================
> --- branches/disp_speed/lib/dispersion/cr72.py  (original)
> +++ branches/disp_speed/lib/dispersion/cr72.py  Mon May 26 13:38:09 2014
> @@ -128,9 +128,9 @@
>      k_BA = pA * kex
>      k_AB = pB * kex
>
> -    # Catch parameter values that will result in no exchange, returning flat 
> R2eff = R20 lines.
> -    if dw == 0.0 or pA == 1.0 or kex == 0.0:
> -        return array([r20_kex]*num_points)
> +    # Catch parameter values that will result in no exchange, returning flat 
> R2eff = R20 lines (when kex = 0.0, k_AB = 0.0).
> +    if dw == 0.0 or pA == 1.0 or k_AB == 0.0 or kex >= 1.e5:
> +        return array([r20a]*num_points)
>
>      # The Psi and zeta values.
>      if r20a != r20b:
> @@ -156,16 +156,12 @@
>      # Catch math domain error of cosh(val > 710).
>      # This is when etapos > 710.
>      if max(etapos) > 700:
> -        R2eff = array([1e100]*num_points)
> -
> -        return R2eff
> +        return array([r20a]*num_points)
>
>      # The arccosh argument - catch invalid values.
>      fact = Dpos * cosh(etapos) - Dneg * cos(etaneg)
>      if min(fact) < 1.0:
> -        R2eff = array([r20_kex]*num_points)
> -
> -        return R2eff
> +        return array([r20_kex]*num_points)
>
>      # Calculate R2eff.
>      R2eff = r20_kex - cpmg_frqs * arccosh( fact )
>
>
> _______________________________________________
> relax (http://www.nmr-relax.com)
>
> This is the relax-commits mailing list
> [email protected]
>
> To unsubscribe from this list, get a password
> reminder, or change your subscription options,
> visit the list information page at
> https://mail.gna.org/listinfo/relax-commits

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel

Reply via email to