mailr14990 - /1.3/generic_fns/structure/mass.py


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

Header


Content

Posted by edward on November 09, 2011 - 11:45:
Author: bugman
Date: Wed Nov  9 11:45:33 2011
New Revision: 14990

URL: http://svn.gna.org/viewcvs/relax?rev=14990&view=rev
Log:
The generic_fns.structure.mass.centre_of_mass() function now accepts the 
model number arg.

This allows specific models to be isolated.


Modified:
    1.3/generic_fns/structure/mass.py

Modified: 1.3/generic_fns/structure/mass.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/mass.py?rev=14990&r1=14989&r2=14990&view=diff
==============================================================================
--- 1.3/generic_fns/structure/mass.py (original)
+++ 1.3/generic_fns/structure/mass.py Wed Nov  9 11:45:33 2011
@@ -32,11 +32,13 @@
 
 
 
-def centre_of_mass(atom_id=None, return_mass=False):
+def centre_of_mass(atom_id=None, model_num=None, return_mass=False):
     """Calculate and return the centre of mass of the structure.
 
-    @keyword atom_id:       The molecule, residue, and atom identifier 
string.  Only atoms matching this selection will be yielded.
+    @keyword atom_id:       The molecule, residue, and atom identifier 
string.  Only atoms matching this selection will be used.
     @type atom_id:          str
+    @keyword model_num:     Only use a specific model.
+    @type model_num:        int or None
     @keyword 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.
@@ -57,7 +59,7 @@
     M = 0.0
 
     # Loop over all atoms.
-    for mol_name, res_num, res_name, atom_num, atom_name, element, pos in 
cdp.structure.atom_loop(atom_id=atom_id, mol_name_flag=True, 
res_num_flag=True, res_name_flag=True, atom_num_flag=True, 
atom_name_flag=True, element_flag=True, pos_flag=True):
+    for mol_name, res_num, res_name, atom_num, atom_name, element, pos in 
cdp.structure.atom_loop(atom_id=atom_id, model_num=model_num, 
mol_name_flag=True, res_num_flag=True, res_name_flag=True, 
atom_num_flag=True, atom_name_flag=True, element_flag=True, pos_flag=True):
         # Initialise the spin id string.
         id = ''
 




Related Messages


Powered by MHonArc, Updated Wed Nov 09 12:00:02 2011