From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Nov 18 2004 - 17:06:08 CST

Hi,
  In regards to finding the starting point and endpoint of your
arrow for the best fit line calculated for a set of atoms, my suggestion
would be one of:
  a) If you want a better result, you could project the atoms onto the
     best fit line/ray, keeping the min/max distances from the line origin
     and using those as the arrow begin/end coordinate. This requires more
     calculation of course. Since none of the atoms really fall exactly
     on the line, this is a better solution, and if you base the start/end
     of off the min/max line coordinates from the projected atoms, you
     don't have to worry about making ordering assumptions, so it ought
     to "just work". There's probably an elegant way of coding this but
     I don't have time to write it for you.

  b) Assume that atoms occur spatially in the same sequence that they
     occur in increasing index, so choose the first atom as the starting
     point, this is cheesy, but may be sufficient for your purpose.

  John Stone
  vmd_at_ks.uiuc.edu

On Thu, Nov 18, 2004 at 04:53:46PM +0000, Anthony Ivetac wrote:
> Hi John,
>
> Many thanks for your reply to my request on how to draw vectors as
> arrows. My only problem now is working out how to identify the 'start'
> and 'end' coordinates of my line-of-best-fit vectors, which are
> generated in:
>
> http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/att-2279/fit_angle.tcl
>
> The procedure "sel_sel_angle {sel1 sel2}" takes 2 atom selections and
> then passes the coordinates of the atoms in each selection to a
> procedure called "lsq {x}", which calculates the line of best fit for
> the atoms in that dimension (x,y or z).
>
> I was wondering if you could help me identify where the coordinates for
> the start and end of the vector lie, though? I guess the line of best
> fit doesn't really have a specific start and end though?
>
> Many thanks for any help,
>
> Tony
>
>
> >Hi,
> > There's a simple example procedure in the VMD User's Guide that
> >illustrates a simple way to draw arrows/vectors:
> >
> >proc vmd_draw_arrow {mol start end} {
> > # an arrow is made of a cylinder and a cone
> > set middle [vecadd $start [vecscale 0.9 [vecsub $end $start]]]
> > graphics $mol cylinder $start $middle radius 0.15
> > graphics $mol cone $middle $end radius 0.25
> >}
> >
> >The example in the User's Guide shows how to use this to add new
> >"draw" commands that are easy to use:
> > http://www.ks.uiuc.edu/Research/vmd/current/ug/node112.html
> >
> > John
> >
> >On Tue, Nov 16, 2004 at 02:53:35PM +0000, Anthony Ivetac wrote:
> >
> >>Hi,
> >>
> >>I am interested in calculating the angle formed between the axes of 2
> >>domains in my protein, for different frames of a simulation trajectory.
> >>
> >>I have used the script 'fit_angle.tcl' - see here:
> >>
> >>http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/att-2279/fit_angle.tcl
> >>
> >>This script takes 2 atom selections and fits a vector to each - it then
> >>calculates the angle formed between the 2 vectors and outputs this. It
> >>can do it for a single structure, and also multiple frames.
> >>
> >>I am wondering how I can visualise the vectors it fits to the atoms in
> >>VMD, superimposed onto my protein? Something like the
> >>'cylinder-and-cone' representation used to draw principal axes in this
> >>script:
> >>
> >>http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/orient/
> >>
> >>The orient.tcl script has a function to draw a vector, but I am not sure
> >>which variables in the fit_angle.tcl script hold the vectors I need to
> >>draw and how to do this.
> >>
> >>Many thanks,
> >>
> >>Tony

-- 
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