From: Ondrej Kroutil (
Date: Thu Oct 30 2014 - 08:49:09 CDT

Dear VMD users,
  I modified distance.tcl to get distance between water oxygen atom and
platinum atom. There is always 1 confined water molecule in the selection
but this molecule can have different id during simulation (1 water molecule
is replaced by another and so on).
  First I select whole water molecule (sel2), than I get an index of OW
atom (set ndx [$sel2 list] and set ow [lindex $ndx 0]). I need to select
whole water molecule because I will need to get also distances between Pt
and HW1 and Pt and HW2.
  The problem is that after processing of a script displayed below I always
get thist Pt-OW distance in the last frame for all frames:

0 3.5100714578446253
1 3.5100714578446253
2 3.5100714578446253
3 3.5100714578446253
4 3.5100714578446253

  There is maybe problem with update of selection or variable but I cannot
find it. I'm sorry I bother you with such a easy thing. I really tried hard
to solve it by myself and but I didn't succeeded ...
  Thanks a lot.

    Ondrej Kroutil

********************** **********************
********************** **********************
set sel1 [atomselect top "name Pt"]
set sel2 [atomselect top "same resid as (name OW and sqrt((x-6.81)*(x-6.81)
+ (y-6.81)*(y-6.81)) < 1.2 and within 5 of name Pt)"]
set nf [molinfo top get numframes]
set outfile [open pok.dat w]

for {set i 0} {$i < $nf} {incr i} {

  puts "frame $i of $nf"
  $sel1 frame $i
  $sel2 frame $i

  set ndx [$sel2 list]
  set ow [lindex $ndx 0]
  set owsel [atomselect top "index $ow"]

  set com1 [measure center $sel1]
  set com2 [measure center $owsel]

  set simdata($i.r) [veclength [vecsub $com1 $com2]]
  puts $outfile "$i $simdata($i.r)"

  $owsel delete
  unset ow
  unset com2
  unset com1
  unset simdata
close $outfile
********************** **********************

Ondřej Kroutil
        ,,              Faculty of Health and Social Studies
   ----"))'             University of South Bohemia
     OOO           Jirovcova 24, Ceske Budejovice
      OOO          The Czech Republic
        | OO         E-mail:
>------    O         Mobile:  +420 736 537 190