Author: tlinnet Date: Tue Jul 22 16:51:55 2014 New Revision: 24635 URL: http://svn.gna.org/viewcvs/relax?rev=24635&view=rev Log: Code validation of lib/dispersion/tp02.py. Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis. Modified: branches/disp_spin_speed/lib/dispersion/tp02.py Modified: branches/disp_spin_speed/lib/dispersion/tp02.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/tp02.py?rev=24635&r1=24634&r2=24635&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/tp02.py (original) +++ branches/disp_spin_speed/lib/dispersion/tp02.py Tue Jul 22 16:51:55 2014 @@ -100,13 +100,23 @@ pB = 1.0 - pA # Repetitive calculations (to speed up calculations). - 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]. - da = Wa - offset # Offset of spin-lock from A. - db = Wb - offset # Offset of spin-lock from B. - d = W - offset # Offset of spin-lock from pop-average. + + # Larmor frequency [s^-1]. + Wa = omega + Wb = omega + dw + + # Pop-averaged Larmor frequency [s^-1]. + W = pA*Wa + pB*Wb + + # Offset of spin-lock from A. + da = Wa - offset + + # Offset of spin-lock from B. + db = Wb - offset + + # Offset of spin-lock from pop-average. + d = W - offset da2 = da**2 db2 = db**2 d2 = d**2 @@ -115,9 +125,14 @@ numer = pA * pB * dw**2 * kex # We assume that A resonates at 0 [s^-1], without loss of generality. - waeff2 = spin_lock_fields2 + da2 # Effective field at A. - wbeff2 = spin_lock_fields2 + db2 # Effective field at B. - weff2 = spin_lock_fields2 + d2 # Effective field at pop-average. + # Effective field at A. + waeff2 = spin_lock_fields2 + da2 + + # Effective field at B. + wbeff2 = spin_lock_fields2 + db2 + + # Effective field at pop-average. + weff2 = spin_lock_fields2 + d2 # The rotating frame flip angle. theta = arctan2(spin_lock_fields, d) @@ -136,7 +151,7 @@ # Denominator. denom = waeff2 * wbeff2 / weff2 + kex2 #denom_extended = waeff2*wbeff2/weff2+kex2-2*sin_theta2*pA*pB*dw**2 - + # R1rho calculation. back_calc[:] = R1_cos_theta2 + R1rho_prime_sin_theta2 + sin_theta2 * numer / denom