mailr10612 - in /1.3: 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 February 02, 2010 - 00:20:
Author: bugman
Date: Tue Feb  2 00:19:55 2010
New Revision: 10612

URL: http://svn.gna.org/viewcvs/relax?rev=10612&view=rev
Log:
Switched from using a cone angle to using an order parameter in the isotropic 
cone frame order model.


Modified:
    1.3/maths_fns/__init__.py
    1.3/maths_fns/frame_order.py
    1.3/maths_fns/frame_order_matrix_ops.py
    1.3/specific_fns/frame_order.py

Modified: 1.3/maths_fns/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/maths_fns/__init__.py?rev=10612&r1=10611&r2=10612&view=diff
==============================================================================
--- 1.3/maths_fns/__init__.py (original)
+++ 1.3/maths_fns/__init__.py Tue Feb  2 00:19:55 2010
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2005, 2008-2009 Edward d'Auvergne                       
 #
+# Copyright (C) 2003-2005, 2008-2010 Edward d'Auvergne                       
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -37,6 +37,7 @@
             'kronecker_product',
             'mf',
             'n_state_model',
+            'order_parameters',
             'pcs',
             'potential',
             'rdc',

Modified: 1.3/maths_fns/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/maths_fns/frame_order.py?rev=10612&r1=10611&r2=10612&view=diff
==============================================================================
--- 1.3/maths_fns/frame_order.py (original)
+++ 1.3/maths_fns/frame_order.py Tue Feb  2 00:19:55 2010
@@ -227,17 +227,17 @@
 
         This function optimises against alignment tensors.
 
-        @param params:  The vector of parameter values {beta, gamma, theta, 
phi, theta_cone} where the first 2 are the tensor rotation Euler angles, the 
next two are the polar and azimuthal angles of the cone axis theta_cone is 
the isotropic cone angle.
+        @param params:  The vector of parameter values {beta, gamma, theta, 
phi, s1} where the first 2 are the tensor rotation Euler angles, the next two 
are the polar and azimuthal angles of the cone axis, and s1 is the isotropic 
cone order parameter.
         @type params:   list of float
         @return:        The chi-squared or SSE value.
         @rtype:         float
         """
 
         # Unpack the parameters.
-        beta, gamma, theta, phi, theta_cone = params
+        beta, gamma, theta, phi, s1 = 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, self.z_axis, 
self.cone_axis, theta, phi, s1)
 
         # Reduced alignment tensor rotation.
         euler_to_R(0.0, beta, gamma, self.rot)

Modified: 1.3/maths_fns/frame_order_matrix_ops.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/maths_fns/frame_order_matrix_ops.py?rev=10612&r1=10611&r2=10612&view=diff
==============================================================================
--- 1.3/maths_fns/frame_order_matrix_ops.py (original)
+++ 1.3/maths_fns/frame_order_matrix_ops.py Tue Feb  2 00:19:55 2010
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2009 Edward d'Auvergne                                       
 #
+# Copyright (C) 2009-2010 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -30,12 +30,19 @@
 
 # relax module imports.
 from float import isNaN
+from maths_fns import order_parameters
 from maths_fns.kronecker_product import kron_prod, transpose_23
 from maths_fns.rotation_matrix import two_vect_to_R
 
 
-def compile_2nd_matrix_iso_cone(matrix, R, z_axis, cone_axis, theta_axis, 
phi_axis, theta_cone):
+def compile_2nd_matrix_iso_cone(matrix, R, z_axis, cone_axis, theta_axis, 
phi_axis, s1):
     """Generate the rotated 2nd degree Frame Order matrix.
+
+    The cone axis is assumed to be parallel to the z-axis in the eigenframe. 
 In this model, the three order parameters are defined as::
+
+        S1 = S2,
+        S3 = 0
+
 
     @param matrix:      The Frame Order matrix, 2nd degree to be populated.
     @type matrix:       numpy 9D, rank-2 array
@@ -49,8 +56,8 @@
     @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
+    @param s1:          The cone order parameter.
+    @type s1:           float
     """
 
     # Generate the cone axis from the spherical angles.
@@ -63,7 +70,7 @@
     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, s1)
 
     # Perform the T23 transpose to obtain the Kronecker product matrix!
     transpose_23(matrix)
@@ -170,15 +177,19 @@
     matrix[2, 2] = (cos(angle) + 1.0) / 2.0
 
 
-def populate_2nd_eigenframe_iso_cone(matrix, angle):
+def populate_2nd_eigenframe_iso_cone(matrix, s1):
     """Populate the 2nd degree Frame Order matrix in the eigenframe for an 
isotropic cone.
 
-    The cone axis is assumed to be parallel to the z-axis in the eigenframe.
+    The cone axis is assumed to be parallel to the z-axis in the eigenframe. 
 In this model, the three order parameters are defined as::
+
+        S1 = S2,
+        S3 = 0
+
 
     @param matrix:  The Frame Order matrix, 2nd degree.
     @type matrix:   numpy 9D, rank-2 array
