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

Source Code for Module maths_fns.jw_mapping

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 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  # Python module imports. 
 24  from math import pi 
 25  from numpy import float64, zeros 
 26   
 27  # relax module imports. 
 28  from ri_comps import calc_fixed_csa, calc_fixed_dip, comp_csa_const_func, comp_dip_const_func 
 29   
 30   
31 -class Mapping:
32 - def __init__(self, frq=None, gx=None, gh=None, mu0=None, h_bar=None):
33 """Reduced spectral density mapping.""" 34 35 # Initialise the data container. 36 self.data = Data() 37 38 # Add the initial data to self.data 39 self.data.gx = gx 40 self.data.gh = gh 41 self.data.mu0 = mu0 42 self.data.h_bar = h_bar 43 44 # The number of frequencies. 45 self.data.num_frq = 1 46 47 # Dipolar and CSA data structures. 48 self.data.dip_const_fixed = 0.0 49 self.data.csa_const_fixed = [0.0] 50 self.data.dip_const_func = 0.0 51 self.data.csa_const_func = zeros(1, float64) 52 53 # Nuclear frequencies. 54 frq = frq * 2 * pi 55 frqX = frq * self.data.gx / self.data.gh 56 57 # Calculate the five frequencies which cause R1, R2, and NOE relaxation. 58 self.data.frq_list = zeros((1, 5), float64) 59 self.data.frq_list[0, 1] = frqX 60 self.data.frq_list[0, 2] = frq - frqX 61 self.data.frq_list[0, 3] = frq 62 self.data.frq_list[0, 4] = frq + frqX 63 self.data.frq_sqrd_list = self.data.frq_list ** 2
64 65
66 - def calc_sigma_noe(self, noe, r1):
67 """Function for calculating the sigma NOE value.""" 68 69 return (noe - 1.0) * r1 * self.data.gx / self.data.gh
70 71
72 - def func(self, r=None, csa=None, r1=None, r2=None, noe=None):
73 """Function for calculating the three spectal density values. 74 75 Three values are returned, J(0), J(wX), and J(wH) (or J(0.87wH)). 76 """ 77 78 # Calculate the fixed component of the dipolar and CSA constants. 79 calc_fixed_dip(self.data) 80 calc_fixed_csa(self.data) 81 82 # Calculate the dipolar and CSA constants. 83 comp_dip_const_func(self.data, r) 84 comp_csa_const_func(self.data, csa) 85 86 # Rename the dipolar and CSA constants. 87 d = self.data.dip_const_func 88 c = self.data.csa_const_func[0] 89 90 # Calculate the sigma NOE value. 91 sigma_noe = self.calc_sigma_noe(noe, r1) 92 93 # Calculate J(0). 94 j0 = -1.5 / (3.0*d + c) * (0.5*r1 - r2 + 0.6*sigma_noe) 95 96 # Calculate J(wX). 97 jwx = 1.0 / (3.0*d + c) * (r1 - 1.4*sigma_noe) 98 99 # Calculate J(wH). 100 jwh = sigma_noe / (5.0*d) 101 102 # Return the three values. 103 return j0, jwx, jwh
104 105
106 -class Data:
107 - def __init__(self):
108 """Empty container for storing data."""
109