mailr8878 - /branches/bmrb/generic_fns/mol_res_spin.py


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

Header


Content

Posted by edward on February 26, 2009 - 15:21:
Author: bugman
Date: Thu Feb 26 15:21:28 2009
New Revision: 8878

URL: http://svn.gna.org/viewcvs/relax?rev=8878&view=rev
Log:
Created the get_molecule_names() function.

This new function returns a list of all the molecule names.  
bmrb_write_entity() now calls this.


Modified:
    branches/bmrb/generic_fns/mol_res_spin.py

Modified: branches/bmrb/generic_fns/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bmrb/generic_fns/mol_res_spin.py?rev=8878&r1=8877&r2=8878&view=diff
==============================================================================
--- branches/bmrb/generic_fns/mol_res_spin.py (original)
+++ branches/bmrb/generic_fns/mol_res_spin.py Thu Feb 26 15:21:28 2009
@@ -501,8 +501,11 @@
     if count_molecules() > 1:
         raise RelaxError, "Support for multiple molecules is not yet 
supported."
 
+    # Get the molecule names.
+    mol_names = get_molecule_names()
+
     # Add the entity.
-    star.entity.add()
+    star.entity.add(mol_names[0])
 
 
 def copy_molecule(pipe_from=None, mol_from=None, pipe_to=None, mol_to=None):
@@ -1297,11 +1300,31 @@
     return id
 
 
+def get_molecule_names(selection=None):
+    """Return a list of the molecule names.
+
+    @param selection:   The molecule selection identifier.
+    @type selection:    str
+    @return:            The molecule names.
+    @rtype:             list of str
+    """
+
+    # Loop over the molecules, append the name of each within the selection.
+    mol_names = []
+    for mol in molecule_loop(selection):
+        mol_names.append(mol.name)
+
+    # Return the names.
+    return mol_names
+
+
 def last_residue_num(selection=None):
     """Determine the last residue number.
 
-    @return:    The number of the last residue.
-    @rtype:     int
+    @param selection:   The molecule selection identifier.
+    @type selection:    str
+    @return:            The number of the last residue.
+    @rtype:             int
     """
 
     # Get the molecule.




Related Messages


Powered by MHonArc, Updated Fri Feb 27 14:40:02 2009