mailr23002 - in /trunk: lib/dispersion/b14.py target_functions/relax_disp.py


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

Header


Content

Posted by tlinnet on May 06, 2014 - 17:14:
Author: tlinnet
Date: Tue May  6 17:14:51 2014
New Revision: 23002

URL: http://svn.gna.org/viewcvs/relax?rev=23002&view=rev
Log:
Speed-up. Made B14 use the precalculated inverse time, instead of calculating 
the inverse time inside the function.

sr #3154: (https://gna.org/support/?3154) Implementation of Baldwin (2014) 
B14 model - 2-site exact solution model for all time scales.

This follows the tutorial for adding relaxation dispersion models at:
http://wiki.nmr-relax.com/Tutorial_for_adding_relaxation_dispersion_models_to_relax#Debugging


Modified:
    trunk/lib/dispersion/b14.py
    trunk/target_functions/relax_disp.py

Modified: trunk/lib/dispersion/b14.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/dispersion/b14.py?rev=23002&r1=23001&r2=23002&view=diff
==============================================================================
--- trunk/lib/dispersion/b14.py (original)
+++ trunk/lib/dispersion/b14.py Tue May  6 17:14:51 2014
@@ -102,7 +102,7 @@
 from numpy import arccosh, cos, cosh, log, sin, sinh, sqrt, power
 
 
-def r2eff_B14(r20a=None, r20b=None, pA=None, dw=None, kex=None, ncyc=None, 
relax_time=None, tcp=None, back_calc=None, num_points=None):
+def r2eff_B14(r20a=None, r20b=None, pA=None, dw=None, kex=None, ncyc=None, 
inv_tcpmg=None, tcp=None, back_calc=None, num_points=None):
     """Calculate the R2eff values for the CR72 model.
 
     See the module docstring for details.
@@ -120,8 +120,8 @@
     @type kex:              float
     @keyword ncyc:          The matrix exponential power array. The number 
of CPMG blocks.
     @type ncyc:             numpy int16, rank-1 array
-    @keyword relax_time:    The total relaxation time period (in seconds).
-    @type relax_time:       float
+    @keyword inv_tcpmg:     The inverse of the total duration of the CPMG 
element (in inverse seconds).
+    @type inv_tcpmg:        float
     @keyword tcp:           The tau_CPMG times (1 / 4.nu1).
     @type tcp:              numpy rank-1 float array
     @keyword back_calc:     The array for holding the back calculated R2eff 
values.  Each element corresponds to one of the CPMG nu1 frequencies.
@@ -210,8 +210,8 @@
 
     Tog = (1 + y) / 2 + (1 - y) / (2 * v3) * v2pPdN / N
 
-    # Estimate R2eff. relax_time = Trel. 
-    Minty = Rpre - ncyc/relax_time * arccosh(ex0b.real) - 1/relax_time * 
log(Tog.real)
+    # Estimate R2eff. relax_time = Trel = 1/inv_tcpmg.
+    Minty = Rpre - ncyc * inv_tcpmg * arccosh(ex0b.real) - inv_tcpmg * 
log(Tog.real)
 
     # Loop over the time points, back calculating the R2eff values.
     for i in range(num_points):

Modified: trunk/target_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/target_functions/relax_disp.py?rev=23002&r1=23001&r2=23002&view=diff
==============================================================================
--- trunk/target_functions/relax_disp.py        (original)
+++ trunk/target_functions/relax_disp.py        Tue May  6 17:14:51 2014
@@ -321,7 +321,7 @@
                         self.spin_lock_omega1_squared[ei][mi][oi] = 
self.spin_lock_omega1[ei][mi][oi] ** 2
 
         # The inverted relaxation delay.
-        if model in [MODEL_MMQ_CR72, MODEL_NS_CPMG_2SITE_3D, 
MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_EXPANDED, 
MODEL_NS_CPMG_2SITE_STAR, MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE, 
MODEL_NS_MMQ_3SITE, MODEL_NS_MMQ_3SITE_LINEAR, MODEL_NS_R1RHO_2SITE, 
MODEL_NS_R1RHO_3SITE, MODEL_NS_R1RHO_3SITE_LINEAR]:
+        if model in [MODEL_B14, MODEL_MMQ_CR72, MODEL_NS_CPMG_2SITE_3D, 
MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_EXPANDED, 
MODEL_NS_CPMG_2SITE_STAR, MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE, 
MODEL_NS_MMQ_3SITE, MODEL_NS_MMQ_3SITE_LINEAR, MODEL_NS_R1RHO_2SITE, 
MODEL_NS_R1RHO_3SITE, MODEL_NS_R1RHO_3SITE_LINEAR]:
             self.inv_relax_times = 1.0 / relax_times
 
         # Special storage matrices for the multi-quantum CPMG N-site 
numerical models.
@@ -800,7 +800,7 @@
                 dw_frq = dw[si] * self.frqs[0][si][mi]
 
                 # Back calculate the R2eff values.
-                r2eff_B14(r20a=R20A[r20_index], r20b=R20B[r20_index], pA=pA, 
dw=dw_frq, kex=kex, ncyc=self.power[0][mi], 
relax_time=self.relax_times[0][mi], tcp=self.tau_cpmg[0][mi], 
back_calc=self.back_calc[0][si][mi][0], 
num_points=self.num_disp_points[0][si][mi][0])
+                r2eff_B14(r20a=R20A[r20_index], r20b=R20B[r20_index], pA=pA, 
dw=dw_frq, kex=kex, ncyc=self.power[0][mi], 
inv_tcpmg=self.inv_relax_times[0][mi], tcp=self.tau_cpmg[0][mi], 
back_calc=self.back_calc[0][si][mi][0], 
num_points=self.num_disp_points[0][si][mi][0])
 
                 # For all missing data points, set the back-calculated value 
to the measured values so that it has no effect on the chi-squared value.
                 for di in range(self.num_disp_points[0][si][mi][0]):




Related Messages


Powered by MHonArc, Updated Tue May 06 17:40:02 2014