Author: bugman Date: Tue Jun 3 09:16:09 2014 New Revision: 23615 URL: http://svn.gna.org/viewcvs/relax?rev=23615&view=rev Log: Proper edge case handling and slight speed up of the frame order PCS integration functions. The case whereby no Sobol' points in the numerical integration lie within the motional distribution is now caught and the rotation matrix set to the motional eigenframe to simulate the rigid state. As the code for averaging the PCS was changed, it was also simplified by removing an unnecessary loop over all spins. This should speed up the PCS integration by a tiny amount. Modified: branches/frame_order_cleanup/lib/frame_order/double_rotor.py branches/frame_order_cleanup/lib/frame_order/iso_cone.py branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py branches/frame_order_cleanup/lib/frame_order/rotor.py Modified: branches/frame_order_cleanup/lib/frame_order/double_rotor.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/double_rotor.py?rev=23615&r1=23614&r2=23615&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/double_rotor.py (original) +++ branches/frame_order_cleanup/lib/frame_order/double_rotor.py Tue Jun 3 09:16:09 2014 @@ -129,11 +129,14 @@ # Increment the number of points. num += 1 - # Calculate the PCS and error. - for i in range(len(pcs_theta)): - for j in range(len(pcs_theta[i])): - # The average PCS. - pcs_theta[i, j] = c[i] * pcs_theta[i, j] / float(num) + # Default to the rigid state if no points lie in the distribution. + if num == 0: + pcs_pivot_motion_double_rotor(full_in_ref_frame=full_in_ref_frame, r_pivot_atom=r_pivot_atom, r_pivot_atom_rev=r_pivot_atom_rev, r_ln_pivot=r_ln_pivot, A=A, R_eigen=R_eigen, RT_eigen=RT_eigen, Ri_prime=R_eigen, pcs_theta=pcs_theta, pcs_theta_err=pcs_theta_err, missing_pcs=missing_pcs) + + # Average the PCS. + else: + for i in range(len(pcs_theta)): + pcs_theta[i] = c[i] * pcs_theta[i] / float(num) def pcs_pivot_motion_double_rotor(full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): Modified: branches/frame_order_cleanup/lib/frame_order/iso_cone.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/iso_cone.py?rev=23615&r1=23614&r2=23615&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/iso_cone.py (original) +++ branches/frame_order_cleanup/lib/frame_order/iso_cone.py Tue Jun 3 09:16:09 2014 @@ -109,11 +109,14 @@ # Increment the number of points. num += 1 - # Calculate the PCS and error. - for i in range(len(pcs_theta)): - for j in range(len(pcs_theta[i])): - # The average PCS. - pcs_theta[i, j] = c[i] * pcs_theta[i, j] / float(num) + # Default to the rigid state if no points lie in the distribution. + if num == 0: + pcs_pivot_motion_full_qrint(full_in_ref_frame=full_in_ref_frame, r_pivot_atom=r_pivot_atom, r_pivot_atom_rev=r_pivot_atom_rev, r_ln_pivot=r_ln_pivot, A=A, R_eigen=R_eigen, RT_eigen=RT_eigen, Ri_prime=R_eigen, pcs_theta=pcs_theta, pcs_theta_err=pcs_theta_err, missing_pcs=missing_pcs) + + # Average the PCS. + else: + for i in range(len(pcs_theta)): + pcs_theta[i] = c[i] * pcs_theta[i] / float(num) def populate_1st_eigenframe_iso_cone(matrix, angle): Modified: branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py?rev=23615&r1=23614&r2=23615&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py (original) +++ branches/frame_order_cleanup/lib/frame_order/iso_cone_torsionless.py Tue Jun 3 09:16:09 2014 @@ -128,8 +128,11 @@ # Increment the number of points. num += 1 - # Calculate the PCS and error. - for i in range(len(pcs_theta)): - for j in range(len(pcs_theta[i])): - # The average PCS. - pcs_theta[i, j] = c[i] * pcs_theta[i, j] / float(num) + # Default to the rigid state if no points lie in the distribution. + if num == 0: + pcs_pivot_motion_torsionless_qrint(full_in_ref_frame=full_in_ref_frame, r_pivot_atom=r_pivot_atom, r_pivot_atom_rev=r_pivot_atom_rev, r_ln_pivot=r_ln_pivot, A=A, R_eigen=R_eigen, RT_eigen=RT_eigen, Ri_prime=R_eigen, pcs_theta=pcs_theta, pcs_theta_err=pcs_theta_err, missing_pcs=missing_pcs) + + # Average the PCS. + else: + for i in range(len(pcs_theta)): + pcs_theta[i] = c[i] * pcs_theta[i] / float(num) Modified: branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py?rev=23615&r1=23614&r2=23615&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py (original) +++ branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse.py Tue Jun 3 09:16:09 2014 @@ -653,11 +653,14 @@ # Increment the number of points. num += 1 - # Calculate the PCS and error. - for i in range(len(pcs_theta)): - for j in range(len(pcs_theta[i])): - # The average PCS. - pcs_theta[i, j] = c[i] * pcs_theta[i, j] / float(num) + # Default to the rigid state if no points lie in the distribution. + if num == 0: + pcs_pivot_motion_full_qrint(full_in_ref_frame=full_in_ref_frame, r_pivot_atom=r_pivot_atom, r_pivot_atom_rev=r_pivot_atom_rev, r_ln_pivot=r_ln_pivot, A=A, R_eigen=R_eigen, RT_eigen=RT_eigen, Ri_prime=R_eigen, pcs_theta=pcs_theta, pcs_theta_err=pcs_theta_err, missing_pcs=missing_pcs) + + # Average the PCS. + else: + for i in range(len(pcs_theta)): + pcs_theta[i] = c[i] * pcs_theta[i] / float(num) def tmax_pseudo_ellipse(phi, theta_x, theta_y): Modified: branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py?rev=23615&r1=23614&r2=23615&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py (original) +++ branches/frame_order_cleanup/lib/frame_order/pseudo_ellipse_torsionless.py Tue Jun 3 09:16:09 2014 @@ -314,8 +314,11 @@ # Increment the number of points. num += 1 - # Calculate the PCS and error. - for i in range(len(pcs_theta)): - for j in range(len(pcs_theta[i])): - # The average PCS. - pcs_theta[i, j] = c[i] * pcs_theta[i, j] / float(num) + # Default to the rigid state if no points lie in the distribution. + if num == 0: + pcs_pivot_motion_torsionless_qrint(full_in_ref_frame=full_in_ref_frame, r_pivot_atom=r_pivot_atom, r_pivot_atom_rev=r_pivot_atom_rev, r_ln_pivot=r_ln_pivot, A=A, R_eigen=R_eigen, RT_eigen=RT_eigen, Ri_prime=R_eigen, pcs_theta=pcs_theta, pcs_theta_err=pcs_theta_err, missing_pcs=missing_pcs) + + # Average the PCS. + else: + for i in range(len(pcs_theta)): + pcs_theta[i] = c[i] * pcs_theta[i] / float(num) Modified: branches/frame_order_cleanup/lib/frame_order/rotor.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/rotor.py?rev=23615&r1=23614&r2=23615&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/rotor.py (original) +++ branches/frame_order_cleanup/lib/frame_order/rotor.py Tue Jun 3 09:16:09 2014 @@ -130,14 +130,14 @@ # Increment the number of points. num += 1 - # Calculate the PCS and error. - for i in range(len(pcs_theta)): - for j in range(len(pcs_theta[i])): - if num == 0: - continue + # Default to the rigid state if no points lie in the distribution. + if num == 0: + pcs_pivot_motion_rotor_qrint(full_in_ref_frame=full_in_ref_frame, r_pivot_atom=r_pivot_atom, r_pivot_atom_rev=r_pivot_atom_rev, r_ln_pivot=r_ln_pivot, A=A, R_eigen=R_eigen, RT_eigen=RT_eigen, Ri_prime=R_eigen, pcs_theta=pcs_theta, pcs_theta_err=pcs_theta_err, missing_pcs=missing_pcs) - # The average PCS. - pcs_theta[i, j] = c[i] * pcs_theta[i, j] / float(num) + # Average the PCS. + else: + for i in range(len(pcs_theta)): + pcs_theta[i] = c[i] * pcs_theta[i] / float(num) def pcs_pivot_motion_rotor_qrint(full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None):