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 set(self, run=None, params=None, time_scale=1.0, d_scale=1.0, angle_units='deg', param_types=0, axial_type=None, fixed=1):
140 """Function for setting up 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 axial_type: A string, which if supplied with axially symmetric 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 Description
164 ~~~~~~~~~~~
165
166 Isotropic diffusion.
167
168 To select isotropic diffusion, the parameters argument should be a single floating point
169 number. The number is the value of the isotropic global correlation time in seconds. To
170 specify the time in nanoseconds, set the 'time_scale' argument to 1e-9. Alternative
171 parameters can be used by changing the 'param_types' flag to the following integers:
172
173 0 - tm (Default)
174 1 - Diso
175
176 where:
177 tm = 1 / 6Diso
178
179
180 Axially symmetric diffusion.
181
182 To select axially symmetric anisotropic diffusion, the parameters argument should be a tuple
183 of floating point numbers of length four. A tuple is a type of data structure enclosed in
184 round brackets, the elements of which are separated by commas. Alternative sets of
185 parameters, 'param_types', are:
186
187 0 - (tm, Da, theta, phi) (Default)
188 1 - (tm, Dratio, theta, phi)
189 2 - (Dpar, Dper, theta, phi)
190 3 - (Diso, Da, theta, phi)
191 4 - (Diso, Dratio, theta, phi)
192
193 where:
194 tm = 1 / 6Diso
195 Diso = 1/3 (Dpar + 2Dper)
196 Da = 1/3 (Dpar - Dper)
197 Dratio = Dpar / Dper
198
199 The diffusion tensor is defined by the vector Dpar. The angle alpha describes the bond
200 vector with respect to the diffusion frame while the spherical angles {theta, phi} describe
201 the diffusion tensor with respect to the PDB frame. Theta is the polar angle and phi is the
202 azimuthal angle defined between:
203 0 <= theta <= pi
204 0 <= phi <= 2pi
205 The angle alpha is defined between:
206 0 <= alpha <= 2pi
207
208 The 'axial_type' argument should be 'oblate', 'prolate', or None. The argument will be
209 ignored if the diffusion tensor is not axially symmetric. If 'oblate' is given, then the
210 constraint Dper >= Dpar is used. If 'prolate' is given, then the constraint Dper <= Dpar is
211 used. If nothing is supplied, then Dper and Dpar will be allowed to have any values. To
212 prevent minimisation of diffusion tensor parameters in a space with two minima, it is
213 recommended to specify which tensor to be minimised, thereby partitioning the two minima
214 into the two subspaces (the partition is where Da equals 0).
215
216
217 Anisotropic diffusion.
218
219 To select fully anisotropic diffusion, the parameters argument should be a tuple of length
220 six. A tuple is a type of data structure enclosed in round brackets, the elements of which
221 are separated by commas. Alternative sets of parameters, 'param_types', are:
222
223 0 - (tm, Da, Dr, alpha, beta, gamma) (Default)
224 1 - (Diso, Da, Dr, alpha, beta, gamma)
225 2 - (Dx, Dy, Dz, alpha, beta, gamma)
226
227 where:
228 tm = 1 / 6Diso
229 Diso = 1/3 (Dx + Dy + Dz)
230 Da = 1/3 (Dz - (Dx + Dy)/2)
231 Dr = (Dx - Dy)/2
232
233 The angles alpha, beta, and gamma are the Euler angles describing the diffusion tensor
234 within the PDB frame. These angles are defined using the z-y-z axis rotation notation where
235 alpha is the initial rotation angle around the z-axis, beta is the rotation angle around the
236 y-axis, and gamma is the final rotation around the z-axis again. The angles are defined
237 between:
238 0 <= alpha <= 2pi
239 0 <= beta <= pi
240 0 <= gamma <= 2pi
241 Within the PDB frame, the bond vector is described using the spherical angels theta and phi
242 where theta is the polar angle and phi is the azimuthal angle defined between:
243 0 <= theta <= pi
244 0 <= phi <= 2pi
245
246
247 Units.
248
249 The 'time_scale' argument should be a floating point number. Parameters affected by this
250 value are: tm.
251
252 The 'd_scale' argument should also be a floating point number. Parameters affected by this
253 value are: Diso; Dpar; Dper; Da; Dr; Dx; Dy; Dz.
254
255 The 'angle_units' argument should either be the string 'deg' or 'rad'. Parameters affected
256 are: theta; phi; alpha; beta; gamma.
257
258
259
260 Examples
261 ~~~~~~~~
262
263 To set an isotropic diffusion tensor with a correlation time of 10ns, assigning it to the
264 run 'm1', type:
265
266 relax> diffusion_tensor('m1', 10e-9)
267 relax> diffusion_tensor(run='m1', params=10e-9)
268 relax> diffusion_tensor('m1', 10.0, 1e-9)
269 relax> diffusion_tensor(run='m1', params=10.0, time_scale=1e-9, fixed=1)
270
271
272 To select axially symmetric diffusion with a tm value of 8.5ns, Dratio of 1.1, theta value
273 of 20 degrees, and phi value of 20 degrees, and assign it to the run 'm8', type:
274
275 relax> diffusion_tensor('m8', (8.5e-9, 1.1, 20.0, 20.0), param_types=1)
276
277
278 To select an axially symmetric diffusion tensor with a Dpar value of 1.698e7, Dper value of
279 1.417e7, theta value of 67.174 degrees, and phi value of -83.718 degrees, and assign it to
280 the run 'axial', type one of:
281
282 relax> diffusion_tensor('axial', (1.698e7, 1.417e7, 67.174, -83.718), param_types=1)
283 relax> diffusion_tensor(run='axial', params=(1.698e7, 1.417e7, 67.174, -83.718),
284 param_types=1)
285 relax> diffusion_tensor('axial', (1.698e-1, 1.417e-1, 67.174, -83.718), param_types=1,
286 d_scale=1e8)
287 relax> diffusion_tensor(run='axial', params=(1.698e-1, 1.417e-1, 67.174, -83.718),
288 param_types=1, d_scale=1e8)
289 relax> diffusion_tensor('axial', (1.698e-1, 1.417e-1, 1.1724, -1.4612), param_types=1,
290 d_scale=1e8, angle_units='rad')
291 relax> diffusion_tensor(run='axial', params=(1.698e-1, 1.417e-1, 1.1724, -1.4612),
292 param_types=1, d_scale=1e8, angle_units='rad', fixed=1)
293
294
295 To select fully anisotropic diffusion, type:
296
297 relax> diffusion_tensor('m5', (1.340e7, 1.516e7, 1.691e7, -82.027, -80.573, 65.568),
298 param_types=2)
299
300
301 To select and minimise an isotropic diffusion tensor, type (followed by a minimisation
302 command):
303
304 relax> diffusion_tensor('diff', 10e-9, fixed=0)
305 """
306
307
308 if self.__relax__.interpreter.intro:
309 text = sys.ps3 + "diffusion_tensor.set("
310 text = text + "run=" + `run`
311 text = text + ", params=" + `params`
312 text = text + ", time_scale=" + `time_scale`
313 text = text + ", d_scale=" + `d_scale`
314 text = text + ", angle_units=" + `angle_units`
315 text = text + ", param_types=" + `param_types`
316 text = text + ", axial_type=" + `axial_type`
317 text = text + ", fixed=" + `fixed` + ")"
318 print text
319
320
321 if type(run) != str:
322 raise RelaxStrError, ('run', run)
323
324
325 if type(params) != int and type(params) != float and type(params) != tuple:
326 raise RelaxNumTupleError, ('diffusion parameters', params)
327 if type(params) == tuple:
328 if len(params) != 4 and len(params) != 6:
329 raise RelaxError, "The diffusion parameters argument must either be a number or a tuple of numbers of length 4 or 6."
330 for i in xrange(len(params)):
331 if type(params[i]) != float and type(params[i]) != int:
332 raise RelaxNumTupleError, ('diffusion parameters', params)
333
334
335 if type(time_scale) != float:
336 raise RelaxFloatError, ('time scale', time_scale)
337
338
339 if type(d_scale) != float:
340 raise RelaxFloatError, ('D scale', d_scale)
341
342
343 if type(angle_units) != str:
344 raise RelaxStrError, ('angle units', angle_units)
345
346
347 if type(param_types) != int:
348 raise RelaxIntError, ('parameter types', param_types)
349
350
351 if axial_type != None and type(axial_type) != str:
352 raise RelaxNoneStrError, ('axial type', axial_type)
353
354
355 if type(fixed) != int or (fixed != 0 and fixed != 1):
356 raise RelaxBinError, ('fixed flag', fixed)
357
358
359 self.__relax__.generic.diffusion_tensor.set(run=run, params=params, time_scale=time_scale, d_scale=d_scale, angle_units=angle_units, param_types=param_types, axial_type=axial_type, fixed=fixed)
360