Buildstructure and xform coordinates
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)
On Dec 19, 2008, at 7:14 AM, Dr. Jean-Didier Maréchal wrote:
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?
Hi JD, When a new Model is open/created in Chimera, by default it is given the same transformation matrix as the lowest currently-open model. This is based on the presumption that frequently model coordinate systems are related and that therefore it is useful to show them in the relative positions that their raw coordinates imply. This presumption is hosing you: you want your new model to start with an identity matrix as its transformation matrix, since you are basing your model on the transformed coordinates of the existing model(s). So, you need to set your model's transform to be the identity. The first thing you should do is change your code a little so that your placing_points function returns the atom it placed (which is easy since the placeHelium function returns the new helium atom). So the last line of placing_points becomes:
return BuildStructure.placeHelium('com', model='scratch', position=center)
Then the last line of your script changes from:
placing_points(center)
to:
a = placing_points(center) a.molecule.openState.xform = chimera.Xform.identity()
I don't know if your center of mass of calculation will always be restricted to a single model (in your example it is), but if so then you can get away with using coord() instead of xformCoord() and I think your script will work without further changes in that case.
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
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)
Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
Gang,
Could you give me a brief update on the status of being able to use crystaleyes stereo (esp. for OSX). Possible, requirements?
thanks, Randy
On Fri, 9 Jan 2009, Randy Heiland wrote:
Gang,
Could you give me a brief update on the status of being able to use crystaleyes stereo (esp. for OSX). Possible, requirements?
thanks, Randy
Hi Randy,
For posterity, I'm going to give a little background first.
On all platforms, to use CrystalEyes, http://reald-corporate.com/scientific/, you need a workstation-class graphics card with a stereo DIN connector (ATI FireGL/FirePro, NVidia Quadro FX), and a display that supports a high refresh rate (>85Hz, 120Hz is ideal). Historically, for the desktop, the displays have been CRTs. But LCD technology is improving -- ViewSonic is due to release a 120Hz LCD, the VX2265wm, this quarter. You should also be aware of newer TVs from Samsung/Panasonic/Mitisubshi, that are "3D ready", use similar technology to CrystalEyes and may be compatible.
So for OS X 10.5:
Your only option is to use the Aqua version of chimera for stereo. Fortunately, it works well. If you want to use the X11 version of chimera in stereo, you'll need to replace the X11 application that comes with 10.5 with the _next_ version of XQuartz from http://xquartz.macosforge.org/trac/wiki, version 2.3.2. X11 stereo works in the 2.3.2 release candidate if you start chimera in stereo from the command line (and don't switch out).
For OX X 10.4:
Both the Aqua and the X11 versions of chimera should work in stereo. But we only test on 10.5. So we recommend that you use the Aqua version because OpenGL works better in Aqua.
Greg Couch UCSF Computer Graphics Lab
participants (4)
-
Dr. Jean-Didier Maréchal
-
Eric Pettersen
-
Greg Couch
-
Randy Heiland