1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The align_tensor user function definitions."""
24
25
26 from graphics import WIZARD_IMAGE_PATH
27 from pipe_control import align_tensor, pipes
28 from user_functions.data import Uf_info; uf_info = Uf_info()
29 from user_functions.objects import Desc_container
30
31
32
33 uf_class = uf_info.add_class('align_tensor')
34 uf_class.title = "Class for manipulating the alignment tensor."
35 uf_class.menu_text = "&align_tensor"
36 uf_class.gui_icon = "relax.align_tensor"
37
38
39
40 uf = uf_info.add_uf('align_tensor.copy')
41 uf.title = "Copy alignment tensor data."
42 uf.title_short = "Alignment tensor copying."
43 uf.add_keyarg(
44 name = "tensor_from",
45 default = None,
46 py_type = "str",
47 desc_short = "source tensor ID",
48 desc = "The identification string of the alignment tensor to copy the data from."
49 )
50 uf.add_keyarg(
51 name = "pipe_from",
52 default = None,
53 py_type = "str",
54 desc_short = "source data pipe",
55 desc = "The name of the data pipe to copy the alignment tensor data from.",
56 wiz_element_type = 'combo',
57 wiz_combo_iter = pipes.pipe_names,
58 can_be_none = True
59 )
60 uf.add_keyarg(
61 name = "tensor_to",
62 default = None,
63 py_type = "str",
64 desc_short = "destination tensor ID",
65 desc = "The identification string of the alignment tensor to copy the data to.",
66 can_be_none = True
67 )
68 uf.add_keyarg(
69 name = "pipe_to",
70 default = None,
71 py_type = "str",
72 desc_short = "destination data pipe",
73 desc = "The name of the data pipe to copy the alignment tensor data to.",
74 wiz_element_type = 'combo',
75 wiz_combo_iter = pipes.pipe_names,
76 can_be_none = True
77 )
78
79 uf.desc.append(Desc_container())
80 uf.desc[-1].add_paragraph("This will copy the alignment tensor data to a new tensor or a new data pipe. The destination data pipe must not contain any alignment tensor data corresponding to the tensor_to label. If the source or destination data pipes are not supplied, then both will default to the current data pipe. Both the source and destination tensor IDs must be supplied.")
81
82 uf.desc.append(Desc_container("Prompt examples"))
83 uf.desc[-1].add_paragraph("To copy the alignment tensor data corresponding to 'Pf1' from the data pipe 'old' to the current data pipe, type one of:")
84 uf.desc[-1].add_prompt("relax> align_tensor.copy('Pf1', 'old')")
85 uf.desc[-1].add_prompt("relax> align_tensor.copy(tensor_from='Pf1', pipe_from='old')")
86 uf.desc[-1].add_paragraph("To copy the alignment tensor data corresponding to 'Otting' from the current data pipe to the data pipe new, type one of:")
87 uf.desc[-1].add_prompt("relax> align_tensor.copy('Otting', pipe_to='new')")
88 uf.desc[-1].add_prompt("relax> align_tensor.copy(tensor_from='Otting', pipe_to='new')")
89 uf.desc[-1].add_paragraph("To copy the alignment tensor data of 'Otting' to that of 'Otting new', type one of:")
90 uf.desc[-1].add_prompt("relax> align_tensor.copy('Otting', tensor_to='Otting new')")
91 uf.desc[-1].add_prompt("relax> align_tensor.copy(tensor_from='Pf1', tensor_to='Otting new')")
92 uf.backend = align_tensor.copy
93 uf.menu_text = "©"
94 uf.gui_icon = "oxygen.actions.list-add"
95 uf.wizard_size = (800, 600)
96 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
97
98
99
100 uf = uf_info.add_uf('align_tensor.delete')
101 uf.title = "Delete alignment tensor data from the relax data store."
102 uf.title_short = "Alignment tensor pipe deletion."
103 uf.add_keyarg(
104 name = "tensor",
105 py_type = "str",
106 desc_short = "tensor",
107 desc = "The alignment tensor identification string.",
108 wiz_element_type = 'combo',
109 wiz_combo_iter = align_tensor.get_tensor_ids,
110 wiz_read_only = True,
111 can_be_none = True
112 )
113
114 uf.desc.append(Desc_container())
115 uf.desc[-1].add_paragraph("This will delete the specified alignment tensor data from the current data pipe. If no tensor is specified, all tensors will be deleted.")
116 uf.backend = align_tensor.delete
117 uf.menu_text = "&delete"
118 uf.gui_icon = "oxygen.actions.list-remove"
119 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
120
121
122
123 uf = uf_info.add_uf('align_tensor.display')
124 uf.title = "Display the alignment tensor information in full detail."
125 uf.title_short = "Align tensor display."
126 uf.display = True
127 uf.add_keyarg(
128 name = "tensor",
129 py_type = "str",
130 desc_short = "tensor",
131 desc = "The alignment tensor identification string.",
132 wiz_element_type = 'combo',
133 wiz_combo_iter = align_tensor.get_tensor_ids,
134 wiz_read_only = True,
135 can_be_none = True
136 )
137 uf.desc.append(Desc_container())
138 uf.desc[-1].add_paragraph("This will show all information relating to the alignment tensor, including the different tensor forms:")
139 uf.desc[-1].add_list_element("Probability tensor.")
140 uf.desc[-1].add_list_element("Saupe order matrix.")
141 uf.desc[-1].add_list_element("Alignment tensor.")
142 uf.desc[-1].add_list_element("Magnetic susceptibility tensor.")
143 uf.desc[-1].add_paragraph("All possible tensor parameters and information will also be shown (Eigensystem, GDO, Aa, Ar, R, eta, chi_ax, chi_rh, etc). The printout will be extensive.")
144 uf.desc[-1].add_paragraph("If no tensor is specified, all tensors will be displayed.")
145 uf.backend = align_tensor.display
146 uf.menu_text = "dis&play"
147 uf.gui_icon = "oxygen.actions.document-preview"
148 uf.wizard_height_desc = 400
149 uf.wizard_size = (800, 600)
150 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
151
152
153
154 uf = uf_info.add_uf('align_tensor.fix')
155 uf.title = "Fix all alignment tensors so that they do not change during optimisation."
156 uf.title_short = "Fix alignment tensors."
157 uf.add_keyarg(
158 name = "id",
159 py_type = "str",
160 desc_short = "tensor ID",
161 desc = "The alignment tensor identification string.",
162 wiz_element_type = 'combo',
163 wiz_combo_iter = align_tensor.get_tensor_ids,
164 wiz_read_only = True,
165 can_be_none = True
166 )
167 uf.add_keyarg(
168 name = "fixed",
169 default = True,
170 py_type = "bool",
171 desc_short = "fixed flag",
172 desc = "The flag specifying if the tensors should be fixed or variable."
173 )
174 uf.desc.append(Desc_container())
175 uf.desc[-1].add_paragraph("If the ID string is left unset, then all alignment tensors will be fixed.")
176 uf.backend = align_tensor.fix
177 uf.menu_text = "&fix"
178 uf.gui_icon = "oxygen.status.object-locked"
179 uf.wizard_size = (800, 500)
180 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
181
182
183
184 uf = uf_info.add_uf('align_tensor.init')
185 uf.title = "Initialise an alignment tensor."
186 uf.title_short = "Alignment tensor initialisation."
187 uf.add_keyarg(
188 name = "tensor",
189 py_type = "str",
190 desc_short = "tensor ID",
191 desc = "The optional alignment tensor ID string, required if multiple tensors exist per alignment.",
192 can_be_none = True
193 )
194 uf.add_keyarg(
195 name = "align_id",
196 py_type = "str",
197 desc_short = "alignment ID",
198 desc = "The alignment ID string that the tensor corresponds to.",
199 wiz_element_type = "combo",
200 wiz_combo_iter = align_tensor.get_tensor_ids,
201 wiz_read_only = False
202 )
203 uf.add_keyarg(
204 name = "domain",
205 py_type = "str",
206 desc_short = "domain ID",
207 desc = "The optional domain ID string that the tensor corresponds to.",
208 can_be_none = True
209 )
210 uf.add_keyarg(
211 name = "params",
212 py_type = "num_tuple",
213 desc_short = "alignment tensor parameters",
214 dim = 5,
215 desc = "The alignment tensor data.",
216 wiz_read_only = False
217 )
218 uf.add_keyarg(
219 name = "scale",
220 default = 1.0,
221 py_type = "float",
222 desc_short = "scale",
223 desc = "The alignment tensor eigenvalue scaling value."
224 )
225 uf.add_keyarg(
226 name = "angle_units",
227 default = "deg",
228 py_type = "str",
229 desc_short = "angle units",
230 desc = "The units for the angle parameters."
231 )
232 uf.add_keyarg(
233 name = "param_types",
234 default = 2,
235 py_type = "int",
236 desc_short = "parameter types",
237 desc = "A flag to select different parameter combinations.",
238 wiz_element_type = "combo",
239 wiz_combo_choices = [
240 "{Sxx, Syy, Sxy, Sxz, Syz}",
241 "{Szz, Sxx-yy, Sxy, Sxz, Syz}",
242 "{Axx, Ayy, Axy, Axz, Ayz}",
243 "{Azz, Axx-yy, Axy, Axz, Ayz}",
244 "{Axx, Ayy, Axy, Axz, Ayz}",
245 "{Azz, Axx-yy, Axy, Axz, Ayz}",
246 "{Pxx, Pyy, Pxy, Pxz, Pyz}",
247 "{Pzz, Pxx-yy, Pxy, Pxz, Pyz}"
248 ],
249 wiz_combo_data = [
250 0,
251 1,
252 2,
253 3,
254 4,
255 5,
256 6,
257 7
258 ],
259 wiz_read_only = True
260 )
261 uf.add_keyarg(
262 name = "errors",
263 default = False,
264 py_type = "bool",
265 desc_short = "errors flag",
266 desc = "A flag which determines if the alignment tensor data or its errors are being input."
267 )
268 uf.desc.append(Desc_container())
269 uf.desc[-1].add_paragraph("The tensor ID is only required if there are multiple unique tensors per alignment. An example is if internal domain motions cause multiple parts of the molecule to align differently. The tensor ID is optional and in the case of only a single tensor per alignment, the tensor can be identified using the alignment ID instead.")
270 uf.desc[-1].add_paragraph("The alignment tensor parameters should be a tuple of floating point numbers (a list surrounded by round brakets). These correspond to the parameters of the tensor which can be specified by the parameter types whereby the values correspond to:")
271 uf.desc[-1].add_item_list_element("0", "{Sxx, Syy, Sxy, Sxz, Syz} (unitless),")
272 uf.desc[-1].add_item_list_element("1", "{Szz, Sxx-yy, Sxy, Sxz, Syz} (Pales default format),")
273 uf.desc[-1].add_item_list_element("2", "{Axx, Ayy, Axy, Axz, Ayz} (unitless),")
274 uf.desc[-1].add_item_list_element("3", "{Azz, Axx-yy, Axy, Axz, Ayz} (unitless),")
275 uf.desc[-1].add_item_list_element("4", "{Axx, Ayy, Axy, Axz, Ayz} (units of Hertz),")
276 uf.desc[-1].add_item_list_element("5", "{Azz, Axx-yy, Axy, Axz, Ayz} (units of Hertz),")
277 uf.desc[-1].add_item_list_element("6", "{Pxx, Pyy, Pxy, Pxz, Pyz} (unitless),")
278 uf.desc[-1].add_item_list_element("7", "{Pzz, Pxx-yy, Pxy, Pxz, Pyz} (unitless).")
279 uf.desc[-1].add_paragraph("Other formats may be added later. The relationship between the Saupe order matrix S and the alignment tensor A is")
280 uf.desc[-1].add_item_list_element(None, "S = 3/2 A.")
281 uf.desc[-1].add_paragraph("The probability matrix P is related to the alignment tensor A by")
282 uf.desc[-1].add_item_list_element(None, "A = P - 1/3 I,")
283 uf.desc[-1].add_paragraph("where I is the identity matrix. For the alignment tensor to be supplied in Hertz, the bond vectors must all be of equal length.")
284
285 uf.desc.append(Desc_container("Prompt examples"))
286 uf.desc[-1].add_paragraph("To set a rhombic tensor for the domain labelled 'domain 1' with the alignment named 'super media', type one of:")
287 uf.desc[-1].add_prompt("relax> align_tensor.init('domain 1', 'super media', (-8.6322e-05, -5.5786e-04, -3.1732e-05, 2.2927e-05, 2.8599e-04), param_types=1)")
288 uf.desc[-1].add_prompt("relax> align_tensor.init(tensor='domain 1', align_id='super media', params=(-8.6322e-05, -5.5786e-04, -3.1732e-05, 2.2927e-05, 2.8599e-04), param_types=1)")
289 uf.backend = align_tensor.init
290 uf.menu_text = "&init"
291 uf.wizard_height_desc = 370
292 uf.wizard_size = (1000, 750)
293 uf.gui_icon = "relax.align_tensor"
294 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
295
296
297
298 uf = uf_info.add_uf('align_tensor.matrix_angles')
299 uf.title = "Calculate the 5D angles between all alignment tensors."
300 uf.title_short = "Alignment tensor angle calculation."
301 uf.display = True
302 uf.add_keyarg(
303 name = "basis_set",
304 default = 0,
305 py_type = "int",
306 desc_short = "basis set",
307 desc = "The basis set to operate with.",
308 wiz_element_type = "combo",
309 wiz_combo_choices = ["{Sxx, Syy, Sxy, Sxz, Syz}", "{Szz, Sxxyy, Sxy, Sxz, Syz}"],
310 wiz_combo_data = [0, 1]
311 )
312 uf.add_keyarg(
313 name = "tensors",
314 py_type = "str_list",
315 desc_short = "alignment tensor IDs",
316 desc = "A list of the tensors to apply the calculation to. If None, all tensors are used.",
317 wiz_element_type = "combo_list",
318 wiz_combo_iter = align_tensor.get_tensor_ids,
319 wiz_read_only = True,
320 can_be_none = True
321 )
322
323 uf.desc.append(Desc_container())
324 uf.desc[-1].add_paragraph("This will calculate the angles between all loaded alignment tensors for the current data pipe. The matrices are first converted to a 5D vector form and then then angles are calculated. The angles are dependent on the basis set. If the basis set is set to the default of 0, the vectors {Sxx, Syy, Sxy, Sxz, Syz} are used. If the basis set is set to 1, the vectors {Szz, Sxxyy, Sxy, Sxz, Syz} are used instead.")
325 uf.backend = align_tensor.matrix_angles
326 uf.menu_text = "&matrix_angles"
327 uf.gui_icon = "oxygen.categories.applications-education"
328 uf.wizard_size = (800, 600)
329 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
330
331
332
333 uf = uf_info.add_uf('align_tensor.reduction')
334 uf.title = "Specify that one tensor is a reduction of another."
335 uf.title_short = "Specify tensor reductions."
336 uf.add_keyarg(
337 name = "full_tensor",
338 py_type = "str",
339 desc_short = "full tensor",
340 desc = "The full alignment tensor.",
341 wiz_element_type = 'combo',
342 wiz_combo_iter = align_tensor.get_tensor_ids,
343 wiz_read_only = True
344 )
345 uf.add_keyarg(
346 name = "red_tensor",
347 py_type = "str",
348 desc_short = "reduced tensor",
349 desc = "The reduced alignment tensor.",
350 wiz_element_type = 'combo',
351 wiz_combo_iter = align_tensor.get_tensor_ids,
352 wiz_read_only = True
353 )
354
355 uf.desc.append(Desc_container())
356 uf.desc[-1].add_paragraph("Prior to optimisation of the N-state model and Frame Order theories using alignment tensors, which tensor is a reduction of which other tensor must be specified through this user function.")
357
358 uf.desc.append(Desc_container("Prompt examples"))
359 uf.desc[-1].add_paragraph("To state that the alignment tensor loaded as 'chi3 C-dom' is a reduction of 'chi3 N-dom', type:")
360 uf.desc[-1].add_prompt("relax> align_tensor.reduction(full_tensor='chi3 N-dom', red_tensor='chi3 C-dom')")
361 uf.backend = align_tensor.reduction
362 uf.menu_text = "&reduction"
363 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
364
365
366
367 uf = uf_info.add_uf('align_tensor.set_domain')
368 uf.title = "Set the domain label for the alignment tensor."
369 uf.title_short = "Tensor domain labelling."
370 uf.add_keyarg(
371 name = "tensor",
372 py_type = "str",
373 desc_short = "tensor ID",
374 desc = "The alignment tensor to assign the domain label to.",
375 wiz_element_type = 'combo',
376 wiz_combo_iter = align_tensor.get_tensor_ids,
377 wiz_read_only = True,
378 )
379 uf.add_keyarg(
380 name = "domain",
381 py_type = "str",
382 desc_short = "domain",
383 desc = "The domain label."
384 )
385
386 uf.desc.append(Desc_container())
387 uf.desc[-1].add_paragraph("Prior to optimisation of the N-state model or Frame Order theories, the domain to which each alignment tensor belongs must be specified.")
388
389 uf.desc.append(Desc_container("Prompt examples"))
390 uf.desc[-1].add_paragraph("To link the alignment tensor loaded as 'chi3 C-dom' to the C-terminal domain 'C', type:")
391 uf.desc[-1].add_prompt("relax> align_tensor.set_domain(tensor='chi3 C-dom', domain='C')")
392 uf.backend = align_tensor.set_domain
393 uf.menu_text = "&set_domain"
394 uf.gui_icon = "oxygen.actions.edit-select"
395 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
396
397
398
399 uf = uf_info.add_uf('align_tensor.svd')
400 uf.title = "Calculate the singular values and condition number for all alignment tensors."
401 uf.title_short = "Alignment tensor SVD calculation."
402 uf.display = True
403 uf.add_keyarg(
404 name = "basis_set",
405 default = 0,
406 py_type = "int",
407 desc_short = "basis set",
408 desc = "The basis set to operate with.",
409 wiz_element_type = "combo",
410 wiz_combo_choices = ["{Sxx, Syy, Sxy, Sxz, Syz}", "{Szz, Sxxyy, Sxy, Sxz, Syz}"],
411 wiz_combo_data = [0, 1]
412 )
413 uf.add_keyarg(
414 name = "tensors",
415 py_type = "str_list",
416 desc_short = "alignment tensor IDs",
417 desc = "A list of the tensors to apply the calculation to. If None, all tensors are used.",
418 wiz_element_type = "combo_list",
419 wiz_combo_iter = align_tensor.get_tensor_ids,
420 wiz_read_only = True,
421 can_be_none = True
422 )
423
424 uf.desc.append(Desc_container())
425 uf.desc[-1].add_paragraph("This will perform a singular value decomposition of all tensors loaded for the current data pipe. If the basis set is set to the default of 0, the matrix on which SVD will be performed is composed of the unitary basis set {Sxx, Syy, Sxy, Sxz, Syz} layed out as:")
426 uf.desc[-1].add_verbatim("""
427 | Sxx1 Syy1 Sxy1 Sxz1 Syz1 |
428 | Sxx2 Syy2 Sxy2 Sxz2 Syz2 |
429 | Sxx3 Syy3 Sxy3 Sxz3 Syz3 |
430 | . . . . . |
431 | . . . . . |
432 | . . . . . |
433 | SxxN SyyN SxyN SxzN SyzN |
434 """)
435 uf.desc[-1].add_paragraph("If basis_set is set to 1, the geometric basis set consisting of the stretching and skewing parameters Szz and Sxx-yy respectively {Szz, Sxxyy, Sxy, Sxz, Syz} will be used instead. The matrix is:")
436 uf.desc[-1].add_verbatim("""
437 | Szz1 Sxxyy1 Sxy1 Sxz1 Syz1 |
438 | Szz2 Sxxyy2 Sxy2 Sxz2 Syz2 |
439 | Szz3 Sxxyy3 Sxy3 Sxz3 Syz3 |
440 | . . . . . |
441 | . . . . . |
442 | . . . . . |
443 | SzzN SxxyyN SxyN SxzN SyzN |
444 """)
445 uf.desc[-1].add_paragraph("The relationships between the geometric and unitary basis sets are:")
446 uf.desc[-1].add_verbatim("""
447 Szz = - Sxx - Syy,
448 Sxxyy = Sxx - Syy,
449 """)
450 uf.desc[-1].add_paragraph("The SVD values and condition number are dependent upon the basis set chosen.")
451 uf.backend = align_tensor.svd
452 uf.menu_text = "s&vd"
453 uf.gui_icon = "oxygen.categories.applications-education"
454 uf.wizard_height_desc = 500
455 uf.wizard_size = (1000, 750)
456 uf.wizard_image = WIZARD_IMAGE_PATH + 'align_tensor.png'
457