Package user_functions :: Module interatomic
[hide private]
[frames] | no frames]

Source Code for Module user_functions.interatomic

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2012 Edward d'Auvergne                                        # 
  4  #                                                                             # 
  5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  6  #                                                                             # 
  7  # This program is free software: you can redistribute it and/or modify        # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation, either version 3 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # This program is distributed in the hope that it will be useful,             # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 19  #                                                                             # 
 20  ############################################################################### 
 21   
 22  # Module docstring. 
 23  """The interatomic user function definitions.""" 
 24   
 25  # Python module imports. 
 26  from os import sep 
 27   
 28  # relax module imports. 
 29  from generic_fns.mol_res_spin import get_spin_ids 
 30  from generic_fns import pipes 
 31  from generic_fns.interatomic import copy, create_interatom 
 32  from graphics import WIZARD_IMAGE_PATH 
 33  from user_functions.data import Uf_info; uf_info = Uf_info() 
 34  from user_functions.objects import Desc_container 
 35   
 36   
 37  # The user function class. 
 38  uf_class = uf_info.add_class('interatomic') 
 39  uf_class.title = "Class for manipulating the interatomic data." 
 40  uf_class.menu_text = "&interatomic" 
 41  uf_class.gui_icon = "relax.dipole_pair" 
 42   
 43   
 44  # The interatomic.copy user function. 
 45  uf = uf_info.add_uf('interatomic.copy') 
 46  uf.title = "Copy all data associated with a interatomic data container." 
 47  uf.title_short = "Spin copying." 
 48  uf.display = True 
 49  uf.add_keyarg( 
 50      name = "pipe_from", 
 51      py_type = "str", 
 52      desc_short = "source data pipe", 
 53      desc = "The data pipe containing the interatomic data container from which the data will be copied.  This defaults to the current data pipe.", 
 54      wiz_element_type = 'combo', 
 55      wiz_combo_iter = pipes.pipe_names, 
 56      wiz_read_only = True, 
 57      can_be_none = True 
 58  ) 
 59  uf.add_keyarg( 
 60      name = "pipe_to", 
 61      py_type = "str", 
 62      desc_short = "destination data pipe", 
 63      desc = "The data pipe to copy the interatomic data container to.  This defaults to the current data pipe.", 
 64      wiz_element_type = 'combo', 
 65      wiz_combo_iter = pipes.pipe_names, 
 66      wiz_read_only = True, 
 67      can_be_none = True 
 68  ) 
 69  uf.add_keyarg( 
 70      name = "spin_id1", 
 71      py_type = "str", 
 72      arg_type = "spin ID", 
 73      desc_short = "first spin ID", 
 74      desc = "The spin ID of the first spin.", 
 75      wiz_combo_iter = get_spin_ids, 
 76      can_be_none = True 
 77  ) 
 78  uf.add_keyarg( 
 79      name = "spin_id2", 
 80      py_type = "str", 
 81      arg_type = "spin ID", 
 82      desc_short = "second spin ID", 
 83      desc = "The spin ID of the first spin.", 
 84      wiz_combo_iter = get_spin_ids, 
 85      can_be_none = True 
 86  ) 
 87  # Description. 
 88  uf.desc.append(Desc_container()) 
 89  uf.desc[-1].add_paragraph("This will copy all the data associated with the identified interatomic data container to a different data pipe.  The new interatomic data container must not already exist.") 
 90  # Prompt examples. 
 91  uf.desc.append(Desc_container("Prompt examples")) 
 92  uf.desc[-1].add_paragraph("To copy the interatomic data container between ':2@C' and ':2@H', from the 'orig' data pipe to the current data pipe, type one of:") 
 93  uf.desc[-1].add_prompt("relax> interatomic.copy('orig', spin_id1=':2@C', spin_id2=':2@H')") 
 94  uf.desc[-1].add_prompt("relax> interatomic.copy(pipe_from='orig', spin_id1=':2@C', spin_id2=':2@H')") 
 95  uf.backend = copy 
 96  uf.menu_text = "&copy" 
 97  uf.gui_icon = "oxygen.actions.list-add" 
 98  uf.wizard_size = (700, 600) 
 99  uf.wizard_image = WIZARD_IMAGE_PATH + 'dipole_pair' + sep + 'NH_dipole_pair.png' 
100   
101   
102  # The interatomic.create user function. 
103  uf = uf_info.add_uf('interatomic.create') 
104  uf.title = "Create a new spin." 
105  uf.title_short = "Spin creation." 
106  uf.display = True 
107  uf.add_keyarg( 
108      name = "spin_id1", 
109      py_type = "str", 
110      arg_type = "spin ID", 
111      desc_short = "first spin ID", 
112      desc = "The spin ID of the first spin.", 
113      wiz_combo_iter = get_spin_ids, 
114      can_be_none = True 
115  ) 
116  uf.add_keyarg( 
117      name = "spin_id2", 
118      py_type = "str", 
119      arg_type = "spin ID", 
120      desc_short = "second spin ID", 
121      desc = "The spin ID of the first spin.", 
122      wiz_combo_iter = get_spin_ids, 
123      can_be_none = True 
124  ) 
125  uf.add_keyarg( 
126      name = "pipe", 
127      py_type = "str", 
128      desc_short = "alternative data pipe", 
129      desc = "The data pipe to create the interatomic data container for.  This defaults to the current data pipe if not supplied.", 
130      wiz_element_type = 'combo', 
131      wiz_combo_iter = pipes.pipe_names, 
132      wiz_read_only = True, 
133      can_be_none = True 
134  ) 
135  # Description. 
136  uf.desc.append(Desc_container()) 
137  uf.desc[-1].add_paragraph("This will add a new interatomic data container connecting two existing spins to the relax data storage object.") 
138  # Prompt examples. 
139  uf.desc.append(Desc_container("Prompt examples")) 
140  uf.desc[-1].add_paragraph("To connect the spins ':1@N' to ':1@H', type one of:") 
141  uf.desc[-1].add_prompt("relax> interatomic.create(':1@N', ':1@H')") 
142  uf.desc[-1].add_prompt("relax> interatomic.create(spin_id1=':1@N', spin_id2=':1@H')") 
143  uf.backend = create_interatom 
144  uf.menu_text = "c&reate" 
145  uf.gui_icon = "oxygen.actions.list-add-relax-blue" 
146  uf.wizard_size = (700, 500) 
147  uf.wizard_image = WIZARD_IMAGE_PATH + 'dipole_pair' + sep + 'NH_dipole_pair.png' 
148