VMD-L Mailing List
From: Justin Gullingsrud (jgulling_at_mccammon.ucsd.edu)
Date: Tue Mar 16 2004 - 16:36:08 CST
- Next message: Saladino, Alex: "HOLE output visualization"
- Previous message: John Stone: "Fwd: Announce: STRAP"
- In reply to: Ekta Khurana: "density profile"
- Next in thread: John Stone: "Re: density profile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi,
On Tue, Mar 16, 2004 at 03:57:36PM -0500, Ekta Khurana wrote:
>
> 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?
Rather than looping over bins and testing to see if the water molecule
falls within that bin, why don't you try using something like this:
set n [expr {round(floor(($z-$zmin)*$idz))}]
where $idz is 1/dz.
Another thing you could do to speed things up is to loop over frames and
analyze all water molecules in that frame at once:
set wat [atomselect top "water and name OH2"]
set nframes [molinfo top get numframes]
for { set frame 0 } { $frame < $nframes } { incr frame } {
$wat frame $frame
foreach z [$wat get z] {
set n [expr {round(floor(($z-$zmin)*$idz))}]
# Might want to correct for water going above or below the periodic
# cell...
incr bin($n)
}
}
Hope this helps,
Justin
> .........................................................
>
> 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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
- Next message: Saladino, Alex: "HOLE output visualization"
- Previous message: John Stone: "Fwd: Announce: STRAP"
- In reply to: Ekta Khurana: "density profile"
- Next in thread: John Stone: "Re: density profile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]