mailr21495 - in /branches/relax_disp: ./ lib/structure/mass.py pipe_control/sequence.py


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

Header


Content

Posted by edward on November 17, 2013 - 20:42:
Author: bugman
Date: Sun Nov 17 20:42:47 2013
New Revision: 21495

URL: http://svn.gna.org/viewcvs/relax?rev=21495&view=rev
Log:
Merged revisions 21492-21494 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r21492 | bugman | 2013-11-17 20:39:27 +0100 (Sun, 17 Nov 2013) | 5 lines
  
  Bug fix for the lib.structure.mass.centre_of_mass() function warning when 
the element is not known.
  
  This warning was buggy and resulted tracebacks.
........
  r21493 | bugman | 2013-11-17 20:40:51 +0100 (Sun, 17 Nov 2013) | 5 lines
  
  Created the pipe_control.sequence.return_attached_protons() function.
  
  This is used to return a list of proton spin containers attached to the 
given spin.
........
  r21494 | bugman | 2013-11-17 20:42:06 +0100 (Sun, 17 Nov 2013) | 3 lines
  
  Fix for a fatal typo in the previous commit (r21493).
........

Modified:
    branches/relax_disp/   (props changed)
    branches/relax_disp/lib/structure/mass.py
    branches/relax_disp/pipe_control/sequence.py

Propchange: branches/relax_disp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Nov 17 20:42:47 2013
@@ -1,1 +1,1 @@
-/trunk:1-21473
+/trunk:1-21494

Modified: branches/relax_disp/lib/structure/mass.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/structure/mass.py?rev=21495&r1=21494&r2=21495&view=diff
==============================================================================
--- branches/relax_disp/lib/structure/mass.py (original)
+++ branches/relax_disp/lib/structure/mass.py Sun Nov 17 20:42:47 2013
@@ -59,7 +59,7 @@
         try:
             mass = return_atomic_mass(elements[i])
         except RelaxError:
-            warn(RelaxWarning("Skipping the atom '%s' as the element '%s' is 
unknown." % (id, elements[i])))
+            warn(RelaxWarning("Skipping the atom index %s as the element 
'%s' is unknown." % (i, elements[i])))
 
         # Total mass.
         M = M + mass

Modified: branches/relax_disp/pipe_control/sequence.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/pipe_control/sequence.py?rev=21495&r1=21494&r2=21495&view=diff
==============================================================================
--- branches/relax_disp/pipe_control/sequence.py (original)
+++ branches/relax_disp/pipe_control/sequence.py Sun Nov 17 20:42:47 2013
@@ -355,6 +355,41 @@
     write_spin_data(sys.stdout, mol_names=mol_names, res_nums=res_nums, 
res_names=res_names, spin_nums=spin_nums, spin_names=spin_names)
 
 
+def return_attached_protons(spin_id=None):
+    """Return a list of all proton spin containers attached to the given 
spin.
+
+    @keyword spin_id:   The spin ID string.
+    @type spin_id:      str
+    @return:            The list of proton spin containers attached to the 
given spin.
+    @rtype:             list of SpinContainer instances
+    """
+
+    # Initialise.
+    spin_list = []
+
+    # Get all interatomic data containers.
+    interatoms = return_interatom_list(spin_id)
+
+    # No containers.
+    if not len(interatoms):
+        return spin_list
+
+    # Loop over the containers.
+    for i in range(len(interatoms)):
+        # Get the attached spin.
+        if interatoms[i].spin_id1 == spin_id:
+            attached = return_spin(interatoms[i].spin_id2)
+        else:
+            attached = return_spin(interatoms[i].spin_id1)
+
+        # Is it a proton?
+        if (hasattr(attached, 'element') and attached.element == 'H') or 
attached.name == 'H':
+            spin_list.append(attached)
+
+    # Return the list.
+    return spin_list
+
+
 def validate_sequence(data, spin_id_col=None, mol_name_col=None, 
res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, 
data_col=None, error_col=None):
     """Test if the sequence data is valid.
 




Related Messages


Powered by MHonArc, Updated Mon Nov 18 11:40:02 2013