[Chimera-users] bond selection

Eric Pettersen pett at cgl.ucsf.edu
Fri Mar 11 15:43:00 PST 2011

On Mar 10, 2011, at 8:53 AM, Elisabeth Ortega wrote:

> Dear Chimera Dev. Team,
> I have a little question for you. How can I select a bond using the  
> Command Line (or the IDLE)?

As Elaine mentioned, in the Command Line selecting atoms will also  
select the bonds between them.  To select just one bond, you have to  
use Python/IDLE.  This fragment of Python code would be used to get  
the bond between atoms a1 and a2:

	b = a1.bondsMap[a2]

to cause it to become selected in the graphics window:

from chimera.selection import setCurrent

[setCurrent make the selection the same as what you specify (i.e. the  
previous selection is replaced).  You would instead use addCurrent if  
you want to add to the current selection]

Now, how you would get a1 and a2 is kind of up to you.  If they were  
the only two atoms in the current selection, then this would do it:

from chimera.selection import currentAtoms
a1, a2 = currentAtoms()

I'd need to know more about your usage scenario in order to give any  
better advice.  But maybe the above is good enough?


                         Eric Pettersen
                         UCSF Computer Graphics Lab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20110311/df5c18c9/attachment.html>

More information about the Chimera-users mailing list