mailr20632 - in /branches/relax_disp/lib/dispersion: __init__.py tsmfk01.py


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

Header


Content

Posted by edward on August 18, 2013 - 20:23:
Author: bugman
Date: Sun Aug 18 20:23:22 2013
New Revision: 20632

URL: http://svn.gna.org/viewcvs/relax?rev=20632&view=rev
Log:
Added the TSMFK01 model equations to the relax library: 
lib/dispersion/tsmfk01.py

Progress sr #3071: https://gna.org/support/index.php?3071 - Implementation of 
Tollinger/Kay dispersion model (2001)
Following the guide at: 
http://wiki.nmr-relax.com/Tutorial_for_adding_relaxation_dispersion_models_to_relax

Troels E. Linnet provided this patch. Commit by: tlinnet _aaattt_ 
gmail_dot_com

Signed-off-by: Edward d'Auvergne <edward@xxxxxxxxxxxxx>

Modified:
    branches/relax_disp/lib/dispersion/__init__.py
    branches/relax_disp/lib/dispersion/tsmfk01.py

Modified: branches/relax_disp/lib/dispersion/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/__init__.py?rev=20632&r1=20631&r2=20632&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/__init__.py (original)
+++ branches/relax_disp/lib/dispersion/__init__.py Sun Aug 18 20:23:22 2013
@@ -27,6 +27,7 @@
     'dpl94',
     'it99',
     'lm63',
+    'tsmfk01',
     'lm63_3site',
     'm61',
     'm61b',

Modified: branches/relax_disp/lib/dispersion/tsmfk01.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/tsmfk01.py?rev=20632&r1=20631&r2=20632&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/tsmfk01.py (original)
+++ branches/relax_disp/lib/dispersion/tsmfk01.py Sun Aug 18 20:23:22 2013
@@ -1,7 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2009 Sebastien Morin                                         
 #
-# Copyright (C) 2013 Edward d'Auvergne                                       
 #
+# Copyright (C) 2013 Troels E. Linnet                                        
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -21,41 +20,43 @@
 
###############################################################################
 
 # Module docstring.
-"""The Luz and Meiboom (1963) 2-site fast exchange model.
+"""The Tollinger, Kay et al. (2001) 2-site very-slow exchange model, range 
of microsecond to second time scale.
+Applicable in the limit of slow exchange, when |R20A-R2bj| << kA,kB << 
1/tau_CP. R20A is the transverse relaxation rate of site A in the absence of 
exchange.
+2*tau_CP is is the time between successive 180 deg. pulses.
 
-This module is for the function, gradient and Hessian of the LM63 model.  
The model is named after the reference:
+This module is for the function, gradient and Hessian of the TSMFK01 model.  
The model is named after the reference:
 
-    - Luz, S. and Meiboom S., (1963)  Nuclear Magnetic Resonance study of 
protolysis of trimethylammonium ion in aqueous solution - order of reaction 
with respect to solvent, J. Chem. Phys. 39, 366-370 (U{DOI: 
10.1063/1.1734254<http://dx.doi.org/10.1063/1.1734254>}).
+    - Martin Tollinger, Nikolai R. Skrynnikov, Frans A. A. Mulder, Julie D. 
Forman-Kay and Lewis E. Kay., (2001)  Slow Dynamics in Folded and Unfolded 
States of an SH3 Domain, J. Am. Chem. Soc., 2001, 123 (46) (U{DOI: 
10.1021/ja011300z<http://dx.doi.org/10.1021/ja011300z>}).
 
 The equation used is::
 
-                  phi_ex   /     4 * nu_cpmg         /     kex     \ \ 
-    R2eff = R20 + ------ * | 1 - -----------  * tanh | ----------- | | ,
-                   kex     \         kex             \ 4 * nu_cpmg / /
+                              sin(delta_omega * tau_CP)
+    R2Aeff = R20A + kA - kA * -------------------------  ,
+                               delta_omega * tau_CP
 
 where::
 
-    phi_ex = pA * pB * delta_omega^2 ,
+    tau_CP = 1.0/(4*nu_cpmg) ,
 
-kex is the chemical exchange rate constant, pA and pB are the populations of 
states A and B, and delta_omega is the chemical shift difference between the 
two states.
+R20A is the transverse relaxation rate of site A in the absence of exchange, 
2*tau_CP is is the time between successive 180 deg. pulses, kA is the forward 
chemical exchange rate constant, delta_omega is the chemical shift difference 
between the two states.
 """
 
 # Python module imports.
-from math import tanh
+from math import sin
 
 
-def r2eff_LM63(r20=None, phi_ex=None, kex=None, cpmg_frqs=None, 
back_calc=None, num_points=None):
-    """Calculate the R2eff values for the LM63 model.
+def r2eff_TSMFK01(r20a=None, dw=None, kA=None, cpmg_frqs=None, 
back_calc=None, num_points=None):
+    """Calculate the R2eff values for the TSMFK01 model.
 
     See the module docstring for details.
 
 
-    @keyword r20:           The R20 parameter value (R2 with no exchange).
-    @type r20:              float
-    @keyword phi_ex:        The phi_ex parameter value (pA * pB * 
delta_omega^2).
-    @type phi_ex:           float
-    @keyword kex:           The kex parameter value (the exchange rate in 
rad/s).
-    @type kex:              float
+    @keyword r20a:          The R20 parameter value of state A (R2 with no 
exchange).
+    @type r20a:             float
+    @keyword dw:            The chemical exchange difference between states 
A and B in rad/s.
+    @type dw:               float
+    @keyword kA:            The kA parameter value (the forward exchange 
rate in rad/s).
+    @type kA:               float
     @keyword cpmg_frqs:     The CPMG nu1 frequencies.
     @type cpmg_frqs:        numpy rank-1 float array
     @keyword back_calc:     The array for holding the back calculated R2eff 
values.  Each element corresponds to one of the CPMG nu1 frequencies.
@@ -64,20 +65,32 @@
     @type num_points:       int
     """
 
-    # Repetitive calculations (to speed up calculations).
-    rex = phi_ex / kex
-    kex_4 = 4.0 / kex
-
     # Loop over the time points, back calculating the R2eff values.
     for i in range(num_points):
-        # Catch zeros.
-        if phi_ex == 0.0:
-            back_calc[i] = r20
+        # Catch zeros (to avoid pointless mathematical operations).
+        if cpmg_frqs[i] == 0.0:
+            back_calc[i] = r20a
+            continue
+
+        # Repetitive calculations (to speed up calculations).
+        tau_CP = 1.0/(4*cpmg_frqs[i])
+
+        # The numerator.
+        numer = sin(dw * tau_CP)
+
+        # Catch zeros (to avoid pointless mathematical operations).
+        if numer == 0.0:
+            back_calc[i] = r20a + kA
+            continue
+
+        # Denominator.
+        denom = dw * tau_CP
 
         # Avoid divide by zero.
-        elif kex == 0.0:
+        if denom == 0.0:
             back_calc[i] = 1e100
+            continue
 
         # The full formula.
         else:
-            back_calc[i] = r20 + rex * (1.0 - kex_4 * cpmg_frqs[i] * 
tanh(kex / (4.0 * cpmg_frqs[i])))
+            back_calc[i] = r20 + kA - kA * numer / denom




Related Messages


Powered by MHonArc, Updated Tue Aug 20 16:20:01 2013