1 from Numeric import Float64, zeros
2 from re import match
3
6 "Function for creating the model-free spectral density gradients."
7
8
10 """Function to create model-free spectral density gradients.
11
12 The spectral density gradients
13 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14
15 Data structure: self.data.djw
16 Dimension: 3D, (number of NMR frequencies, 5 spectral density frequencies, model-free parameters)
17 Type: Numeric 3D matrix, Float64
18 Dependencies: None
19 Required by: self.data.dri, self.data.d2ri
20
21
22 Formulae
23 ~~~~~~~~
24
25 Original
26 ~~~~~~~~
27
28 dJ(w) 2 / tm te' \
29 ----- = - | ------------- - -------------- |
30 dS2 5 \ 1 + (w.tm)**2 1 + (w.te')**2 /
31
32
33 dJ(w) 2 1 - (w.te')**2 / tm \ 2
34 ----- = - . (1 - S2) . ------------------- . | ------- |
35 dte 5 (1 + (w.te')**2)**2 \ te + tm /
36
37
38 dJ(w)
39 ----- = 0
40 dRex
41
42
43 dJ(w)
44 ----- = 0
45 dcsa
46
47
48 dJ(w)
49 ----- = 0
50 dr
51
52
53 Extended
54 ~~~~~~~~
55
56 dJ(w) 2 / S2s.tm tf' (1 - S2s).ts' \
57 ----- = - | ------------- - -------------- + -------------- |
58 dS2f 5 \ 1 + (w.tm)**2 1 + (w.tf')**2 1 + (w.ts')**2 /
59
60
61 dJ(w) 2.S2f / tm ts' \
62 ----- = ----- . | ------------- - -------------- |
63 dS2s 5 \ 1 + (w.tm)**2 1 + (w.ts')**2 /
64
65
66 dJ(w) 2 1 - (w.tf')**2 / tm \ 2
67 ----- = - . (1 - S2f) . ------------------- . | ------- |
68 dtf 5 (1 + (w.tf')**2)**2 \ tf + tm /
69
70
71 dJ(w) 2.S2f 1 - (w.ts')**2 / tm \ 2
72 ----- = ----- . (1 - S2s) . ------------------- . | ------- |
73 dts 5 (1 + (w.ts')**2)**2 \ ts + tm /
74
75
76 dJ(w)
77 ----- = 0
78 dRex
79
80
81 dJ(w)
82 ----- = 0
83 dcsa
84
85
86 dJ(w)
87 ----- = 0
88 dr
89 """
90
91
92 self.data.djw = zeros((self.mf.data.num_frq, 5, len(self.data.params)), Float64)
93
94
95 if match(self.data.diff_type, 'iso'):
96 if match('m[13]', self.data.model):
97 for i in range(self.mf.data.num_frq):
98 for param in range(len(self.data.jw_param_types)):
99 if self.data.jw_param_types[param] == 'S2':
100 self.data.djw[i, 0, param] = self.calc_djw_dS2_iso_m13(i, 0)
101 self.data.djw[i, 1, param] = self.calc_djw_dS2_iso_m13(i, 1)
102 self.data.djw[i, 2, param] = self.calc_djw_dS2_iso_m13(i, 2)
103 self.data.djw[i, 3, param] = self.calc_djw_dS2_iso_m13(i, 3)
104 self.data.djw[i, 4, param] = self.calc_djw_dS2_iso_m13(i, 4)
105 elif match('m[24]', self.data.model):
106 for i in range(self.mf.data.num_frq):
107 for param in range(len(self.data.jw_param_types)):
108 if self.data.jw_param_types[param] == 'S2':
109 self.data.djw[i, 0, param] = self.calc_djw_dS2_iso_m24(i, 0)
110 self.data.djw[i, 1, param] = self.calc_djw_dS2_iso_m24(i, 1)
111 self.data.djw[i, 2, param] = self.calc_djw_dS2_iso_m24(i, 2)
112 self.data.djw[i, 3, param] = self.calc_djw_dS2_iso_m24(i, 3)
113 self.data.djw[i, 4, param] = self.calc_djw_dS2_iso_m24(i, 4)
114 elif self.data.jw_param_types[param] == 'te':
115 self.data.djw[i, 0, param] = self.calc_djw_dte_iso_m24(i, 0)
116 self.data.djw[i, 1, param] = self.calc_djw_dte_iso_m24(i, 1)
117 self.data.djw[i, 2, param] = self.calc_djw_dte_iso_m24(i, 2)
118 self.data.djw[i, 3, param] = self.calc_djw_dte_iso_m24(i, 3)
119 self.data.djw[i, 4, param] = self.calc_djw_dte_iso_m24(i, 4)
120 elif match('m5', self.data.model):
121 for i in range(self.mf.data.num_frq):
122 for param in range(len(self.data.jw_param_types)):
123 if self.data.jw_param_types[param] == 'S2f':
124 self.data.djw[i, 0, param] = self.calc_djw_dS2f_iso_m5(i, 0)
125 self.data.djw[i, 1, param] = self.calc_djw_dS2f_iso_m5(i, 1)
126 self.data.djw[i, 2, param] = self.calc_djw_dS2f_iso_m5(i, 2)
127 self.data.djw[i, 3, param] = self.calc_djw_dS2f_iso_m5(i, 3)
128 self.data.djw[i, 4, param] = self.calc_djw_dS2f_iso_m5(i, 4)
129 if self.data.jw_param_types[param] == 'S2s':
130 self.data.djw[i, 0, param] = self.calc_djw_dS2s_iso_m5(i, 0)
131 self.data.djw[i, 1, param] = self.calc_djw_dS2s_iso_m5(i, 1)
132 self.data.djw[i, 2, param] = self.calc_djw_dS2s_iso_m5(i, 2)
133 self.data.djw[i, 3, param] = self.calc_djw_dS2s_iso_m5(i, 3)
134 self.data.djw[i, 4, param] = self.calc_djw_dS2s_iso_m5(i, 4)
135 if self.data.jw_param_types[param] == 'ts':
136 self.data.djw[i, 0, param] = self.calc_djw_dts_iso_m5(i, 0)
137 self.data.djw[i, 1, param] = self.calc_djw_dts_iso_m5(i, 1)
138 self.data.djw[i, 2, param] = self.calc_djw_dts_iso_m5(i, 2)
139 self.data.djw[i, 3, param] = self.calc_djw_dts_iso_m5(i, 3)
140 self.data.djw[i, 4, param] = self.calc_djw_dts_iso_m5(i, 4)
141
142
143 elif match(self.data.diff_type, 'axail'):
144 raise NameError, "Axially symetric diffusion not implemented yet, quitting program."
145
146
147 elif match(self.data.diff_type, 'aniso'):
148 raise NameError, "Anisotropic diffusion not implemented yet, quitting program."
149
150 else:
151 raise NameError, "Function option not set correctly, quitting program."
152
153
155 "Calculate the model 1 and 3 S2 derivative of the spectral density function for isotropic rotational diffusion."
156
157 temp = 0.4 * self.data.tm / (1.0 + self.data.omega_tm_sqrd[i, frq_index])
158 return temp
159
160
162 "Calculate the model 2 and 4 S2 derivative of the spectral density function for isotropic rotational diffusion."
163
164 temp = 0.4 * (self.data.tm / (1.0 + self.data.omega_tm_sqrd[i, frq_index]) - self.data.te_prime / (1.0 + self.data.omega_te_prime_sqrd[i, frq_index]))
165 return temp
166
167
169 "Calculate the model 5 S2f derivative of the spectral density function for isotropic rotational diffusion."
170
171 temp = 0.4 * (self.data.s2s * self.data.tm / (1.0 + self.data.omega_tm_sqrd[i, frq_index]) + (1.0 - self.data.s2s) * self.data.ts_prime / (1.0 + self.data.omega_ts_prime_sqrd[i, frq_index]))
172 return temp
173
174
176 "Calculate the model 5 S2f derivative of the spectral density function for isotropic rotational diffusion."
177
178 temp = 0.4 * self.data.s2f * (self.data.tm / (1.0 + self.data.omega_tm_sqrd[i, frq_index]) - self.data.ts_prime / (1.0 + self.data.omega_ts_prime_sqrd[i, frq_index]))
179 return temp
180
181
183 "Calculate the model 2 and 4 te derivative of the spectral density function for isotropic rotational diffusion."
184
185 temp = 0.4 * (1.0 - self.data.s2) * ((1.0 - self.data.omega_te_prime_sqrd[i, frq_index]) / ((1.0 + self.data.omega_te_prime_sqrd[i, frq_index])**2)) * self.data.fact_a**2
186 return temp
187
188
190 "Calculate the model 5 ts derivative of the spectral density function for isotropic rotational diffusion."
191
192 temp = 0.4 * self.data.s2f * (1.0 - self.data.s2s) * ((1.0 - self.data.omega_ts_prime_sqrd[i, frq_index]) / ((1.0 + self.data.omega_ts_prime_sqrd[i, frq_index])**2)) * self.data.fact_a**2
193 return temp
194