From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Tue Jul 08 2014 - 11:27:51 CDT

Hi Mihaela,

You are almost there! The molinfo commands operate on the current frame,
which can be set in the script (I haven't tested it, but its a molinfo
command. Check my syntax if it doesn't work.
http://www.ks.uiuc.edu/Research/vmd/current/ug/node140.html) .

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

puts "frame $i of $nf"$atoms frame $i
#Set the current frame.
molinfo top set frame $i

set xcoor [ molinfo top get a]

set ycoor [ molinfo top get b]
set area [expr ( $xcoor * $ycoor) / 274]
set areasum [expr $area + $areasum]
puts $outfile "$i $area"
}

-Josh Vermaas
On 7/8/14, 10:27 AM, Mihaela Drenscko wrote:
> Hello,
>
> I am trying to get average area per lipid with a tcl script and
> molinfo top get a and molinfo top get b (using VMD Tk console). How do
> I set the script such that x and y coordinates of the box will be read
> at each frame (I have 2000 frames)?
>
> These are the preliminaries of a script which does not work because I
> didn't set reading new x and y for a new frame. How do I do that?
>
> set outfile [open “areaeachframe” w]
>
> set nf [molinfo top get numframes]
> set atoms [atomselect top “lipids”]
> set areasum 0.0
>
> for {set i 0} {$i < $nf} {incr i} {
>
> puts "frame $i of $nf"$atoms frame $i
>
> set xcoor [ molinfo top get a]
>
> set ycoor [ molinfo top get b]
> set area [expr ( $xcoor * $ycoor) / 274]
> set areasum [expr $area + $areasum]
> puts $outfile "$i $area"
> }
>
> set areaavg [expr $areasum/$nf]
>
>
>
> Thank you,
> Mihaela