Author: tlinnet
Date: Tue May 6 17:23:13 2014
New Revision: 23006
URL: http://svn.gna.org/viewcvs/relax?rev=23006&view=rev
Log:
Moved Carver and Richards (1972) zeta and Psi notation outside library
function.
sr #3154: (https://gna.org/support/?3154) Implementation of Baldwin (2014)
B14 model - 2-site exact solution model for all time scales.
Not sure, if this speeds the calculation up.
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
trunk/target_functions/relax_disp.py
Modified: trunk/lib/dispersion/b14.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/lib/dispersion/b14.py?rev=23006&r1=23005&r2=23006&view=diff
==============================================================================
--- trunk/lib/dispersion/b14.py (original)
+++ trunk/lib/dispersion/b14.py Tue May 6 17:23:13 2014
@@ -102,7 +102,7 @@
from numpy import arccosh, cos, cosh, log, sin, sinh, sqrt, power
-def r2eff_B14(r20a=None, r20b=None, deltaR2=None, alpha_m=None, pA=None,
pB=None, dw=None, kex=None, k_AB=None, k_BA=None, ncyc=None,
inv_tcpmg=None, tcp=None, back_calc=None, num_points=None):
+def r2eff_B14(r20a=None, r20b=None, deltaR2=None, alpha_m=None, pA=None,
pB=None, dw=None, zeta=None, Psi=None, kex=None, k_AB=None, k_BA=None,
ncyc=None, inv_tcpmg=None, tcp=None, back_calc=None, num_points=None):
"""Calculate the R2eff values for the CR72 model.
See the module docstring for details.
@@ -122,6 +122,10 @@
@type pB: float
@keyword dw: The chemical exchange difference between
states A and B in rad/s.
@type dw: float
+ @keyword zeta: The Carver and Richards (1972) zeta notation.
zeta = 2 * dw * alpha_m.
+ @type zeta: float
+ @keyword Psi: The Carver and Richards (1972) Psi notation.
Psi = alpha_m**2 + 4 * k_BA * k_AB - dw**2.
+ @type Psi: float
@keyword kex: The kex parameter value (the exchange rate in
rad/s).
@type kex: float
@keyword k_AB: The rate of exchange from site A to B (rad/s).
@@ -149,10 +153,8 @@
#########################################################################
#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 - 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
+ g3 = 1/sqrt(2) * sqrt(Psi + sqrt(zeta**2 + Psi**2)) #trig faster
than square roots
+ g4 = 1/sqrt(2) * sqrt(-Psi + sqrt(zeta**2 + Psi**2)) #trig faster
than square roots
#########################################################################
# Repetitive calculations (to speed up calculations).
g32 = g3**2
@@ -176,7 +178,7 @@
t2 = (dw + g4) * complex(dw, -g3) / NNc
# t1 + t2.
- t1pt2 = complex(2 * dw2,g1) / NNc
+ t1pt2 = complex(2 * dw2, zeta) / NNc
# -2 * oG * t2.
oGt2 = complex(-alpha_m - g3, dw - g4) * t2
Modified: trunk/target_functions/relax_disp.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/target_functions/relax_disp.py?rev=23006&r1=23005&r2=23006&view=diff
==============================================================================
--- trunk/target_functions/relax_disp.py (original)
+++ trunk/target_functions/relax_disp.py Tue May 6 17:23:13 2014
@@ -800,15 +800,6 @@
for si in range(self.num_spins):
# Loop over the spectrometer frequencies.
for mi in range(self.num_frq):
- # The R20 index.
- r20_index = mi + si*self.num_frq
-
- # Repetitive calculations (to speed up calculations).
- r20a = R20A[r20_index]
- r20b = R20B[r20_index]
- deltaR2 = r20a - r20b
- alpha_m = deltaR2 + k_AB - k_BA
-
# Convert dw from ppm to rad/s.
dw_frq = dw[si] * self.frqs[ei][si][mi]
@@ -818,8 +809,21 @@
elif self.exp_types[ei] == EXP_TYPE_CPMG_PROTON_SQ:
aliased_dw = dw_frq
+ # The R20 index.
+ r20_index = mi + si*self.num_frq
+
+ # Repetitive calculations (to speed up calculations).
+ r20a = R20A[r20_index]
+ r20b = R20B[r20_index]
+ deltaR2 = r20a - r20b
+
+ # The Carver and Richards (1972) alpha_minus short
notation.
+ alpha_m = deltaR2 + k_AB - k_BA
+ zeta = 2 * aliased_dw * alpha_m
+ Psi = alpha_m**2 + 4 * k_BA * k_AB - aliased_dw**2
+
# Back calculate the R2eff values.
- r2eff_B14(r20a=r20a, r20b=r20b, deltaR2=deltaR2,
alpha_m=alpha_m, pA=pA, pB=pB, dw=dw_frq, kex=kex, k_AB=k_AB, k_BA=k_BA,
ncyc=self.power[ei][mi], inv_tcpmg=self.inv_relax_times[ei][mi],
tcp=self.tau_cpmg[ei][mi], back_calc=self.back_calc[ei][si][mi][0],
num_points=self.num_disp_points[ei][si][mi][0])
+ r2eff_B14(r20a=r20a, r20b=r20b, deltaR2=deltaR2,
alpha_m=alpha_m, pA=pA, pB=pB, dw=dw_frq, zeta=zeta, Psi=Psi, kex=kex,
k_AB=k_AB, k_BA=k_BA, ncyc=self.power[ei][mi],
inv_tcpmg=self.inv_relax_times[ei][mi], tcp=self.tau_cpmg[ei][mi],
back_calc=self.back_calc[ei][si][mi][0],
num_points=self.num_disp_points[ei][si][mi][0])
# 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 di in range(self.num_disp_points[ei][si][mi][0]):
_______________________________________________
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