set myfile [open contact_S4_1ppy_rS_180_200ns_5A_mol_nojump.txt w]
for {set i 0} {$i<=2000} {incr i 1} {
set sel [atomselect top "resname S4 and same resid as within 5.0 of resname pyb pyi pye"]
$sel frame $i
$sel update
puts $myfile "[expr $i*10] [expr [$sel num]/4]"
}
close $myfile