Author: bugman
Date: Fri Nov 7 14:16:04 2014
New Revision: 26443
URL: http://svn.gna.org/viewcvs/relax?rev=26443&view=rev
Log:
Speed ups and simplifications of the free rotor pseudo-ellipse 2nd degree frame
order matrix equations.
Modified:
branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_free_rotor.py
Modified:
branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_free_rotor.py
URL:
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_free_rotor.py?rev=26443&r1=26442&r2=26443&view=diff
==============================================================================
--- branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_free_rotor.py
(original)
+++ branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_free_rotor.py
Fri Nov 7 14:16:04 2014
@@ -78,20 +78,22 @@
"""
# The surface area normalisation factor.
- fact = 1.0 / (6.0 * pec(theta_x, theta_y))
+ fact3 = 1.0 / (3.0 * pec(theta_x, theta_y))
+ fact4 = 1.0 / (4.0 * pec(theta_x, theta_y))
+ fact6 = 1.0 / (6.0 * pec(theta_x, theta_y))
# Diagonal.
- 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])
- 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]
- 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])
- 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])
+ 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])
+ 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]
+ 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])
+ 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])
# Off diagonal set 1.
matrix[0, 4] = matrix[0, 0]
matrix[4, 0] = matrix[4, 4]
- 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])
- 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])
- 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])
+ 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])
+ 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])
+ 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])
matrix[8, 4] = matrix[8, 0]
# Off diagonal set 2.
@@ -137,8 +139,11 @@
# Theta max.
tmax = tmax_pseudo_ellipse(phi, x, y)
- # The theta-sigma integral.
- return cos(phi)**2*cos(tmax)**3 + 3.0*sin(phi)**2*cos(tmax)
+ # Repetitive trig.
+ cos_tmax = cos(tmax)
+
+ # The theta-sigma integral.
+ return cos(phi)**2 * cos_tmax**3 + 3.0*sin(phi)**2 * cos_tmax
def part_int_daeg2_pseudo_ellipse_free_rotor_08(phi, x, y):
@@ -157,8 +162,11 @@
# Theta max.
tmax = tmax_pseudo_ellipse(phi, x, y)
- # The theta-sigma integral.
- return cos(phi)**2*(2.0*cos(tmax)**3 - 6.0*cos(tmax))
+ # Repetitive trig.
+ cos_tmax = cos(tmax)
+
+ # The theta-sigma integral.
+ return cos(phi)**2 * (cos_tmax**3 - 3.0*cos_tmax)
def part_int_daeg2_pseudo_ellipse_free_rotor_11(phi, x, y):
@@ -197,8 +205,11 @@
# Theta max.
tmax = tmax_pseudo_ellipse(phi, x, y)
- # The theta-sigma integral.
- return sin(phi)**2*cos(tmax)**3 + 3*cos(phi)**2*cos(tmax)
+ # Repetitive trig.
+ cos_tmax = cos(tmax)
+
+ # The theta-sigma integral.
+ return sin(phi)**2 * cos_tmax**3 + 3.0*cos(phi)**2 * cos_tmax
def part_int_daeg2_pseudo_ellipse_free_rotor_48(phi, x, y):
@@ -217,8 +228,11 @@
# Theta max.
tmax = tmax_pseudo_ellipse(phi, x, y)
- # The theta-sigma integral.
- return sin(phi)**2*(2.0*cos(tmax)**3 - 6.0*cos(tmax))
+ # Repetitive trig.
+ cos_tmax = cos(tmax)
+
+ # The theta-sigma integral.
+ return sin(phi)**2 * (cos_tmax**3 - 3.0*cos_tmax)
def part_int_daeg2_pseudo_ellipse_free_rotor_80(phi, x, y):
@@ -237,8 +251,11 @@
# Theta max.
tmax = tmax_pseudo_ellipse(phi, x, y)
- # The theta-sigma integral.
- return cos(tmax)**3 - 3.0*cos(tmax)
+ # Repetitive trig.
+ cos_tmax = cos(tmax)
+
+ # The theta-sigma integral.
+ return cos_tmax**3 - 3.0*cos_tmax
def part_int_daeg2_pseudo_ellipse_free_rotor_88(phi, x, y):
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits