mailr9167 - in /branches/frame_order: generic_fns/ maths_fns/ specific_fns/


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

Header


Content

Posted by edward on July 01, 2009 - 13:05:
Author: bugman
Date: Wed Jul  1 13:05:09 2009
New Revision: 9167

URL: http://svn.gna.org/viewcvs/relax?rev=9167&view=rev
Log:
Reverted r9128 to r9133, the elimination of a Euler angle (maybe only 
temporarily).

The command used was:
svn merge -r9134:9127 .  


Modified:
    branches/frame_order/generic_fns/monte_carlo.py
    branches/frame_order/maths_fns/frame_order_matrix_ops.py
    branches/frame_order/maths_fns/frame_order_models.py
    branches/frame_order/specific_fns/frame_order.py

Modified: branches/frame_order/generic_fns/monte_carlo.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order/generic_fns/monte_carlo.py?rev=9167&r1=9166&r2=9167&view=diff
==============================================================================
--- branches/frame_order/generic_fns/monte_carlo.py (original)
+++ branches/frame_order/generic_fns/monte_carlo.py Wed Jul  1 13:05:09 2009
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2004-2005, 2007-2009 Edward d'Auvergne                       
 #
+# Copyright (C) 2004-2005, 2007-2008 Edward d'Auvergne                       
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -51,6 +51,10 @@
     # Test if simulations have been set up.
     if not hasattr(cdp, 'sim_state'):
         raise RelaxError, "Monte Carlo simulations have not been set up."
+
+    # Test if sequence data exists.
+    if not exists_mol_res_spin_data():
+        raise RelaxNoSequenceError
 
     # Test the method argument.
     valid_methods = ['back_calc', 'direct']

Modified: branches/frame_order/maths_fns/frame_order_matrix_ops.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order/maths_fns/frame_order_matrix_ops.py?rev=9167&r1=9166&r2=9167&view=diff
==============================================================================
--- branches/frame_order/maths_fns/frame_order_matrix_ops.py (original)
+++ branches/frame_order/maths_fns/frame_order_matrix_ops.py Wed Jul  1 
13:05:09 2009
@@ -24,46 +24,39 @@
 """Module for the handling of Frame Order."""
 
 # Python module imports.
-from math import cos, sin
-from numpy import cross, dot, transpose
-from numpy.linalg import norm
+from math import cos
+from numpy import dot, transpose
 
 # relax module imports.
-from float import isNaN
 from maths_fns.kronecker_product import kron_prod, transpose_14
-from maths_fns.rotation_matrix import R_2vect
-
-
-def compile_2nd_matrix_iso_cone(matrix, R, z_axis, cone_axis, theta_axis, 
phi_axis, theta_cone):
+from maths_fns.rotation_matrix import R_euler_zyz
+
+
+def compile_2nd_matrix_iso_cone(matrix, R, alpha, beta, gamma, theta):
     """Generate the rotated 2nd degree Frame Order matrix.
 
-    @param matrix:      The Frame Order matrix, 2nd degree to be populated.
-    @type matrix:       numpy 9D, rank-2 array
-    @param R:           The rotation matrix to be populated.
-    @type R:            numpy 3D, rank-2 array
-    @param z_axis:      The molecular frame z-axis from which the cone axis 
is rotated from.
-    @type z_axis:       numpy 3D, rank-1 array
-    @param cone_axis:   The storage structure for the cone axis.
-    @type cone_axis:    numpy 3D, rank-1 array
-    @param theta_axis:  The cone axis polar angle.
-    @type theta_axis:   float
-    @param phi_axis:    The cone axis azimuthal angle.
-    @type phi_axis:     float
-    @param theta_cone:  The cone angle in radians.
-    @type theta_cone:   float
-    """
-
-    # Generate the cone axis from the spherical angles.
-    generate_vector(cone_axis, theta_axis, phi_axis)
+    @param matrix:  The Frame Order matrix, 2nd degree to be populated.
+    @type matrix:   numpy 9D, rank-2 array
+    @param R:       The rotation matrix to be populated.
+    @type R:        numpy 3D, rank-2 array
+    @param alpha:   The alpha Euler angle in radians.
+    @type alpha:    float
+    @param beta:    The beta Euler angle in radians.
+    @type beta:     float
+    @param gamma:   The gamma Euler angle in radians.
+    @type gamma:    float
+    @param theta:   The cone angle in radians.
+    @type theta:    float
+    """
 
     # Generate the rotation matrix.
-    R_2vect(R, z_axis, cone_axis)
+    R_euler_zyz(R, alpha, beta, gamma)
 
     # The outer product of R.
     R_kron = kron_prod(R, R)
 
     # Populate the Frame Order matrix in the eigenframe.
-    populate_2nd_eigenframe_iso_cone(matrix, theta_cone)
+    populate_2nd_eigenframe_iso_cone(matrix, theta)
 
     # Perform the T14 transpose to obtain the Kronecker product matrix!
     matrix = transpose_14(matrix)

Modified: branches/frame_order/maths_fns/frame_order_models.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order/maths_fns/frame_order_models.py?rev=9167&r1=9166&r2=9167&view=diff
==============================================================================
--- branches/frame_order/maths_fns/frame_order_models.py (original)
+++ branches/frame_order/maths_fns/frame_order_models.py Wed Jul  1 13:05:09 
2009
@@ -25,7 +25,7 @@
 
 # Python module imports.
 from copy import deepcopy
-from numpy import array, float64, ones, zeros
+from numpy import float64, ones, zeros
 
 # relax module imports.
 from generic_fns.frame_order import print_frame_order_2nd_degree
@@ -114,10 +114,6 @@
         self.red_errors = red_errors
         self.red_tensors_bc = zeros(self.num_tensors*5, float64)
 
-        # The cone axis storage and molecular frame z-axis.
-        self.cone_axis = zeros(3, float64)
-        self.z_axis = array([0, 0, 1], float64)
-
         # The rotation to the Frame Order eigenframe.
         self.rot = zeros((3, 3), float64)
 
@@ -143,10 +139,6 @@
         # The errors.
         self.errors = ones((9, 9), float64)
 
-        # The cone axis storage and molecular frame z-axis.
-        self.cone_axis = zeros(3, float64)
-        self.z_axis = array([0, 0, 1], float64)
-
         # The rotation.
         self.rot = zeros((3, 3), float64)
 
@@ -160,11 +152,12 @@
     def func_iso_cone(self, params):
         """Target function for isotropic cone model optimisation using the 
