Author: bugman Date: Mon Jun 30 18:10:09 2014 New Revision: 24365 URL: http://svn.gna.org/viewcvs/relax?rev=24365&view=rev Log: Created the very basic structure.com user function for calculating the centre of mass. This is to simply allow an easy interface to the pipe_control.structure.mass.pipe_centre_of_mass() function. 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=24365&r1=24364&r2=24365&view=diff ============================================================================== --- trunk/pipe_control/structure/main.py (original) +++ trunk/pipe_control/structure/main.py Mon Jun 30 18:10:09 2014 @@ -119,6 +119,20 @@ # Add the atoms. 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 + """ + + # Test if the current data pipe exists. + pipes.test() + + # Calculate and store the centre of mass. + cdp.com = pipe_centre_of_mass(model=model) 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=24365&r1=24364&r2=24365&view=diff ============================================================================== --- trunk/user_functions/structure.py (original) +++ trunk/user_functions/structure.py Mon Jun 30 18:10:09 2014 @@ -145,6 +145,30 @@ uf.menu_text = "&add_model" uf.gui_icon = "oxygen.actions.list-add-relax-blue" uf.wizard_size = (700, 400) +uf.wizard_image = WIZARD_IMAGE_PATH + 'structure' + sep + '2JK4.png' + + +# The structure.com user function. +uf = uf_info.add_uf('structure.com') +uf.title = "Calculate the centre of mass 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 +) +# Description. +uf.desc.append(Desc_container()) +uf.desc[-1].add_paragraph("This user function will calculate the centre of mass (CoM) for all loaded structures, printing out the position and storing it in the current data pipe.") +# Prompt examples. +uf.desc.append(Desc_container("Prompt examples")) +uf.desc[-1].add_paragraph("To determine the centre of mass of all structure, simply type:") +uf.desc[-1].add_prompt("relax> structure.com()") +uf.backend = pipe_control.structure.main.com +uf.menu_text = "co&m" +uf.wizard_size = (600, 400) uf.wizard_image = WIZARD_IMAGE_PATH + 'structure' + sep + '2JK4.png'