Package lib :: Package frame_order :: Module pseudo_ellipse_free_rotor
[hide private]
[frames] | no frames]

Source Code for Module lib.frame_order.pseudo_ellipse_free_rotor

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2009-2013 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  """Module for the handling of Frame Order.""" 
 24   
 25  # Dependency check module. 
 26  import dep_check 
 27   
 28  # Python module imports. 
 29  from math import cos, pi, sin 
 30  if dep_check.scipy_module: 
 31      from scipy.integrate import quad 
 32   
 33  # relax module imports. 
 34  from lib.geometry.pec import pec 
 35  from lib.frame_order.matrix_ops import rotate_daeg 
 36  from lib.frame_order.pseudo_ellipse import tmax_pseudo_ellipse 
 37   
 38   
39 -def compile_2nd_matrix_pseudo_ellipse_free_rotor(matrix, Rx2_eigen, theta_x, theta_y):
40 """Generate the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 41 42 @param matrix: The Frame Order matrix, 2nd degree to be populated. 43 @type matrix: numpy 9D, rank-2 array 44 @param Rx2_eigen: The Kronecker product of the eigenframe rotation matrix with itself. 45 @type Rx2_eigen: numpy 9D, rank-2 array 46 @param theta_x: The cone opening angle along x. 47 @type theta_x: float 48 @param theta_y: The cone opening angle along y. 49 @type theta_y: float 50 """ 51 52 # The surface area normalisation factor. 53 fact = 1.0 / (6.0 * pec(theta_x, theta_y)) 54 55 # Diagonal. 56 matrix[0, 0] = fact * (4.0*pi - quad(part_int_daeg2_pseudo_ellipse_free_rotor_00, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 57 matrix[1, 1] = matrix[3, 3] = fact * 3.0/2.0 * quad(part_int_daeg2_pseudo_ellipse_free_rotor_11, -pi, pi, args=(theta_x, theta_y), full_output=1)[0] 58 matrix[4, 4] = fact * (4.0*pi - quad(part_int_daeg2_pseudo_ellipse_free_rotor_44, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 59 matrix[8, 8] = fact * (4.0*pi - 2.0*quad(part_int_daeg2_pseudo_ellipse_free_rotor_88, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 60 61 # Off diagonal set 1. 62 matrix[0, 4] = matrix[0, 0] 63 matrix[4, 0] = matrix[4, 4] 64 matrix[0, 8] = fact * (4.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_08, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 65 matrix[8, 0] = fact * (4.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_80, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 66 matrix[4, 8] = fact * (4.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_48, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 67 matrix[8, 4] = matrix[8, 0] 68 69 # Off diagonal set 2. 70 matrix[1, 3] = matrix[3, 1] = -matrix[1, 1] 71 72 # Rotate and return the frame order matrix. 73 return rotate_daeg(matrix, Rx2_eigen)
74 75
76 -def part_int_daeg2_pseudo_ellipse_free_rotor_00(phi, x, y):
77 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 78 79 @param phi: The azimuthal tilt-torsion angle. 80 @type phi: float 81 @param x: The cone opening angle along x. 82 @type x: float 83 @param y: The cone opening angle along y. 84 @type y: float 85 @return: The theta-sigma partial integral. 86 @rtype: float 87 """ 88 89 # Theta max. 90 tmax = tmax_pseudo_ellipse(phi, x, y) 91 92 # The theta-sigma integral. 93 return cos(phi)**2*cos(tmax)**3 + 3.0*sin(phi)**2*cos(tmax)
94 95
96 -def part_int_daeg2_pseudo_ellipse_free_rotor_08(phi, x, y):
97 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 98 99 @param phi: The azimuthal tilt-torsion angle. 100 @type phi: float 101 @param x: The cone opening angle along x. 102 @type x: float 103 @param y: The cone opening angle along y. 104 @type y: float 105 @return: The theta-sigma partial integral. 106 @rtype: float 107 """ 108 109 # Theta max. 110 tmax = tmax_pseudo_ellipse(phi, x, y) 111 112 # The theta-sigma integral. 113 return cos(phi)**2*(2.0*cos(tmax)**3 - 6.0*cos(tmax))
114 115
116 -def part_int_daeg2_pseudo_ellipse_free_rotor_11(phi, x, y):
117 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 118 119 @param phi: The azimuthal tilt-torsion angle. 120 @type phi: float 121 @param x: The cone opening angle along x. 122 @type x: float 123 @param y: The cone opening angle along y. 124 @type y: float 125 @return: The theta-sigma partial integral. 126 @rtype: float 127 """ 128 129 # Theta max. 130 tmax = tmax_pseudo_ellipse(phi, x, y) 131 132 # The theta-sigma integral. 133 return sin(tmax)**2
134 135
136 -def part_int_daeg2_pseudo_ellipse_free_rotor_44(phi, x, y):
137 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 138 139 @param phi: The azimuthal tilt-torsion angle. 140 @type phi: float 141 @param x: The cone opening angle along x. 142 @type x: float 143 @param y: The cone opening angle along y. 144 @type y: float 145 @return: The theta-sigma partial integral. 146 @rtype: float 147 """ 148 149 # Theta max. 150 tmax = tmax_pseudo_ellipse(phi, x, y) 151 152 # The theta-sigma integral. 153 return sin(phi)**2*cos(tmax)**3 + 3*cos(phi)**2*cos(tmax)
154 155
156 -def part_int_daeg2_pseudo_ellipse_free_rotor_48(phi, x, y):
157 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 158 159 @param phi: The azimuthal tilt-torsion angle. 160 @type phi: float 161 @param x: The cone opening angle along x. 162 @type x: float 163 @param y: The cone opening angle along y. 164 @type y: float 165 @return: The theta-sigma partial integral. 166 @rtype: float 167 """ 168 169 # Theta max. 170 tmax = tmax_pseudo_ellipse(phi, x, y) 171 172 # The theta-sigma integral. 173 return sin(phi)**2*(2.0*cos(tmax)**3 - 6.0*cos(tmax))
174 175
176 -def part_int_daeg2_pseudo_ellipse_free_rotor_80(phi, x, y):
177 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 178 179 @param phi: The azimuthal tilt-torsion angle. 180 @type phi: float 181 @param x: The cone opening angle along x. 182 @type x: float 183 @param y: The cone opening angle along y. 184 @type y: float 185 @return: The theta-sigma partial integral. 186 @rtype: float 187 """ 188 189 # Theta max. 190 tmax = tmax_pseudo_ellipse(phi, x, y) 191 192 # The theta-sigma integral. 193 return cos(tmax)**3 - 3.0*cos(tmax)
194 195
196 -def part_int_daeg2_pseudo_ellipse_free_rotor_88(phi, x, y):
197 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 198 199 @param phi: The azimuthal tilt-torsion angle. 200 @type phi: float 201 @param x: The cone opening angle along x. 202 @type x: float 203 @param y: The cone opening angle along y. 204 @type y: float 205 @return: The theta-sigma partial integral. 206 @rtype: float 207 """ 208 209 # Theta max. 210 tmax = tmax_pseudo_ellipse(phi, x, y) 211 212 # The theta-sigma integral. 213 return cos(tmax)**3
214