If you are interested, there are a tonne of other code optimisations
which can be performed.  For example k_AB and k_BA are calculated in
lib.dispersion.cr72.  But this can happen at the start of the target
function outside of all the looping.  Other dispersion models do this.
 You can even pre-add them.  The pB parameter as well - these only
need to be calculated once, not multiple times for each spin system,
each experiment type, and each magnetic field strength.  r20_kex can
also be calculated in the calc_CR72_chi2() method as a numpy array,
and then sent in to r2eff_CR72() using the r20_index index.  The speed
up of the cosh+cos vs. sqrt(sqrt()) suggestion of Andy
http://thread.gmane.org/gmane.science.nmr.relax.devel/5410/focus=5448
is rather small compared to these optimisations!

Regards,

Edward


On 3 May 2014 13:52, Edward d'Auvergne <[email protected]> wrote:
> Oh, the text 2^(-3/2) is the most compact for the documentation, and
> it separates it from the 1/nu_cpmg part.  So I'd prefer to present it
> that way for compactness and cleanliness.  That can also allow us to
> pre-calculate it when the target function is initialised and and send
> the value of 0.35355339059327373 into the function instead.  That
> would remove one exponential operation, again squeezing out a little
> speed.  As nu_CPMG is fixed, even faster would be to pre-calculate an
> array of 2**(-3/2) / nu_CPMG and sent that in instead.  That would
> really be the maximal optimisation for this part!
>
> Cheers,
>
> Edward
>
> On 3 May 2014 13:45, Edward d'Auvergne <[email protected]> wrote:
>> Hi,
>>
>> The origin of this was exactly what Andy Baldwin said at
>> http://thread.gmane.org/gmane.science.nmr.relax.devel/5410/focus=5448
>> - that there are many different tau_CPMG definitions and there is an
>> error in one of the equations in the original paper.  The code in
>> relax is however correct.  The eta_scale value should be
>> 0.35355339059327373.  Feel free to fix the equations in the
>> documentation of the wiki, manual and lib.dispersion.cr72 docstring.
>> I wrote these before the code was fully tested and hence there is now
>> a mismatch.  As for using 2.0**(-3.0/2.0) in the code, this is for the
>> fastest operation, avoiding the square root.  But now that I look at
>> it, one mathematical operation can be dropped for speed and the factor
>> changed to 2.0**(-1.5).
>>
>> Cheers,
>>
>> Edward
>>
>>
>> On 3 May 2014 12:28, Troels Emtekær Linnet <[email protected]> wrote:
>>> Dear Edward.
>>>
>>> I was inspecting the code of model CR72.
>>>
>>> http://svn.gna.org/viewcvs/*checkout*/relax/trunk/lib/dispersion/cr72.py?revision=HEAD
>>>
>>> This is calculated as:
>>>
>>> eta_scale = 2.0**(-3.0/2.0) = 0.35
>>> which is: 1 / sqrt(2**3).
>>>
>>> This differs from the definition in:
>>> http://wiki.nmr-relax.com/CR72_full#Equation
>>> http://www.nmr-relax.com/manual/full_CR72_2_site_CPMG_model.html
>>> http://www.nmr-relax.com/api/3.1/lib.dispersion.cr72-module.html
>>>
>>> where:
>>> eta_scale = 2.0**(2/3) = 1.58
>>> which is {3}sqrt(2**2).
>>>
>>> If I compare to:
>>> http://wiki.nmr-relax.com/B14#Equation_compared_to_Carver_Richards_72
>>> (DOI: 10.1016/j.jmr.2014.02.023 , eq 70,)
>>>
>>> And to, (DOI: 10.1016/S0076-6879(01)39315-1 , eq 25, with the twist
>>> that "tcp_Pa is the delay between 180 pulses in the CPMG pulse train",
>>>  "delay/180/delay/delay/180/delay " so that tcp_Pa = 2xdelay
>>>
>>> Then really the manual should use:
>>> eta_scale = 2.0**(-3/2)
>>> or
>>> 1 / 2 sqrt(2)
>>>
>>> _______________________________________________
>>> 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

_______________________________________________
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