Calculating the center of mass of a ligand

Hi everyone, I have another question: what would be the easiest way to calculate the center of mass of a given set of atoms? In particular, is there a python module that already has this function implemented? I am interested in particular to find the center of mass of a ligand bound to a protein. Thanks a lot, JD

Hi JD, There is no built-in center of mass method in Chimera. If you've selected the atoms beforehand, then the below Python code will calculate the center of mass: from chimera import selection, Vector sum = 0 center = Vector(0, 0, 0) for a in selection.currentAtoms(): sum += a.element.mass center += a.element.mass * Vector(*a.coord().data()) print "center of mass:", center / sum I've also attached it as a file that you can just use File...Open (or "open") to run. --Eric On Nov 13, 2007, at 7:18 AM, Jean-Didier Maréchal wrote:
Hi everyone,
I have another question: what would be the easiest way to calculate the center of mass of a given set of atoms? In particular, is there a python module that already has this function implemented? I am interested in particular to find the center of mass of a ligand bound to a protein.
Thanks a lot, JD
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (2)
-
Eric Pettersen
-
Jean-Didier Maréchal