**From:** Jeff Wereszczynski (*jmweresz_at_umich.edu*)

**Date:** Thu Dec 06 2007 - 11:43:45 CST

**Next message:**Xu, Jiancong: "RE: Generating a gromacs topology file for analyzing NAMD trajectories"**Previous message:**Jim Pfaendtner: "Simple TCL (Forces) question - defining bond vector"**In reply to:**Jim Pfaendtner: "Simple TCL (Forces) question - defining bond vector"**Next in thread:**Victor Ovchinnikov: "Re: Simple TCL (Forces) question - defining bond vector"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ] [ attachment ]

I believe this syntax should work:

set bond2 [vecadd $p($aid1) [vecscale -1 $p($aid2)] ]

Jeff

On Dec 6, 2007 10:33 AM, Jim Pfaendtner <jpfaendt_at_hec.utah.edu> wrote:

*> Dear NAMD-L,
*

*>
*

*> I am trying easily to define a vector between two atoms inside of a
*

*> TCL forces script. Taking a cue from the tutorial I have written this:
*

*>
*

*> .. intro stuff defining aid1 and aid2 ...
*

*>
*

*> addatom $aid1
*

*> addatom $aid2
*

*> proc calcforces {} {
*

*>
*

*> global aid1 aid2 k
*

*> loadcoords p
*

*> set bond [getbond $p($aid1) $p($aid2)]
*

*>
*

*> ###
*

*> set bond2 [please help me here :) ]
*

*> ###
*

*> addenergy [expr $k*$bond*$bond]
*

*> set force [vecscale [expr -$k*2] $bond2]
*

*> addforce $aid1 $force
*

*> addforce $aid2 $force
*

*> }
*

*> }
*

*>
*

*> I know that bond2 needs to be a vector that is simply equal to:
*

*> $p($aid1) - $p($aid2) but I can't get the syntax right and I struck
*

*> out searching.
*

*>
*

*> Could someone please suggest the correct syntax for defining a new
*

*> vector as the difference of two other vectors?
*

*>
*

*> Thanks very much,
*

*> Jim
*

*>
*

*>
*

*>
*

**Next message:**Xu, Jiancong: "RE: Generating a gromacs topology file for analyzing NAMD trajectories"**Previous message:**Jim Pfaendtner: "Simple TCL (Forces) question - defining bond vector"**In reply to:**Jim Pfaendtner: "Simple TCL (Forces) question - defining bond vector"**Next in thread:**Victor Ovchinnikov: "Re: Simple TCL (Forces) question - defining bond vector"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ] [ attachment ]

*
This archive was generated by hypermail 2.1.6
: Wed Feb 29 2012 - 15:45:40 CST
*