mailr14918 - in /1.3: generic_fns/structure/ prompt/


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

Header


Content

Posted by edward on October 26, 2011 - 10:25:
Author: bugman
Date: Wed Oct 26 10:25:23 2011
New Revision: 14918

URL: http://svn.gna.org/viewcvs/relax?rev=14918&view=rev
Log:
Added the centroid arg to the structure.displacement user function for 
pivoted motions.

By specifying the centroid position for all structures, a pivoted motion is 
assumed.  All
displacements will be zero, and the angles will be that of the pivoting 
motion.


Modified:
    1.3/generic_fns/structure/api_base.py
    1.3/generic_fns/structure/internal.py
    1.3/generic_fns/structure/main.py
    1.3/prompt/structure.py

Modified: 1.3/generic_fns/structure/api_base.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/api_base.py?rev=14918&r1=14917&r2=14918&view=diff
==============================================================================
--- 1.3/generic_fns/structure/api_base.py (original)
+++ 1.3/generic_fns/structure/api_base.py Wed Oct 26 10:25:23 2011
@@ -909,7 +909,7 @@
         return R
 
 
-    def _calculate(self, model_from=None, model_to=None, coord_from=None, 
coord_to=None):
+    def _calculate(self, model_from=None, model_to=None, coord_from=None, 
coord_to=None, centroid=None):
         """Calculate the rotational and translational displacements using 
the given coordinate sets.
 
         This uses the Kabsch algorithm 
(http://en.wikipedia.org/wiki/Kabsch_algorithm).
@@ -923,11 +923,17 @@
         @type coord_from:       numpy rank-2, Nx3 array
         @keyword coord_to:      The list of atomic coordinates for the 
ending structure.
         @type coord_to:         numpy rank-2, Nx3 array
+        @keyword centroid:      An alternative position of the centroid, 
used for studying pivoted systems.
+        @type centroid:         list of float or numpy rank-1, 3D array
         """
 
         # Calculate the centroids.
-        centroid_from = self._calc_centriod(coord_from)
-        centroid_to = self._calc_centriod(coord_to)
+        if centroid != None:
+            centroid_from = centroid
+            centroid_to = centroid
+        else:
+            centroid_from = self._calc_centriod(coord_from)
+            centroid_to = self._calc_centriod(coord_to)
 
         # The translation.
         trans_vect = centroid_to - centroid_from

Modified: 1.3/generic_fns/structure/internal.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/internal.py?rev=14918&r1=14917&r2=14918&view=diff
==============================================================================
--- 1.3/generic_fns/structure/internal.py (original)
+++ 1.3/generic_fns/structure/internal.py Wed Oct 26 10:25:23 2011
@@ -781,7 +781,7 @@
         return data
 
 
-    def calc_displacement(self, model_from=None, model_to=None, 
atom_id=None):
+    def calc_displacement(self, model_from=None, model_to=None, 
atom_id=None, centroid=None):
         """Calculate the rotational and translational displacement between 
two structural models.
 
         @keyword model_from:        The optional model number for the 
starting position of the displacement.
@@ -790,6 +790,8 @@
         @type model_to:             int or None
         @keyword atom_id:           The molecule, residue, and atom 
identifier string.  This matches the spin ID string format.
         @type atom_id:              str or None
+        @keyword centroid:          An alternative position of the centroid, 
used for studying pivoted systems.
+        @type centroid:             list of float or numpy rank-1, 3D array
         """
 
         # Convert the model_from and model_to args to lists, is supplied.
@@ -828,7 +830,7 @@
                     coord_to.append(pos[0])
 
                 # Send to the base container for the calculations.
-                self.displacements._calculate(model_from=model_from[i], 
model_to=model_to[j], coord_from=array(coord_from), coord_to=array(coord_to))
+                self.displacements._calculate(model_from=model_from[i], 
model_to=model_to[j], coord_from=array(coord_from), coord_to=array(coord_to), 
centroid=centroid)
 
 
     def delete(self):

Modified: 1.3/generic_fns/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/main.py?rev=14918&r1=14917&r2=14918&view=diff
==============================================================================
--- 1.3/generic_fns/structure/main.py (original)
+++ 1.3/generic_fns/structure/main.py Wed Oct 26 10:25:23 2011
@@ -61,7 +61,7 @@
             del spin.xh_vect
 
 
