1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import sys
24
25 import help
26
27
30
31 self.__relax_help__ = \
32 """Class for manipulating the diffusion tensor."""
33
34
35 self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help
36
37
38 self.__relax__ = relax
39
40
41 - def copy(self, run1=None, run2=None):
42 """Function for copying diffusion tensor data from run1 to run2.
43
44 Keyword Arguments
45 ~~~~~~~~~~~~~~~~~
46
47 run1: The name of the run to copy the sequence from.
48
49 run2: The name of the run to copy the sequence to.
50
51
52 Description
53 ~~~~~~~~~~~
54
55 This function will copy the diffusion tensor data from 'run1' to 'run2'. 'run2' must not
56 contain any diffusion tensor data.
57
58
59 Examples
60 ~~~~~~~~
61
62 To copy the diffusion tensor from run 'm1' to run 'm2', type:
63
64 relax> diffusion_tensor.copy('m1', 'm2')
65 """
66
67
68 if self.__relax__.interpreter.intro:
69 text = sys.ps3 + "diffusion_tensor.copy("
70 text = text + "run1=" + `run1`
71 text = text + ", run2=" + `run2` + ")"
72 print text
73
74
75 if type(run1) != str:
76 raise RelaxStrError, ('run1', run1)
77
78
79 if type(run2) != str:
80 raise RelaxStrError, ('run2', run2)
81
82
83 self.__relax__.generic.diffusion_tensor.copy(run1=run1, run2=run2)
84
85
87 """Function for deleting diffusion tensor data.
88
89 Keyword Arguments
90 ~~~~~~~~~~~~~~~~~
91
92 run: The name of the run.
93
94
95
96 Description
97 ~~~~~~~~~~~
98
99 This function will delete all diffusion tensor data for the given run.
100 """
101
102
103 if self.__relax__.interpreter.intro:
104 text = sys.ps3 + "diffusion_tensor.delete("
105 text = text + "run=" + `run` + ")"
106 print text
107
108
109 if type(run) != str:
110 raise RelaxStrError, ('run', run)
111
112
113 self.__relax__.generic.diffusion_tensor.delete(run=run)
114
115
117 """Function for displaying the diffusion tensor.
118
119 Keyword Arguments
120 ~~~~~~~~~~~~~~~~~
121
122 run: The name of the run.
123 """
124
125
126 if self.__relax__.interpreter.intro:
127 text = sys.ps3 + "diffusion_tensor.display("
128 text = text + "run=" + `run` + ")"
129 print text
130
131
132 if type(run) != str:
133 raise RelaxStrError, ('run', run)
134
135
136 self.__relax__.generic.diffusion_tensor.display(run=run)
137
138
139 - def init(self, run=None, params=None, time_scale=1.0, d_scale=1.0, angle_units='deg', param_types=0, spheroid_type=None, fixed=1):
140 """Function for initialising the diffusion tensor.
141
142 Keyword Arguments
143 ~~~~~~~~~~~~~~~~~
144
145 run: The name of the run to assign the data to.
146
147 params: The diffusion tensor data.
148
149 time_scale: The correlation time scaling value.
150
151 d_scale: The diffusion tensor eigenvalue scaling value.
152
153 angle_units: The units for the angle parameters.
154
155 param_types: A flag to select different parameter combinations.
156
157 spheroid_type: A string which, if supplied together with spheroid parameters, will restrict
158 the tensor to either being 'oblate' or 'prolate'.
159
160 fixed: A flag specifying whether the diffusion tensor is fixed or can be optimised.
161
162
163 The sphere (isotropic diffusion)
164 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
165
166 When the molecule diffuses as a sphere, all three eigenvalues of the diffusion tensor are
167 equal, Dx = Dy = Dz. In this case, the orientation of the XH bond vector within the
168 diffusion frame is inconsequential to relaxation, hence, the spherical or Euler angles are
169 undefined. Therefore solely a single geometric parameter, either tm or Diso, can fully and
170 sufficiently parameterise the diffusion tensor. The correlation function for the global
171 rotational diffusion is
172
173 -----
174 1 - tau / tm
175 C(tau) = - e ,
176 5
177 -----
178
179 To select isotropic diffusion, the parameters argument should be a single floating point
180 number. The number is the value of the isotropic global correlation time, tm, in seconds.
181 To specify the time in nanoseconds, set the 'time_scale' argument to 1e-9. Alternative
182 parameters can be used by changing the 'param_types' flag to the following integers
183
184 0: tm (Default),
185 1: Diso,
186
187 where
188
189 1 / tm = 6Diso.
190
191
192 The spheroid (axially symmetric diffusion)
193 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
194
195 When two of the three eigenvalues of the diffusion tensor are equal, the molecule diffuses
196 as a spheroid. Four pieces of information are required to specify this tensor, the two
197 geometric parameters, Diso and Da, and the two orientational parameters, the polar angle
198 theta and the azimuthal angle phi describing the orientation of the axis of symmetry. The
199 correlation function of the global diffusion is
200
201 -----
202 _1_
203 1 \ - tau / tau_i
204 C(tau) = - > ci . e ,
205 5 /__
206 i=-1
207 -----
208
209 where
210
211 c-1 = 1/4 (3 dz^2 - 1)^2,
212 c0 = 3 dz^2 (1 - dz^2),
213 c1 = 3/4 (dz^2 - 1)^2,
214
215 and
216
217 1 / tau -1 = 6Diso - 2Da,
218 1 / tau 0 = 6Diso - Da,
219 1 / tau 1 = 6Diso + 2Da.
220
221 The direction cosine dz is defined as the cosine of the angle alpha between the XH bond
222 vector and the unique axis of the diffusion tensor.
223
224 To select axially symmetric anisotropic diffusion, the parameters argument should be a tuple
225 of floating point numbers of length four. A tuple is a type of data structure enclosed in
226 round brackets, the elements of which are separated by commas. Alternative sets of
227 parameters, 'param_types', are
228
229 0: (tm, Da, theta, phi) (Default),
230 1: (Diso, Da, theta, phi),
231 2: (tm, Dratio, theta, phi),
232 3: (Dpar, Dper, theta, phi),
233 4: (Diso, Dratio, theta, phi),
234
235 where
236
237 tm = 1 / 6Diso,
238 Diso = 1/3 (Dpar + 2Dper),
239 Da = Dpar - Dper,
240 Dratio = Dpar / Dper.
241
242 The spherical angles {theta, phi} orienting the unique axis of the diffusion tensor within
243 the PDB frame are defined between
244
245 0 <= theta <= pi,
246 0 <= phi <= 2pi,
247
248 while the angle alpha which is the angle between this axis and the given XH bond vector is
249 defined between
250
251 0 <= alpha <= 2pi.
252
253 The 'spheroid_type' argument should be 'oblate', 'prolate', or None. The argument will be
254 ignored if the diffusion tensor is not axially symmetric. If 'oblate' is given, then the
255 constraint Da <= 0 is used while if 'prolate' is given, then the constraint Da >= 0 is
256 used. If nothing is supplied, then Da will be allowed to have any values. To prevent
257 minimisation of diffusion tensor parameters in a space with two minima, it is recommended
258 to specify which tensor is to be minimised, thereby partitioning the two minima into the two
259 subspaces along the boundry Da = 0.
260
261
262 The ellipsoid (rhombic diffusion)
263 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
264
265 When all three eigenvalues of the diffusion tensor are different, the molecule diffuses as
266 an ellipsoid. This diffusion is also known as fully anisotropic, asymmetric, or rhombic.
267 The full tensor is specified by six pieces of information, the three geometric parameters
268 Diso, Da, and Dr representing the isotropic, anisotropic, and rhombic components of the
269 tensor, and the three Euler angles alpha, beta, and gamma orienting the tensor within the
270 PDB frame. The correlation function is
271
272
273 -----
274 _2_
275 1 \ - tau / tau_i
276 C(tau) = - > ci . e ,
277 5 /__
278 i=-2
279 -----
280
281 where the weights on the exponentials are
282
283 c-2 = 1/4 (d + e),
284 c-1 = 3 dy^2 dz^2,
285 c0 = 3 dx^2 dz^2,
286 c1 = 3 dx^2 dy^2,
287 c2 = 1/4 (d + e).
288
289 Let
290
291 R = sqrt(1 + 3Dr),
292
293 then
294
295 d = 3 (dx^4 + dy^4 + dz^4) - 1,
296 e = - 1 / R ((1 + 3Dr)(dx^4 + 2dy^2 dz^2) + (1 - 3Dr)(dy^4 + 2dx^2 dz^2) - 2(dz^4 + 2dx^2 dy^2)).
297
298 The correlation times are
299
300 1 / tau -2 = 6Diso - 2Da . R,
301 1 / tau -1 = 6Diso - Da (1 + 3Dr),
302 1 / tau 0 = 6Diso - Da (1 - 3Dr),
303 1 / tau 1 = 6Diso + 2Da,
304 1 / tau 1 = 6Diso + 2Da . R.
305
306 The three direction cosines dx, dy, and dz are the coordinates of a unit vector parallel to
307 the XH bond vector. Hence the unit vector is [dx, dy, dz].
308
309 To select fully anisotropic diffusion, the parameters argument should be a tuple of length
310 six. A tuple is a type of data structure enclosed in round brackets, the elements of which
311 are separated by commas. Alternative sets of parameters, 'param_types', are
312
313 0: (tm, Da, Dr, alpha, beta, gamma) (Default),
314 1: (Diso, Da, Dr, alpha, beta, gamma),
315 2: (Dx, Dy, Dz, alpha, beta, gamma),
316
317 where
318
319 tm = 1 / 6Diso,
320 Diso = 1/3 (Dx + Dy + Dz),
321 Da = Dz - (Dx + Dy)/2,
322 Dr = (Dy - Dx)/2Da.
323
324 The angles alpha, beta, and gamma are the Euler angles describing the diffusion tensor
325 within the PDB frame. These angles are defined using the z-y-z axis rotation notation where
326 alpha is the initial rotation angle around the z-axis, beta is the rotation angle around the
327 y-axis, and gamma is the final rotation around the z-axis again. The angles are defined
328 between
329
330 0 <= alpha <= 2pi,
331 0 <= beta <= pi,
332 0 <= gamma <= 2pi.
333
334 Within the PDB frame, the XH bond vector is described using the spherical angles theta and
335 phi where theta is the polar angle and phi is the azimuthal angle defined between
336
337 0 <= theta <= pi,
338 0 <= phi <= 2pi.
339
340
341 Units
342 ~~~~~
343
344 The 'time_scale' argument should be a floating point number. The only parameter affected by
345 this value is tm.
346
347 The 'd_scale' argument should also be a floating point number. Parameters affected by this
348 value are Diso, Dpar, Dper, Da, Dx, Dy, and Dz. Significantly, Dr is not affected.
349
350 The 'angle_units' argument should either be the string 'deg' or 'rad'. Parameters affected
351 are theta, phi, alpha, beta, and gamma.
352
353
354
355 Examples
356 ~~~~~~~~
357
358 To set an isotropic diffusion tensor with a correlation time of 10 ns, assigning it to the
359 run 'm1', type:
360
361 relax> diffusion_tensor('m1', 10e-9)
362 relax> diffusion_tensor(run='m1', params=10e-9)
363 relax> diffusion_tensor('m1', 10.0, 1e-9)
364 relax> diffusion_tensor(run='m1', params=10.0, time_scale=1e-9, fixed=1)
365
366
367 To select axially symmetric diffusion with a tm value of 8.5 ns, Dratio of 1.1, theta value
368 of 20 degrees, and phi value of 20 degrees, and assign it to the run 'm8', type:
369
370 relax> diffusion_tensor('m8', (8.5e-9, 1.1, 20.0, 20.0), param_types=1)
371
372
373 To select a spheroid diffusion tensor with a Dpar value of 1.698e7, Dper value of 1.417e7,
374 theta value of 67.174 degrees, and phi value of -83.718 degrees, and assign it to the run
375 'spheroid', type one of:
376
377 relax> diffusion_tensor('spheroid', (1.698e7, 1.417e7, 67.174, -83.718), param_types=1)
378 relax> diffusion_tensor(run='spheroid', params=(1.698e7, 1.417e7, 67.174, -83.718),
379 param_types=1)
380 relax> diffusion_tensor('spheroid', (1.698e-1, 1.417e-1, 67.174, -83.718), param_types=1,
381 d_scale=1e8)
382 relax> diffusion_tensor(run='spheroid', params=(1.698e-1, 1.417e-1, 67.174, -83.718),
383 param_types=1, d_scale=1e8)
384 relax> diffusion_tensor('spheroid', (1.698e-1, 1.417e-1, 1.1724, -1.4612), param_types=1,
385 d_scale=1e8, angle_units='rad')
386 relax> diffusion_tensor(run='spheroid', params=(1.698e-1, 1.417e-1, 1.1724, -1.4612),
387 param_types=1, d_scale=1e8, angle_units='rad', fixed=1)
388
389
390 To select ellipsoidal diffusion, type:
391
392 relax> diffusion_tensor('m5', (1.340e7, 1.516e7, 1.691e7, -82.027, -80.573, 65.568),
393 param_types=2)
394
395
396 To select and minimise a spherical diffusion tensor, type (followed by a minimisation
397 command):
398
399 relax> diffusion_tensor('diff', 10e-9, fixed=0)
400 """
401
402
403 if self.__relax__.interpreter.intro:
404 text = sys.ps3 + "diffusion_tensor.init("
405 text = text + "run=" + `run`
406 text = text + ", params=" + `params`
407 text = text + ", time_scale=" + `time_scale`
408 text = text + ", d_scale=" + `d_scale`
409 text = text + ", angle_units=" + `angle_units`
410 text = text + ", param_types=" + `param_types`
411 text = text + ", spheroid_type=" + `spheroid_type`
412 text = text + ", fixed=" + `fixed` + ")"
413 print text
414
415
416 if type(run) != str:
417 raise RelaxStrError, ('run', run)
418
419
420 if type(params) != int and type(params) != float and type(params) != tuple:
421 raise RelaxNumTupleError, ('diffusion parameters', params)
422 if type(params) == tuple:
423 if len(params) != 4 and len(params) != 6:
424 raise RelaxError, "The diffusion parameters argument must either be a number or a tuple of numbers of length 4 or 6."
425 for i in xrange(len(params)):
426 if type(params[i]) != float and type(params[i]) != int:
427 raise RelaxNumTupleError, ('diffusion parameters', params)
428
429
430 if type(time_scale) != float:
431 raise RelaxFloatError, ('time scale', time_scale)
432
433
434 if type(d_scale) != float:
435 raise RelaxFloatError, ('D scale', d_scale)
436
437
438 if type(angle_units) != str:
439 raise RelaxStrError, ('angle units', angle_units)
440
441
442 if type(param_types) != int:
443 raise RelaxIntError, ('parameter types', param_types)
444
445
446 if spheroid_type != None and type(spheroid_type) != str:
447 raise RelaxNoneStrError, ('spheroid type', spheroid_type)
448
449
450 if type(fixed) != int or (fixed != 0 and fixed != 1):
451 raise RelaxBinError, ('fixed flag', fixed)
452
453
454 self.__relax__.generic.diffusion_tensor.init(run=run, params=params, time_scale=time_scale, d_scale=d_scale, angle_units=angle_units, param_types=param_types, spheroid_type=spheroid_type, fixed=fixed)
455