mailr14989 - /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:38:
Author: bugman
Date: Wed Nov  9 11:38:56 2011
New Revision: 14989

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

This allows the centre of mass of subsets of the structure to be calculated.


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=14989&r1=14988&r2=14989&view=diff
==============================================================================
--- 1.3/generic_fns/structure/mass.py (original)
+++ 1.3/generic_fns/structure/mass.py Wed Nov  9 11:38:56 2011
@@ -32,12 +32,12 @@
 
 
 
-def centre_of_mass(return_mass=False):
+def centre_of_mass(atom_id=None, return_mass=False):
     """Calculate and return the centre of mass of the structure.
 
-    @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.
+    @keyword atom_id:       The molecule, residue, and atom identifier 
string.  Only atoms matching this selection will be yielded.
+    @type atom_id:          str
+    @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.
     @rtype:                 list of 3 floats (or tuple of a list of 3 floats 
and one float)
@@ -57,7 +57,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(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, 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