Author: bugman Date: Wed Dec 7 10:47:48 2011 New Revision: 15039 URL: http://svn.gna.org/viewcvs/relax?rev=15039&view=rev Log: Pre-calculation of a dot product to speed up numerical integration of the rotor frame order PCS. Modified: branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py Modified: branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py?rev=15039&r1=15038&r2=15039&view=diff ============================================================================== --- branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py (original) +++ branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py Wed Dec 7 10:47:48 2011 @@ -1330,8 +1330,11 @@ Ri_prime[2, 1] = 0.0 Ri_prime[2, 2] = 1.0 + # Pre-calculate a dot product for speed ups in the integration. + dot_RT_eigen_R_ave = dot(RT_eigen, R_ave) + # Perform numerical integration. - result = quad(pcs_pivot_motion_rotor, -sigma_max, sigma_max, args=(c, r_pivot_atom, r_ln_pivot, A, R_ave, R_eigen, RT_eigen, Ri_prime), full_output=1) + result = quad(pcs_pivot_motion_rotor, -sigma_max, sigma_max, args=(c, r_pivot_atom, r_ln_pivot, A, R_ave, R_eigen, RT_eigen, Ri_prime, dot_RT_eigen_R_ave), full_output=1) # The surface area normalisation factor. SA = 2.0 * sigma_max @@ -1340,29 +1343,31 @@ return result[0] / SA -def pcs_pivot_motion_rotor(sigma_i, c, r_pivot_atom, r_ln_pivot, A, R_ave, R_eigen, RT_eigen, Ri_prime): +def pcs_pivot_motion_rotor(sigma_i, c, r_pivot_atom, r_ln_pivot, A, R_ave, R_eigen, RT_eigen, Ri_prime, dot_RT_eigen_R_ave): """Calculate the PCS value after a pivoted motion for the rotor model. - @param sigma_i: The rotor angle for state i. - @type sigma_i: float - @param c: The PCS constant (without the interatomic distance and in Angstrom units). - @type c: float - @param r_pivot_atom: The pivot point to atom vector. - @type r_pivot_atom: numpy rank-1, 3D array - @param r_ln_pivot: The lanthanide position to pivot point vector. - @type r_ln_pivot: numpy rank-1, 3D array - @param A: The full alignment tensor of the non-moving domain. - @type A: numpy rank-2, 3D array - @param R_ave: The rotation matrix for rotating from the reference frame to the average position. - @type R_ave: numpy rank-2, 3D array - @param R_eigen: The eigenframe rotation matrix. - @type R_eigen: numpy rank-2, 3D array - @param RT_eigen: The transpose of the eigenframe rotation matrix (for faster calculations). - @type RT_eigen: numpy rank-2, 3D array - @param Ri_prime: The empty rotation matrix for the in-frame rotor motion for state i. - @type Ri_prime: numpy rank-2, 3D array - @return: The PCS value for the changed position. - @rtype: float + @param sigma_i: The rotor angle for state i. + @type sigma_i: float + @param c: The PCS constant (without the interatomic distance and in Angstrom units). + @type c: float + @param r_pivot_atom: The pivot point to atom vector. + @type r_pivot_atom: numpy rank-1, 3D array + @param r_ln_pivot: The lanthanide position to pivot point vector. + @type r_ln_pivot: numpy rank-1, 3D array + @param A: The full alignment tensor of the non-moving domain. + @type A: numpy rank-2, 3D array + @param R_ave: The rotation matrix for rotating from the reference frame to the average position. + @type R_ave: numpy rank-2, 3D array + @param R_eigen: The eigenframe rotation matrix. + @type R_eigen: numpy rank-2, 3D array + @param RT_eigen: The transpose of the eigenframe rotation matrix (for faster calculations). + @type RT_eigen: numpy rank-2, 3D array + @param Ri_prime: The empty rotation matrix for the in-frame rotor motion for state i. + @type Ri_prime: numpy rank-2, 3D array + @param dot_RT_eigen_R_ave: The dot product of RT_eigen and R_ave to speed up this calculation. + @type dot_RT_eigen_R_ave: numpy rank-2, 3D array + @return: The PCS value for the changed position. + @rtype: float """ # The rotation matrix. @@ -1374,8 +1379,7 @@ Ri_prime[1, 1] = c_sigma # The rotation. - #RT_i = dot(R_ave, dot(R_eigen, dot(transpose(Ri_prime), RT_eigen))) - R_i = dot(R_eigen, dot(Ri_prime, dot(RT_eigen, R_ave))) + R_i = dot(R_eigen, dot(Ri_prime, dot_RT_eigen_R_ave)) # Calculate the new vector. vect = dot(R_i, r_pivot_atom) + r_ln_pivot