From: Ivan Degtyarenko (imd_at_fyslab.hut.fi)
Date: Fri Feb 23 2007 - 10:18:16 CST

Dear All,

could someone help with scripting? How to get a list out of "get {x y z}"?
Here is an example

vmd > set n [atomselect top {index 0} frame 0]
atomselect0
vmd > set h1 [atomselect top {index 3} frame 0]
atomselect1
vmd > set nh1 [vecdist [$n get {x y z}] [$h1 get {x y z}]]
vecsub: non-numeric in first argument

the error it is due to [$n get {x y z}] returns a single value but not a
list

vmd > foreach i [$n get {x y z}] {puts $i}
15.8505477905 12.2714548111 14.0315284729

and splitting gives:

vmd > foreach i [split [$n get {x y z}]] {puts $i}
{15.8505477905
12.2714548111
14.0315284729}

while construction like this works fine:

vmd> set nh1 [vecdist "[$n get x] [$n get y] [$n get z]" \
                       "[$h1 get x] [$h1 get y] [$h1 get z]"];

So, the questions how to make "vecdist [$n get {x y z}] [$h1 get {x y z}]"
work in one string?

Ivan Degtyarenko