mailr24353 - /branches/disp_spin_speed/lib/dispersion/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 - 17:53:
Author: bugman
Date: Fri Jun 27 17:53:53 2014
New Revision: 24353

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

The k_BA and k_AB rates are used to simplify the Psi calculation, dropping 
from 3 to 2
multiplications and removing a squaring operation.  The Dpos and Dneg value 
calculations have been
simplified to drop one multiplication operation.  And the calculation of 
eta_scale / cpmg_frqs now
only occurs once rather than twice.

Using the disp_profile_all.py script, the speed ups for these two models are:

100 single spins analysis:
CR72:                        1.608+/-0.025 ->   1.552+/-0.028,   1.036x 
faster.
CR72 full:                   1.795+/-0.043 ->   1.705+/-0.024,   1.053x 
faster.

Cluster of 100 spins analysis:
CR72:                        0.109+/-0.001 ->   0.107+/-0.001,   1.026x 
faster. 
CR72 full:                   0.114+/-0.004 ->   0.110+/-0.001,   1.034x 
faster. 


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

Modified: branches/disp_spin_speed/lib/dispersion/cr72.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/cr72.py?rev=24353&r1=24352&r2=24353&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/cr72.py     (original)
+++ branches/disp_spin_speed/lib/dispersion/cr72.py     Fri Jun 27 17:53:53 
2014
@@ -154,7 +154,7 @@
     # The Psi and zeta values.
     if sum(r20a_orig - r20b_orig) != 0.0:
         fact = r20a - r20b - k_BA + k_AB
-        Psi = fact**2 - dw2 + 4.0*pA*pB*kex**2
+        Psi = fact**2 - dw2 + 4.0*k_BA*k_AB
         zeta = 2.0*dw * fact
     else:
         Psi = kex**2 - dw2
@@ -164,13 +164,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 = eta_scale * sqrt(Psi + sqrt_psi2_zeta2) / cpmg_frqs
-    etaneg = eta_scale * sqrt(-Psi + sqrt_psi2_zeta2) / cpmg_frqs
+    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.




Related Messages


Powered by MHonArc, Updated Fri Jun 27 18:20:02 2014