Author: bugman Date: Sun Nov 17 13:42:30 2013 New Revision: 21480 URL: http://svn.gna.org/viewcvs/relax?rev=21480&view=rev Log: Added the 'TAP03' R2eff calculating function to the relax library. This is the Trott, Abergel and Palmer 2003 R1rho analytic model for 2-site off-resonance exchange. This follows the tutorial for adding relaxation dispersion models at: http://wiki.nmr-relax.com/Tutorial_for_adding_relaxation_dispersion_models_to_relax#The_relax_library. Added: branches/relax_disp/lib/dispersion/tap03.py - copied, changed from r21474, branches/relax_disp/lib/dispersion/mp05.py Modified: branches/relax_disp/lib/dispersion/__init__.py Modified: branches/relax_disp/lib/dispersion/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/__init__.py?rev=21480&r1=21479&r2=21480&view=diff ============================================================================== --- branches/relax_disp/lib/dispersion/__init__.py (original) +++ branches/relax_disp/lib/dispersion/__init__.py Sun Nov 17 13:42:30 2013 @@ -38,6 +38,7 @@ 'ns_cpmg_2site_star', 'ns_r1rho_2site', 'ns_matrices', + 'tap03', 'tp02', 'tsmfk01', 'two_point' Copied: branches/relax_disp/lib/dispersion/tap03.py (from r21474, branches/relax_disp/lib/dispersion/mp05.py) URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/tap03.py?p2=branches/relax_disp/lib/dispersion/tap03.py&p1=branches/relax_disp/lib/dispersion/mp05.py&r1=21474&r2=21480&rev=21480&view=diff ============================================================================== --- branches/relax_disp/lib/dispersion/mp05.py (original) +++ branches/relax_disp/lib/dispersion/tap03.py Sun Nov 17 13:42:30 2013 @@ -22,13 +22,13 @@ ############################################################################### # Module docstring. -"""This Miloushev and Palmer (2005) 2-site exchange R1rho model. +"""This is the Trott, Abergel and Palmer (2003) off-resonance 2-site exchange R1rho model. -This module is for the function, gradient and Hessian of the MP05 model. The model is named after the reference: +This module is for the function, gradient and Hessian of the TAP03 model. The model is named after the reference: - - Miloushev V. Z. and Palmer A. (2005). R1rho relaxation for two-site chemical exchange: General approximations and some exact solutions. J. Magn. Reson., 177, 221-227. (U{DOI: 10.1016/j.jmr.2005.07.023<http://dx.doi.org/10.1016/j.jmr.2005.07.023>}). + - Trott, O., Abergel, D., and Palmer, A. (2003). An average-magnetization analysis of R1rho relaxation outside of the fast exchange. Mol. Phys., 101, 753â763. (U{DOI: 10.1080/0026897021000054826<http://dx.doi.org/10.1080/0026897021000054826>}). -The code was copied from the TP02 model, hence it originates as the funTrottPalmer.m Matlab file from the sim_all.tar file attached to task #7712 (https://gna.org/task/?7712). This is code from Nikolai Skrynnikov and Martin Tollinger. +The code was copied from the TP02 model (via the MP05 model), hence it originates as the funTrottPalmer.m Matlab file from the sim_all.tar file attached to task #7712 (https://gna.org/task/?7712). This is code from Nikolai Skrynnikov and Martin Tollinger. Links to the copyright licensing agreements from all authors are: @@ -37,13 +37,13 @@ """ # Python module imports. -from math import atan, cos, pi, sin +from math import atan, cos, pi, sin, sqrt -def r1rho_MP05(r1rho_prime=None, omega=None, offset=None, pA=None, pB=None, dw=None, kex=None, R1=0.0, spin_lock_fields=None, spin_lock_fields2=None, back_calc=None, num_points=None): +def r1rho_TAP03(r1rho_prime=None, omega=None, offset=None, pA=None, pB=None, dw=None, kex=None, R1=0.0, spin_lock_fields=None, spin_lock_fields2=None, back_calc=None, num_points=None): """Calculate the R1rho' values for the TP02 model. - See the module docstring for details. This is the Miloushev and Palmer (2005) equation according to Korzhnev (J. Biomol. NMR (2003), 26, 39-48). + See the module docstring for details. This is the Trott, Abergel and Palmer (2003) equation. @keyword r1rho_prime: The R1rho_prime parameter value (R1rho with no exchange). @@ -76,6 +76,9 @@ Wa = omega # Larmor frequency [s^-1]. Wb = omega + dw # Larmor frequency [s^-1]. kex2 = kex**2 + W = pA*Wa + pB*Wb # Pop-averaged Larmor frequency [s^-1]. + sigma = pB*Wa + pA*Wb + sigma2 = sigma**2 # The numerator. phi_ex = pA * pB * dw**2 @@ -83,17 +86,19 @@ # Loop over the dispersion points, back calculating the R1rho values. for i in range(num_points): + # The gamma factor. + gamma = 1.0 + phi_ex*(sigma2 - kex2 + spin_lock_fields2[i]) / (sigma2 + kex2 + spin_lock_fields2[i]) + # We assume that A resonates at 0 [s^-1], without loss of generality. - W = pA*Wa + pB*Wb # Pop-averaged Larmor frequency [s^-1]. da = Wa - offset[i] # Offset of spin-lock from A. db = Wb - offset[i] # Offset of spin-lock from B. d = W - offset[i] # Offset of spin-lock from pop-average. - waeff2 = spin_lock_fields2[i] + da**2 # Effective field at A. - wbeff2 = spin_lock_fields2[i] + db**2 # Effective field at B. - weff2 = spin_lock_fields2[i] + d**2 # Effective field at pop-average. + waeff2 = spin_lock_fields2[i] + gamma*da**2 # Effective field at A. + wbeff2 = spin_lock_fields2[i] + gamma*db**2 # Effective field at B. + weff2 = spin_lock_fields2[i] + gamma*d**2 # Effective field at pop-average. # The rotating frame flip angle. - theta = atan(spin_lock_fields[i] / d) + theta = atan(sqrt(gamma)*spin_lock_fields[i] / d) # Repetitive calculations (to speed up calculations). sin_theta2 = sin(theta)**2 @@ -106,9 +111,7 @@ continue # Denominator. - waeff2_wbeff2 = waeff2*wbeff2 - fact = 1.0 + 2.0*kex2*(pA*waeff2 + pB*wbeff2) / (waeff2_wbeff2 + weff2*kex2) - denom = waeff2_wbeff2/weff2 + kex2 - sin_theta2*phi_ex*(fact) + denom = waeff2*wbeff2/weff2 + kex2 - 2.0*sin_theta2*phi_ex*kex + (1.0 - gamma)*spin_lock_fields2[i] # Avoid divide by zero. if denom == 0.0: @@ -116,4 +119,4 @@ continue # R1rho calculation. - back_calc[i] = R1_cos_theta2 + R1rho_prime_sin_theta2 + sin_theta2 * numer / denom + back_calc[i] = R1_cos_theta2 + R1rho_prime_sin_theta2 + sin_theta2 * numer / denom / gamma