alignment tensors.
 
-        This function optimises against alignment tensors.  The cone axis 
spherical angles theta and
-        phi and the cone angle theta are the 3 parameters optimised in this 
model.
-
-        @param params:  The vector of parameter values {theta, phi, 
theta_cone} where the first two
-                        are the polar and azimuthal angles of the cone axis 
theta_cone is the
+        This function optimises against alignment tensors.  The Frame Order 
eigenframe via the
+        alpha, beta, and gamma Euler angles, and the cone angle theta are 
the 4 parameters optimised
+        in this model.
+
+        @param params:  The vector of parameter values {alpha, beta, gamma, 
theta} where the first
+                        three are the Euler angles for the Frame Order 
eigenframe and theta is the
                         isotropic cone angle.
         @type params:   list of float
         @return:        The chi-squared or SSE value.
@@ -172,10 +165,10 @@
         """
 
         # Break up the parameters.
-        theta, phi, theta_cone = params
+        alpha, beta, gamma, theta = params
 
         # Generate the 2nd degree Frame Order super matrix.
-        self.frame_order_2nd = 
compile_2nd_matrix_iso_cone(self.frame_order_2nd, self.rot, self.z_axis, 
self.cone_axis, theta, phi, theta_cone)
+        self.frame_order_2nd = 
compile_2nd_matrix_iso_cone(self.frame_order_2nd, self.rot, alpha, beta, 
gamma, theta)
 
         # Back calculate the reduced tensors.
         for i in range(self.num_tensors):
@@ -189,11 +182,11 @@
         """Target function for isotropic cone model optimisation using the 
Frame Order matrix.
 
         This function optimises by directly matching the elements of the 2nd 
degree Frame Order
-        super matrix.  The cone axis spherical angles theta and phi and the 
cone angle theta are the
-        3 parameters optimised in this model.
-
-        @param params:  The vector of parameter values {theta, phi, 
theta_cone} where the first two
-                        are the polar and azimuthal angles of the cone axis 
theta_cone is the
+        super matrix.  The Frame Order eigenframe via the alpha, beta, and 
gamma Euler angles, and
+        the cone angle theta are the 4 parameters optimised in this model.
+
+        @param params:  The vector of parameter values {alpha, beta, gamma, 
theta} where the first
+                        three are the Euler angles for the Frame Order 
eigenframe and theta is the
                         isotropic cone angle.
         @type params:   list of float
         @return:        The chi-squared or SSE value.
