proc measureSAS { args } {
  puts "Counting SAS for each atom in given molecule"
 
  set mol [atomselect top all]
  set pocetAtomu [$mol num]

  puts "Number of atoms: $pocetAtomu"

  set fw [open "sas.txt" w]

  for {set i 0} {$i <= $pocetAtomu-1} {incr i} {
      set atom [atomselect top "index $i"]
      set result [measure sasa 1.4 $mol -restrict $atom]
      puts $fw "$i $result"
      puts "$i $result"
  }

  close $fw
  puts "done"
  
}