mailr20347 - in /branches/relax_disp: lib/dispersion/ns_2site_3d.py lib/dispersion/ns_2site_star.py target_functions/relax_disp.py


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

Header


Content

Posted by edward on July 17, 2013 - 11:09:
Author: bugman
Date: Wed Jul 17 11:09:56 2013
New Revision: 20347

URL: http://svn.gna.org/viewcvs/relax?rev=20347&view=rev
Log:
More changes to the numerical solution dispersion code to match relax's 
conventions.

This includes the changes of df->dw, fA->wA, fB->wB, and Mgx->Mx.


Modified:
    branches/relax_disp/lib/dispersion/ns_2site_3d.py
    branches/relax_disp/lib/dispersion/ns_2site_star.py
    branches/relax_disp/target_functions/relax_disp.py

Modified: branches/relax_disp/lib/dispersion/ns_2site_3d.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/ns_2site_3d.py?rev=20347&r1=20346&r2=20347&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/ns_2site_3d.py (original)
+++ branches/relax_disp/lib/dispersion/ns_2site_3d.py Wed Jul 17 11:09:56 2013
@@ -41,7 +41,7 @@
 from lib.dispersion.ns_matrices import rcpmg_3d
 
 
-def r2eff_ns_2site_3D(r180x=None, M0=None, r10a=0.0, r10b=0.0, r20a=None, 
r20b=None, pA=None, dw=None, k_AB=None, k_BA=None, inv_tcpmg=None, tcp=None, 
back_calc=None, num_points=None, power=None):
+def r2eff_ns_2site_3D(r180x=None, M0=None, r10a=0.0, r10b=0.0, r20a=None, 
r20b=None, pA=None, pB=None, dw=None, k_AB=None, k_BA=None, inv_tcpmg=None, 
tcp=None, back_calc=None, num_points=None, power=None):
     """The 2-site numerical solution to the Bloch-McConnell equation.
 
     This function calculates and stores the R2eff values.
@@ -61,6 +61,8 @@
     @type r20b:             float
     @keyword pA:            The population of state A.
     @type pA:               float
+    @keyword pB:            The population of state B.
+    @type pB:               float
     @keyword dw:            The chemical exchange difference between states 
A and B in rad/s.
     @type dw:               float
     @keyword k_AB:          The rate of exchange from site A to B (rad/s).
@@ -80,7 +82,7 @@
     """
 
     # The matrix R that contains all the contributions to the evolution, 
i.e. relaxation, exchange and chemical shift evolution.
-    R = rcpmg_3d(R1A=r10a, R1B=r10b, R2A=r20a, R2B=r20b, df=dw, k_AB=k_AB, 
k_BA=k_BA)
+    R = rcpmg_3d(R1A=r10a, R1B=r10b, R2A=r20a, R2B=r20b, pA=pA, pB=pB, 
dw=dw, k_AB=k_AB, k_BA=k_BA)
 
     # Loop over the time points, back calculating the R2eff values.
     for i in range(num_points):
@@ -97,8 +99,8 @@
             Mint = dot(Rexpo, Mint)
 
         # The next lines calculate the R2eff using a two-point 
approximation, i.e. assuming that the decay is mono-exponential.
-        Mgx = fabs(Mint[1] / pA)
-        if Mgx == 0.0:
+        Mx = fabs(Mint[1] / pA)
+        if Mx == 0.0:
             back_calc[i] = 1e99
         else:
-            back_calc[i]= -inv_tcpmg * log(Mgx)
+            back_calc[i]= -inv_tcpmg * log(Mx)

Modified: branches/relax_disp/lib/dispersion/ns_2site_star.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/ns_2site_star.py?rev=20347&r1=20346&r2=20347&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/ns_2site_star.py (original)
+++ branches/relax_disp/lib/dispersion/ns_2site_star.py Wed Jul 17 11:09:56 
2013
@@ -39,7 +39,7 @@
     from scipy.linalg import expm
 
 
