Package lib :: Package dispersion :: Module dpl94
[hide private]
[frames] | no frames]

Source Code for Module lib.dispersion.dpl94

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2009 Sebastien Morin                                          # 
  4  # Copyright (C) 2013-2014 Edward d'Auvergne                                   # 
  5  #                                                                             # 
  6  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  7  #                                                                             # 
  8  # This program is free software: you can redistribute it and/or modify        # 
  9  # it under the terms of the GNU General Public License as published by        # 
 10  # the Free Software Foundation, either version 3 of the License, or           # 
 11  # (at your option) any later version.                                         # 
 12  #                                                                             # 
 13  # This program is distributed in the hope that it will be useful,             # 
 14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 16  # GNU General Public License for more details.                                # 
 17  #                                                                             # 
 18  # You should have received a copy of the GNU General Public License           # 
 19  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Module docstring. 
 24  """The Davis, Perlman and London (1994) 2-site fast exchange R1rho U{DPL94<http://wiki.nmr-relax.com/DPL94>} model. 
 25   
 26  Description 
 27  =========== 
 28   
 29  This module is for the function, gradient and Hessian of the U{DPL94<http://wiki.nmr-relax.com/DPL94>} model. 
 30   
 31   
 32  References 
 33  ========== 
 34   
 35  The model is named after the reference: 
 36   
 37      - Davis, D. G., Perlman, M. E. and London, R. E. (1994).  Direct measurements of the dissociation-rate constant for inhibitor-enzyme complexes via the T1rho and T2 (CPMG) methods.  I{J. Magn. Reson.}, Series B, B{104}, 266-275.  (U{DOI: 10.1006/jmrb.1994.1084<http://dx.doi.org/10.1006/jmrb.1994.1084>}) 
 38   
 39  Equations 
 40  ========= 
 41   
 42  The equation used is:: 
 43   
 44                                                                        phi_ex * kex 
 45      R1rho = R1.cos^2(theta) + R1rho'.sin^2(theta) + sin^2(theta) * ------------------ , 
 46                                                                     kex^2 + omega_sl^2 
 47   
 48  where theta is the rotating frame tilt angle, and:: 
 49   
 50      phi_ex = pA * pB * delta_omega^2 , 
 51   
 52  kex is the chemical exchange rate constant, pA and pB are the populations of states A and B, delta_omega is the chemical shift difference between the two states, and omega_sl is the spin-lock field strength. 
 53   
 54   
 55  Links 
 56  ===== 
 57   
 58  More information on the DPL94 model can be found in the: 
 59   
 60      - U{relax wiki<http://wiki.nmr-relax.com/DPL94>}, 
 61      - U{relax manual<http://www.nmr-relax.com/manual/DPL94_2_site_fast_exchange_R1_model.html>}, 
 62      - U{relaxation dispersion page of the relax website<http://www.nmr-relax.com/analyses/relaxation_dispersion.html#DPL94>}. 
 63  """ 
 64   
 65  # Python module imports. 
 66  from numpy import abs, array, cos, isfinite, min, sin, sum 
 67   
 68   
69 -def r1rho_DPL94(r1rho_prime=None, phi_ex=None, kex=None, theta=None, R1=0.0, spin_lock_fields2=None, back_calc=None, num_points=None):
70 """Calculate the R1rho values for the DPL94 model. 71 72 See the module docstring for details. 73 74 75 @keyword r1rho_prime: The R1rho_prime parameter value (R1rho with no exchange). 76 @type r1rho_prime: float 77 @keyword phi_ex: The phi_ex parameter value (pA * pB * delta_omega^2). 78 @type phi_ex: float 79 @keyword kex: The kex parameter value (the exchange rate in rad/s). 80 @type kex: float 81 @keyword theta: The rotating frame tilt angles for each dispersion point. 82 @type theta: numpy rank-1 float array 83 @keyword R1: The R1 relaxation rate. 84 @type R1: float 85 @keyword spin_lock_fields2: The R1rho spin-lock field strengths squared (in rad^2.s^-2). 86 @type spin_lock_fields2: numpy rank-1 float array 87 @keyword back_calc: The array for holding the back calculated R1rho values. Each element corresponds to the combination of theta and spin lock field. 88 @type back_calc: numpy rank-1 float array 89 @keyword num_points: The number of points on the dispersion curve, equal to the length of the spin_lock_fields and back_calc arguments. 90 @type num_points: int 91 """ 92 93 # Repetitive calculations (to speed up calculations). 94 kex2 = kex**2 95 96 # The non-Rex factors. 97 sin_theta2 = sin(theta)**2 98 R1_R2 = R1 * cos(theta)**2 + r1rho_prime * sin_theta2 99 100 # The numerator. 101 numer = sin_theta2 * phi_ex * kex 102 103 # Catch zeros (to avoid pointless mathematical operations). 104 # This will result in no exchange, returning flat lines. 105 if min(numer) == 0.0: 106 back_calc[:] = R1_R2 107 return 108 109 # Denominator. 110 denom = kex2 + spin_lock_fields2 111 112 # Catch math domain error of dividing with 0. 113 # This is when denom =0. 114 if min(abs(denom)) == 0: 115 back_calc[:] = array([1e100]*num_points) 116 return 117 118 # R1rho calculation. 119 R1rho = R1_R2 + numer / denom 120 121 # Catch errors, taking a sum over array is the fastest way to check for 122 # +/- inf (infinity) and nan (not a number). 123 if not isfinite(sum(R1rho)): 124 R1rho = array([1e100]*num_points) 125 126 back_calc[:] = R1rho
127