mailr27073 - in /trunk: lib/structure/internal/coordinates.py pipe_control/structure/main.py


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

Header


Content

Posted by edward on December 11, 2014 - 10:20:
Author: bugman
Date: Thu Dec 11 10:20:56 2014
New Revision: 27073

URL: http://svn.gna.org/viewcvs/relax?rev=27073&view=rev
Log:
The coordinate assembly function now returns list of unique IDs.

This is for each structural object, model and molecule.


Modified:
    trunk/lib/structure/internal/coordinates.py
    trunk/pipe_control/structure/main.py

Modified: trunk/lib/structure/internal/coordinates.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/coordinates.py?rev=27073&r1=27072&r2=27073&view=diff
==============================================================================
--- trunk/lib/structure/internal/coordinates.py (original)
+++ trunk/lib/structure/internal/coordinates.py Thu Dec 11 10:20:56 2014
@@ -39,12 +39,13 @@
     @type molecules:        None or list of lists of str
     @keyword atom_id:       The molecule, residue, and atom identifier 
string of the coordinates of interest.  This matches the spin ID string 
format.
     @type atom_id:          None or str
-    @return:                The array of atomic coordinates (first dimension 
is the model and/or molecule, the second are the atoms, and the third are the 
coordinates), and the list of element names for each atom (if the elements 
flag is set).
-    @rtype:                 numpy rank-3 float64 array, list of str
+    @return:                The array of atomic coordinates (first dimension 
is the model and/or molecule, the second are the atoms, and the third are the 
coordinates); a list of unique IDs for each structural object, model, and 
molecule; the list of element names for each atom (if the elements flag is 
set).
+    @rtype:                 numpy rank-3 float64 array, list of str, list of 
str
     """
 
     # Assemble the atomic coordinates of all structures.
     print("Assembling all atomic coordinates:")
+    ids = []
     atom_ids = []
     atom_pos = []
     atom_elem = []
@@ -94,6 +95,12 @@
                         atom_pos.append({})
                         atom_elem.append({})
 
+                    # Create a new structure ID.
+                    if model.num != None:
+                        ids.append("%s, %i, %s" % 
(object_names[struct_index], model.num, mol_name))
+                    else:
+                        ids.append("%s, %s" % (object_names[struct_index], 
mol_name))
+
                 # A unique identifier.
                 if molecules != None:
                     id = ":%s&%s@%s" % (res_num, res_name, atom_name)
@@ -135,6 +142,6 @@
 
     # Return the information.
     if elements_flag:
-        return coord, elements
+        return coord, ids, elements
     else:
-        return coord
+        return coord, ids

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=27073&r1=27072&r2=27073&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py        (original)
+++ trunk/pipe_control/structure/main.py        Thu Dec 11 10:20:56 2014
@@ -136,7 +136,7 @@
         raise RelaxError("The superimposition centre type '%s' is unknown.  
It must be one of %s." % (centre_type, allowed))
 
     # Assemble the atomic coordinates and obtain the corresponding element 
information.
-    coord, elements = assemble_coordinates(pipes=pipes, molecules=molecules, 
models=models, atom_id=atom_id, elements_flag=True)
+    coord, ids, elements = assemble_coordinates(pipes=pipes, 
molecules=molecules, models=models, atom_id=atom_id, elements_flag=True)
 
     # The different algorithms.
     if method == 'fit to mean':
@@ -195,8 +195,8 @@
     @type molecules:        None or list of lists of str
     @keyword atom_id:       The molecule, residue, and atom identifier 
string of the coordinates of interest.  This matches the spin ID string 
format.
     @type atom_id:          None or str
-    @return:                The array of atomic coordinates (first dimension 
is the model and/or molecule, the second are the atoms, and the third are the 
coordinates), and the list of element names for each atom (if the elements 
flag is set).
-    @rtype:                 numpy rank-3 float64 array, list of str
+    @return:                The array of atomic coordinates (first dimension 
is the model and/or molecule, the second are the atoms, and the third are the 
coordinates); a list of unique IDs for each pipe, model, and molecule; the 
list of element names for each atom (if the elements flag is set).
+    @rtype:                 numpy rank-3 float64 array, list of str, list of 
str
     """
 
     # The data pipes to use.
@@ -557,7 +557,7 @@
     init_pos = array(init_pos)
 
     # Assemble the atomic coordinates.
-    coord = assemble_coordinates(pipes=pipes, molecules=molecules, 
models=models, atom_id=atom_id)
+    coord, ids = assemble_coordinates(pipes=pipes, molecules=molecules, 
models=models, atom_id=atom_id)
 
     # Linear constraints for the pivot position (between -1000 and 1000 
Angstrom).
     A = zeros((6, 3), float64)




Related Messages


Powered by MHonArc, Updated Thu Dec 11 10:40:04 2014