mailr26676 - /branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on November 21, 2014 - 08:58:
Author: bugman
Date: Fri Nov 21 08:58:39 2014
New Revision: 26676

URL: http://svn.gna.org/viewcvs/relax?rev=26676&view=rev
Log:
Huge bug fix for the frame_order.pdb_model user function - the single axis 
direction was incorrect.

In the PDB representation of the frame order motion for the rotor and 
isotropic cone models (rotor,
free rotor, isotropic cone, free rotor isotropic cone, and torsionless 
isotropic cone), the X and Z
axes were swapped.  This is because the eigenframe of the motion was being 
incorrectly constructed
via the lib.geometry.rotations.two_vect_to_R() function.

For better control, the 
specific_analyses.frame_order.geometric.frame_from_axis() function has been
created.  This constructs a full motional eigenframe from the Z-axis.  The 
problem was detected via
the new Frame_order.test_pdb_model_rotor system test.


Modified:
    branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py

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=26676&r1=26675&r2=26676&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py   
  (original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py   
  Fri Nov 21 08:58:39 2014
@@ -25,7 +25,8 @@
 # Python module imports.
 from copy import deepcopy
 from math import pi
-from numpy import array, dot, eye, float64, zeros
+from numpy import array, cross, dot, eye, float64, zeros
+from numpy.linalg import norm
 import sys
 from warnings import warn
 
@@ -33,7 +34,7 @@
 from lib.errors import RelaxFault
 from lib.frame_order.conversions import create_rotor_axis_alpha, 
create_rotor_axis_euler, create_rotor_axis_spherical
 from lib.frame_order.variables import MODEL_DOUBLE_ROTOR, MODEL_FREE_ROTOR, 
MODEL_ISO_CONE, MODEL_ISO_CONE_FREE_ROTOR, MODEL_ISO_CONE_TORSIONLESS, 
MODEL_LIST_DOUBLE, MODEL_LIST_FREE_ROTORS, MODEL_LIST_ISO_CONE, 
MODEL_LIST_PSEUDO_ELLIPSE, MODEL_PSEUDO_ELLIPSE, 
MODEL_PSEUDO_ELLIPSE_FREE_ROTOR, MODEL_PSEUDO_ELLIPSE_TORSIONLESS, MODEL_ROTOR
-from lib.geometry.rotations import euler_to_R_zyz, two_vect_to_R
+from lib.geometry.rotations import euler_to_R_zyz
 from lib.io import open_write_file
 from lib.order import order_parameters
 from lib.structure.cones import Iso_cone, Pseudo_elliptic
@@ -723,6 +724,30 @@
             pdb_file.close()
 
 
+def frame_from_axis(axis, frame):
+    """Build a full 3D frame from the single axis.
+
+    @param axis:    The Z-axis of the system.
+    @type axis:     numpy rank-1, 3D array
+    @param frame:   The empty frame to populate.
+    @type frame:    numpy rank-2, 3D array
+    """
+
+    # Store the Z-axis.
+    frame[:, 2] = axis
+
+    # The temporary eigenframe X-axis.
+    frame[0, 0] = 1.0
+
+    # The Y-axis (orthonormal to Z and X).
+    frame[:, 1] = cross(frame[:, 2], frame[:, 0])
+    frame[:, 1] /= norm(frame[:, 1])
+
+    # The orthonormal X-axis.
+    frame[:, 0] = cross(frame[:, 1], frame[:, 2])
+    frame[:, 0] /= norm(frame[:, 0])
+
+
 def generate_axis_system(sim_index=None):
     """Generate and return the full 3D axis system for the current frame 
order model.
 
@@ -751,7 +776,7 @@
             axis = 
create_rotor_axis_alpha(alpha=cdp.axis_alpha_sim[sim_index], pivot=pivot, 
point=com)
 
         # Create a full normalised axis system.
-        two_vect_to_R(array([1, 0, 0], float64), axis, frame)
+        frame_from_axis(axis, frame)
 
     # The system for the isotropic cones.
     elif cdp.model in MODEL_LIST_ISO_CONE:
@@ -762,7 +787,7 @@
             axis = 
create_rotor_axis_spherical(theta=cdp.axis_theta_sim[sim_index], 
phi=cdp.axis_phi_sim[sim_index])
 
         # Create a full normalised axis system.
-        two_vect_to_R(array([1, 0, 0], float64), axis, frame)
+        frame_from_axis(axis, frame)
 
     # The system for the pseudo-ellipses and double rotor.
     elif cdp.model in MODEL_LIST_PSEUDO_ELLIPSE + MODEL_LIST_DOUBLE:




Related Messages


Powered by MHonArc, Updated Fri Nov 21 09:20:02 2014