mailr18618 - in /branches/frame_order_testing: maths_fns/frame_order/__init__.py specific_fns/frame_order.py


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

Header


Content

Posted by edward on March 04, 2013 - 16:30:
Author: bugman
Date: Mon Mar  4 16:30:23 2013
New Revision: 18618

URL: http://svn.gna.org/viewcvs/relax?rev=18618&view=rev
Log:
The atomic positions for the PCS are now rotated about a centroid for the 
frame order analysis.

This is for determining the average domain position.  The centroid is 
currently set to the CoM.
Previously the rotation was about the pivot of the motion, but this does not 
make sense if the
starting structure is not in the correct position.


Modified:
    branches/frame_order_testing/maths_fns/frame_order/__init__.py
    branches/frame_order_testing/specific_fns/frame_order.py

Modified: branches/frame_order_testing/maths_fns/frame_order/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/maths_fns/frame_order/__init__.py?rev=18618&r1=18617&r2=18618&view=diff
==============================================================================
--- branches/frame_order_testing/maths_fns/frame_order/__init__.py (original)
+++ branches/frame_order_testing/maths_fns/frame_order/__init__.py Mon Mar  4 
16:30:23 2013
@@ -62,7 +62,7 @@
 class Frame_order:
     """Class containing the target function of the optimisation of Frame 
Order matrix components."""
 
-    def __init__(self, model=None, init_params=None, full_tensors=None, 
full_in_ref_frame=None, rdcs=None, rdc_errors=None, rdc_weights=None, 
rdc_vect=None, dip_const=None, pcs=None, pcs_errors=None, pcs_weights=None, 
atomic_pos=None, temp=None, frq=None, paramag_centre=zeros(3), 
scaling_matrix=None, num_int_pts=500, translation_opt=False, pivot=zeros(3), 
pivot_opt=False, quad_int=True):
+    def __init__(self, model=None, init_params=None, full_tensors=None, 
full_in_ref_frame=None, rdcs=None, rdc_errors=None, rdc_weights=None, 
rdc_vect=None, dip_const=None, pcs=None, pcs_errors=None, pcs_weights=None, 
atomic_pos=None, temp=None, frq=None, paramag_centre=zeros(3), 
scaling_matrix=None, num_int_pts=500, centroid=zeros(3), 
translation_opt=False, pivot=zeros(3), pivot_opt=False, quad_int=True):
         """Set up the target functions for the Frame Order theories.
 
         @keyword model:             The name of the Frame Order model.
@@ -101,6 +101,8 @@
         @type scaling_matrix:       numpy rank-2 array
         @keyword num_int_pts:       The number of points to use for the 
numerical integration technique.
         @type num_int_pts:          int
+        @keyword centroid:          The central position to rotate all atoms 
about.  For example this can be the centre of mass of the moving domain.
+        @type centroid:             numpy 3D rank-1 array
         @keyword translation_opt:   A flag which if True will allow the 
pivot point of the motion to be optimised.
         @type translation_opt:      bool
         @keyword pivot:             The pivot point for the ball-and-socket 
joint motion.  This is needed if PCS or PRE values are used.
@@ -134,6 +136,7 @@
         self.paramag_centre = paramag_centre
         self.total_num_params = len(init_params)
         self.num_int_pts = num_int_pts
+        self.centroid = centroid
         self.translation_opt = translation_opt
         self._param_pivot = pivot
         self.pivot_opt = pivot_opt
@@ -1934,16 +1937,19 @@
         return chi2_sum
 
 
-    def calc_vectors(self, pivot, R_ave, RT_ave):
+    def calc_vectors(self, pivot=None, R_ave=None, RT_ave=None):
         """Calculate the pivot to atom and lanthanide to pivot vectors for 
the target functions.
 
-        @param pivot:   The pivot point.
-        @type pivot:    numpy rank-1, 3D array
-        @param R_ave:   The rotation matrix for rotating from the reference 
frame to the average position.
-        @type R_ave:    numpy rank-2, 3D array
-        @param RT_ave:  The transpose of R_ave.
-        @type RT_ave:   numpy rank-2, 3D array
-        """
+        @keyword pivot:     The pivot point.
+        @type pivot:        numpy rank-1, 3D array
+        @keyword R_ave:     The rotation matrix for rotating from the 
reference frame to the average position.
+        @type R_ave:        numpy rank-2, 3D array
+        @keyword RT_ave:    The transpose of R_ave.
+        @type RT_ave:       numpy rank-2, 3D array
+        """
+
+        # Centroid translation.
+        centroid = self.centroid + self._translation_vector
 
         # The pivot to atom vectors.
         for j in range(self.num_spins):
