About the command "set z [lindex $coorList($i) 2]".

From: Boyang Wang (pkuwangboyang_at_yahoo.com.cn)
Date: Sat Apr 15 2006 - 19:47:04 CDT

  Hi all. I have a question about extracting z coordinate from a list of coordinates.
  In the configuration file sim_short.conf from the tutorial of pressure induced water flow, there is one line of command as follows,
  set z [lindex $coorList($i) 2]
  and this command line is to extract the z coordinate of the ith atom in the coorList. However, I don't see the reason of putting "2" at last. As z coordinate of an atom in the coorList should appear the last, which means I think it should be "3". I guess that the sequence of coordinates of an atom in the coorList should be x, y, z.
  Would anybody give me some advice?
  Thanks for your time!
 The sim_short.conf file contains a tclForcesScript, as follows,
 tclForces on
 tclForcesScript {
   set cellLengthZ 30.3962 ;# The length of the unit cell in the z-direction, should be the same as the value in "cellBasisVector3"
   set LowerBoundary -12.5
   set UpperBoundary 12.5
   set force {0 0 0.4}
   set watIdList {}
   for {set i 577} {$i<1320} {incr i 3} {
     lappend watIdList $i
     addatom $i
   proc calcforces {} {
     global cellLengthZ LowerBoundary UpperBoundary force watIdList
     loadcoords coorList
     foreach i $watIdList {
       set z [lindex $coorList($i) 2]
       set z [expr $z-round($z/$cellLengthZ)*$cellLengthZ] ;# Translate this coordinate into its corresponding value in the original unit cell
       if {$z>$UpperBoundary || $z<$LowerBoundary} {
         addforce $i $force

Boyang Wang,
Email - bwang9_at_uic.edu
Major - Phys. Chem.
dept Chemistry,
Univ Illinois, Chicago,
60607 IL US.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:43:32 CST