@@ -201,10 +194,10 @@
         """
 
         # Break up the parameters.
-        theta, phi, theta_cone = params
+        alpha, beta, gamma, theta = params
 
         # Generate the 2nd degree Frame Order super matrix.
-        self.frame_order_2nd = 
compile_2nd_matrix_iso_cone(self.frame_order_2nd, self.rot, self.z_axis, 
self.cone_axis, theta, phi, theta_cone)
+        self.frame_order_2nd = 
compile_2nd_matrix_iso_cone(self.frame_order_2nd, self.rot, alpha, beta, 
gamma, theta)
 
         # Make the Frame Order matrix contiguous.
         self.frame_order_2nd = self.frame_order_2nd.copy()

Modified: branches/frame_order/specific_fns/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order/specific_fns/frame_order.py?rev=9167&r1=9166&r2=9167&view=diff
==============================================================================
--- branches/frame_order/specific_fns/frame_order.py (original)
+++ branches/frame_order/specific_fns/frame_order.py Wed Jul  1 13:05:09 2009
@@ -152,17 +152,20 @@
         if cdp.model == 'iso cone':
             # Set up the parameter arrays.
             if not len(cdp.params):
-                cdp.params.append('theta_axis')
-                cdp.params.append('phi_axis')
-                cdp.params.append('theta_cone')
-
-            # Initialise the cone axis angles and cone angle values.
-            if not hasattr(cdp, 'theta_axis'):
-                cdp.theta_axis = 0.0
-            if not hasattr(cdp, 'phi_axis'):
-                cdp.phi_axis = 0.0
-            if not hasattr(cdp, 'theta_cone'):
-                cdp.theta_cone = 0.0
+                cdp.params.append('alpha')
+                cdp.params.append('beta')
+                cdp.params.append('gamma')
+                cdp.params.append('theta')
+
+            # Initialise the Euler angle and cone angle values.
+            if not hasattr(cdp, 'alpha'):
+                cdp.alpha = 0.0
+            if not hasattr(cdp, 'beta'):
+                cdp.beta = 0.0
+            if not hasattr(cdp, 'gamma'):
+                cdp.gamma = 0.0
+            if not hasattr(cdp, 'theta'):
+                cdp.theta = 0.0
 
 
     def __unpack_opt_results(self, results, sim_index=None):
@@ -192,20 +195,21 @@
         # Isotropic cone model.
         if cdp.model == 'iso cone':
             # Disassemble the parameter vector.
-            theta_axis, phi_axis, theta_cone = param_vector
+            alpha, beta, gamma, theta = param_vector
 
             # Wrap the cone angle to be between 0 and pi.
-            if theta_cone < 0.0:
-                theta_cone = -theta_cone
-            if theta_cone > pi:
-                theta_cone = 2.0*pi - theta_cone
+            if theta < 0.0:
+                theta = -theta
+            if theta > pi:
+                theta = 2.0*pi - theta
 
             # Monte Carlo simulation data structures.
             if sim_index != None:
                 # Model parameters.
-                cdp.theta_axis_sim[sim_index] = theta_axis
-                cdp.phi_axis_sim[sim_index] = phi_axis
-                cdp.theta_cone_sim[sim_index] = theta_cone
+                cdp.alpha_sim[sim_index] = alpha
+                cdp.beta_sim[sim_index] = beta
+                cdp.gamma_sim[sim_index] = gamma
+                cdp.theta_sim[sim_index] = theta
 
                 # Optimisation info.
                 cdp.chi2_sim[sim_index] = func
@@ -218,9 +222,10 @@
             # Normal data structures.
             else:
                 # Model parameters.
-                cdp.theta_axis = theta_axis
-                cdp.phi_axis = phi_axis
-                cdp.theta_cone = theta_cone
+                cdp.alpha = alpha
+                cdp.beta = beta
+                cdp.gamma = gamma
+                cdp.theta = theta
 
                 # Optimisation info.
                 cdp.chi2 = func
@@ -509,12 +514,14 @@
 
         # Set the grid search options.
         for i in xrange(n):
-            # Cone axis angles and cone angle.
-            if cdp.params[i] == 'phi_axis':
+            # Euler angles.
+            if cdp.params[i] in ['alpha', 'gamma']:
+                grid_ops.append([inc[i], 0.0, 2*pi])
+            if cdp.params[i] == 'beta':
                 grid_ops.append([inc[i], 0.0, pi])
-            if cdp.params[i] == 'theta_axis':
-                grid_ops.append([inc[i], 0.0, pi])
-            if cdp.params[i] == 'theta_cone':
+
+            # The cone angle.
+            if cdp.params[i] == 'theta':
                 grid_ops.append([inc[i], 0.0, pi])
 
             # Lower bound (if supplied).
@@ -562,8 +569,8 @@
 
         # Isotropic cone model.
         if cdp.model == 'iso cone':
-            # The initial parameter vector (the cone axis angles and the 
cone angle).
-            param_vector = array([cdp.theta_axis, cdp.phi_axis, 
cdp.theta_cone], float64)
+            # The initial parameter vector (the Euler angles and the cone 
angle).
+            param_vector = array([cdp.alpha, cdp.beta, cdp.gamma, 
cdp.theta], float64)
 
             # Get the data structures for optimisation using the tensors as 
base data sets.
             full_tensors, red_tensors, red_tensor_err = 
self.__minimise_setup_tensors(sim_index)




Related Messages


Powered by MHonArc, Updated Wed Jul 01 16:20:03 2009