mailr22176 - in /branches/double_rotor: specific_analyses/frame_order/user_functions.py user_functions/frame_order.py


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

Header


Content

Posted by edward on February 12, 2014 - 14:56:
Author: bugman
Date: Wed Feb 12 14:56:21 2014
New Revision: 22176

URL: http://svn.gna.org/viewcvs/relax?rev=22176&view=rev
Log:
Changes to the frame_order.pivot user function.

The 'order' argument has been added to allow for multiple pivots to be 
present.  The user function
backend will store these as cdp.pivot, cdp.pivot2, cdp.pivot3, etc.  The 
'fix' argument is now
defaulting to False to make sure it is always boolean.


Modified:
    branches/double_rotor/specific_analyses/frame_order/user_functions.py
    branches/double_rotor/user_functions/frame_order.py

Modified: 
branches/double_rotor/specific_analyses/frame_order/user_functions.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/specific_analyses/frame_order/user_functions.py?rev=22176&r1=22175&r2=22176&view=diff
==============================================================================
--- branches/double_rotor/specific_analyses/frame_order/user_functions.py 
(original)
+++ branches/double_rotor/specific_analyses/frame_order/user_functions.py Wed 
Feb 12 14:56:21 2014
@@ -29,6 +29,7 @@
 import sys
 
 # relax module imports.
+from lib.arg_check import is_float_array
 from lib.errors import RelaxError
 from lib.geometry.coord_transform import spherical_to_cartesian
 from lib.geometry.rotations import euler_to_R_zyz, two_vect_to_R
@@ -395,11 +396,13 @@
     pdb_distribution(file=dist_file, dir=dir, force=force)
 
 
-def pivot(pivot=None, fix=None):
+def pivot(pivot=None, order=1, fix=False):
     """Set the pivot point for the 2 body motion.
 
     @keyword pivot: The pivot point of the two bodies (domains, etc.) in the 
structural coordinate system.
     @type pivot:    list of num
+    @keyword order: The ordinal number of the pivot point.  The value of 1 
is for the first pivot point, the value of 2 for the second pivot point, and 
so on.
+    @type order:    int
     @keyword fix:   A flag specifying if the pivot point should be fixed 
during optimisation.
     @type fix:      bool
     """
@@ -407,13 +410,24 @@
     # Test if the current data pipe exists.
     pipes.test()
 
-    # Set the pivot point and fixed flag.
-    cdp.pivot = pivot
+    # Convert the pivot to a numpy array.
+    pivot = array(pivot, float64)
+
+    # Check the pivot validity.
+    is_float_array(pivot, name='pivot point', size=3)
+
+    # Store the pivot point. and fixed flag.
+    if order == 1:
+        cdp.pivot = pivot
+    else:
+        # The variable name.
+        name = 'pivot%i' % order
+
+        # Store the variable.
+        setattr(cdp, name, pivot)
+
+    # Store the fixed flag.
     cdp.pivot_fixed = fix
-
-    # Convert to floats.
-    for i in range(3):
-        cdp.pivot[i] = float(cdp.pivot[i])
 
 
 def quad_int(flag=False):

Modified: branches/double_rotor/user_functions/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/double_rotor/user_functions/frame_order.py?rev=22176&r1=22175&r2=22176&view=diff
==============================================================================
--- branches/double_rotor/user_functions/frame_order.py (original)
+++ branches/double_rotor/user_functions/frame_order.py Wed Feb 12 14:56:21 
2014
@@ -172,7 +172,7 @@
 
 # The frame_order.pivot user function.
 uf = uf_info.add_uf('frame_order.pivot')
-uf.title = "Set the pivot point for the two body motion in the structural 
coordinate system."
+uf.title = "Set the pivot points for the two body motion in the structural 
coordinate system."
 uf.title_short = "Pivot point setting."
 uf.add_keyarg(
     name = "pivot",
@@ -182,14 +182,25 @@
     desc = "The pivot point for the motion (e.g. the position between the 2 
domains in PDB coordinates)."
 )
 uf.add_keyarg(
+    name = "order",
+    default = 1,
+    min = 1,
+    max = 100,
+    py_type = "int",
+    desc_short = "pivot point number",
+    desc = "The ordinal number of the pivot point.  The value of 1 is for 
the first pivot point, the value of 2 for the second pivot point, and so on.",
+    wiz_element_type = "spin"
+)
+uf.add_keyarg(
     name = "fix",
     py_type = "bool",
+    default = False,
     desc_short = "fixed flag",
     desc = "A flag specifying if the pivot point should be fixed during 
optimisation."
 )
 # Description.
 uf.desc.append(Desc_container())
-uf.desc[-1].add_paragraph("This will set the pivot point for the two domain 
system within the PDB coordinate system.  This is required for interpreting 
PCS data as well as for the generation of cone or other PDB representations 
of the domain motions.")
+uf.desc[-1].add_paragraph("This will set the pivot points for the two domain 
system within the PDB coordinate system.  This is required for interpreting 
PCS data as well as for the generation of cone or other PDB representations 
of the domain motions.")
 # Prompt examples.
 uf.desc.append(Desc_container("Prompt examples"))
 uf.desc[-1].add_paragraph("To set the pivot point, type one of:")
@@ -197,6 +208,7 @@
 uf.desc[-1].add_prompt("relax> frame_order.pivot(pivot=[12.067, 14.313, 
-3.2675])")
 uf.backend = pivot
 uf.menu_text = "&pivot"
+uf.wizard_size = (900, 500)
 uf.wizard_image = WIZARD_IMAGE_PATH + 'frame_order.png'
 
 




Related Messages


Powered by MHonArc, Updated Wed Feb 12 16:40:02 2014