From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Wed Dec 26 2007 - 14:12:05 CST

dear thomas, nagaraju,

please note that the original script was looking only for water oxygens
and not water atoms. so your version needs to add a "name O" to the
selection.

the problem in the original script is the loop over the residues while
printing out the whole list every time.

nagaraju,
if you have a problem, please tell us _why_ you think the script is
not working the way you expect it. if you want to output the number of
residues you have to print the _lenght_ of the list of residues instead
of the list itself. i.e., [llength $reslist] instead of $reslist.

please have a look at the many example scripts in the script library
or a good tcl tutorial (there is a very good one on www.tcl.tk in the
documentation of the tcl/tk8.5 beta release).

cheers,
    axel.

On 12/26/07, Thomas Evangelidis <te8624_at_mbg.duth.gr> wrote:
> Dear Nagaraju,
>
> I think b-cyclodextrin consists of 7 sugar residues and gamma-cyclodextrin
> consists of 8. In both cases if all the sugar residues have the same name (4GA)
> the following atomselection should work. Otherwise you have to play with the
> atomselection in line 2 untill you find the right one. Also remember that the
> residue indexing starts from 0, for example if you want to select residues 1 to
> 4 you should write "residue 0 to 3".
> ##############################################################
> set outfile [open waters.txt w]
> set sel [atomselect top "water within 5 of resname 4GA"]
> set n [molinfo top get numframes]
> for { set i 0 } { $i < $n } { incr i } {
> $sel frame $i
> $sel update
> set residuelist [$sel get residue]
> puts "list of waters within 5 of residue 1 to 7:"
> puts "$residuelist"
> puts $outfile "Frame $i, $residuelist"
> }
> close $outfile
> ##############################################################
> The output will look like this:
>
> Frame 0,(+ the indices of waters within 5 angstroms of residues 1 to 7)
> Frame 1,(+ the indices of waters within 5 angstroms of residues 1 to 7)
> .....
>
> regards,
> Thomas
>
> > Dear VMD users,
> > I solvated beta-cyclodextrine (resname 4GA, total residues 8
> > except water). I want to know the number of water molecules within 5
> > angstroms from resid 1 to 8 of beta-cyclodextrine.
> > I used the script from mailing list:
> > http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/7639.html
> >
> > I used script:
> > ###################################################
> > set outfile [open waters.txt w]
> > set sel [atomselect top "name O and resname WAT and within 5 of residue 1 "]
> > set n [molinfo top get numframes]
> > for { set i 0 } { $i < $n } { incr i } {
> > $sel frame $i
> > $sel update
> > set residuelist [$sel get residue]
> > puts "list of waters within 5 of residue 1:"
> > puts "$residuelist"
> > foreach res $residuelist {
> > puts $outfile "Frame $i, $residuelist"
> > }
> > }
> > close $outfile
> > ##################################################
> > then out put is look like this
> > ****************************************************
> > Frame 0, 69 426 1003 1022 1735 2800
> > Frame 0, 69 426 1003 1022 1735 2800
> > Frame 0, 69 426 1003 1022 1735 2800
> > Frame 0, 69 426 1003 1022 1735 2800
> > Frame 0, 69 426 1003 1022 1735 2800
> > Frame 0, 69 426 1003 1022 1735 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 1, 206 482 668 1852 1858 1876 2035 2088 2800
> > Frame 2, 1517 1925 2009 2409 2468 2800
> > Frame 2, 1517 1925 2009 2409 2468 2800
> > Frame 2, 1517 1925 2009 2409 2468 2800
> > Frame 2, 1517 1925 2009 2409 2468 2800
> > Frame 2, 1517 1925 2009 2409 2468 2800
> > Frame 2, 1517 1925 2009 2409 2468 2800
> > Frame 3, 209 2009 2148 2468 2694
> > Frame 3, 209 2009 2148 2468 2694
> > Frame 3, 209 2009 2148 2468 2694
> > Frame 3, 209 2009 2148 2468 2694
> > Frame 3, 209 2009 2148 2468 2694
> > Frame 4, 1848 2072 2148
> > Frame 4, 1848 2072 2148
> > Frame 4, 1848 2072 2148
> > Frame 5, 1003 2696
> > Frame 5, 1003 2696
> > Frame 6, 1575 1740 2448
> > Frame 6, 1575 1740 2448
> > Frame 6, 1575 1740 2448
> > Frame 7, 388 2011 2468 2911
> > Frame 7, 388 2011 2468 2911
> > Frame 7, 388 2011 2468 2911
> > Frame 7, 388 2011 2468 2911
> > Frame 8, 328 1639 2725
> > Frame 8, 328 1639 2725
> > Frame 8, 328 1639 2725
> > Frame 9, 328 1393 1517 1928 2274 2373 2725
> > Frame 9, 328 1393 1517 1928 2274 2373 2725
> > Frame 9, 328 1393 1517 1928 2274 2373 2725
> > Frame 9, 328 1393 1517 1928 2274 2373 2725
> > Frame 9, 328 1393 1517 1928 2274 2373 2725
> > Frame 9, 328 1393 1517 1928 2274 2373 2725
> > Frame 9, 328 1393 1517 1928 2274 2373 2725
> > Frame 10, 1073 2038
> > ********************************************************
> > My question is :
> > What is wrong in script? If I want water molecules within 5
> > angstroms from residue 1 to 8. Is this script work or not? If it works where
> > I have to modify?
> >
> > Any suggestion is appreciated.
> >
> > with best regards,
> > Nagaraju Mulpuri.
> >
> > ---------------------------------
> > Never miss a thing. Make Yahoo your homepage.
>
>
>
>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
  Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.