mailRe: r23012 - /trunk/lib/dispersion/b14.py


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

Header


Content

Posted by Edward d'Auvergne on May 06, 2014 - 17:38:
That's a more elegant solution, removing all complex() function calls.

Cheers,

Edward



On 6 May 2014 17:25,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Tue May  6 17:25:05 2014
New Revision: 23012

URL: http://svn.gna.org/viewcvs/relax?rev=23012&view=rev
Log:
Speed-up. Converted expressions of complex(x, y) to (x + y*1j).

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=23012&r1=23011&r2=23012&view=diff
==============================================================================
--- trunk/lib/dispersion/b14.py (original)
+++ trunk/lib/dispersion/b14.py Tue May  6 17:25:05 2014
@@ -163,7 +163,7 @@

     # Time independent factors.
     # N = oG + oE.
-    N = complex(g3, g4)
+    N = g3 + g4*1j

     NNc = g32 + g42

@@ -176,13 +176,13 @@
     # t1 = (-dw + g4) * (complex(-dw, -g3)) / NNc #t1.

     # t2.
-    t2 = (dw + g4) * complex(dw, -g3) / NNc
+    t2 = (dw + g4) * (dw - g3*1j) / NNc

     # t1 + t2.
-    t1pt2 = complex(2. * dw2, zeta) / NNc
+    t1pt2 = (2. * dw2 + zeta*1j) / NNc

     # -2 * oG * t2.
-    oGt2 = complex(-alpha_m - g3, dw - g4) * t2
+    oGt2 = t2 * (-alpha_m - g3 ) + t2 * (dw - g4)*1j

     # -1/Trel * log(LpreDyn).
     Rpre = (r20a + r20b + kex) / 2.0
@@ -195,13 +195,13 @@
     E2 =  two_tcp * g4

     # Mixed term (complex) (E0 - iE2)/2.
-    E1 = complex(g3, -g4) * tcp
+    E1 = (g3 - g4*1j) * tcp

     # Real. The v_1c in paper.
     ex0b = f0 * cosh(E0) - f2 * cos(E2)

     # Complex.
-    ex0c = f0 * sinh(E0) - f2 * sin(E2) * complex(0, 1.0)
+    ex0c = f0 * sinh(E0) - f2 * sin(E2)*1j

     # Complex.
     ex1c = sinh(E1)
@@ -212,7 +212,7 @@
     y = power( (ex0b - v3) / (ex0b + v3), ncyc)

     # Off diagonal common factor. sinh fuctions.
-    v2pPdN = complex(-deltaR2 + kex, dw) * ex0c + (-oGt2 - k_AB * t1pt2) * 
2. * ex1c
+    v2pPdN = (-deltaR2 + kex + dw*1j) * ex0c + (-oGt2 - k_AB * t1pt2) * 2. 
* ex1c

     Tog = (1. + y) / 2. + (1. - y) / (2. * v3) * v2pPdN / N



_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

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-commits



Related Messages


Powered by MHonArc, Updated Tue May 06 18:00:10 2014