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 from math import atan2, cos, log, sin
53 from numpy import dot
54
55
56 from lib.dispersion.ns_matrices import rr1rho_3d
57 from lib.float import isNaN
58 from lib.linear_algebra.matrix_exponential import matrix_exponential
59
60
61 -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):
62 """The 2-site numerical solution to the Bloch-McConnell equation for R1rho data.
63
64 This function calculates and stores the R1rho values.
65
66
67 @keyword M0: This is a vector that contains the initial magnetizations corresponding to the A and B state transverse magnetizations.
68 @type M0: numpy float64, rank-1, 7D array
69 @keyword matrix: A numpy array to be populated to create the evolution matrix.
70 @type matrix: numpy rank-2, 6D float64 array
71 @keyword r1rho_prime: The R1rho_prime parameter value (R1rho with no exchange).
72 @type r1rho_prime: float
73 @keyword omega: The chemical shift for the spin in rad/s.
74 @type omega: float
75 @keyword offset: The spin-lock offsets for the data.
76 @type offset: numpy rank-1 float array
77 @keyword r1: The R1 relaxation rate.
78 @type r1: float
79 @keyword pA: The population of state A.
80 @type pA: float
81 @keyword pB: The population of state B.
82 @type pB: float
83 @keyword dw: The chemical exchange difference between states A and B in rad/s.
84 @type dw: float
85 @keyword k_AB: The rate of exchange from site A to B (rad/s).
86 @type k_AB: float
87 @keyword k_BA: The rate of exchange from site B to A (rad/s).
88 @type k_BA: float
89 @keyword spin_lock_fields: The R1rho spin-lock field strengths (in rad.s^-1).
90 @type spin_lock_fields: numpy rank-1 float array
91 @keyword relax_time: The total relaxation time period for each spin-lock field strength (in seconds).
92 @type relax_time: float
93 @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.
94 @type inv_relax_time: float
95 @keyword back_calc: The array for holding the back calculated R2eff values. Each element corresponds to one of the CPMG nu1 frequencies.
96 @type back_calc: numpy rank-1 float array
97 @keyword num_points: The number of points on the dispersion curve, equal to the length of the tcp and back_calc arguments.
98 @type num_points: int
99 """
100
101
102 Wa = omega
103 Wb = omega + dw
104 W = pA*Wa + pB*Wb
105 dA = Wa - offset
106 dB = Wb - offset
107 d = W - offset
108
109
110 for i in range(num_points):
111
112 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)
113
114
115 theta = atan2(spin_lock_fields[i], dA)
116 M0[0] = sin(theta)
117 M0[2] = cos(theta)
118
119
120 Rexpo = matrix_exponential(matrix*relax_time)
121
122
123 MA = dot(M0, dot(Rexpo, M0))
124
125
126 if MA <= 0.0 or isNaN(MA):
127 back_calc[i] = 1e99
128 else:
129 back_calc[i]= -inv_relax_time * log(MA)
130