Package prompt :: Module paramag
[hide private]
[frames] | no frames]

Source Code for Module prompt.paramag

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003-2005,2007-2010 Edward d'Auvergne                         # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax 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 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax 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 relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Module docstring. 
 24  """Module containing the user function class for paramagnetic related functions.""" 
 25  __docformat__ = 'plaintext' 
 26   
 27  # relax module imports. 
 28  from base_class import User_fn_class 
 29  import arg_check 
 30  from generic_fns import paramag 
 31  from relax_errors import RelaxError 
 32   
 33   
34 -class Paramag(User_fn_class):
35 """Class for handling paramagnetic information.""" 36
37 - def centre(self, pos=None, atom_id=None, pipe=None, verbosity=1, fix=True, ave_pos=True, force=False):
38 """Specify which atom is the paramagnetic centre. 39 40 Keyword Arguments 41 ~~~~~~~~~~~~~~~~~ 42 43 pos: The atomic position. 44 45 atom_id: The atom ID string. 46 47 pipe: The data pipe containing the structures to extract the centre from. 48 49 verbosity: The amount of information to print out. 50 51 fix: A flag specifying if the paramagnetic centre should be fixed during optimisation. 52 53 ave_pos: A flag specifying if the position of the atom is to be averaged across all models. 54 55 force: A flag which if True will cause the current paramagnetic centre to be overwritten. 56 57 58 Description 59 ~~~~~~~~~~~ 60 61 This function is required for specifying where the paramagnetic centre is located in the 62 loaded structure file. If no structure number is given, then the average atom position will 63 be calculated if multiple structures are loaded. 64 65 A different set of structures than those loaded into the current data pipe can also be used 66 to determine the position, or its average. This can be achieved by loading the alternative 67 structures into another data pipe, and then specifying that pipe through the pipe argument. 68 69 If the ave_pos flag is set to True, the average position from all models will be used as the 70 position of the paramagnetic centre. If False, then the positions from all structures will 71 be used. If multiple positions are used, then a fast paramagnetic centre motion will be 72 assumed so that PCSs for a single tensor will be calculated for each position, and the PCS 73 values linearly averaged. 74 75 76 Examples 77 ~~~~~~~~ 78 79 If the paramagnetic centre is the lanthanide Dysprosium which is labelled as Dy in a loaded 80 PDB file, then type one of: 81 82 relax> paramag.centre('Dy') 83 relax> paramag.centre(atom_id='Dy') 84 85 If the carbon atom 'C1' of residue '4' in the PDB file is to be used as the paramagnetic 86 centre, then type: 87 88 relax> paramag.centre(':4@C1') 89 90 To state that the Dy3+ atomic position is [0.136, 12.543, 4.356], type one of: 91 92 relax> paramag.centre([0.136, 12.543, 4.356]) 93 relax> paramag.centre(pos=[0.136, 12.543, 4.356]) 94 95 To find an unknown paramagnetic centre, type: 96 97 relax> paramag.centre(fix=False) 98 """ 99 100 # Function intro text. 101 if self._exec_info.intro: 102 text = self._exec_info.ps3 + "paramag.centre(" 103 text = text + "pos=" + repr(pos) 104 text = text + ", atom_id=" + repr(atom_id) 105 text = text + ", pipe=" + repr(pipe) 106 text = text + ", verbosity=" + repr(verbosity) 107 text = text + ", fix=" + repr(fix) 108 text = text + ", ave_pos=" + repr(ave_pos) 109 text = text + ", force=" + repr(force) + ")" 110 print(text) 111 112 # The argument checks. 113 arg_check.is_num_list(pos, 'atomic position', size=3, can_be_none=True) 114 arg_check.is_str(atom_id, 'atom ID string', can_be_none=True) 115 arg_check.is_str(pipe, 'data pipe', can_be_none=True) 116 arg_check.is_int(verbosity, 'verbosity level') 117 arg_check.is_bool(fix, 'fix flag') 118 arg_check.is_bool(ave_pos, 'average position flag') 119 arg_check.is_bool(force, 'force flag') 120 121 # Execute the functional code. 122 paramag.centre(pos=pos, atom_id=atom_id, pipe=pipe, verbosity=verbosity, fix=fix, ave_pos=ave_pos, force=force)
123