-    @param angle:   The cone angle.
-    @type angle:    float
+    @param s1:      The cone order parameter.
+    @type s1:       float
     """
 
     # Zeros.
@@ -186,24 +197,23 @@
         for j in range(9):
             matrix[i, j] = 0.0
 
-    # Trigonometric terms.
-    cos_theta = cos(angle)
-    cos2_theta = cos_theta**2
-
     # The c11^2, c22^2, c12^2, and c21^2 elements.
-    matrix[0, 0] = (4.0 + cos_theta + cos2_theta) / 12.0
+    matrix[0, 0] = (s1 + 1.0) / 3.0
     matrix[4, 4] = matrix[0, 0]
     matrix[1, 1] = matrix[0, 0]
     matrix[3, 3] = matrix[0, 0]
 
     # The c33^2 element.
-    matrix[8, 8] = (1.0 + cos_theta + cos2_theta) / 3.0
+    matrix[8, 8] = (2.0*s1 + 1.0) / 3.0
 
     # The c13^2, c31^2, c23^2, c32^2 elements.
-    matrix[2, 2] = (2.0 + cos_theta)*(1.0 - cos_theta) / 6.0
+    matrix[2, 2] = (1.0 - s1) / 3.0
     matrix[6, 6] = matrix[2, 2]
     matrix[5, 5] = matrix[2, 2]
     matrix[7, 7] = matrix[2, 2]
+
+    # Calculate the cone angle.
+    cos_theta = order_parameters.cos_theta(s1)
 
     # The c11.c22 and c12.c21 elements.
     matrix[0, 4] = matrix[4, 0] = (cos_theta + 1.0) / 4.0

Modified: 1.3/specific_fns/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/frame_order.py?rev=10612&r1=10611&r2=10612&view=diff
==============================================================================
--- 1.3/specific_fns/frame_order.py (original)
+++ 1.3/specific_fns/frame_order.py Tue Feb  2 00:19:55 2010
@@ -40,7 +40,7 @@
 from generic_fns.angles import wrap_angles
 from generic_fns.structure.geometric import cone_edge, generate_vector_dist, 
generate_vector_residues, stitch_cone_to_edge
 from generic_fns.structure.internal import Internal
-from maths_fns import frame_order
+from maths_fns import frame_order, order_parameters
 from maths_fns.frame_order_matrix_ops import generate_vector
 from maths_fns.rotation_matrix import two_vect_to_R
 from relax_errors import RelaxError, RelaxInfError, RelaxNaNError, 
RelaxNoModelError
@@ -73,7 +73,7 @@
 
         # The isotropic cone model initial parameter vector (the cone axis 
angles and the cone angle).
         elif cdp.model == 'iso cone':
-            return array([cdp.beta, cdp.gamma, cdp.theta_axis, cdp.phi_axis, 
cdp.theta_cone], float64)
+            return array([cdp.beta, cdp.gamma, cdp.theta_axis, cdp.phi_axis, 
cdp.s1], float64)
 
 
     def _back_calc(self):
@@ -455,15 +455,15 @@
             if init:
                 cdp.params.append('theta_axis')
                 cdp.params.append('phi_axis')
-                cdp.params.append('theta_cone')
-
-            # Initialise the cone axis angles and cone angle values.
+                cdp.params.append('s1')
+
+            # Initialise the cone axis angles and order parameter 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
+            if not hasattr(cdp, 's1'):
+                cdp.s1 = 0.0
 
 
     def _unpack_opt_results(self, results, sim_index=None):
@@ -501,30 +501,27 @@
         # Isotropic cone model.
         elif cdp.model == 'iso cone':
             # Disassemble the parameter vector.
-            beta, gamma, theta_axis, phi_axis, theta_cone = param_vector
+            beta, gamma, theta_axis, phi_axis, s1 = param_vector
 
             # Alpha is zero in this model!
             alpha = 0.0
 
-            # 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
+            # Calculate the cone angle.
+            cdp.theta_cone = order_parameters.theta_cone(s1)
 
             # 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.s1_sim[sim_index] = s1
 
             # Normal data structures.
             else:
                 # Model parameters.
                 cdp.theta_axis = theta_axis
                 cdp.phi_axis = phi_axis
-                cdp.theta_cone = theta_cone
+                cdp.s1 = s1
 
         # Wrap the Euler angles.
         alpha = wrap_angles(alpha, 0.0, 2.0*pi)
@@ -637,7 +634,7 @@
 
             - 'theta_axis', the cone axis polar angle (for the isotropic 
cone model).
             - 'phi_axis', the cone axis azimuthal angle (for the isotropic 
cone model).
-            - 'theta_cone', the isotropic cone angle.
+            - 's1', the isotropic cone order parameter.
 
 
         @keyword set:           The set of object names to return.  This can 
be set to 'all' for all
@@ -672,7 +669,7 @@
                 # Angular cone parameters.
                 names.append('theta_axis')
                 names.append('phi_axis')
-                names.append('theta_cone')
+                names.append('s1')
 
             # All other models.
             else:
@@ -700,7 +697,7 @@
                 # Angular cone parameters.
                 names.append('theta_axis_err')
                 names.append('phi_axis_err')
-                names.append('theta_cone_err')
+                names.append('s1_err')
 
             # All other models.
             else:
@@ -719,7 +716,7 @@
                 # Angular cone parameters.
                 names.append('theta_axis_sim')
                 names.append('phi_axis_sim')
-                names.append('theta_cone_sim')
+                names.append('s1_sim')
 
             # All other models.
             else:
@@ -841,12 +838,12 @@
                         lower.append(0.0)
                         upper.append(2*pi * (1.0 - 1.0/incs[i]))
 
-                # The cone angle.
-                if cdp.params[i] == 'theta_cone':
+                # The cone order parameter.
+                if cdp.params[i] == 's1':
                     # Set the default bounds.
                     if default_bounds:
-                        lower.append(0.0)
-                        upper.append(pi)
+                        lower.append(-0.5)
+                        upper.append(1.0)
 
             # Get the grid row.
             if not row:
@@ -1048,9 +1045,9 @@
         if search('phi[ -_]axis', param):
             return 'phi_axis'
 
-        # Cone angle.
-        if search('theta[ -_]cone', param):
-            return 'theta_cone'
+        # Cone order parameter.
+        if search('[Ss]1', param):
+            return 's1'
 
 
     def return_error(self, spin_id):




Related Messages


Powered by MHonArc, Updated Tue Feb 02 15:40:03 2010