From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Mon Dec 29 2014 - 06:14:52 CST

I'd use:

measure bond [list $a $b]

-Josh Vermaas
On 12/29/14 1:23 AM, sunyeping wrote:
> Dear all,
>
> I want to measure the distance of two atoms by the vmd command
> "measure bond". For example, the two atoms with their index being 10
> and 20 respectively. By using the command:
>
> measure bond {10 20}
>
> I can correctly get the distance between these atoms, say 1.711A.
> However, I don't know how the use variable to replace the two numbers
> that represent the indexes of these atoms. For example, I set the two
> numbers to two variable, a and b:
>
> set a 10
> set b 20
>
> then I use the command:
>
> measure bond {$a $b}
>
> it returns the following error message: expected integer but got "$h"
> measure bond: bad atom index.
>
> In TCL language, the varialbe replacement symbol "$" can not work in
> the curly brace ({ }), but measure bond definitely need the the curly
> brace . So how this conflict be solved?
>
> Thanks in advance!
>
> Yeping Sun
>
> Institute of Microbiology, Chinese Academy of Sciences
>
>