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

Source Code for Module prompt.n_state_model

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2008-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 'n_state_model' user function class.""" 
 25  __docformat__ = 'plaintext' 
 26   
 27  # relax module imports. 
 28  from base_class import User_fn_class 
 29  import arg_check 
 30  from specific_fns.setup import n_state_model_obj 
 31   
 32   
33 -class N_state_model(User_fn_class):
34 """Class for the N-state models.""" 35
36 - def CoM(self, pivot_point=[0.0, 0.0, 0.0], centre=None):
37 """Centre of mass (CoM) analysis. 38 39 Keyword Arguments 40 ~~~~~~~~~~~~~~~~~ 41 42 pivot_point: The pivot point of the motions between the two domains. 43 44 centre: The optional argument for manually specifying the CoM of the initial position prior 45 to the N rotations to the positions of the N states. 46 47 48 Description 49 ~~~~~~~~~~~ 50 51 This function is used for analysing the domain motion information content of the N states 52 from the N-state model. The states do not correspond to physical states, hence nothing can 53 be extracted from the individual states. This analysis involves the calculation of the 54 pivot to centre of mass (pivot-CoM) order parameter and subsequent cone of motions. 55 56 For the analysis, both the pivot point and centre of mass must be specified. The supplied 57 pivot point must be a vector of floating point numbers of length 3. If the centre keyword 58 argument is supplied, it must also be a vector of floating point numbers (of length 3). If 59 the centre argument is not supplied, then the CoM will be calulcated from the selected parts 60 of a previously loaded structure. 61 62 63 Examples 64 ~~~~~~~~ 65 66 To perform an analysis where the pivot is at the origin and the CoM is set to the N-terminal 67 domain of a previously loaded PDB file (the C-terminal domain has been deselected), type: 68 69 relax> n_state_model.CoM() 70 71 72 To perform an analysis where the pivot is at the origin (because the real pivot has been 73 shifted to this position) and the CoM is at the position [0, 0, 1], type one of: 74 75 relax> n_state_model.CoM(centre=[0, 0, 1]) 76 relax> n_state_model.CoM(centre=[0.0, 0.0, 1.0]) 77 relax> n_state_model.CoM(pivot_point=[0.0, 0.0, 0.0], centre=[0.0, 0.0, 1.0]) 78 """ 79 80 # Function intro text. 81 if self._exec_info.intro: 82 text = self._exec_info.ps3 + "n_state_model.CoM(" 83 text = text + "pivot_point=" + repr(pivot_point) 84 text = text + ", centre=" + repr(centre) + ")" 85 print(text) 86 87 # The argument checks. 88 arg_check.is_num_list(pivot_point, 'pivot point', size=3) 89 arg_check.is_num_list(centre, 'centre of mass', size=3, can_be_none=True) 90 91 # Execute the functional code. 92 n_state_model_obj._CoM(pivot_point=pivot_point, centre=centre)
93 94
95 - def cone_pdb(self, cone_type=None, scale=1.0, file='cone.pdb', dir=None, force=False):
96 """Create a PDB file representing the cone models from the centre of mass (CoM) analysis. 97 98 Keyword Arguments 99 ~~~~~~~~~~~~~~~~~ 100 101 cone_type: The type of cone model to represent. 102 103 scale: Value for scaling the pivot-CoM distance which the size of the cone defaults to. 104 105 file: The name of the PDB file. 106 107 dir: The directory where the file is located. 108 109 force: A flag which, if set to True, will overwrite the any pre-existing file. 110 111 112 Description 113 ~~~~~~~~~~~ 114 115 This function creates a PDB file containing an artificial geometric structure to represent 116 the various cone models. These models include: 117 118 'diff in cone' 119 'diff on cone' 120 121 The model can be selected by setting the cone_type argument to one of these strings. The 122 cone is represented as an isotropic cone with its axis parallel to the average pivot-CoM 123 vector, the vertex placed at the pivot point of the domain motions, and the length of the 124 edge of the cone equal to the pivot-CoM distance multipled by the scaling argument. The 125 resultant PDB file can subsequently read into any molecular viewer. 126 127 There are four different types of residue within the PDB. The pivot point is represented as 128 as a single carbon atom of the residue 'PIV'. The cone consists of numerous H atoms of the 129 residue 'CON'. The average pivot-CoM vector is presented as the residue 'AVE' with one 130 carbon atom positioned at the pivot and the other at the head of the vector (after scaling 131 by the scale argument). Finally, if Monte Carlo have been performed, there will be multiple 132 'MCC' residues representing the cone for each simulation, and multiple 'MCA' residues 133 representing the varying average pivot-CoM vector for each simulation. 134 135 To create the diffusion in a cone PDB representation, a uniform distribution of vectors on a 136 sphere is generated using spherical coordinates with the polar angle defined from the 137 average pivot-CoM vector. By incrementing the polar angle using an arccos distribution, a 138 radial array of vectors representing latitude are created while incrementing the azimuthal 139 angle evenly creates the longitudinal vectors. These are all placed into the PDB file as H 140 atoms and are all connected using PDB CONECT records. Each H atom is connected to its two 141 neighbours on the both the longitude and latitude. This creates a geometric PDB object with 142 longitudinal and latitudinal lines representing the filled cone. 143 """ 144 145 # Function intro text. 146 if self._exec_info.intro: 147 text = self._exec_info.ps3 + "n_state_model.cone_pdb(" 148 text = text + "cone_type=" + repr(cone_type) 149 text = text + ", scale=" + repr(scale) 150 text = text + ", file=" + repr(file) 151 text = text + ", dir=" + repr(dir) 152 text = text + ", force=" + repr(force) + ")" 153 print(text) 154 155 # The argument checks. 156 arg_check.is_str(cone_type, 'cone type') 157 arg_check.is_num(scale, 'scaling factor') 158 arg_check.is_str(file, 'file name') 159 arg_check.is_str(dir, 'directory name', can_be_none=True) 160 arg_check.is_bool(force, 'force flag') 161 162 # Execute the functional code. 163 n_state_model_obj._cone_pdb(cone_type=cone_type, scale=scale, file=file, dir=dir, force=force)
164 165
166 - def elim_no_prob(self):
167 """Eliminate the structures or states with no probability. 168 169 Examples 170 ~~~~~~~~ 171 172 Simply type: 173 174 relax> n_state_model.elim_no_prob(N=8) 175 """ 176 177 # Function intro text. 178 if self._exec_info.intro: 179 text = self._exec_info.ps3 + "n_state_model.elim_no_prob()" 180 print(text) 181 182 # Execute the functional code. 183 n_state_model_obj._elim_no_prob()
184 185
186 - def number_of_states(self, N=None):
187 """Set the number of states in the N-state model. 188 189 Keyword Arguments 190 ~~~~~~~~~~~~~~~~~ 191 192 N: The number of states. 193 194 195 Description 196 ~~~~~~~~~~~ 197 198 Prior to optimisation, the number of states in the N-state model can be specified. If the 199 number of states is not set, then this parameter will be equal to the number of loaded 200 structures. 201 202 203 Examples 204 ~~~~~~~~ 205 206 To set up an 8-state model, type: 207 208 relax> n_state_model.number_of_states(N=8) 209 """ 210 211 # Function intro text. 212 if self._exec_info.intro: 213 text = self._exec_info.ps3 + "n_state_model.number_of_states(" 214 text = text + "N=" + repr(N) + ")" 215 print(text) 216 217 # The argument checks. 218 arg_check.is_int(N, 'number of states N') 219 220 # Execute the functional code. 221 n_state_model_obj._number_of_states(N=N)
222 223
224 - def ref_domain(self, ref=None):
225 """Set the reference domain for the '2-domain' N-state model. 226 227 Keyword Arguments 228 ~~~~~~~~~~~~~~~~~ 229 230 ref: The domain which will act as the frame of reference. This is only valid for the 231 '2-domain' N-state model. 232 233 234 Description 235 ~~~~~~~~~~~ 236 237 Prior to optimisation of the '2-domain' N-state model, which of the two domains will act as 238 the frame of reference must be specified. The N-states will be rotations of the other 239 domain, so to switch the frame of reference to the other domain simply transpose the 240 rotation matrices. 241 242 243 Examples 244 ~~~~~~~~ 245 246 To set up a 5-state model with 'C' domain being the frame of reference, type: 247 248 relax> n_state_model.ref_domain(ref='C') 249 """ 250 251 # Function intro text. 252 if self._exec_info.intro: 253 text = self._exec_info.ps3 + "n_state_model.ref_domain(" 254 text = text + "ref=" + repr(ref) + ")" 255 print(text) 256 257 # The argument checks. 258 arg_check.is_str(ref, 'reference frame') 259 260 # Execute the functional code. 261 n_state_model_obj._ref_domain(ref=ref)
262 263
264 - def select_model(self, model=None):
265 """Select the N-state model type and set up the model. 266 267 Keyword Arguments 268 ~~~~~~~~~~~~~~~~~ 269 270 model: The name of the preset N-state model. 271 272 273 Description 274 ~~~~~~~~~~~ 275 276 Prior to optimisation, the N-state model type should be selected. The preset models are: 277 278 '2-domain' - The N-state model for a system of two domains, where one domain experiences a 279 a reduced tensor. 280 281 'population' - The N-state model whereby only populations are optimised. The structures 282 loaded into relax are assumed to be fixed. I.e. if two domains are present, the Euler 283 angles for each state are fixed. The parameters of the model include the weight or 284 probability for each state and the alignment tensor - {p0, p1, ..., pN, Axx, Ayy, Axy, Axz, 285 Ayz}. 286 287 'fixed' - The N-state model whereby all motions are fixed and all populations are fixed to 288 the set probabilities. The parameters of the model are simply the alignment tensor, {Axx, 289 Ayy, Axy, Axz, Ayz}. 290 291 292 Examples 293 ~~~~~~~~ 294 295 To analyse populations of states, type: 296 297 relax> n_state_model.select_model(model='populations') 298 """ 299 300 # Function intro text. 301 if self._exec_info.intro: 302 text = self._exec_info.ps3 + "n_state_model.select_model(" 303 text = text + "model=" + repr(model) + ")" 304 print(text) 305 306 # The argument checks. 307 arg_check.is_str(model, 'model') 308 309 # Execute the functional code. 310 n_state_model_obj._select_model(model=model)
311