mailr24360 - /branches/disp_spin_speed/lib/dispersion/mmq_cr72.py


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

Header


Content

Posted by edward on June 27, 2014 - 19:01:
Author: bugman
Date: Fri Jun 27 19:01:21 2014
New Revision: 24360

URL: http://svn.gna.org/viewcvs/relax?rev=24360&view=rev
Log:
A very small speed up to the MMQ CR72 dispersion model by minimising 
repetitive maths operations.

This matches the recent change for the CR72 model (r24353), though the Psi 
calculation was already
using the fast form.  Using the disp_profile_all.py script, the speed ups are:

100 single spins analysis:
MMQ CR72:                    4.276+/-0.066 ->   4.230+/-0.089,   1.011x 
faster.

Cluster of 100 spins analysis:
MMQ CR72:                    0.883+/-0.015 ->   0.862+/-0.010,   1.024x 
faster. 


Modified:
    branches/disp_spin_speed/lib/dispersion/mmq_cr72.py

Modified: branches/disp_spin_speed/lib/dispersion/mmq_cr72.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/mmq_cr72.py?rev=24360&r1=24359&r2=24360&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/mmq_cr72.py (original)
+++ branches/disp_spin_speed/lib/dispersion/mmq_cr72.py Fri Jun 27 19:01:21 
2014
@@ -128,16 +128,14 @@
     sqrt_psi2_zeta2 = sqrt(Psi**2 + zeta**2)
 
     # The D+/- values.
-    D_part = (Psi + 2.0*dw2) / sqrt_psi2_zeta2
-    Dpos = 0.5 * (1.0 + D_part)
-    Dneg = 0.5 * (-1.0 + D_part)
+    D_part = (0.5*Psi + dw2) / sqrt_psi2_zeta2
+    Dpos = 0.5 + D_part
+    Dneg = -0.5 + D_part
 
-    # Partial eta+/- values.
-    etapos_part = eta_scale * sqrt(Psi + sqrt_psi2_zeta2)
-    etaneg_part = eta_scale * sqrt(-Psi + sqrt_psi2_zeta2)
-
-    # The full eta+ values.
-    etapos = etapos_part / cpmg_frqs
+    # The eta+/- values.
+    eta_fact = eta_scale / cpmg_frqs
+    etapos = eta_fact * sqrt(Psi + sqrt_psi2_zeta2)
+    etaneg = eta_fact * sqrt(-Psi + sqrt_psi2_zeta2)
 
     # Catch math domain error of cosh(val > 710).
     # This is when etapos > 710.
@@ -146,9 +144,6 @@
         mask_max_etapos = masked_greater_equal(etapos, 700.0)
         # To prevent math errors, set etapos to 1.
         etapos[mask_max_etapos.mask] = 1.0
-
-    # The full eta - values.
-    etaneg = etaneg_part / cpmg_frqs
 
     # The mD value.
     mD = isqrt_pApBkex2 / (dpos * zpos) * (zpos + 
2.0*dw*sin(zpos*tcp)/sin((dpos + zpos)*tcp))




Related Messages


Powered by MHonArc, Updated Mon Jun 30 10:20:04 2014