-def r2eff_ns_2site_star(Rr=None, Rex=None, RCS=None, R=None, M0=None, 
r20a=None, r20b=None, fA=None, inv_tcpmg=None, tcp=None, back_calc=None, 
num_points=None, power=None):
+def r2eff_ns_2site_star(Rr=None, Rex=None, RCS=None, R=None, M0=None, 
r20a=None, r20b=None, dw=None, inv_tcpmg=None, tcp=None, back_calc=None, 
num_points=None, power=None):
     """The 2-site numerical solution to the Bloch-McConnell equation using 
complex conjugate matrices.
 
     This function calculates and stores the R2eff values.
@@ -59,8 +59,8 @@
     @type r20a:             float
     @keyword r20b:          The R2 value for state B in the absence of 
exchange.
     @type r20b:             float
-    @keyword fA:            The frequency of state A.
-    @type fA:               float
+    @keyword dw:            The chemical exchange difference between states 
A and B in rad/s.
+    @type dw:               float
     @keyword inv_tcpmg:     The inverse of the total duration of the CPMG 
element (in inverse seconds).
     @type inv_tcpmg:        float
     @keyword tcp:           The tau_CPMG times (1 / 4.nu1).
@@ -77,8 +77,8 @@
     Rr[0, 0] = -r20a
     Rr[1, 1] = -r20b
 
-    # The matrix that contains the chemical shift evolution.  It works here 
only with X magnetization, and the complex notation allows to evolve in the 
transverse plane (x, y).
-    RCS[1, 1] = complex(0.0, -fA)
+    # The matrix that contains the chemical shift evolution.  It works here 
only with X magnetization, and the complex notation allows to evolve in the 
transverse plane (x, y).  The chemical shift for state A is assumed to be 
zero.
+    RCS[1, 1] = complex(0.0, -dw)
 
     # The matrix R that contains all the contributions to the evolution, 
i.e. relaxation, exchange and chemical shift evolution.
     add(Rr, Rex, out=R)
@@ -102,8 +102,8 @@
         Moft = dot(prop_total, M0)
 
         # The next lines calculate the R2eff using a two-point 
approximation, i.e. assuming that the decay is mono-exponential.
-        Mgx = Moft[0].real / M0[0]
-        if Mgx == 0.0:
+        Mx = Moft[0].real / M0[0]
+        if Mx == 0.0:
             back_calc[i] = 1e99
         else:
-            back_calc[i]= -inv_tcpmg * log(Mgx)
+            back_calc[i]= -inv_tcpmg * log(Mx)

Modified: branches/relax_disp/target_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/target_functions/relax_disp.py?rev=20347&r1=20346&r2=20347&view=diff
==============================================================================
--- branches/relax_disp/target_functions/relax_disp.py (original)
+++ branches/relax_disp/target_functions/relax_disp.py Wed Jul 17 11:09:56 
2013
@@ -284,7 +284,7 @@
                 dw_frq = dw[spin_index] * self.frqs[spin_index, frq_index]
 
                 # Back calculate the R2eff values.
-                r2eff_ns_2site_3D(r180x=self.r180x, M0=self.M0, 
r20a=R20A[r20_index], r20b=R20B[r20_index], pA=pA, dw=dw_frq, k_AB=k_AB, 
k_BA=k_BA, inv_tcpmg=self.inv_relax_time, tcp=self.tau_cpmg, 
back_calc=self.back_calc[spin_index, frq_index], 
num_points=self.num_disp_points, power=self.power)
+                r2eff_ns_2site_3D(r180x=self.r180x, M0=self.M0, 
r20a=R20A[r20_index], r20b=R20B[r20_index], pA=pA, pB=pB, dw=dw_frq, 
k_AB=k_AB, k_BA=k_BA, inv_tcpmg=self.inv_relax_time, tcp=self.tau_cpmg, 
back_calc=self.back_calc[spin_index, frq_index], 
num_points=self.num_disp_points, power=self.power)
 
                 # For all missing data points, set the back-calculated value 
to the measured values so that it has no effect on the chi-squared value.
                 for point_index in range(self.num_disp_points):
@@ -344,7 +344,7 @@
                 dw_frq = dw[spin_index] * self.frqs[spin_index, frq_index]
 
                 # Back calculate the R2eff values.
-                r2eff_ns_2site_star(Rr=self.Rr, Rex=self.Rex, RCS=self.RCS, 
R=self.R, M0=self.M0, r20a=R20A[r20_index], r20b=R20B[r20_index], fA=dw_frq, 
inv_tcpmg=self.inv_relax_time, tcp=self.tau_cpmg, 
back_calc=self.back_calc[spin_index, frq_index], 
num_points=self.num_disp_points, power=self.power)
+                r2eff_ns_2site_star(Rr=self.Rr, Rex=self.Rex, RCS=self.RCS, 
R=self.R, M0=self.M0, r20a=R20A[r20_index], r20b=R20B[r20_index], dw=dw_frq, 
inv_tcpmg=self.inv_relax_time, tcp=self.tau_cpmg, 
back_calc=self.back_calc[spin_index, frq_index], 
num_points=self.num_disp_points, power=self.power)
 
                 # For all missing data points, set the back-calculated value 
to the measured values so that it has no effect on the chi-squared value.
                 for point_index in range(self.num_disp_points):




Related Messages


Powered by MHonArc, Updated Wed Jul 17 12:00:01 2013