mailr22963 - /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:18:
Author: tlinnet
Date: Mon May  5 20:18:16 2014
New Revision: 22963

URL: http://svn.gna.org/viewcvs/relax?rev=22963&view=rev
Log:
Implemented g3 and g4 as square root functions instead of atan2.

atan2 is alwas returning values between -pi and pi.
https://docs.python.org/2/library/math.html

Next step is to convert g1>-g1, which will truely follow the CR72 
Nomenclature.
For this, the atan2 function is a blocker.

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=22963&r1=22962&r2=22963&view=diff
==============================================================================
--- trunk/lib/dispersion/b14.py (original)
+++ trunk/lib/dispersion/b14.py Mon May  5 20:18:16 2014
@@ -99,7 +99,7 @@
 
 # Python module imports.
 import numpy
-from math import cos,sin,atan2
+from math import cos,sin, sqrt
 
 
 def r2eff_B14(r20a=None, r20b=None, pA=None, dw=None, kex=None, power=None, 
relax_time=None, tcp=None, back_calc=None, num_points=None):
@@ -150,8 +150,8 @@
     #get the real and imaginary components of the exchange induced shift
     g1=2*dw*(deltaR2+keg-kge)                   #same as carver richards zeta
     g2=(deltaR2+keg-kge)**2+4*keg*kge-dw**2   #same as carver richards psi
-    g3=cos(0.5*atan2(g1,g2))*(g1**2+g2**2)**(1/4.0)   #trig faster than 
square roots
-    g4=sin(0.5*atan2(g1,g2))*(g1**2+g2**2)**(1/4.0)   #trig faster than 
square roots
+    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
     #########################################################################
     #time independent factors
     N=complex(kge+g3-kge,g4)            #N=oG+oE




Related Messages


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