From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Thu Apr 11 2019 - 19:16:36 CDT

Hi,

Those usage lines pop up when you do something that isn't kosher in your input, and VMD is trying to tell you what the correct syntax is. The trouble is that there is nothing that jumps out at me as being incorrect syntax. When I'm debugging these kinds of things, I tend to like to debug my selections, as there may be some problems if your selection has no atoms, and then you try to write a pdb. To get the number of atoms in a selection and print it, you'd call "puts [$sel num]". However, water is tricky, and not all atoms in any given water molecule will satisfy your distance criteria. Instead, I'd use "same residue as" to include whole water molecules if only one atom is within 2 angstroms. Putting it together, this is what I'd do:

#Double check visually that this first selection selects atoms you want in a graphical display window. If it doesn't, check if "water" or "protein" highlight what they should, since that depends on the macro definitions corresponding to what you've loaded.
set sel [atomselect top "water and same residue as within 2 of protein"]
set n [molinfo top get numframes]
for { set i 0 } { $i < $n } { incr i } {
  $sel frame $i
  $sel update
puts [expr {[$sel num] /3 }] ; #Now the number of water molecules instead of the number of atoms
  $sel writepdb water_$i.pdb
}

-Josh

On 2019-04-11 15:21:49-06:00 owner-vmd-l_at_ks.uiuc.edu wrote:

Hi,

I wanted to find waters near a protein by the analysis script. However, when I try to load this script file to the VMD tkconsole by writing source findwater.tcl, I get this lines: usage: atomselect <command> [args...]Creating an Atom Selection: <molId> <selection text> [frame <n>] -- creates an atom selection function list -- list existing atom selection functions (type an atomselection function to see a list of commands for it)Getting Info about Keywords: keywords -- keywords for selection's get/set commands symboltable -- list keyword function and return typesAtom Selection Text Macros: macro <name> <definition> -- define a new text macro delmacro <name> -- delete a text macro definition macro [<name>] -- list all (or named) text macros

I used this script:

set sel [atomselect top "water and within 2 of protein"]
set n [molinfo top get numframes]
for { set i 0 } { $i < $n } { incr i } {
  $sel frame $i
  $sel update
  $sel writepdb water_$i.pdb
}
I want to display the number of water molecules near the protein. How can I see the result?