From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Tue Jan 07 2014 - 14:22:10 CST

Hi Flavio,

Your order of operations is a bit wonky. You've set the variable sasa,
and then never update inside the loop. Try the following instead:

set fp [open "SASA-output.dat" w]
set nf [molinfo top get numframes]
set sel [atomselect top "protein and noh"]
for { set i 0 } { $i < $nf } { incr i } {
    $sel frame $i
set sasa [measure sasa 1.40 $sel -restrict]
puts $fp "$i $sasa"
}
close $fp

-Josh Vermaas

On 01/07/2014 12:40 PM, flavio seixas wrote:
> Hi,
> I am trying to generate a file containing Solvent Acessible Surface
> Area from each frame of the trajectory.
> I search in VMD list and user guide and I build the following script,
> which was sourced after loading pdb and dcd files:
>
> #sasa calculation loop
> set fp [open "SASA-output.dat" w]
> set nf [molinfo top get numframes]
> set complex [atomselect top "protein and noh"]
> set sel [atomselect top "protein and noh"]
> set sasa [measure sasa 1.40 $complex -restrict]
> for { set i 0 } { $i < $nf } { incr i } {
> $sel frame $i
> puts $fp "$i $sasa"
> }
> close $fp
>
> However, the output file gives the same value for all frames:
>
> 0 21724.5625
> 1 21724.5625
> 2 21724.5625
> 3 21724.5625
> ...
> 1250 21724.5625
>
> I think the calculation for the first frame was repeated to all others.
>
> I am not expert in TCL language, so I appreciate very much if an
> experienced user could tell me what is wrong with the script.
>
> Thanks in advance
>
> Flavio
>