
Dear Chimerians... I'm running an analysis about H-bonds geometries in several models. I need to measure the distance of a H-bond and the angle formed with a third atom bonded to one of the H-bond atoms. How could I do that in a python IDLE/script? In a more general way, how could I measure the angle between three atoms linked by a bond o pseudobond? Thanks in advance Yasser -- Yasser Almeida Hernández, BSc. Center of Molecular Immunology (CIM) Tumor Biology Department 216 St.& 15th Ave, Siboney, Playa P.O.Box 16040, Havana 11600 CUBA Phone: (+53-7) 214-3178 almeida@cim.sld.cu<mailto:almeida@cim.sld.cu>

Hi Yasser, It does not matter if the atoms are bonded or not. You could name any 3 or 4 atoms (for "valence" or "torsion" type of angle), for example with command: angle :2.a@ca:4.a@ca:6.b@ca (angle formed by three CA atoms: in residue 2 chain A, residue 4 chain A, residue 6 chain B) Or, instead of using names, you could select atoms (in order) with the mouse and then use: angle sel Angle command: <http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/angle.html> How to specify atoms by name: <http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/atom_spec.html#subcats> I can't answer the Python part, except that there are some basic scripting instructions here: <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco On Sep 26, 2012, at 11:04 AM, Yasser Almeida Hernandez wrote:
Dear Chimerians...
I'm running an analysis about H-bonds geometries in several models.
I need to measure the distance of a H-bond and the angle formed with a third atom bonded to one of the H-bond atoms. How could I do that in a python IDLE/script?
In a more general way, how could I measure the angle between three atoms linked by a bond o pseudobond?
Thanks in advance
Yasser

On Sep 26, 2012, at 11:04 AM, Yasser Almeida Hernandez wrote:
Dear Chimerians...
I'm running an analysis about H-bonds geometries in several models.
I need to measure the distance of a H-bond and the angle formed with a third atom bonded to one of the H-bond atoms. How could I do that in a python IDLE/script?
In a more general way, how could I measure the angle between three atoms linked by a bond o pseudobond?
In regards to the Python part, probably the single most salient fact is that there is an "angle" function in the chimera module, i.e.: chimera.angle(a1.coord(), a2.coord(), a3.coord()) returns the a1-a2-a3 angle in degrees formed by the Python Atom objects. If the Atoms could be in different models, then use .xformCoord() rather than .coord(). So, how to get an Atom object? Let's say you've selected the Atom by some means, then: a = chimera.selection.currentAtoms()[0] would get you the selected Atom object. Along the same lines, if you've selected a (covalent) Bond, then: b = chimera.selection.currentBonds()[0] a1, a2 = b.atoms would get you the two Atoms that form the bond. If the third Atom of interest is a neighbor of a1 or a2 then you could look through a1.neighbors or a2.neighbors to find it (FYI an Atom's name is a.name). Hydrogen bonds are PseudoBonds, so an analogous procedure could be used with chimera.selection.currentPseudobonds(). It sounds like you may want to run the hydrogen-bond finding code directly in your Python script, which will return a list of donor/acceptor Atom pairs, which you could then use in your angle call once you've found the third atom that you care about. This is how: from FindHBond import findHBonds da_list = findHBonds(chimera.openModels.list(modelTypes=[chimera.Molecule])) that call will return only hbonds meeting the strict angle/distance cutoff parameters. If you want to use the default GUI/command relaxed parameters (+0.4 angstroms / +20 degrees), then use this code instead: from FindHBonds import findHBonds, recDistSlop, recAngleSlop da_list = findHBonds(chimera.openModels.list(modelTypes=[chimera.Molecule]), distSlop=recDistSlop, angleSlop=recAngleSlop) --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
participants (3)
-
Elaine Meng
-
Eric Pettersen
-
Yasser Almeida Hernandez