proc dist { a b } { # Distance between two vectors return [veclength [vecsub $b $a]] } proc angle { a b } { # Angle between two vectors set amag [veclength $a] set bmag [veclength $b] set dotprod [vecdot $a $b] return [expr 57.2958 * acos($dotprod / ($amag * $bmag))] } proc fsel { sel1 sel2 cutoff } { set n [molinfo top get numframes] for {set i 0} {$i < $n} {incr i} { set sel [atomselect top "(within $cutoff of $sel1) and $sel2" frame $i] set num [$sel num] set resid [lsort -unique [$sel get {resid}]] puts "$i $resid" } }