Author: bugman Date: Mon Jul 28 15:48:50 2014 New Revision: 24784 URL: http://svn.gna.org/viewcvs/relax?rev=24784&view=rev Log: Renamed the lib.frame_order.rotor_axis module to lib.frame_order.conversions. This module will be used for all sorts of frame order parameter conversions. Added: branches/frame_order_cleanup/lib/frame_order/conversions.py - copied unchanged from r24783, branches/frame_order_cleanup/lib/frame_order/rotor_axis.py Removed: branches/frame_order_cleanup/lib/frame_order/rotor_axis.py Modified: branches/frame_order_cleanup/lib/frame_order/__init__.py branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py branches/frame_order_cleanup/target_functions/frame_order.py Modified: branches/frame_order_cleanup/lib/frame_order/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/__init__.py?rev=24784&r1=24783&r2=24784&view=diff ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/__init__.py (original) +++ branches/frame_order_cleanup/lib/frame_order/__init__.py Mon Jul 28 15:48:50 2014 @@ -23,6 +23,7 @@ """The relax-lib NMR package - a library of functions for the frame order theories.""" __all__ = [ + 'conversions', 'double_rotor', 'format', 'free_rotor', @@ -33,6 +34,5 @@ 'pseudo_ellipse_free_rotor', 'pseudo_ellipse', 'pseudo_ellipse_torsionless', - 'rotor', - 'rotor_axis' + 'rotor' ] Removed: branches/frame_order_cleanup/lib/frame_order/rotor_axis.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/lib/frame_order/rotor_axis.py?rev=24783&view=auto ============================================================================== --- branches/frame_order_cleanup/lib/frame_order/rotor_axis.py (original) +++ branches/frame_order_cleanup/lib/frame_order/rotor_axis.py (removed) @@ -1,131 +0,0 @@ -############################################################################### -# # -# Copyright (C) 2014 Edward d'Auvergne # -# # -# This file is part of the program relax (http://www.nmr-relax.com). # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -# # -############################################################################### - -# Module docstring. -"""Functions for creating or calculating the rotor axis for the frame order models.""" - -# Python module imports. -from numpy import array, cross, dot, float64, zeros -from numpy.linalg import norm - -# relax module imports. -from lib.geometry.coord_transform import cartesian_to_spherical, spherical_to_cartesian -from lib.geometry.rotations import axis_angle_to_R, euler_to_R_zyz - -# Module variables. -R = zeros((3, 3), float64) # A rotation matrix. -Z_AXIS = array([0, 0, 1], float64) - - -def convert_axis_alpha_to_spherical(alpha=None, pivot=None, point=None): - """Convert the axis alpha angle to spherical angles theta and phi. - - @keyword alpha: The axis alpha angle, defined as the angle between a vector perpendicular to the pivot-CoM vector in the xy-plane and the rotor axis. - @type alpha: float - @keyword pivot: The pivot point on the rotation axis. - @type pivot: numpy rank-1 3D array - @keyword point: The reference point in space. - @type point: numpy rank-1 3D array - @return: The theta and phi spherical angles. - @rtype: float, float - """ - - # Create the axis. - axis = create_rotor_axis_alpha(alpha=alpha, pivot=pivot, point=point) - - # Coordinate system transform. - r, theta, phi = cartesian_to_spherical(axis) - - # Return the angles. - return theta, phi - - -def create_rotor_axis_alpha(alpha=None, pivot=None, point=None): - """Create the rotor axis from the axis alpha angle. - - @keyword alpha: The axis alpha angle, defined as the angle between a vector perpendicular to the pivot-CoM vector in the xy-plane and the rotor axis. - @type alpha: float - @keyword pivot: The pivot point on the rotation axis. - @type pivot: numpy rank-1 3D array - @keyword point: The reference point in space. - @type point: numpy rank-1 3D array - @return: The rotor axis as a unit vector. - @rtype: numpy rank-1 3D float64 array - """ - - # The CoM-pivot unit vector - the norm of the system (the pivot is defined as the point on the axis closest to the point). - n = point - pivot - n /= norm(n) - - # The vector perpendicular to the CoM-pivot vector and in the xy plane. - mu_xy = cross(Z_AXIS, n) - mu_xy /= norm(mu_xy) - - # Rotate the vector about the CoM-pivot axis by the angle alpha. - axis_angle_to_R(n, alpha, R) - axis = dot(R, mu_xy) - - # Return the new axis. - return axis - - -def create_rotor_axis_euler(alpha=None, beta=None, gamma=None): - """Create the rotor axis from the Euler angles. - - @keyword alpha: The alpha Euler angle in the zyz notation. - @type alpha: float - @keyword beta: The beta Euler angle in the zyz notation. - @type beta: float - @keyword gamma: The gamma Euler angle in the zyz notation. - @type gamma: float - @return: The rotor axis as a unit vector. - @rtype: numpy rank-1 3D float64 array - """ - - # Initialise the 3D frame. - frame = zeros((3, 3), float64) - - # Euler angle to rotation matrix conversion. - euler_to_R_zyz(alpha, beta, gamma, frame) - - # Return the z-axis component. - return frame[:, 2] - - -def create_rotor_axis_spherical(theta=None, phi=None): - """Create the rotor axis from the spherical coordinates. - - @keyword theta: The polar spherical angle. - @type theta: float - @keyword phi: The azimuthal spherical angle. - @type phi: float - @return: The rotor axis as a unit vector. - @rtype: numpy rank-1 3D float64 array - """ - - # Initialise the axis. - axis = zeros(3, float64) - - # Parameter conversion. - spherical_to_cartesian([1.0, theta, phi], axis) - - # Return the new axis. - return axis Modified: branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py?rev=24784&r1=24783&r2=24784&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py Mon Jul 28 15:48:50 2014 @@ -29,7 +29,7 @@ import sys # relax module imports. -from lib.frame_order.rotor_axis import create_rotor_axis_alpha, create_rotor_axis_euler, create_rotor_axis_spherical +from lib.frame_order.conversions import create_rotor_axis_alpha, create_rotor_axis_euler, create_rotor_axis_spherical from lib.geometry.rotations import euler_to_R_zyz, two_vect_to_R from lib.io import open_write_file from lib.order import order_parameters 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=24784&r1=24783&r2=24784&view=diff ============================================================================== --- branches/frame_order_cleanup/target_functions/frame_order.py (original) +++ branches/frame_order_cleanup/target_functions/frame_order.py Mon Jul 28 15:48:50 2014 @@ -35,6 +35,7 @@ from lib.compat import norm from lib.errors import RelaxError from lib.float import isNaN +from lib.frame_order.conversions import create_rotor_axis_alpha from lib.frame_order.double_rotor import compile_2nd_matrix_double_rotor, pcs_numeric_int_double_rotor from lib.frame_order.free_rotor import compile_2nd_matrix_free_rotor from lib.frame_order.iso_cone import compile_2nd_matrix_iso_cone, pcs_numeric_int_iso_cone_qrint @@ -45,7 +46,6 @@ from lib.frame_order.pseudo_ellipse_free_rotor import compile_2nd_matrix_pseudo_ellipse_free_rotor from lib.frame_order.pseudo_ellipse_torsionless import compile_2nd_matrix_pseudo_ellipse_torsionless, pcs_numeric_int_pseudo_ellipse_torsionless_qrint from lib.frame_order.rotor import compile_2nd_matrix_rotor, pcs_numeric_int_rotor_qrint -from lib.frame_order.rotor_axis import create_rotor_axis_alpha from lib.geometry.coord_transform import spherical_to_cartesian from lib.geometry.rotations import euler_to_R_zyz, tilt_torsion_to_R, two_vect_to_R from lib.linear_algebra.kronecker_product import kron_prod