Package maths_fns :: Module ri_prime
[hide private]
[frames] | no frames]

Source Code for Module maths_fns.ri_prime

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003, 2004 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   
 24  # The transformed relaxation equations 
 25  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 26  # 
 27  #    Relaxation equations 
 28  #    ~~~~~~~~~~~~~~~~~~~~ 
 29  # 
 30  #        R1()  =  dip_const_func . dip_Jw_R1_func  +  csa_const_func . csa_Jw_R1_func 
 31  # 
 32  # 
 33  #                 dip_const_func                      csa_const_func 
 34  #        R2()  =  -------------- . dip_Jw_R2_func  +  -------------- . csa_Jw_R2_func  +  rex_const_func 
 35  #                       2                                   6 
 36  # 
 37  # 
 38  #        sigma_noe()  =  dip_const_func . dip_Jw_sigma_noe_func 
 39  # 
 40  # 
 41  #        Ri  =  dip_comps_func . dip_jw_comps_func  +  csa_comps_func * csa_jw_comps_func  +  rex_comps_func 
 42  # 
 43  # 
 44  # 
 45  # The transformed relaxation gradients 
 46  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 47  # 
 48  #    Spectral density parameter 
 49  #    ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 50  # 
 51  #        dR1() 
 52  #        -----  =  dip_const_func . dip_Jw_R1_grad  +  csa_const_func . csa_Jw_R1_grad 
 53  #         dJw 
 54  # 
 55  # 
 56  #        dR2()     dip_const_func                      csa_const_func 
 57  #        -----  =  -------------- . dip_Jw_R2_grad  +  -------------- . csa_Jw_R2_grad 
 58  #         dJw            2                                   6 
 59  # 
 60  # 
 61  #        dsigma_noe() 
 62  #        ------------  = dip_const_func . dip_Jw_sigma_noe_grad 
 63  #            dJw 
 64  # 
 65  # 
 66  #        dRi() 
 67  #        -----  =  dip_comps_func . dip_jw_comps_grad  +  csa_comps_func . csa_jw_comps_grad 
 68  #         dJw 
 69  # 
 70  # 
 71  #    Chemical exchange 
 72  #    ~~~~~~~~~~~~~~~~~ 
 73  # 
 74  #        dR1() 
 75  #        -----  =  0 
 76  #        dRex 
 77  # 
 78  # 
 79  #        dR2() 
 80  #        -----  =  rex_const_grad 
 81  #        dRex 
 82  # 
 83  # 
 84  #        dsigma_noe() 
 85  #        ------------  =  0 
 86  #           dRex 
 87  # 
 88  # 
 89  #        dRi() 
 90  #        -----  =  rex_comps_grad 
 91  #        dRex 
 92  # 
 93  # 
 94  #    Bond length 
 95  #    ~~~~~~~~~~~ 
 96  # 
 97  #        dR1() 
 98  #        -----  =  dip_const_grad . dip_Jw_R1_func 
 99  #         dr 
