|This code has been put under version control in the project Pymol-script-repo|
COM is a small script that returns the value of the center of mass of your selection. It also can translate the object of that selection to the origin.
COM (selection=PyMOLSelection), [center=boolean]
# get the COM of the polymer import com fetch 4ins, async=0 COM polymer # move some 'ligand' to the origin COM ligand, center=1