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 """The numerical solution for the 2-site Bloch-McConnell equations for R1rho-type data, the U{NS R1rho 2-site<http://wiki.nmr-relax.com/NS_R1rho_2-site>} model.
26
27 Description
28 ===========
29
30 This is the model of the numerical solution for the 2-site Bloch-McConnell equations. It originates from the funNumrho.m file from the Skrynikov & Tollinger code (the sim_all.tar file U{https://web.archive.org/web/https://gna.org/support/download.php?file_id=18404} attached to U{https://web.archive.org/web/https://gna.org/task/?7712#comment5}).
31
32
33 References
34 ==========
35
36 The solution has been modified to use the from presented in:
37
38 - Korzhnev, D. M., Orekhov, V. Y., and Kay, L. E. (2005). Off-resonance R(1rho) NMR studies of exchange dynamics in proteins with low spin-lock fields: an application to a Fyn SH3 domain. I{J. Am. Chem. Soc.}, B{127}, 713-721. (U{DOI: 10.1021/ja0446855<http://dx.doi.org/10.1021/ja0446855>}).
39
40
41 Links
42 =====
43
44 More information on the NS R1rho 2-site model can be found in the:
45
46 - U{relax wiki<http://wiki.nmr-relax.com/NS_R1rho_2-site>},
47 - U{relax manual<http://www.nmr-relax.com/manual/NS_2_site_R1_model.html>},
48 - U{relaxation dispersion page of the relax website<http://www.nmr-relax.com/analyses/relaxation_dispersion.html#NS_R1rho_2-site>}.
49 """
50
51
52 import dep_check
53
54
55 from math import atan, cos, log, pi, sin, sqrt
56 from numpy import dot
57
58
59 from lib.dispersion.ns_matrices import rr1rho_3d
60 from lib.float import isNaN
61 from lib.linear_algebra.matrix_exponential import matrix_exponential
62
63
64 -def ns_r1rho_2site(M0=None, matrix=None, r1rho_prime=None, omega=None, offset=None, r1=0.0, pA=None, pB=None, dw=None, k_AB=None, k_BA=None, spin_lock_fields=None, relax_time=None, inv_relax_time=None, back_calc=None, num_points=None):
65 """The 2-site numerical solution to the Bloch-McConnell equation for R1rho data.
66
67 This function calculates and stores the R1rho values.
68
69
70 @keyword M0: This is a vector that contains the initial magnetizations corresponding to the A and B state transverse magnetizations.
71 @type M0: numpy float64, rank-1, 7D array
72 @keyword matrix: A numpy array to be populated to create the evolution matrix.
73 @type matrix: numpy rank-2, 6D float64 array
74 @keyword r1rho_prime: The R1rho_prime parameter value (R1rho with no exchange).
75 @type r1rho_prime: float
76 @keyword omega: The chemical shift for the spin in rad/s.
77 @type omega: float
78 @keyword offset: The spin-lock offsets for the data.
79 @type offset: numpy rank-1 float array
80 @keyword r1: The R1 relaxation rate.
81 @type r1: float
82 @keyword pA: The population of state A.
83 @type pA: float
84 @keyword pB: The population of state B.
85 @type pB: float
86 @keyword dw: The chemical exchange difference between states A and B in rad/s.
87 @type dw: float
88 @keyword k_AB: The rate of exchange from site A to B (rad/s).
89 @type k_AB: float
90 @keyword k_BA: The rate of exchange from site B to A (rad/s).
91 @type k_BA: float
92 @keyword spin_lock_fields: The R1rho spin-lock field strengths (in rad.s^-1).
93 @type spin_lock_fields: numpy rank-1 float array
94 @keyword relax_time: The total relaxation time period for each spin-lock field strength (in seconds).
95 @type relax_time: float
96 @keyword inv_relax_time: The inverse of the relaxation time period for each spin-lock field strength (in inverse seconds). This is used for faster calculations.
97 @type inv_relax_time: float
98 @keyword back_calc: The array for holding the back calculated R2eff values. Each element corresponds to one of the CPMG nu1 frequencies.
99 @type back_calc: numpy rank-1 float array
100 @keyword num_points: The number of points on the dispersion curve, equal to the length of the tcp and back_calc arguments.
101 @type num_points: int
102 """
103
104
105 Wa = omega
106 Wb = omega + dw
107 W = pA*Wa + pB*Wb
108 dA = Wa - offset
109 dB = Wb - offset
110 d = W - offset
111
112
113 for i in range(num_points):
114
115 rr1rho_3d(matrix=matrix, R1=r1, r1rho_prime=r1rho_prime, pA=pA, pB=pB, wA=dA, wB=dB, w1=spin_lock_fields[i], k_AB=k_AB, k_BA=k_BA)
116
117
118 theta = atan(spin_lock_fields[i]/dA)
119 M0[0] = sin(theta)
120 M0[2] = cos(theta)
121
122
123 Rexpo = matrix_exponential(matrix*relax_time)
124
125
126 MA = dot(M0, dot(Rexpo, M0))
127
128
129 if MA <= 0.0 or isNaN(MA):
130 back_calc[i] = 1e99
131 else:
132 back_calc[i]= -inv_relax_time * log(MA)
133