set outfile [open my_protein.txt w] set nf [molinfo top get numframes] set all [atomselect top "resid 54 to 103"] for {set i 0} {$i<$nf} {incr i} { $all frame $i $all update set sasa [measure sasa 1.4 $all] puts $outfile "Frame $i, SASA $sasa" } close $outfile