[chimera-dev] Buildstructure and xform coordinates

Dr. Jean-Didier Maréchal jeandidier.marechal at uab.cat
Fri Dec 19 07:14:19 PST 2008


Dear all,

Based on early queries, I am now using xform coord for most of my scripts.
However, now I have a problem because I have mixture between xforms and
coord.

For example, I want to place a helium at the center of mass of the molecular
and having previously calculated it using xform coordinates... The center of
mass is therefore located at another part of the space.

How could I transform on set of coords to the other? 

Thanks for any help!
JD

Here is the script

from chimera import selection
from chimera import Point, Vector, Xform
import BuildStructure

def com(sub):
    for i in range(len(sub.atoms)):
        sumi=0
        center = Vector(0, 0, 0)
        for a in sub.atoms:
            sumi += a.element.mass
            center += a.element.mass * Vector(*a.xformCoord().data())
        center_point=Point(center[0]/sumi,center[1]/sumi,center[2]/sumi)
    return center_point

def placing_points(center):
    #pt=Point(center[0]/sum,center[1]/sum,center[2]/sum)
    #print pt
    BuildStructure.placeHelium('com', model='scratch', position=center)

ligand = selection.currentResidues()[0]
center=com(ligand)
placing_points(center)






More information about the Chimera-dev mailing list