100  # 
101  # 
102  #        dR2()     dip_const_grad 
103  #        -----  =  -------------- . dip_Jw_R2_func 
104  #         dr             2 
105  # 
106  # 
107  #        dsigma_noe() 
108  #        ------------  =  dip_const_grad . dip_Jw_sigma_noe_func 
109  #             dr 
110  # 
111  # 
112  #        dRi() 
113  #        -----  =  dip_comps_grad . dip_jw_comps_func 
114  #         dr 
115  # 
116  # 
117  #    CSA 
118  #    ~~~ 
119  # 
120  #        dR1() 
121  #        -----  =  csa_const_grad . csa_Jw_R1_func 
122  #        dcsa 
123  # 
124  # 
125  #        dR2()     csa_const_grad 
126  #        -----  =  -------------- . csa_Jw_R2_func 
127  #        dcsa            6 
128  # 
129  # 
130  #        dsigma_noe() 
131  #        ------------  =  0 
132  #            dcsa 
133  # 
134  # 
135  #        dRi() 
136  #        -----  =  csa_comps_grad . csa_jw_comps_func 
137  #        dcsa 
138  # 
139  # 
140  # 
141  # The transformed relaxation Hessians 
142  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
143  # 
144  #    Spectral density parameter - Spectral density parameter 
145  #    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
146  # 
147  #          d2R1() 
148  #        ---------  =  dip_const_func . dip_Jw_R1_hess  +  csa_const_func . csa_Jw_R1_hess 
149  #        dJwi.dJwj 
150  # 
151  # 
152  #          d2R2()      dip_const_func                      csa_const_func 
153  #        ---------  =  -------------- . dip_Jw_R2_hess  +  -------------- . csa_Jw_R2_hess 
154  #        dJwi.dJwj           2                                   6 
155  # 
156  # 
157  #        d2sigma_noe() 
158  #        -------------  =  dip_const_func . dip_Jw_sigma_noe_hess 
159  #          dJwi.dJwj 
160  # 
161  # 
162  #          d2Ri() 
163  #        ---------  =  dip_comps_func . dip_jw_comps_hess  +  csa_comps_func . csa_jw_comps_hess 
164  #        dJwi.dJwj 
165  # 
166  # 
167  #    Spectral density parameter - Chemical exchange 
168  #    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
169  # 
170  #         d2R1()               d2R2()              d2sigma_noe() 
171  #        --------  =  0   ,   --------  =  0   ,   -------------  =  0 
172  #        dJw.dRex             dJw.dRex               dJw.dRex 
173  # 
174  # 
175  #    Spectral density parameter - CSA 
176  #    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
177  # 
178  #         d2R1() 
179  #        --------  =  csa_const_grad . csa_Jw_R1_grad 
180  #        dJw.dcsa 
181  # 
182  # 
183  #         d2R2()      csa_const_grad 
184  #        --------  =  -------------- . csa_Jw_R2_grad 
185  #        dJw.dcsa           6 
186  # 
187  # 
188  #        d2sigma_noe() 
189  #        -------------  =  0 
190  #          dJw.dcsa 
191  # 
192  # 
193  #         d2Ri() 
194  #        --------  =  csa_comps_grad . csa_jw_comps_grad 
195  #        dJw.dcsa 
196  # 
197  # 
198  #    Spectral density parameter - Bond length 
199  #    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
200  # 
201  #        d2R1() 
202  #        ------  =  dip_const_grad . dip_Jw_R1_grad 
203  #        dJw.dr 
204  # 
205  # 
206  #        d2R2()     dip_const_grad 
207  #        ------  =  -------------- . dip_Jw_R2_grad 
208  #        dJw.dr           2 
209  # 
210  # 
211  #        d2sigma_noe() 
212  #        -------------  =  dip_const_grad . dip_Jw_sigma_noe_grad 
213  #           dJw.dr 
214  # 
215  # 
216  #        d2Ri() 
217  #        ------  =  dip_comps_grad . dip_jw_comps_grad 
218  #        dJw.dr 
219  # 
220  # 
221  #    Chemical exchange - Chemical exchange 
222  #    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
223  # 
224  #         d2R1()              d2R2()             d2sigma_noe() 
225  #        -------  =  0   ,   -------  =  0   ,   -------------  =  0 
226  #        dRex**2             dRex**2                dRex**2 
227  # 
228  # 
229  #    Chemical exchange - CSA 
230  #    ~~~~~~~~~~~~~~~~~~~~~~~ 
231  # 
232  #          d2R1()                d2R2()              d2sigma_noe() 
233  #        ---------  =  0   ,   ---------  =  0   ,   -------------  =  0 
234  #        dRex.dcsa             dRex.dcsa               dRex.dcsa 
235  # 
236  # 
237  #    Chemical exchange - Bond length 
238  #    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
239  # 
240  #         d2R1()              d2R2()             d2sigma_noe() 
241  #        -------  =  0   ,   -------  =  0   ,   -------------  =  0 
242  #        dRex.dr             dRex.dr                dRex.dr 
243  # 
244  # 
245  #    CSA - CSA 
246  #    ~~~~~~~~~ 
247  # 
248  #         d2R1() 
249  #        -------  =  csa_const_hess  . csa_Jw_R1_func 
250  #        dcsa**2 
251  # 
252  # 
253  #         d2R2()     csa_const_hess 
254  #        -------  =  -------------- . csa_Jw_R2_func 
255  #        dcsa**2           6 
256  # 
257  # 
258  #        d2sigma_noe() 
259  #        -------------  =  0 
260  #           dcsa**2 
261  # 
262  # 
263  #         d2Ri() 
264  #        -------  =  csa_comps_hess  . csa_jw_comps_func 
265  #        dcsa**2 
266  # 
267  # 
268  #    CSA - Bond length 
269  #    ~~~~~~~~~~~~~~~~~ 
270  # 
271  #         d2R1()              d2R2()             d2sigma_noe() 
272  #        -------  =  0   ,   -------  =  0   ,   -------------  =  0 
273  #        dcsa.dr             dcsa.dr                dcsa.dr 
274  # 
275  # 
276  #    Bond length - Bond length 
277  #    ~~~~~~~~~~~~~~~~~~~~~~~~~ 
278  # 
279  #        d2R1() 
280  #        ------  =  dip_const_hess . dip_Jw_R1_func 
281  #        dr**2 
282  # 
283  # 
284  #        d2R2()     dip_const_hess 
285  #        ------  =  -------------- . dip_Jw_R2_func 
286  #        dr**2            2 
287  # 
288  # 
289  #        d2sigma_noe() 
290  #        -------------  =  dip_const_hess . dip_Jw_sigma_noe_func 
291  #            dr**2 
292  # 
293  # 
294  #        d2Ri() 
295  #        ------  =  dip_comps_hess . dip_jw_comps_func 
296  #        dr**2 
297  # 
298  # 
299   
300   
301  # Transformed relaxation equatons. 
302  ################################## 
303   
304 -def func_ri_prime(data):
305 """Calculate the transformed relaxation values.""" 306 307 return data.dip_comps_func * data.dip_jw_comps_func + data.csa_comps_func * data.csa_jw_comps_func
308 309
310 -def func_ri_prime_rex(data):
311 """Calculate the transformed relaxation values.""" 312 313 return data.dip_comps_func * data.dip_jw_comps_func + data.csa_comps_func * data.csa_jw_comps_func + data.rex_comps_func
314 315 316 # Transformed relaxation gradients. 317 ################################### 318 319 # dRi/dJ(w)
320 -def func_dri_djw_prime(data):
321 """Spectral density parameter derivatives.""" 322 323 return data.dip_comps_func * data.dip_jw_comps_grad + data.csa_comps_func * data.csa_jw_comps_grad
324 325 326 # dRi/dRex
327 -def func_dri_drex_prime(data):
328 """Chemical exchange derivatives.""" 329 330 return data.rex_comps_grad
331 332 333 # dRi/dr
334 -def func_dri_dr_prime(data):
335 """Bond length derivatives.""" 336 337 return data.dip_comps_grad * data.dip_jw_comps_func
338 339 340 # dRi/dCSA
341 -def func_dri_dcsa_prime(data):
342 """CSA derivatives.""" 343 344 return data.csa_comps_grad * data.csa_jw_comps_func
345 346 347 348 349 # Transformed relaxation Hessians. 350 ################################## 351 352 353 # d2Ri/dJ(w)i.dJ(w)j
354 -def func_d2ri_djwidjwj_prime(data):
355 """Spectral density parameter / spectral density parameter Hessian. 356 357 d2R1() 358 --------- = dip_const_func . dip_Jw_R1_hess + csa_const_func . csa_Jw_R1_hess 359 dJwi.dJwj 360 361 d2R2() dip_const_func csa_const_func 362 --------- = -------------- . dip_Jw_R2_hess + -------------- . csa_Jw_R2_hess 363 dJwi.dJwj 2 6 364 365 d2sigma_noe() 366 ------------- = dip_const_func . dip_Jw_sigma_noe_hess 367 dJwi.dJwj 368 369 d2Ri() 370 --------- = dip_comps_func . dip_jw_comps_hess + csa_comps_func . csa_jw_comps_hess 371 dJwi.dJwj 372 """ 373 374 return data.dip_comps_func * data.dip_jw_comps_hess + data.csa_comps_func * data.csa_jw_comps_hess
375 376 377 # d2Ri/dJ(w).dCSA
378 -def func_d2ri_djwdcsa_prime(data):
379 """Spectral density parameter / CSA Hessian. 380 381 d2R1() 382 -------- = csa_const_grad . csa_Jw_R1_grad 383 dJw.dcsa 384 385 d2R2() csa_const_grad 386 -------- = -------------- . csa_Jw_R2_grad 387 dJw.dcsa 6 388 389 d2sigma_noe() 390 ------------- = 0 391 dJw.dcsa 392 393 d2Ri() 394 -------- = csa_comps_grad . csa_jw_comps_grad 395 dJw.dcsa 396 """ 397 398 return data.csa_comps_grad * data.csa_jw_comps_grad
399 400 401 # d2Ri/dJ(w).dr
402 -def func_d2ri_djwdr_prime(data):
403 """Spectral density parameter / bond length Hessian. 404 405 d2R1() 406 ------ = dip_const_grad . dip_Jw_R1_grad 407 dJw.dr 408 409 d2R2() dip_const_grad 410 ------ = -------------- . dip_Jw_R2_grad 411 dJw.dr 2 412 413 d2sigma_noe() 414 ------------- = dip_const_grad . dip_Jw_sigma_noe_grad 415 dJw.dr 416 417 d2Ri() 418 ------ = dip_comps_grad . dip_jw_comps_grad 419 dJw.dr 420 """ 421 422 return data.dip_comps_grad * data.dip_jw_comps_grad
423 424 425 # d2Ri/dCSA^2
426 -def func_d2ri_dcsa2_prime(data):
427 """CSA / CSA Hessian. 428 429 d2R1() 430 ------- = csa_const_hess . csa_Jw_R1_func 431 dcsa**2 432 433 d2R2() csa_const_hess 434 ------- = -------------- . csa_Jw_R2_func 435 dcsa**2 6 436 437 d2sigma_noe() 438 ------------- = 0 439 dcsa**2 440 441 d2Ri() 442 ------- = csa_comps_hess . csa_jw_comps_func 443 dcsa**2 444 """ 445 446 return data.csa_comps_hess * data.csa_jw_comps_func
447 448 449 # d2Ri/dr^2
450 -def func_d2ri_dr2_prime(data):
451 """Bond length / bond length Hessian. 452 453 d2R1() 454 ------ = dip_const_hess . dip_Jw_R1_func 455 dr**2 456 457 d2R2() dip_const_hess 458 ------ = -------------- . dip_Jw_R2_func 459 dr**2 2 460 461 d2sigma_noe() 462 ------------- = dip_const_hess . dip_Jw_sigma_noe_func 463 dr**2 464 465 d2Ri() 466 ------ = dip_comps_hess . dip_jw_comps_func 467 dr**2 468 """ 469 470 return data.dip_comps_hess * data.dip_jw_comps_func
471