Author: bugman Date: Thu Oct 2 15:30:58 2014 New Revision: 26137 URL: http://svn.gna.org/viewcvs/relax?rev=26137&view=rev Log: Expanded the structure.com user function to accept the atom_id argument. This allows the centre of mass (CoM) calculation to be restricted to a certain subset of atoms. The backend already had support for this feature, but now it is exposed in the frontend. The user function docstring has been slightly modified as well. Modified: trunk/pipe_control/structure/main.py trunk/user_functions/structure.py Modified: trunk/pipe_control/structure/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=26137&r1=26136&r2=26137&view=diff ============================================================================== --- trunk/pipe_control/structure/main.py (original) +++ trunk/pipe_control/structure/main.py Thu Oct 2 15:30:58 2014 @@ -299,18 +299,23 @@ cdp.structure.connect_atom(index1=index1, index2=index2) -def com(model=None): - """Calculate the centre of mass of all structures. - - @keyword model: Only use a specific model. - @type model: int or None +def com(model=None, atom_id=None): + """Calculate the centre of mass (CoM) of all structures. + + The value will be stored in the current data pipe 'com' variable. + + + @keyword model: Only use a specific model. + @type model: int or None + @keyword atom_id: The molecule, residue, and atom identifier string. This matches the spin ID string format. If not given, then all structural data will be used for calculating the CoM. + @type atom_id: str or None """ # Test if the current data pipe exists. check_pipe() # Calculate and store the centre of mass. - cdp.com = pipe_centre_of_mass(model=model) + cdp.com = pipe_centre_of_mass(model=model, atom_id=atom_id) def create_diff_tensor_pdb(scale=1.8e-6, file=None, dir=None, force=False): Modified: trunk/user_functions/structure.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/structure.py?rev=26137&r1=26136&r2=26137&view=diff ============================================================================== --- trunk/user_functions/structure.py (original) +++ trunk/user_functions/structure.py Thu Oct 2 15:30:58 2014 @@ -233,13 +233,20 @@ # The structure.com user function. uf = uf_info.add_uf('structure.com') -uf.title = "Calculate the centre of mass for all structures." +uf.title = "Calculate the centre of mass (CoM) for all structures." uf.title_short = "Centre of mass calculation." uf.add_keyarg( name = "model", py_type = "int", desc_short = "model", desc = "The optional structural model number to restrict the calculation of the centre of mass to.", + can_be_none = True +) +uf.add_keyarg( + name = "atom_id", + py_type = "str", + desc_short = "atom ID string", + desc = "The atom identification string to restrict the CoM calculation to.", can_be_none = True ) # Description.