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