@@ -1951,9 +1957,13 @@
             if self.pivot_opt:
                 self.r_ln_pivot[:, j] = pivot - self.paramag_centre
 
-            # The rotated and translated vectors.
-            self.r_pivot_atom[:, j] = dot(R_ave, self.atomic_pos[j] + 
self._translation_vector - pivot)
-            self.r_pivot_atom_rev[:, j] = dot(RT_ave, self.atomic_pos[j] + 
self._translation_vector - pivot)
+            # Rotate then translate the atomic positions, then calculate the 
pivot to atom vector.
+            self.r_pivot_atom[:, j] = dot(R_ave, self.atomic_pos[j] - 
centroid) + centroid
+            self.r_pivot_atom[:, j] += self._translation_vector
+            self.r_pivot_atom[:, j] -= pivot
+            self.r_pivot_atom_rev[:, j] = dot(RT_ave, self.atomic_pos[j] - 
centroid) + centroid
+            self.r_pivot_atom_rev[:, j] += self._translation_vector
+            self.r_pivot_atom_rev[:, j] -= pivot
 
 
     def create_sobol_data(self, n=10000, dims=None):

Modified: branches/frame_order_testing/specific_fns/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/frame_order.py?rev=18618&r1=18617&r2=18618&view=diff
==============================================================================
--- branches/frame_order_testing/specific_fns/frame_order.py (original)
+++ branches/frame_order_testing/specific_fns/frame_order.py Mon Mar  4 
16:30:23 2013
@@ -42,6 +42,7 @@
 from generic_fns.mol_res_spin import return_spin, spin_loop
 from generic_fns.structure import geometric
 from generic_fns.structure.cones import Iso_cone, Pseudo_elliptic
+from generic_fns.structure.mass import centre_of_mass
 from generic_fns.structure.internal import Internal
 from maths_fns import frame_order, order_parameters
 from maths_fns.coord_transform import spherical_to_cartesian
@@ -1396,9 +1397,12 @@
             raise RelaxNoRDCError
 
         # Get the atomic_positions.
-        atomic_pos, paramag_centre, centre_fixed = None, None, True
+        atomic_pos, paramag_centre = None, None
         if 'pcs' in data_types or 'pre' in data_types:
             atomic_pos, paramag_centre = 
self._minimise_setup_atomic_pos(sim_index=sim_index)
+
+        # The centre of mass of the moving domain - to use as the centroid 
for the average domain position rotation.
+        com = centre_of_mass(atom_id=self._domain_moving(), verbosity=0)
 
         # Average domain translation.
         translation_opt = False
@@ -1434,7 +1438,7 @@
             sys.stdout.write("Base data: %s\n" % repr(base_data))
 
         # Set up the optimisation function.
-        target = frame_order.Frame_order(model=cdp.model, 
init_params=param_vector, full_tensors=full_tensors, 
full_in_ref_frame=full_in_ref_frame, rdcs=rdcs, rdc_errors=rdc_err, 
rdc_weights=rdc_weight, rdc_vect=rdc_vect, dip_const=rdc_const, pcs=pcs, 
pcs_errors=pcs_err, pcs_weights=pcs_weight, atomic_pos=atomic_pos, temp=temp, 
frq=frq, paramag_centre=paramag_centre, scaling_matrix=scaling_matrix, 
translation_opt=translation_opt, pivot=pivot, pivot_opt=pivot_opt, 
num_int_pts=cdp.num_int_pts, quad_int=cdp.quad_int)
+        target = frame_order.Frame_order(model=cdp.model, 
init_params=param_vector, full_tensors=full_tensors, 
full_in_ref_frame=full_in_ref_frame, rdcs=rdcs, rdc_errors=rdc_err, 
rdc_weights=rdc_weight, rdc_vect=rdc_vect, dip_const=rdc_const, pcs=pcs, 
pcs_errors=pcs_err, pcs_weights=pcs_weight, atomic_pos=atomic_pos, temp=temp, 
frq=frq, paramag_centre=paramag_centre, scaling_matrix=scaling_matrix, 
centroid=com, translation_opt=translation_opt, pivot=pivot, 
pivot_opt=pivot_opt, num_int_pts=cdp.num_int_pts, quad_int=cdp.quad_int)
 
         # Return the data.
         return target, param_vector, data_types, scaling_matrix




Related Messages


Powered by MHonArc, Updated Mon Mar 04 16:40:01 2013