From: Justin Gullingsrud (jgulling_at_mccammon.ucsd.edu)
Date: Tue Mar 30 2004 - 17:53:44 CST

Hi,

On Tue, Mar 30, 2004 at 05:44:03PM -0500, Satyavani Vemparala wrote:
>
> Hi:
>
> Iam trying to find the vector subtraction and the following doesn't work:
>
> set atm1 [atomselect top "resname TYR and resid 277 and name CG"]
> set atm2 [atomselect top "resname TYR and resid 277 and name CE1"]
> set atm3 [atomselect top "resname TYR and resid 277 and name CE2"]
>
> set coord1 [$atm1 get {x y z}]
> set coord2 [$atm2 get {x y z}]
> set coord3 [$atm3 get {x y z}]
>
> set vec1 [vecsub $coord1 $coord2]
>
> The error i get is
> vecsub: non-numeric in first argument
>
> can not "vecsub" take variables as inline input?

The reason is that coord1, coord2, and coord3 are all nested lists, i.e.
they look like this:

 {{a b c}}

instead of this:

  {a b c}

The solution is to do this:

  set coord1 [lindex [$atm get {x y z}] 0]

and the same for the others; this takes the first element of the list,
getting rid of the outer nesting.

Cheers,
Justin

>
> Vani
>