From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Oct 31 2011 - 08:10:08 CDT

On Mon, Oct 31, 2011 at 8:09 AM, Mike Wykes <mikewykes_at_gmail.com> wrote:
> After a bit of tinkering, I got this to work. Just in case any other
> tcl novices want to try this in the future, here is the functioning
> command: It may be a bit long-winded, but it works.
>
> foreach {bond } [topo getbondlist none] {
>        set atomPairList [regexp -inline -all -- {\S+} $bond]

this line should not be needed.

>        set a1 [ lindex $atomPairList 0 ]
>        set a2 [ lindex $atomPairList 1 ]
>        label add Bonds "$mol/$a1" "$mol/$a2"}

you could simplify this code to:

 foreach bond [topo getbondlist none] { label add Bonds "$mol/[lindex
$bond 0]" "$mol/[lindex $bond 1]" }

cheers,
     axel.

> Many thanks for your help,
>
> Mike
>
> On 27 October 2011 18:42, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>>
>>
>> On Thu, Oct 27, 2011 at 12:43 PM, Mike Wykes <mikewykes_at_gmail.com> wrote:
>>>
>>> Hi there,
>>>
>>> I am a VMD novice and would greatly appreciate some help.
>>>
>>> Could someone tell me if it is possible to label all the
>>> covalent/coordinate bonds in a system (i.e. bonds shown by VMD when
>>> using the lines/bonds drawing method) without having to manually click
>>> every pair of bonded atoms ?
>>
>> topo getbondlist
>> should give you an easily digestable list of bonds
>> http://sites.google.com/site/akohlmey/software/topotools/topotools---documentation#TOC-getbondlist-type-order-both-none-
>> and then you just need to do a loop and generate the
>> labels using the "label" command.
>> http://www.ks.uiuc.edu/Research/vmd/current/ug/node131.html
>>>
>>> I imagine this must somehow be possible via the tcl command line, but
>>> I have no idea where to start.
>>>
>>> Could someone possibly point me in the right direction on how to go
>>> about generating the required command?
>>
>> so you would have to do something like this
>> (off the top of my head and completely untested)
>> set mol [molinfo top]
>> foreach {b1 b2} [topo getbondlist none] {
>>   label add Bonds "$mol/$b1" "$mol/$b2"
>> }
>> good luck,
>>      axel.
>>>
>>> Many thanks,
>>>
>>> Mike
>>
>>
>>
>> --
>> Dr. Axel Kohlmeyer
>> akohlmey_at_gmail.com  http://goo.gl/1wk0
>>
>> Institute for Computational Molecular Science
>> Temple University, Philadelphia PA, USA.
>>
>
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.