From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Apr 14 2005 - 16:23:19 CDT

Charles,
  I just ran your script and it works perfectly as-written on my
test machine here in the lab. I get a red line that starts at one
of the CA atoms, and runs to the origin. You can verify this for
yourself by creating a VDW rep with an atom selection of
"name CA and index 1" (just to be paranoid), run your script,
and you'll see that your red line goes right up to the CA atom.
If there's doubt, you can draw another sphere at the origin using
Tcl just to check, with "draw sphere { 0 0 0 }". I got this to work
fine on my box here. Please re-test on your machine. If you still
have problems getting the correct result, then it is possible that
there's a problem with the Python build in your VMD version, or
something else that's platform or machine specific.

Thanks,
  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Apr 13, 2005 at 06:40:54PM -0500, Charles Moad wrote:
> The scale is flat out wrong if I don't adjust it. I am expecting a line
> from the center of the scene to the first alpha carbon. (code below)
> It is close so I am guessing there needs to be some small adjustment to
> the center/translation. The rotations are identical.
>
> Thanks for looking at this,
> Charlie
>
> -------------------------------------------------------
> import Molecule as mol
> import AtomSel as sel
> import vmdnumpy
> import graphics as gl
> import molecule
> import trans
>
> m = mol.Molecule()
> m.load('1di9', filetype='webpdb')
> mid = int(m)
>
> cas = sel.AtomSel('name CA', mid)
> cas.frame(0)
>
> cgo = molecule.load('graphics', 'test')
> # Move to pdb coord system
> trans.set_center(cgo, trans.get_center(mid))
> trans.set_scale(cgo, trans.get_scale(mid))
>
> x, y, z = cas.get('x', 'y', 'z')
> gl.color(cgo, 'red')
> gl.line(cgo, (0,0,0), (x[0], y[0], z[0]), width=3)
> -------------------------------------------------------
>
> John Stone wrote:
> > Charles,
> > Can you send me the script you're performing these commands within?
> > I can probably be more helpful if I could see what you're actually doing
> > beyond these two lines. The scale command you've got there may be causing
> > troubles. When you say it does not appear correct, do you have any
> > judgement as to whether the origin, scale, or both are being drawn incorrectly
> > for your graphics object? Did you do anything else with your transforms
> > before this code is executed, or after?
> >
> > John Stone
> > vmd_at_ks.uiuc.edu
> >
> > On Sun, Apr 10, 2005 at 07:13:31PM -0500, Charles Moad wrote:
> >
> >>What is the correct way to draw a graphics object in a pdb's coordinate
> >>system in python? I tried:
> >>
> >>trans.set_center(cgo, trans.get_center(mid))
> >>trans.set_scale(cgo, trans.get_scale(mid))
> >>
> >>Where cgo is the id of the graphics object, and mid is the molecule's id.
> >>
> >>This does not appear correct.
> >>
> >>Thanks,
> >> Charlie
> >
> >

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078