[chimera-dev] python equivalent for Axis

Tom Goddard goddard at cgl.ucsf.edu
Thu Nov 13 12:47:59 PST 2008


Hi JD,

  In Chimera 1.4 daily builds (not release candidate) the "turn" command 
has been upgraded to allow rotating whole models about an arbitrary axis 
and center:

    turn 0.8,0.5,0.1 35 center 10,15,20 coordinateSystem #0 models #0

This turns model 0 by 35 degrees around the center point and axis 
(0.8,0.5,0.1) specified in model #0 coordinates.

  The turn command can't move a subset of atoms in a model.  It just 
changes the overall model transform.  To move a few atoms you need to 
change atom coordinates as is done by MoveSelection.  I've attached a 
bit of Python code as an example.  Getting the transforms right is tricky.

    Tom

Jean-Didier Maréchal wrote:
> Hi Eric,
> thanks a lot for this that's just perfect!
>
> I'm afraid that I have another question. Could you tell me what is the 
> easiest way to rotate only one model or a given selection of a model 
> around an axis passing through its center of rotation?
>
> What I am trying to do is to rotate only one model (or a subset of one 
> model :a water molecule,  a ligand etc..) around one of these 
> calculated axis. Basically, I am trying to pilot in my script a 
> similar thing that the "movement--> movement mouse mode" does with the 
> "move selection mode". I thought I had clear in mind how of deal with 
> Xform, but I can't get work and get mixed up. I looked at the 
> MoveSelection scripts for inspiring me but I get stuck.
>
> Thanks for any help
>
> JD
>  
>
> 2008/11/10 Eric Pettersen <pett at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>>
>
>     Hi JD,
>            The StructMeasure.bestLine routine almost does what you
>     want, but although it returns the eigenvectors, it doesn't return
>     the eigenvalues (!) which makes it kind of useless.  I'll be
>     fixing that in tonight's build.  At any rate, you can just
>     conscript the underlying code:  if your list of atoms is in the
>     variable "atoms", then this will get you the eigenvectors/values:
>
>            coords = chimera.numpyArrayFromAtoms(atoms)
>            centroid = coords.mean(0)
>            centered = coords - centroid
>            from numpy.linalg import svd
>            ignore, vals, vecs = svd(centered)
>
>     --Eric
>
>
>     On Nov 8, 2008, at 7:00 AM, Dr. Jean-Didier Maréchal wrote:
>
>         Dear all,
>
>         Sorry to bother you again with a similar kind of question, but
>         I'd like my
>         script to stock in an array the three resulting vectors of the new
>         implemented calculation of the axes for a given set of
>         selected atoms. The
>         truth is that I find the right python call for the axis
>         function. I imported
>         StructMeasure and tried different ways around but I can't find
>         my way
>         through. I don't know if I don't give the wrong arguments or
>         have the wrong
>         syntaxes.
>
>         Thanks a lot for any help,
>
>         JD
>
>
>         -----Mensaje original-----
>         De: chimera-dev-bounces at cgl.ucsf.edu
>         <mailto:chimera-dev-bounces at cgl.ucsf.edu>
>         [mailto:chimera-dev-bounces at cgl.ucsf.edu
>         <mailto:chimera-dev-bounces at cgl.ucsf.edu>] En nombre de
>         chimera-dev-request at cgl.ucsf.edu
>         <mailto:chimera-dev-request at cgl.ucsf.edu>
>         Enviado el: jueves, 06 de noviembre de 2008 21:00
>         Para: chimera-dev at cgl.ucsf.edu <mailto:chimera-dev at cgl.ucsf.edu>
>         Asunto: Chimera-dev Digest, Vol 58, Issue 2
>
>         Send Chimera-dev mailing list submissions to
>                chimera-dev at cgl.ucsf.edu <mailto:chimera-dev at cgl.ucsf.edu>
>
>         To subscribe or unsubscribe via the World Wide Web, visit
>                http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
>         or, via email, send a message with subject or body 'help' to
>                chimera-dev-request at cgl.ucsf.edu
>         <mailto:chimera-dev-request at cgl.ucsf.edu>
>
>         You can reach the person managing the list at
>                chimera-dev-owner at cgl.ucsf.edu
>         <mailto:chimera-dev-owner at cgl.ucsf.edu>
>
>         When replying, please edit your Subject line so it is more
>         specific
>         than "Re: Contents of Chimera-dev digest..."
>
>
>         Today's Topics:
>
>          1. atom spec. in BNF (David A. C. Beck)
>          2. Re: atom spec. in BNF (Eric Pettersen)
>
>
>         ----------------------------------------------------------------------
>
>         Message: 1
>         Date: Wed, 5 Nov 2008 14:03:02 -0800 (PST)
>         From: "David A. C. Beck" <dacb at u.washington.edu
>         <mailto:dacb at u.washington.edu>>
>         Subject: [chimera-dev] atom spec. in BNF
>         To: chimera-dev at cgl.ucsf.edu <mailto:chimera-dev at cgl.ucsf.edu>
>         Message-ID:
>              
>          <Pine.LNX.4.64.0811051401230.9881 at homer23.u.washington.edu
>         <mailto:Pine.LNX.4.64.0811051401230.9881 at homer23.u.washington.edu>>
>         Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
>         Does anyone have BNF notation for the atom specification
>         'language' used
>         by Chimera?  Thanks,
>          - David
>
>         --
>         David A. C. Beck, Ph.D.
>         dacb at u.washington.edu <mailto:dacb at u.washington.edu>
>         Valerie Daggett Laboratory
>         University of Washington, Seattle
>
>
>         ------------------------------
>
>         Message: 2
>         Date: Wed, 5 Nov 2008 14:26:16 -0800
>         From: Eric Pettersen <pett at cgl.ucsf.edu
>         <mailto:pett at cgl.ucsf.edu>>
>         Subject: Re: [chimera-dev] atom spec. in BNF
>         To: "David A. C. Beck" <dacb at u.washington.edu
>         <mailto:dacb at u.washington.edu>>
>         Cc: chimera-dev at cgl.ucsf.edu <mailto:chimera-dev at cgl.ucsf.edu>
>         Message-ID: <88F81EBE-CCD4-495F-9316-FEA5D095965D at cgl.ucsf.edu
>         <mailto:88F81EBE-CCD4-495F-9316-FEA5D095965D at cgl.ucsf.edu>>
>         Content-Type: text/plain; charset="us-ascii"
>
>         On Nov 5, 2008, at 2:03 PM, David A. C. Beck wrote:
>
>             Does anyone have BNF notation for the atom specification
>             'language'
>             used
>             by Chimera?
>
>
>         I don't think so.  What's the use case here?  If you're in the
>         context
>         of Chimera, you should be able to use Chimera's own atom-spec
>         parsing
>         facilities, e.g. chimera.specifier.evalSpec().  Outside of
>         Chimera,
>         I'm aware of a pretty extensive but not totally complete parser in
>         perl:  Chemistry::MidasPattern - Select atoms in macromolecules -
>         search.cpan.org <http://search.cpan.org>
>
>         --Eric
>
>                                Eric Pettersen
>                                UCSF Computer Graphics Lab
>                                http://www.cgl.ucsf.edu
>
>         -------------- next part --------------
>         An HTML attachment was scrubbed...
>         URL:
>         http://www.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20081105/4e237100/
>         attachment-0001.html
>
>         ------------------------------
>
>         _______________________________________________
>         Chimera-dev mailing list
>         Chimera-dev at cgl.ucsf.edu <mailto:Chimera-dev at cgl.ucsf.edu>
>         http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
>
>
>         End of Chimera-dev Digest, Vol 58, Issue 2
>         ******************************************
>
>         _______________________________________________
>         Chimera-dev mailing list
>         Chimera-dev at cgl.ucsf.edu <mailto:Chimera-dev at cgl.ucsf.edu>
>         http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
>   

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rotatoms.py
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20081113/a5ba53cf/attachment.ksh>


More information about the Chimera-dev mailing list