Package specific_analyses :: Package model_free :: Module parameter_object
[hide private]
[frames] | no frames]

Source Code for Module specific_analyses.model_free.parameter_object

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2007-2009,2011,2014 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 module for the Lipari-Szabo model-free parameter list object.""" 
 24   
 25  # Python module imports. 
 26  from math import pi 
 27   
 28  # relax module imports. 
 29  from lib.physical_constants import N15_CSA 
 30  from pipe_control import relax_data 
 31  from specific_analyses.parameter_object import Param_list 
 32  from specific_analyses.model_free.parameters import conv_factor_rex, units_rex 
 33   
 34   
35 -def rex_scaling(model_info=None):
36 """Determine the scaling factor for the Rex parameter. 37 38 @keyword model_info: The model information from model_loop(). This index is zero for the global models or equal to the global spin index (which covers the molecule, residue, and spin indices). 39 @type model_info: int 40 @return: The scaling factor for the Rex parameter. 41 @rtype: float 42 """ 43 44 # Return the scaling factor. 45 return 1.0 / (2.0 * pi * cdp.spectrometer_frq[cdp.ri_ids[0]])**2
46 47
48 -def rex_upper(incs=None, model_info=None):
49 """Determine the grid search upper bound for the Rex parameter. 50 51 @keyword incs: The number of grid search increments. 52 @type incs: int 53 @keyword model_info: The model information from model_loop(). This index is zero for the global models or equal to the global spin index (which covers the molecule, residue, and spin indices). 54 @type model_info: int 55 @return: The grid search upper bound for the Rex parameter. 56 @rtype: float 57 """ 58 59 # Return the upper bound. 60 return 5.0 / (2.0 * pi * cdp.spectrometer_frq[cdp.ri_ids[0]])**2
61 62 63
64 -class Model_free_params(Param_list):
65 """The Lipari-Szabo model-free parameter list singleton.""" 66 67 # Class variable for storing the class instance (for the singleton design pattern). 68 _instance = None 69
70 - def __init__(self):
71 """Define all the parameters of the analysis.""" 72 73 # The object is already initialised. 74 if self._initialised: return 75 76 # Execute the base class __init__ method. 77 Param_list.__init__(self) 78 79 # Add the base data for the models. 80 self._add( 81 'ri_data', 82 scope = 'spin', 83 desc = relax_data.return_data_desc('ri_data'), 84 py_type = dict, 85 err = False, 86 sim = True 87 ) 88 self._add( 89 'ri_data_err', 90 scope = 'spin', 91 desc = relax_data.return_data_desc('ri_data_err'), 92 py_type = dict, 93 err = False, 94 sim = False 95 ) 96 97 # Add the model variables. 98 self._add_model_info(equation_flag=True) 99 100 # Add up the global model parameters. 101 self._add_diffusion_params() 102 103 # Add up the spin model parameters. 104 self._add( 105 's2', 106 scope = 'spin', 107 default = 0.8, 108 desc = 'S2, the model-free generalised order parameter (S2 = S2f.S2s)', 109 py_type = float, 110 set = 'params', 111 grid_lower = 0.0, 112 grid_upper = 1.0, 113 grace_string = '\\qS\\v{0.4}\\z{0.71}2\\Q', 114 err = True, 115 sim = True 116 ) 117 self._add( 118 's2f', 119 scope = 'spin', 120 default = 0.8, 121 desc = 'S2f, the faster motion model-free generalised order parameter', 122 py_type = float, 123 set = 'params', 124 grid_lower = 0.0, 125 grid_upper = 1.0, 126 grace_string = '\\qS\\sf\\N\\h{-0.2}\\v{0.4}\\z{0.71}2\\Q', 127 err = True, 128 sim = True 129 ) 130 self._add( 131 's2s', 132 scope = 'spin', 133 default = 0.8, 134 desc = 'S2s, the slower motion model-free generalised order parameter', 135 py_type = float, 136 set = 'params', 137 grid_lower = 0.0, 138 grid_upper = 1.0, 139 grace_string = '\\qS\\ss\\N\\h{-0.2}\\v{0.4}\\z{0.71}2\\Q', 140 err = True, 141 sim = True 142 ) 143 self._add( 144 'local_tm', 145 scope = 'spin', 146 default = 10.0 * 1e-9, 147 desc = 'The spin specific global correlation time (seconds)', 148 py_type = float, 149 set = 'params', 150 scaling = 1e-12, 151 grid_lower = 1.0 * 1e-9, 152 grid_upper = 12.0 * 1e-9, 153 grace_string = '\\xt\\f{}\\sm', 154 units = 'ns', 155 err = True, 156 sim = True 157 ) 158 self._add( 159 'te', 160 scope = 'spin', 161 default = 100.0 * 1e-12, 162 desc = 'Single motion effective internal correlation time (seconds)', 163 py_type = float, 164 set = 'params', 165 scaling = 1e-12, 166 grid_lower = 0.0, 167 grid_upper = 500.0 * 1e-12, 168 conv_factor = 1e-12, 169 grace_string = '\\xt\\f{}\\se', 170 units = 'ps', 171 err = True, 172 sim = True 173 ) 174 self._add( 175 'tf', 176 scope = 'spin', 177 default = 10.0 * 1e-12, 178 desc = 'Faster motion effective internal correlation time (seconds)', 179 py_type = float, 180 set = 'params', 181 scaling = 1e-12, 182 grid_lower = 0.0, 183 grid_upper = 500.0 * 1e-12, 184 conv_factor = 1e-12, 185 grace_string = '\\xt\\f{}\\sf', 186 units = 'ps', 187 err = True, 188 sim = True 189 ) 190 self._add( 191 'ts', 192 scope = 'spin', 193 default = 1000.0 * 1e-12, 194 desc = 'Slower motion effective internal correlation time (seconds)', 195 py_type = float, 196 set = 'params', 197 scaling = 1e-12, 198 grid_lower = 0.0, 199 grid_upper = 500.0 * 1e-12, 200 conv_factor = 1e-12, 201 grace_string = '\\xt\\f{}\\ss', 202 units = 'ps', 203 err = True, 204 sim = True 205 ) 206 self._add( 207 'rex', 208 scope = 'spin', 209 default = 0.0, 210 desc = 'Chemical exchange relaxation (sigma_ex = Rex / omega**2)', 211 py_type = float, 212 set = 'params', 213 scaling = rex_scaling, 214 grid_lower = 0.0, 215 grid_upper = rex_upper, 216 conv_factor = conv_factor_rex, 217 units = units_rex, 218 grace_string = '\\qR\\sex\\Q', 219 err = True, 220 sim = True 221 ) 222 # FIXME: This interatomic parameter should be activated. 223 #self._add( 224 # 'r', 225 # scope = 'interatomic', 226 # default = 1.02e-10, 227 # desc = 'The XH bond length', 228 # py_type = float, 229 # set = 'params', 230 # scaling = 1e-10, 231 # grid_lower = 1.0 * 1e-10, 232 # grid_upper = 1.05 * 1e-10, 233 # units = 'm', 234 # grace_string = 'Bond length (m)', 235 # err = True, 236 # sim = True 237 #) 238 self._add_csa( 239 default = N15_CSA, 240 set = 'params', 241 err = True, 242 sim = True 243 ) 244 245 # Add the minimisation data. 246 self._add_min_data(min_stats_global=True, min_stats_spin=True) 247 248 # Set up the user function documentation. 249 self._set_uf_title("Model-free parameters") 250 self._uf_param_table(label="table: model-free parameters", caption="Model-free parameters.") 251 self._uf_param_table(label="table: model-free parameter writing", caption="Model-free parameters.") 252 self._uf_param_table(label="table: model-free parameters and min stats", caption="Model-free parameters and minimisation statistics.", sets=['params', 'fixed', 'min']) 253 self._uf_param_table(label="table: all model-free parameters", caption="Model-free parameters.", scope=None) 254 self._uf_param_table(label="table: model-free parameter value setting", caption="Model-free parameters.") 255 self._uf_param_table(label="table: model-free parameter value setting with defaults", caption="Model-free parameter value setting.", default=True) 256 257 # Parameter setting documentation. 258 for doc in self._uf_doc_loop(["table: model-free parameter value setting", "table: model-free parameter value setting with defaults"]): 259 doc.add_paragraph("Setting a parameter value may have no effect depending on which model-free model is chosen. For example if S2f values and S2s values are set but the data pipe corresponds to the model-free model 'm4' then because these data values are not parameters of the model they will have no effect.") 260 doc.add_paragraph("Note that the Rex values are scaled quadratically with field strength and should be supplied as a field strength independent value. Use the following formula to obtain the correct value:") 261 doc.add_verbatim(" value = rex / (2.0 * pi * frequency) ** 2") 262 doc.add_paragraph("where:") 263 doc.add_list_element("rex is the chemical exchange value for the current frequency.") 264 doc.add_list_element("frequency is the proton frequency corresponding to the data.") 265 266 # Parameter writing documentation. 267 for doc in self._uf_doc_loop(["table: model-free parameter writing"]): 268 doc.add_paragraph("For model-free theory it is assumed that Rex values are scaled quadratically with field strength. The values will be very small as they will be written out as a field strength independent value. Hence use the following formula to convert the value to that expected for a given magnetic field strength:") 269 doc.add_verbatim(" Rex = value * (2.0 * pi * frequency) ** 2") 270 doc.add_paragraph("The frequency is that of the proton in Hertz.")
271