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