From: McGuire, Kelly (mcg05004_at_byui.edu)
Date: Sat Apr 28 2018 - 18:26:48 CDT

I wrote a script that counts waters within 6 angstroms (or whatever distance I want) from the sidechains inside of an ion channel throughout a trajectory. This gives (basically) the total number of waters in the channel per frame. However, I would like to get waters per residue per frame. I could do this by using multiple lines of selections, i.e. set a [atomselect top "waters within 2 of resid 1"], set b [atomselect top "waters within 2 of resid 2"], and so on, and then have those tabulated into a file. Is there a more efficient way to do this though? Here is my code:

set numframes [molinfo top get numframes]

set output [open "NumberofWaters.dat" w]

for {set i 0} {$i < $numframes} {incr i} {

set sel [atomselect top "waters within 6 of resid 31 34 37 40 and segname XP1 XP2 XP3 XP4"]

$sel frame $i

$sel update

set num [$sel num]

puts $output "$i $num"

$sel delete

}

close $output

Kelly L. McGuire

PhD Scholar

Department of Physiology and Developmental Biology

Brigham Young University

LSB 3050

Provo, UT 84602