help with TCL forces script

From: Jim Pfaendtner (
Date: Sun Apr 27 2008 - 05:47:30 CDT

dear namd-l,

I am trying to apply a fixed force to a group of atoms in my protein
and have the direction of that force be defined by a vector between
two other atoms. The direction of the force is not applied correctly
and the group of atoms is not moving in the right direction. I think
I am doing something wrong with the loadcoords part of my TCL forces
script. I have pasted the essentials of the script below. Are there
any obvious problems?

set aid1 100
set aid2 200 #the vector between atom 100 and atom 200 defines the
direction of my force
addatom aid1
addatom aid2
set group [addgroup {1 2 3 4 5 6 ....}] #group contains all the atoms
to have force applied
set k 50

   proc calcforces {} {
     global aid1 aid2 group k
     loadcoords p
     #calculate normalized vector
     set bondv [vecsub $p($aid2) $p($aid1)]
       ... normalize vector
     set force [vecscale $k $bondv]
     #apply forces
     addforce $group $force

When I look at the simulation results the direction of motion of the
group of atoms does not seem to correspond to the vector defined in
the script. My guess is that I am doing something wrong with the
atoms/group and loading the coordinates.

I appreciate any suggestions!


This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:49:25 CST