From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Oct 12 2009 - 12:41:31 CDT

On Mon, 2009-10-12 at 18:11 +0200, politr_at_huji.ac.il wrote:
> Dear VMD users and developers,

dear regina,

> Does anyone knows how can I get from topology file a list of atoms that
> covalently bonded to some predefined atom that always changes. Let say
> I'm interested to get all atoms that are covalently bonded to oxygens. I
> don't want to do it based on the distance as i need the exact
> information. The only way I'm familiar with is to make a list by myself:

this information is available through atomselect functions. try:

set sel [atomselect top {name "O.*"}]
set blist [$sel getbonds]
set aidx [$sel list]

now $blist should contain a list of lists with the indices
that each atom matching the selection string is bound to
from the topology data that VMD has available, so you could
do something like this:

set j 0
foreach i $aidx b $blist {
  puts "oxygen index $i is bound to [lindex $blist $j]"
  incr j
}

HTH,
   axel.

> to define that if the oxygen 's type is OG then the covalently boded
> carbon atom is CB etc. Is there any other way to do it?
> Thank you for your help
> Regina
>

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com 
Institute for Computational Molecular Science
College of Science and Technology
Temple University, Philadelphia PA, USA.