mailr14897 - 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 24, 2011 - 15:01:
Author: bugman
Date: Mon Oct 24 15:01:05 2011
New Revision: 14897

URL: http://svn.gna.org/viewcvs/relax?rev=14897&view=rev
Log:
The structure.rotate user function can now operate in individual structural 
models.

The model keyword argument has been added to allow this.


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=14897&r1=14896&r2=14897&view=diff
==============================================================================
--- 1.3/generic_fns/structure/api_base.py (original)
+++ 1.3/generic_fns/structure/api_base.py Mon Oct 24 15:01:05 2011
@@ -459,13 +459,15 @@
                 model.mol[-1].file_model = orig_model_num[i]
 
 
-    def rotate(self, R=None, origin=None):
+    def rotate(self, R=None, origin=None, model=None):
         """Method stub for rotating a structure.
 
         @keyword R:         The forwards rotation matrix.
         @type R:            numpy 3D, rank-2 array
         @keyword origin:    The origin of the rotation.
         @type origin:       numpy 3D, rank-1 array
+        @keyword model:     The model to rotate.  If None, all models will 
be rotated.
+        @type model:        int
         """
 
         # Raise the error.

Modified: 1.3/generic_fns/structure/internal.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/internal.py?rev=14897&r1=14896&r2=14897&view=diff
==============================================================================
--- 1.3/generic_fns/structure/internal.py (original)
+++ 1.3/generic_fns/structure/internal.py Mon Oct 24 15:01:05 2011
@@ -1020,19 +1020,21 @@
         return True
         
 
-    def rotate(self, R=None, origin=None):
+    def rotate(self, R=None, origin=None, model=None):
         """Rotate the structural information about the given origin.
 
         @keyword R:         The forwards rotation matrix.
         @type R:            numpy 3D, rank-2 array
         @keyword origin:    The origin of the rotation.
         @type origin:       numpy 3D, rank-1 array
+        @keyword model:     The model to rotate.  If None, all models will 
be rotated.
+        @type model:        int
         """
 
         # Loop over the models.
-        for model in self.model_loop():
+        for model_cont in self.model_loop(model):
             # Loop over the molecules.
-            for mol in model.mol:
+            for mol in model_cont.mol:
                 # Loop over the atoms.
                 for i in range(len(mol.atom_num)):
                     # The origin to atom vector.

Modified: 1.3/generic_fns/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/main.py?rev=14897&r1=14896&r2=14897&view=diff
==============================================================================
--- 1.3/generic_fns/structure/main.py (original)
+++ 1.3/generic_fns/structure/main.py Mon Oct 24 15:01:05 2011
@@ -387,13 +387,15 @@
     cdp.structure.load_xyz(file_path, read_mol=read_mol, 
set_mol_name=set_mol_name, read_model=read_model, 
set_model_num=set_model_num, verbosity=verbosity)
 
 
-def rotate(R=None, origin=None):
+def rotate(R=None, origin=None, model=None):
     """Rotate the structural data about the origin by the specified forwards 
rotation.
 
     @keyword R:         The forwards rotation matrix.
     @type R:            numpy 3D, rank-2 array or a 3x3 list of floats
     @keyword origin:    The origin of the rotation.  If not supplied, the 
origin will be set to [0, 0, 0].
     @type origin:       numpy 3D, rank-1 array or list of len 3 or None
+    @keyword model:     The model to rotate.  If None, all models will be 
rotated.
+    @type model:        int
     """
 
     # Test if the current data pipe exists.
@@ -412,7 +414,7 @@
     origin = array(origin, float64)
 
     # Call the specific code.
-    cdp.structure.rotate(R=R, origin=origin)
+    cdp.structure.rotate(R=R, origin=origin, model=model)
 
 
 def set_vector(spin=None, xh_vect=None):

Modified: 1.3/prompt/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/structure.py?rev=14897&r1=14896&r2=14897&view=diff
==============================================================================
--- 1.3/prompt/structure.py (original)
+++ 1.3/prompt/structure.py Mon Oct 24 15:01:05 2011
@@ -438,30 +438,33 @@
         generic_fns.structure.main.read_xyz(file=file, dir=dir, 
read_mol=read_mol, set_mol_name=set_mol_name, read_model=read_model, 
set_model_num=set_model_num)
 
 
-    def rotate(self, R=None, origin=None):
+    def rotate(self, R=None, origin=None, model=None):
         # Function intro text.
         if self._exec_info.intro:
             text = self._exec_info.ps3 + "structure.rotate("
             text = text + "R=" + repr(R)
-            text = text + ", origin=" + repr(origin) + ")"
+            text = text + ", origin=" + repr(origin)
+            text = text + ", model=" + repr(model) + ")"
             print(text)
 
         # The argument checks.
         arg_check.is_float_matrix(R, 'rotation matrix', dim=(3,3))
         arg_check.is_float_array(origin, 'origin of rotation', size=3, 
can_be_none=True)
-
-        # Execute the functional code.
-        generic_fns.structure.main.rotate(R=R, origin=origin)
+        arg_check.is_int(model, 'model', can_be_none=True)
+
+        # Execute the functional code.
+        generic_fns.structure.main.rotate(R=R, origin=origin, model=model)
 
     # The function doc info.
     rotate._doc_title = "Rotate the internal structural object about the 
given origin by the rotation matrix."
     rotate._doc_title_short = "Structure rotation."
     rotate._doc_args = [
         ["R", "The rotation matrix in forwards rotation notation."],
-        ["origin", "The origin or pivot of the rotation."]
+        ["origin", "The origin or pivot of the rotation."],
+        ["model", "The model to rotate (which if not set will cause all 
models to be rotated)."]
     ]
     rotate._doc_desc = """
-        This is used to rotate the internal structural data by the given 
rotation matrix.  If the origin is supplied, then this will act as the pivot 
of the rotation.  Otherwise, all structural data will be rotated about the 
point [0, 0, 0].
+        This is used to rotate the internal structural data by the given 
rotation matrix.  If the origin is supplied, then this will act as the pivot 
of the rotation.  Otherwise, all structural data will be rotated about the 
point [0, 0, 0].  The model argument can be used to rotate only specific 
models.
         """
     _build_doc(rotate)
 




Related Messages


Powered by MHonArc, Updated Mon Oct 24 15:20:02 2011