From: andrea spitaleri (
Date: Thu Mar 23 2006 - 08:53:40 CST

Hi all,
this is a script that I use for finding aa in contact with my ligand
below a cutoff. It runs fine. However what I get is a list of resid and
resname for each atom in contact with the ligand. In few words I get:
... and so on.
I would like to print out only once 15,gly (only the aa in contact and
not the atoms)
Any trick?




proc findneigh {cutoff} {
     set out [open neigh.out w]
     set nid [molinfo num]
     for {set i 0} {$i < $nid} {incr i} {
        puts "Reading molid $i ..."
        set clu [expr $i+1]
        puts $out "Cluster $clu ..."
        set nframes [molinfo $i get numframes]
        for {set j 0} {$j < $nframes } {incr j} {
            puts "\tReading frame $j ..."
            puts $out "Reading frame $j ..."
            set t [atomselect $i "(protein within $cutoff of segid B)" frame $j]
            foreach resid [$t get resid] resname [$t get resname] {
                puts $out $resid,$resname
        # puts $resid,$resname
     close $out

Andrea Spitaleri
Dulbecco Telethon Institute
c/o DIBIT Scientific Institute
Biomolecular NMR, 1B4
Via Olgettina 58
20132 Milano (Italy)