1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 r"""The Luz and Meiboom (1963) 2-site fast exchange U{LM63<http://wiki.nmr-relax.com/LM63>} model.
26
27 Description
28 ===========
29
30 This module is for the function, gradient and Hessian of the U{LM63<http://wiki.nmr-relax.com/LM63>} model.
31
32
33 References
34 ==========
35
36 The model is named after the reference:
37
38 - 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, I{J. Chem. Phys.}, B{39}, 366-370 (U{DOI: 10.1063/1.1734254<http://dx.doi.org/10.1063/1.1734254>}).
39
40
41 Equations
42 =========
43
44 The equation used is::
45
46 phi_ex / 4 * nu_cpmg / kex \ \
47 R2eff = R20 + ------ * | 1 - ----------- * tanh | ----------- | | ,
48 kex \ kex \ 4 * nu_cpmg / /
49
50 where::
51
52 phi_ex = pA * pB * delta_omega^2 ,
53
54 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.
55
56
57 Links
58 =====
59
60 More information on the LM63 model can be found in the:
61
62 - U{relax wiki<http://wiki.nmr-relax.com/LM63>},
63 - U{relax manual<http://www.nmr-relax.com/manual/The_LM63_2_site_fast_exchange_CPMG_model.html>},
64 - U{relaxation dispersion page of the relax website<http://www.nmr-relax.com/analyses/relaxation_dispersion.html#LM63>}.
65 """
66
67
68 from numpy import isfinite, min, sum, tanh
69 from numpy.ma import fix_invalid, masked_where
70
71
72 -def r2eff_LM63(r20=None, phi_ex=None, kex=None, cpmg_frqs=None, back_calc=None):
73 """Calculate the R2eff values for the LM63 model.
74
75 See the module docstring for details.
76
77
78 @keyword r20: The R20 parameter value (R2 with no exchange).
79 @type r20: numpy float array of rank [NE][NS][NM][NO][ND]
80 @keyword phi_ex: The phi_ex parameter value (pA * pB * delta_omega^2).
81 @type phi_ex: numpy float array of rank [NE][NS][NM][NO][ND]
82 @keyword kex: The kex parameter value (the exchange rate in rad/s).
83 @type kex: float
84 @keyword cpmg_frqs: The CPMG nu1 frequencies.
85 @type cpmg_frqs: numpy float array of rank [NE][NS][NM][NO][ND]
86 @keyword back_calc: The array for holding the back calculated R2eff values. Each element corresponds to one of the CPMG nu1 frequencies.
87 @type back_calc: numpy float array of rank [NE][NS][NM][NO][ND]
88 """
89
90
91 t_phi_ex_zero = False
92
93
94 if kex == 0.0:
95 back_calc[:] = r20
96 return
97
98
99
100 if min(phi_ex) == 0.0:
101 t_phi_ex_zero = True
102 mask_phi_ex_zero = masked_where(phi_ex == 0.0, phi_ex)
103
104
105 rex = phi_ex / kex
106 kex_4 = 4.0 / kex
107
108
109 back_calc[:] = r20 + rex * (1.0 - kex_4 * cpmg_frqs * tanh(kex / (4.0 * cpmg_frqs)))
110
111
112
113 if t_phi_ex_zero:
114 back_calc[mask_phi_ex_zero.mask] = r20[mask_phi_ex_zero.mask]
115
116
117
118 if not isfinite(sum(back_calc)):
119
120 fix_invalid(back_calc, copy=False, fill_value=1e100)
121