-def displacement(model_from=None, model_to=None, atom_id=None):
+def displacement(model_from=None, model_to=None, atom_id=None, 
centroid=None):
     """Calculate the rotational and translational displacement between two 
structural models.
 
     This will just redirect straight to the API.
@@ -72,9 +72,11 @@
     @type model_to:             int or None
     @keyword atom_id:           The molecule, residue, and atom identifier 
string.  This matches the spin ID string format.
     @type atom_id:              str or None
-    """
-
-    cdp.structure.calc_displacement(model_from=model_from, 
model_to=model_to, atom_id=atom_id)
+    @keyword centroid:          An alternative position of the centroid, 
used for studying pivoted systems.
+    @type centroid:             list of float or numpy rank-1, 3D array
+    """
+
+    cdp.structure.calc_displacement(model_from=model_from, 
model_to=model_to, atom_id=atom_id, centroid=centroid)
 
 
 def get_pos(spin_id=None, str_id=None, ave_pos=False):

Modified: 1.3/prompt/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/structure.py?rev=14918&r1=14917&r2=14918&view=diff
==============================================================================
--- 1.3/prompt/structure.py (original)
+++ 1.3/prompt/structure.py Wed Oct 26 10:25:23 2011
@@ -195,22 +195,24 @@
     _build_doc(delete)
 
 
-    def displacement(self, model_from=None, model_to=None, atom_id=None):
+    def displacement(self, model_from=None, model_to=None, atom_id=None, 
centroid=None):
         # Function intro text.
         if self._exec_info.intro:
             text = self._exec_info.ps3 + "structure.displacement("
             text = text + "model_from=" + repr(model_from)
             text = text + ", model_to=" + repr(model_to)
-            text = text + ", atom_id=" + repr(atom_id) + ")"
+            text = text + ", atom_id=" + repr(atom_id)
+            text = text + ", centroid=" + repr(centroid) + ")"
             print(text)
 
         # The argument checks.
         arg_check.is_int(model_from, 'model from', can_be_none=True)
         arg_check.is_int(model_to, 'model to', can_be_none=True)
         arg_check.is_str(atom_id, 'atom identification string', 
can_be_none=True)
-
-        # Execute the functional code.
-        generic_fns.structure.main.displacement(model_from=model_from, 
model_to=model_to, atom_id=atom_id)
+        arg_check.is_float_array(centroid, 'centroid position', 
can_be_none=True)
+
+        # Execute the functional code.
+        generic_fns.structure.main.displacement(model_from=model_from, 
model_to=model_to, atom_id=atom_id, centroid=centroid)
 
     # The function doc info.
     displacement._doc_title = "Determine the rotational and translational 
displacement between a set of models."
@@ -218,12 +220,15 @@
     displacement._doc_args = [
         ["model_from", "The optional model number for the starting position 
of the displacement."],
         ["model_to", "The optional model number for the ending position of 
the displacement."],
-        ["atom_id", "The atom identification string."]
+        ["atom_id", "The atom identification string."],
+        ["centroid", "The alternative position of the centroid."]
     ]
     displacement._doc_desc = """
         This user function allows the rotational and translational 
displacement between two models of the same structure to be calculated.  The 
information will be printed out in various formats and held in the relax data 
store.  This is directional, so there is a starting and ending position for 
each displacement.  If the starting and ending models are not specified, then 
the displacements in all directions between all models will be calculated.
 
         The atom ID, which uses the same notation as the spin ID strings, 
can be used to restrict the displacement calculation to certain molecules, 
residues, or atoms.  This is useful if studying domain motions, secondary 
structure rearrangements, amino acid side chain rotations, etc.
+
+        By supplying the position of the centroid, an alternative position 
than the standard rigid body centre is used as the focal point of the motion. 
 The allows, for example, a pivot of a rotational domain motion to be 
specified.  This is not a formally correct algorithm, all translations will 
be zero, but does give an indication to the amplitude of the pivoting angle.
         """
     displacement._doc_examples = """
         To determine the rotational and translational displacements between 
all sets of models, type:




Related Messages


Powered by MHonArc, Updated Wed Oct 26 10:40:02 2011