Author: bugman Date: Tue Jun 17 11:30:47 2014 New Revision: 24017 URL: http://svn.gna.org/viewcvs/relax?rev=24017&view=rev Log: Speed up for the frame order analyses when only one domain is aligned. When only one domain is aligned, the reverse Ln3+ to spin vectors for the PCS are no longer calculated. For most analyses, this should significantly reduce the number of mathematical operations required for the quasi-random Sobol' point numerical integration. Modified: branches/frame_order_cleanup/lib/frame_order/double_rotor.py branches/frame_order_cleanup/lib/frame_order/matrix_ops.py branches/frame_order_cleanup/lib/frame_order/rotor.py branches/frame_order_cleanup/target_functions/frame_order.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=24017&r1=24016&r2=24017&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 17 11:30:47 2014 @@ -176,13 +176,16 @@ @type missing_pcs: numpy rank-2 array """ - # Pre-calculate all the new vectors (forwards and reverse). - rot_vect_rev = dot(r_pivot_atom_rev, Ri) + r_ln_pivot + # Pre-calculate all the new vectors. rot_vect = dot(r_pivot_atom, Ri) + r_ln_pivot # The vector length (to the 5th power). - length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 length = 1.0 / norm(rot_vect, axis=1)**5 + + # The reverse vectors and lengths. + if min(full_in_ref_frame) == 0: + rot_vect_rev = dot(r_pivot_atom_rev, Ri) + r_ln_pivot + length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 # Loop over the atoms. for j in range(len(r_pivot_atom[:, 0])): Modified: branches/frame_order_cleanup/lib/frame_order/matrix_ops.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/matrix_ops.py?rev=24017&r1=24016&r2=24017&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/matrix_ops.py (original) +++ branches/frame_order_cleanup/lib/frame_order/matrix_ops.py Tue Jun 17 11:30:47 2014 @@ -111,13 +111,16 @@ @type missing_pcs: numpy rank-2 array """ - # Pre-calculate all the new vectors (forwards and reverse). - rot_vect_rev = dot(r_pivot_atom_rev, Ri) + r_ln_pivot + # Pre-calculate all the new vectors. rot_vect = dot(r_pivot_atom, Ri) + r_ln_pivot # The vector length (to the 5th power). - length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 length = 1.0 / norm(rot_vect, axis=1)**5 + + # The reverse vectors and lengths. + if min(full_in_ref_frame) == 0: + rot_vect_rev = dot(r_pivot_atom_rev, Ri) + r_ln_pivot + length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 # Loop over the atoms. for j in range(len(r_pivot_atom[:, 0])): @@ -162,13 +165,16 @@ @type missing_pcs: numpy rank-2 array """ - # Pre-calculate all the new vectors (forwards and reverse). - rot_vect_rev = dot(r_pivot_atom_rev, Ri) + r_ln_pivot + # Pre-calculate all the new vectors. rot_vect = dot(r_pivot_atom, Ri) + r_ln_pivot # The vector length (to the 5th power). - length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 length = 1.0 / norm(rot_vect, axis=1)**5 + + # The reverse vectors and lengths. + if min(full_in_ref_frame) == 0: + rot_vect_rev = dot(r_pivot_atom_rev, Ri) + r_ln_pivot + length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 # Loop over the atoms. for j in range(len(r_pivot_atom[:, 0])): 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=24017&r1=24016&r2=24017&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/rotor.py (original) +++ branches/frame_order_cleanup/lib/frame_order/rotor.py Tue Jun 17 11:30:47 2014 @@ -176,13 +176,16 @@ @type missing_pcs: numpy rank-2 array """ - # Pre-calculate all the new vectors (forwards and reverse). - rot_vect_rev = dot(r_pivot_atom_rev, Ri) + r_ln_pivot + # Pre-calculate all the new vectors. rot_vect = dot(r_pivot_atom, Ri) + r_ln_pivot # The vector length (to the 5th power). - length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 length = 1.0 / norm(rot_vect, axis=1)**5 + + # The reverse vectors and lengths. + if min(full_in_ref_frame) == 0: + rot_vect_rev = dot(r_pivot_atom_rev, Ri) + r_ln_pivot + length_rev = 1.0 / norm(rot_vect_rev, axis=1)**5 # Loop over the atoms. for j in range(len(r_pivot_atom[:, 0])): Modified: branches/frame_order_cleanup/target_functions/frame_order.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/target_functions/frame_order.py?rev=24017&r1=24016&r2=24017&view=diff ============================================================================== --- branches/frame_order_cleanup/target_functions/frame_order.py (original) +++ branches/frame_order_cleanup/target_functions/frame_order.py Tue Jun 17 11:30:47 2014 @@ -1159,10 +1159,11 @@ subtract(self.r_pivot_atom, pivot, self.r_pivot_atom) # And the reverse vectors. - self.r_pivot_atom_rev[:] = dot(vect, R_ave) - add(self.r_pivot_atom_rev, self.ave_pos_pivot, self.r_pivot_atom_rev) - add(self.r_pivot_atom_rev, self._translation_vector, self.r_pivot_atom_rev) - subtract(self.r_pivot_atom_rev, pivot, self.r_pivot_atom_rev) + if min(self.full_in_ref_frame) == 0: + self.r_pivot_atom_rev[:] = dot(vect, R_ave) + add(self.r_pivot_atom_rev, self.ave_pos_pivot, self.r_pivot_atom_rev) + add(self.r_pivot_atom_rev, self._translation_vector, self.r_pivot_atom_rev) + subtract(self.r_pivot_atom_rev, pivot, self.r_pivot_atom_rev) def create_sobol_data(self, n=10000, dims=None):