From: Justin Gullingsrud (justinrocks_at_gmail.com)
Date: Wed Jan 05 2005 - 10:29:51 CST

Hi,

On Wed, 5 Jan 2005 09:29:52 +0100 (CET), Axel Kohlmeyer
<axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de> wrote:
> On Tue, 4 Jan 2005, Uday Chippada wrote:
>
> UC> Hello everybody,
>
> hello uday,
>
> UC> I am trying to represent (show in graphics window) the hydrogen bonds
> UC> formed between two chains using VMD, which means an atom of chain A
> UC> has to form a hydrogen bond with an atom of chain B. I dont want to
> UC> show the hydrogen bonds formed between atoms of the same chain.

Finding the H-bonds themselves can actually be done directly with the
"measure hbonds" command. This command lets you specify different
selections for donors and acceptors. Here's a link to more
information about the command:
http://www.ks.uiuc.edu/Research/vmd/current/ug/node121.html

Once you have the list of donors and acceptors, you would have to draw
the hbonds manually using the 'draw' or 'graphics' commands. Here's a
rough sketch of what such a script would look like:

# draw_hbonds: draw cylinders between hydrogen and acceptor atoms in
hydrogen bonds
# formed between two selections. Cutoff and angle are also specified.
proc draw_hhbonds { cutoff angle sel1text sel2text} {
  set a [atomselect top $sel1text]
  set b [atomselect top $sel2text]
  set coords [[atomselect top all] get {x y z}]
  
  # get hbonds with 1 as donor and 2 as acceptor
  foreach { d1 a1 h1 } [measure hbonds $cutoff $angle $a $b] break
  # get hbonds wiith 2 as donor and 1 as acceptor
  foreach { d2 a2 h2 } [measure hbonds $cutoff $angle $b $a] break
  # combine the lists
  set hyd [concat $h1 $h2]
  set acc [concat $a1 $a2]
  # draw them!
  draw delete all
  foreach hi $hyd ai $acc {
    set hpos [lindex $coords $hi]
    set apos [lindex $coords $ai]
    draw cylinder $hpos $apos radius 0.2
  }
}

You would use this script by typing something like the following on
the command line:
  draw_hbonds 3.0 45 {chain A} {chain B}

Hope this helps,
Justin

>
> UC> Please tell me how this can be done.
>
> as far as i can tell, this cannot be done with the HBonds
> representation directly. i have been asking to have something
> similar for DynamicBonds as well for quite some time. but of
> course somebody has to program it, and it is a bit tricky to
> get it right.
>
> you should be able to do it manually, if you are familiar
> with the VMD scripting capabilities.
>
> - you can use 'measure hbonds' to get a list of the hydrogen bonds.
> in fact you'll get three lists with the indices of the donor,
> acceptor, and hydrogen atoms.
>
> - now you loop through the list and weed out all entries, where
> acceptor and donor are from the same chain.
>
> - from the remaining lists you retrieve the coordinates
> of the hydrogens and acceptors and then use the graphics
> (or draw) command to draw lines between those atoms.
>
> - of course if you want to animate this, you can put it in a subroutine
> which can be called via tracing vmd_frame() and then deletes and
> redraws everything.
>
> hmmm.... come to think of it, this could be a useful addition to
> the collection of vmd scripting on my homepage.
> if you can send me (an) example file(s), i may give it a try
> since i now have an idea for how to work around my similar
> problems with the dynamic bonds as well. ;-)
>
> regards,
> axel.
>
> UC>
> UC> Sincerely
> UC> Uday Chippada.
>
> --
>
> =======================================================================
> Dr. Axel Kohlmeyer e-mail: axel.kohlmeyer_at_theochem.ruhr-uni-bochum.de
> Lehrstuhl fuer Theoretische Chemie Phone: ++49 (0)234/32-26673
> Ruhr-Universitaet Bochum - NC 03/53 Fax: ++49 (0)234/32-14045
> D-44780 Bochum http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
> =======================================================================
> If you make something idiot-proof, the universe creates a better idiot.
>
>

-- 
The spirit of Plato dies hard.  We have been unable to escape the
philosophical tradition that what we can see and measure in the world
is merely the superficial and imperfect representation of an
underlying reality.
                -- S.J. Gould, "The Mismeasure of Man"