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-2012,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  """Module for the handling of Frame Order.""" 
 24   
 25  # Python module imports. 
 26  from math import cos, pi, sin 
 27  try: 
 28      from scipy.integrate import quad 
 29  except ImportError: 
 30      pass 
 31   
 32  # relax module imports. 
 33  from lib.geometry.pec import pec 
 34  from lib.frame_order.matrix_ops import rotate_daeg 
 35  from lib.frame_order.pseudo_ellipse import tmax_pseudo_ellipse 
 36   
 37   
38 -def compile_1st_matrix_pseudo_ellipse_free_rotor(matrix, R_eigen, theta_x, theta_y):
39 """Generate the 1st degree Frame Order matrix for the free rotor pseudo-ellipse. 40 41 @param matrix: The Frame Order matrix, 1st degree to be populated. 42 @type matrix: numpy 3D, rank-2 array 43 @param R_eigen: The eigenframe rotation matrix. 44 @type R_eigen: numpy 3D, rank-2 array 45 @param theta_x: The cone opening angle along x. 46 @type theta_x: float 47 @param theta_y: The cone opening angle along y. 48 @type theta_y: float 49 """ 50 51 # The surface area normalisation factor. 52 fact = 2.0 * pec(theta_x, theta_y) 53 54 # Invert. 55 if fact == 0.0: 56 fact = 1e100 57 else: 58 fact = 1.0 / fact 59 60 # Numerical integration of phi of each element. 61 matrix[2, 2] = fact * quad(part_int_daeg1_pseudo_ellipse_free_rotor_22, -pi, pi, args=(theta_x, theta_y), full_output=1)[0] 62 63 # Rotate and return the frame order matrix. 64 return rotate_daeg(matrix, R_eigen)
65 66
67 -def compile_2nd_matrix_pseudo_ellipse_free_rotor(matrix, Rx2_eigen, theta_x, theta_y):
68 """Generate the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 69 70 @param matrix: The Frame Order matrix, 2nd degree to be populated. 71 @type matrix: numpy 9D, rank-2 array 72 @param Rx2_eigen: The Kronecker product of the eigenframe rotation matrix with itself. 73 @type Rx2_eigen: numpy 9D, rank-2 array 74 @param theta_x: The cone opening angle along x. 75 @type theta_x: float 76 @param theta_y: The cone opening angle along y. 77 @type theta_y: float 78 """ 79 80 # The surface area normalisation factor. 81 fact3 = 3.0 * pec(theta_x, theta_y) 82 fact4 = 4.0 * pec(theta_x, theta_y) 83 fact6 = 6.0 * pec(theta_x, theta_y) 84 85 # Invert. 86 if fact3 == 0.0: 87 fact3 = 1e100 88 fact4 = 1e100 89 fact6 = 1e100 90 else: 91 fact3 = 1.0 / fact3 92 fact4 = 1.0 / fact4 93 fact6 = 1.0 / fact6 94 95 # Diagonal. 96 matrix[0, 0] = fact6 * (4.0*pi - quad(part_int_daeg2_pseudo_ellipse_free_rotor_00, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 97 matrix[1, 1] = matrix[3, 3] = fact4 * quad(part_int_daeg2_pseudo_ellipse_free_rotor_11, -pi, pi, args=(theta_x, theta_y), full_output=1)[0] 98 matrix[4, 4] = fact6 * (4.0*pi - quad(part_int_daeg2_pseudo_ellipse_free_rotor_44, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 99 matrix[8, 8] = fact3 * (2.0*pi - quad(part_int_daeg2_pseudo_ellipse_free_rotor_88, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 100 101 # Off diagonal set 1. 102 matrix[0, 4] = matrix[0, 0] 103 matrix[4, 0] = matrix[4, 4] 104 matrix[0, 8] = fact3 * (2.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_08, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 105 matrix[8, 0] = fact6 * (4.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_80, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 106 matrix[4, 8] = fact3 * (2.0*pi + quad(part_int_daeg2_pseudo_ellipse_free_rotor_48, -pi, pi, args=(theta_x, theta_y), full_output=1)[0]) 107 matrix[8, 4] = matrix[8, 0] 108 109 # Off diagonal set 2. 110 matrix[1, 3] = matrix[3, 1] = -matrix[1, 1] 111 112 # Rotate and return the frame order matrix. 113 return rotate_daeg(matrix, Rx2_eigen)
114 115
116 -def part_int_daeg1_pseudo_ellipse_free_rotor_22(phi, x, y):
117 """The theta-sigma partial integral of the 1st degree Frame Order matrix element zz 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_00(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 # Repetitive trig. 153 cos_tmax = cos(tmax) 154 155 # The theta-sigma integral. 156 return cos(phi)**2 * cos_tmax**3 + 3.0*sin(phi)**2 * cos_tmax
157 158
159 -def part_int_daeg2_pseudo_ellipse_free_rotor_08(phi, x, y):
160 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 161 162 @param phi: The azimuthal tilt-torsion angle. 163 @type phi: float 164 @param x: The cone opening angle along x. 165 @type x: float 166 @param y: The cone opening angle along y. 167 @type y: float 168 @return: The theta-sigma partial integral. 169 @rtype: float 170 """ 171 172 # Theta max. 173 tmax = tmax_pseudo_ellipse(phi, x, y) 174 175 # Repetitive trig. 176 cos_tmax = cos(tmax) 177 178 # The theta-sigma integral. 179 return cos(phi)**2 * (cos_tmax**3 - 3.0*cos_tmax)
180 181
182 -def part_int_daeg2_pseudo_ellipse_free_rotor_11(phi, x, y):
183 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 184 185 @param phi: The azimuthal tilt-torsion angle. 186 @type phi: float 187 @param x: The cone opening angle along x. 188 @type x: float 189 @param y: The cone opening angle along y. 190 @type y: float 191 @return: The theta-sigma partial integral. 192 @rtype: float 193 """ 194 195 # Theta max. 196 tmax = tmax_pseudo_ellipse(phi, x, y) 197 198 # The theta-sigma integral. 199 return sin(tmax)**2
200 201
202 -def part_int_daeg2_pseudo_ellipse_free_rotor_44(phi, x, y):
203 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 204 205 @param phi: The azimuthal tilt-torsion angle. 206 @type phi: float 207 @param x: The cone opening angle along x. 208 @type x: float 209 @param y: The cone opening angle along y. 210 @type y: float 211 @return: The theta-sigma partial integral. 212 @rtype: float 213 """ 214 215 # Theta max. 216 tmax = tmax_pseudo_ellipse(phi, x, y) 217 218 # Repetitive trig. 219 cos_tmax = cos(tmax) 220 221 # The theta-sigma integral. 222 return sin(phi)**2 * cos_tmax**3 + 3.0*cos(phi)**2 * cos_tmax
223 224
225 -def part_int_daeg2_pseudo_ellipse_free_rotor_48(phi, x, y):
226 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 227 228 @param phi: The azimuthal tilt-torsion angle. 229 @type phi: float 230 @param x: The cone opening angle along x. 231 @type x: float 232 @param y: The cone opening angle along y. 233 @type y: float 234 @return: The theta-sigma partial integral. 235 @rtype: float 236 """ 237 238 # Theta max. 239 tmax = tmax_pseudo_ellipse(phi, x, y) 240 241 # Repetitive trig. 242 cos_tmax = cos(tmax) 243 244 # The theta-sigma integral. 245 return sin(phi)**2 * (cos_tmax**3 - 3.0*cos_tmax)
246 247
248 -def part_int_daeg2_pseudo_ellipse_free_rotor_80(phi, x, y):
249 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 250 251 @param phi: The azimuthal tilt-torsion angle. 252 @type phi: float 253 @param x: The cone opening angle along x. 254 @type x: float 255 @param y: The cone opening angle along y. 256 @type y: float 257 @return: The theta-sigma partial integral. 258 @rtype: float 259 """ 260 261 # Theta max. 262 tmax = tmax_pseudo_ellipse(phi, x, y) 263 264 # Repetitive trig. 265 cos_tmax = cos(tmax) 266 267 # The theta-sigma integral. 268 return cos_tmax**3 - 3.0*cos_tmax
269 270
271 -def part_int_daeg2_pseudo_ellipse_free_rotor_88(phi, x, y):
272 """The theta-sigma partial integral of the 2nd degree Frame Order matrix for the free rotor pseudo-ellipse. 273 274 @param phi: The azimuthal tilt-torsion angle. 275 @type phi: float 276 @param x: The cone opening angle along x. 277 @type x: float 278 @param y: The cone opening angle along y. 279 @type y: float 280 @return: The theta-sigma partial integral. 281 @rtype: float 282 """ 283 284 # Theta max. 285 tmax = tmax_pseudo_ellipse(phi, x, y) 286 287 # The theta-sigma integral. 288 return cos(tmax)**3
289