From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon Apr 17 2006 - 11:33:19 CDT

Margaret,
  In the TkConsole, you'd use the scripting commands to get this done,
as Axel mentioned. More specifically, for a single frame,
you'd do something like this:
  set sel [atomselect top "water and (within 5 of residue 0 to 10)"]
  $sel writepdb "some_file.pdb"

In order to extend that to multiple frames, you'd need to write a longer
script that loops over frames. Axel's got tutorial examples of these,
and there are also examples in the VMD tutorials online on our web site.

  John

On Mon, Apr 17, 2006 at 12:16:18PM -0400, Margaret Shun Cheung wrote:
>
>
> Dear Axel,
> Thank you very much for the hints and weblinks.
> I think this goes where I got confused at the beginning.
>
> I think I can do
>
> water and (within 5 of residue 0 to 10)
>
> at "Selected Atoms" under "Graphical Representations" and that gave me
> something in the Display screen.
>
> But when I go Extensions->TKconsole, and I want to select the citeria
> and write into a file, it gave me the following error
>
> Main console display active (Tcl8.4.1 / Tk8.4.1)
> >Main< (150ps) 2 % water and within 5 of reside 0 to 10
> invalid command name "water"
> >Main< (150ps) 3 %
>
> I think I am missing something very crucial to understand how things work
> in VMD. Please drop me a hint or a website. I went over the tutorials
> and I think my learning curve improved a bit at this point.
> Thank you very much.
> Sincerely,
> Margaret
>
>
>
>
>
> On Mon, 17 Apr 2006, Axel Kohlmeyer wrote:
>
> >On Mon, 17 Apr 2006, Margaret Shun Cheung wrote:
> >
> >MC>
> >MC> Dear Axel,
> >MC> Thank you very much for the syntax. I think this is what I'd
> >MC> like to have.
> >MC> Thank you for reminding to check "update selection every frame".
> >
> >dear margaret,
> >
> >MC> I wonder how I can write these results that only include the water
> >into a
> >MC> file. Thank you.
> >
> >you have to create a script for that. please have a look at
> >the mailing list archives, there might be some examples.
> >
> >generally, from a given selection $sel1 (created in a scriptfile)
> >you can do '$sel1 writepdb some_filename.pdb' (or $sel1 writexyz etc.)
> >to output the structure in the selection to a file. now you basically
> >have to create the selection, loop over the timesteps and do
> >$sel1 frame $n
> >$sel1 update
> >$sel1 writepdb "some_file_$n.pdb"
> >
> >or use somthing more fancy as shown in:
> >http://www.theochem.rub.de/~axel.kohlmeyer/cpmd-vmd/part6.html#chap8_sect4
> >
> >see the section below for how to loop over a trajectory
> >and elsewhere in the pages is an example for how to look
> >at trajectories with changing numbers of atoms (as VMD does
> >not support this natively (yet).
> >
> >best regards,
> > axel.
> >
> >
> >MC> Sincerely,
> >MC> Margaret
> >MC>
> >MC> On Sat, 15 Apr 2006, Axel Kohlmeyer wrote:
> >MC>
> >MC> > On Sat, 15 Apr 2006, Margaret Shun Cheung wrote:
> >MC> >
> >MC> > MC>
> >MC> > MC> Dear VMD wizards,
> >MC> >
> >MC> > MC> I am struggling with the tcl syntax (VMD tkconsole).
> >MC> > MC> I'd like to select water molecules between two residues in a
> >trajectory
> >MC> > MC> (eg 100 frames).
> >MC> > MC>
> >MC> > MC> The "within 5 of protein" seems to only select waters around
> >proteins. But
> >MC> > MC> how could I identify water molecules that are enclosed between
> >two or more
> >MC> > MC> residues?
> >MC> >
> >MC> > you can easily combine multiple conditions, e.g.:
> >MC> >
> >MC> > water and ((within 5.0 of residue 4 5) and (within 5.0 of residue
> >20))
> >MC> >
> >MC> > please see the user's guide for more details on the selection syntax.
> >MC> > remember to activate 'Update selection' or it will stick to the first
> >MC> > selection and also please note the subtle difference between
> >'residue'
> >MC> > - which is unique but always renumbered starting from 0 - and 'resid'
> >MC> > which is the number from the initial structure (e.g. pdb / psf file)
> >MC> > - which which can be useful if you have multiple peptides with the
> >MC> > same sequence in your system.
> >MC> >
> >MC> > best regards,
> >MC> > axel.
> >MC> >
> >MC> > MC> Thank you very much for your help!
> >MC> > MC> Sincerely,
> >MC> > MC>
> >MC> > MC> Margaret S. Cheung,
> >MC> > MC> Ph. D. Postdoctoral Fellow,
> >MC> > MC>
> >MC> > MC> ------------------------------------------------------------
> >MC> > MC> Room 2117 Tel: (301) 405-4892
> >MC> > MC> Inst. for Phys. Sci. & Tech. Fax: (301) 314-9404
> >MC> > MC> University of Maryland http://glue.umd.edu/~mscheung
> >MC> > MC> College Park, MD 20742-2431 email: mscheung_at_ipst.umd.edu
> >MC> > MC> ------------------------------------------------------------
> >MC> > MC>
> >MC> >
> >MC> > --
> >MC> >
> >=======================================================================
> >MC> > Axel Kohlmeyer akohlmey_at_cmm.chem.upenn.edu
> >http://www.cmm.upenn.edu
> >MC> > Center for Molecular Modeling -- University of Pennsylvania
> >MC> > Department of Chemistry, 231 S.34th Street, Philadelphia, PA
> >19104-6323
> >MC> > tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel:
> >1-215-898-5425
> >MC> >
> >=======================================================================
> >MC> > If you make something idiot-proof, the universe creates a better
> >idiot.
> >MC> >
> >MC> >
> >MC>
> >MC> Margaret S. Cheung,
> >MC> Ph. D. Postdoctoral Fellow,
> >MC>
> >MC> ------------------------------------------------------------
> >MC> Room 2117 Tel: (301) 405-4892
> >MC> Inst. for Phys. Sci. & Tech. Fax: (301) 314-9404
> >MC> University of Maryland http://glue.umd.edu/~mscheung
> >MC> College Park, MD 20742-2431 email: mscheung_at_ipst.umd.edu
> >MC> ------------------------------------------------------------
> >MC>
> >
> >--
> >=======================================================================
> >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.
> >
>
> Margaret S. Cheung,
> Ph. D. Postdoctoral Fellow,
>
> ------------------------------------------------------------
> Room 2117 Tel: (301) 405-4892
> Inst. for Phys. Sci. & Tech. Fax: (301) 314-9404
> University of Maryland http://glue.umd.edu/~mscheung
> College Park, MD 20742-2431 email: mscheung_at_ipst.umd.edu
> ------------------------------------------------------------

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078