From PyMOLWiki
Revision as of 15:42, 12 October 2016 by Speleo3 (talk | contribs) (created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The centerofmass command calculates the center of mass for an atom selection. It considers atom mass and occupancy.

New in PyMOL 1.7.2. See the center_of_mass script for older PyMOL versions.


centerofmass [ selection [, state ]]


  • selection = str: atom selection {default: all}
  • state = int: object state, -1 for current state, 0 for all states {default: -1}


PyMOL> fetch 1ubq, async=0
PyMOL> centerofmass
 Center of Mass: [  30.004,  28.522,  14.701]

Python API

cmd.centerofmass() returns a list of 3 floats.

See Also