Author: bugman Date: Fri Mar 21 09:39:33 2014 New Revision: 22515 URL: http://svn.gna.org/viewcvs/relax?rev=22515&view=rev Log: The CaM frame order system tests for the rotor models are converted to the new axis_alpha parameter. The axis_theta and axis_phi spherical coordinates are converted to the new reduced parameter set defined by a random point in space (the CoM of all atoms), the pivot point, and a single angle alpha. Modified: branches/double_rotor/test_suite/system_tests/scripts/frame_order/cam/base_script.py Modified: branches/double_rotor/test_suite/system_tests/scripts/frame_order/cam/base_script.py URL: http://svn.gna.org/viewcvs/relax/branches/double_rotor/test_suite/system_tests/scripts/frame_order/cam/base_script.py?rev=22515&r1=22514&r2=22515&view=diff ============================================================================== --- branches/double_rotor/test_suite/system_tests/scripts/frame_order/cam/base_script.py (original) +++ branches/double_rotor/test_suite/system_tests/scripts/frame_order/cam/base_script.py Fri Mar 21 09:39:33 2014 @@ -23,11 +23,13 @@ """Base script for the optimisation of the rigid frame order test models.""" # Python module imports. -from numpy import array, float32, float64, transpose, zeros +from numpy import arccos, array, cross, dot, float32, float64, transpose, zeros +from numpy.linalg import norm from os import F_OK, access, sep # relax module imports. from data_store import Relax_data_store; ds = Relax_data_store() +from lib.geometry.coord_transform import spherical_to_cartesian from lib.geometry.rotations import euler_to_R_zyz, reverse_euler_zyz from status import Status; status = Status() @@ -71,9 +73,16 @@ PIVOT = array([ 37.254, 0.5, 16.7465], float32) PIVOT2 = None + # The CoM - for use in the rotor models. + COM = array([44.737253525507697, -1.1684805963699558, 14.072436716990133], float32) + def __init__(self, exec_fn): """Execute the frame order analysis.""" + + # Parameter conversions. + if self.AXIS_THETA != None and self.AXIS_ALPHA == None: + self.AXIS_ALPHA = self.convert_rotor(theta=self.AXIS_THETA, phi=self.AXIS_PHI, pivot=self.PIVOT, com=self.COM) # Alias the user function executor method. self._execute_uf = exec_fn @@ -103,6 +112,41 @@ # Save the state. self._execute_uf(uf_name='state.save', state='devnull', force=True) + + + def convert_rotor(self, theta=None, phi=None, pivot=None, com=None): + """Convert the rotor axis spherical angles to the axis alpha notation. + + @keyword theta: The polar spherical angle. + @type theta: float + @keyword phi: The azimuthal spherical angle. + @type phi: float + @keyword pivot: The pivot point on the rotation axis. + @type pivot: numpy rank-1 3D array + @keyword com: The pivot point on the rotation axis. + @type com: numpy rank-1 3D array + @return: The axis alpha angle for the system. + @rtype: float + """ + + # The CoM-pivot unit vector. + com_piv = pivot - com + com_piv = com_piv / norm(com_piv) + + # The vector perpendicular to the CoM-pivot vector. + z_axis = array([0, 0, 1], float64) + perp_vect = cross(com_piv, z_axis) + perp_vect = perp_vect / norm(perp_vect) + + # The axis. + axis = zeros(3, float64) + spherical_to_cartesian([1.0, theta, phi], axis) + + # The alpha angle (the angle between the perpendicular vector and the axis). + alpha = arccos(dot(perp_vect, axis)) + + # Return the axis alpha angle. + return alpha def optimisation(self):