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

Source Code for Module lib.frame_order.iso_cone_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 
27   
28  # relax module imports. 
29  from lib.frame_order.matrix_ops import rotate_daeg 
30   
31   
32 -def compile_1st_matrix_iso_cone_free_rotor(matrix, R_eigen, tmax):
33 """Generate the 1st degree Frame Order matrix for the free rotor isotropic cone. 34 35 @param matrix: The Frame Order matrix, 1st degree to be populated. 36 @type matrix: numpy 3D, rank-2 array 37 @param R_eigen: The eigenframe rotation matrix. 38 @type R_eigen: numpy 3D, rank-2 array 39 @param tmax: The cone opening angle. 40 @type tmax: float 41 """ 42 43 # Zeros. 44 matrix[:] = 0.0 45 46 # Diagonal values. 47 matrix[2, 2] = cos(tmax) + 1.0 48 49 # Rotate and return the frame order matrix. 50 return 0.5 * rotate_daeg(matrix, R_eigen)
51 52
53 -def compile_2nd_matrix_iso_cone_free_rotor(matrix, Rx2_eigen, tmax):
54 """Generate the rotated 2nd degree Frame Order matrix for the free rotor isotropic cone. 55 56 The cone axis is assumed to be parallel to the z-axis in the eigenframe. 57 58 59 @param matrix: The Frame Order matrix, 2nd degree to be populated. 60 @type matrix: numpy 9D, rank-2 array 61 @param Rx2_eigen: The Kronecker product of the eigenframe rotation matrix with itself. 62 @type Rx2_eigen: numpy 9D, rank-2 array 63 @param tmax: The cone opening angle. 64 @type tmax: float 65 """ 66 67 # Zeros. 68 matrix[:] = 0.0 69 70 # Repetitive trig calculations. 71 cos_tmax = cos(tmax) 72 cos_tmax2 = cos_tmax**2 73 74 # Diagonal. 75 matrix[0, 0] = matrix[4, 4] = (cos_tmax2 + cos_tmax + 4.0) / 12.0 76 matrix[1, 1] = matrix[3, 3] = (cos_tmax + 1.0) / 4.0 77 matrix[8, 8] = (cos_tmax2 + cos_tmax + 1.0) / 3.0 78 79 # Off diagonal set 1. 80 matrix[0, 4] = matrix[4, 0] = matrix[0, 0] 81 matrix[0, 8] = matrix[8, 0] = -(cos_tmax2 + cos_tmax - 2.0) / 6.0 82 matrix[4, 8] = matrix[8, 4] = matrix[0, 8] 83 84 # Off diagonal set 2. 85 matrix[1, 3] = matrix[3, 1] = -matrix[1, 1] 86 87 # Rotate and return the frame order matrix. 88 return rotate_daeg(matrix, Rx2_eigen)
89