From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Oct 30 2002 - 10:02:35 CST

Hi Marc,
  I still think that using (well, abusing in this case :-)
the best-fit code in VMD is the easiest way to do what you need:
Rather than fit the whole structure, just fit 3 atoms of interest,
just as you say, something in the center, some residue X pointing out
of the screen, and some residue Y pointing in another consistent direction.
You'll need at least 3 atoms to come up with correction matrix to bring
the other structures into the same viewing orientation. Now, instead of
applying the transformation matrix to the atom coordinates themselves,
you could also apply it to the viewing transformation matrix, and you
should be able to accomplish exactly the same thing, without actually
altering the atom coordinates. The advantage to this would be that you
would not alter the coordinates. The disadvantage is that you will have
to setup a callback that calculates and updates the modified viewing
transformation matrix every time the frame changes.

Yet another way to do this is to calculate translations and Euler angle
rotations and to do your viewing changes instead of doing them in matrix
form, but I think you'll find that its a lot easier to use the best-fit
way of doing this than to write out all of the code to calculate the
angles of rotation etc.

If what I've written isn't clear, let me know and we can discuss
this some more and hopefully get you up and running with results soon.
 
Thanks,
  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Oct 30, 2002 at 11:33:26AM +0000, Marc Baaden wrote:
>
> Hi John,
>
> thanks for your answer. In fact this is not really what I was looking
> for. But I realize that my question was ill-defined. In fact the only
> thing I really want/need is to set the viewpoint in a similar fashion
> for every coordinate set loaded. The "problem" is that as I load each
> coordinate set seperately, there is no reference structure to fit or
> compare to.
>
> So I was looking for a simple general definition, like: look at the
> protein such that its geometrical centre is in the centre of the screen
> and that residue X is pointing towards you.
>
> I am trying to translate this into "VMD language", and that's where
> I would need some assistance. I guess I have to simply set the viewpoints
> with some magically calculated matrices.
>
> johns_at_ks.uiuc.edu said:
> >> Hi Marc,
> >> It sounds like what you want to do could be done by doing a best-fit
> >> alignment on a subset of the atoms. There's an example of how do
> >> this in the VMD User's Guide:
> >> http://www.ks.uiuc.edu/Research/vmd/vmd-1.7.1/ug/node185.html
>
>
> Concerning the "proper lighting", usually the default view in VMD is
> nicely lit, if you render the scene. But if you change the viewpoint,
> you might get shadows/unlit areas that are not so nice. So the question
> was, how do I re-create, once my viewpoint is chosen, the kind of default
> lighting with respect to that position.
>
> >> I'm not sure what you're second question about "proper lighting" is
> >> referring to, so I'll wait to answer that until you determine if the
> >> best-fit alignment feature above does in fact solve your problem.
>
>
> I hope I outlined my questions in a better way, if not feel free to
> ask for more details.
>
> Thanks,
> Marc
>
>
> --
> Dr. Marc Baaden - Laboratory of Molecular Biophysics, Oxford University
> mailto:baaden_at_smplinux.de - ICQ# 11466242 - http://www.marc-baaden.de
> FAX/Voice +49 697912 39550 - Tel: +44 1865 275380 or +33 609 843217
>

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