mailr22987 - /trunk/lib/dispersion/b14.py


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

Header


Content

Posted by tlinnet on May 05, 2014 - 20:19:
Author: tlinnet
Date: Mon May  5 20:19:00 2014
New Revision: 22987

URL: http://svn.gna.org/viewcvs/relax?rev=22987&view=rev
Log:
Speed-up of code, replaceing Repetitive calculations of dw**2.

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

Modified: trunk/lib/dispersion/b14.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/dispersion/b14.py?rev=22987&r1=22986&r2=22987&view=diff
==============================================================================
--- trunk/lib/dispersion/b14.py (original)
+++ trunk/lib/dispersion/b14.py Mon May  5 20:19:00 2014
@@ -136,6 +136,7 @@
     # Repetitive calculations (to speed up calculations).
     k_BA = pA * kex
     k_AB = pB * kex
+    dw2 = dw**2
 
     #########################################################################
     ##### Baldwins code.
@@ -146,7 +147,7 @@
     #########################################################################
     #get the real and imaginary components of the exchange induced shift
     g1 = 2 * dw * alpha_m                            #same as carver 
richards zeta
-    g2 = alpha_m**2 + 4 * k_BA * k_AB - dw**2   #same as carver richards psi
+    g2 = alpha_m**2 + 4 * k_BA * k_AB - dw2   #same as carver richards psi
     g3 = 1/sqrt(2) * sqrt(g2 + sqrt(g1**2 + g2**2))   #trig faster than 
square roots
     g4 = 1/sqrt(2) * sqrt(-g2 + sqrt(g1**2 + g2**2))   #trig faster than 
square roots
     #########################################################################
@@ -157,10 +158,10 @@
     NNc = g3**2 + g4**2
 
     # f0.
-    f0 = (dw**2 + g3**2) / NNc
+    f0 = (dw2 + g3**2) / NNc
 
     # f2.
-    f2 = (dw**2 - g4**2) / NNc
+    f2 = (dw2 - g4**2) / NNc
 
     # t1 = (-dw + g4) * (complex(-dw, -g3)) / NNc #t1.
 
@@ -168,7 +169,7 @@
     t2 = (dw + g4) * complex(dw, -g3) / NNc
 
     # t1 + t2.
-    t1pt2 = complex(2 * dw**2,g1) / NNc
+    t1pt2 = complex(2 * dw2,g1) / NNc
 
     # -2 * oG * t2.
     oGt2 = complex(-alpha_m - g3, dw - g4) * t2




Related Messages


Powered by MHonArc, Updated Mon May 05 20:20:02 2014