From: Ekta Khurana (ekta_at_VITAE.CMM.UPENN.EDU)
Date: Tue Mar 16 2004 - 14:57:36 CST

Hi,
   My system consists of two surfactant monolayers at vacuum/water
interface.I want to create a density profile of various residues from the
dcd files.I have 954 water residues.I am using a TCL script to do that but
it is taking too long to get the information for water residues(more than
a day!)I just load the dcd file and source the script in the vmd TkCon
window.The script as shown below reads the coordinates of oxygen atoms of
TIP3 residues and assigns them to 36 different bins depending on their z
coordinate.Can anyone suggest how I can make it faster?
.........................................................

set fa [open out.dat w]
 for {set j 1} { $j < 37} {incr j} {
    set bin($j) 0
    }
for {set res 128} { $res < 10181 } {incr res} {
    set sel [atomselect top "resname TIP3 and name OH2 and residue $res"]
    set nf [molinfo top get numframes]
    for {set i 0 } { $i < $nf } {incr i } {
        $sel frame $i
        $sel update
        set dz 1.25
        set z [$sel get z]
        set z1 [expr {$z/$dz}]
        set n 1
        for { set c 8} {$c < 45 } {incr c} {
        if {$z1>$c && $z1<=($c+1)} {
                incr bin($n)
                }
              incr n
            }
        }
    }
set md 10.625
for { set n 1} { $n < 37} {incr n} {
puts $fa "$md $bin($n)"
 set new [expr {$md+1.25} ]
 set md $new
}

close $fa
.............................................................

Thanks
Ekta