mailr5007 - in /branches/N_state_model: ./ generic_fns/structure.py


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

Header


Content

Posted by edward on February 15, 2008 - 11:30:
Author: bugman
Date: Fri Feb 15 11:30:47 2008
New Revision: 5007

URL: http://svn.gna.org/viewcvs/relax?rev=5007&view=rev
Log:
Merged revisions 5005-5006 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r5005 | bugman | 2008-02-15 11:06:25 +0100 (Fri, 15 Feb 2008) | 3 lines
  
  Modified the centre_of_mass() function to use obey the selections in the 
mol-res-spin structure.
........
  r5006 | bugman | 2008-02-15 11:10:27 +0100 (Fri, 15 Feb 2008) | 3 lines
  
  Converted the generic_fns.structure.centre_of_mass() docstring to epydoc 
format.
........

Modified:
    branches/N_state_model/   (props changed)
    branches/N_state_model/generic_fns/structure.py

Propchange: branches/N_state_model/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: branches/N_state_model/generic_fns/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/generic_fns/structure.py?rev=5007&r1=5006&r2=5007&view=diff
==============================================================================
--- branches/N_state_model/generic_fns/structure.py (original)
+++ branches/N_state_model/generic_fns/structure.py Fri Feb 15 11:30:47 2008
@@ -186,7 +186,15 @@
 
 
 def centre_of_mass(return_mass=False):
-    """Calculate and return the centre of mass of the structure."""
+    """Calculate and return the centre of mass of the structure.
+
+    @param return_mass: A flag which if False will cause only the centre of 
mass to be returned, but
+                        if True will cause the centre of mass and the mass 
itself to be returned as
+                        a tuple.
+    @type return_mass:  bool
+    @return:            The centre of mass vector, and additionally the mass.
+    @rtype:             list of 3 floats (or tuple of a list of 3 floats and 
one float)
+    """
 
     # Alias the current data pipe.
     cdp = relax_data_store[relax_data_store.current_pipe]
@@ -206,6 +214,16 @@
 
     # Loop over the structures.
     for struct in cdp.structure.structures:
+        # Get the corresponding molecule container.
+        if cdp.mol[0].name == None:
+            mol_cont = cdp.mol[0]
+        else:
+            mol_cont = return_molecule(struct.name)
+
+        # Deselected molecule.
+        if not mol_cont.select:
+            continue
+
         # Protein.
         if struct.peptide_chains:
             chains = struct.peptide_chains
@@ -216,23 +234,28 @@
 
         # Loop over the residues of the protein in the PDB file.
         for res in chains[0].residues:
-            # Find the corresponding residue in 'relax_data_store'.
-            found = 0
-            for res_data in relax_data_store.res[run]:
-                if res.number == res_data.num:
-                    found = 1
-                    break
-
-            # Doesn't exist.
-            if not found:
-                continue
-
-            # Skip unselected residues.
-            if not res_data.select:
+            # Get the corresponding residue container.
+            if mol_cont.res[0].name == None and mol_cont.res[0].num == None:
+                res_cont = mol_cont.res[0]
+            else:
+                res_cont = return_residue(res.number)
+
+            # Deselected residue.
+            if not res_cont.select:
                 continue
 
             # Loop over the atoms of the residue.
             for atom in res:
+                # Get the corresponding spin container.
+                if res_cont.spin[0].name == None and res_cont.spin[0].num == 
None:
+                    spin_cont = res_cont.spin[0]
+                else:
+                    spin_cont = return_spin(atom.properties['number'])
+
+                # Deselected spin.
+                if not spin_cont.select:
+                    continue
+
                 # Atomic mass.
                 mass = atomic_mass(atom.properties['element'])
 




Related Messages


Powered by MHonArc, Updated Fri Feb 15 11:40:42 2008