From: John Stone (johns_at_ks.uiuc.edu)
Date: Fri Feb 24 2006 - 13:56:40 CST

Anthony,
  The "within" selection in VMD is used to select atoms within certain
distances of other atoms, but not from an arbitrary point in space.
To do something like that, you can use an atom selection command in a manner
similar to this little code snippet (cx, cy, cz would be replaced by your
own COM coordinates:

  echo "generating water sphere of radius $rad from box, in VMD"
  set r2 [expr $rad*$rad]
  set wat2keep [atomselect top "same residue as ((sqr(x-$cx)+sqr(y-$cy)+sqr(z-
$cz)) <= $r2)"]

  ... do something with the resulting selection, then delete
  ... the selection when you're all done.

  $wat2keep delete
 
Enjoy,
  John Stone
  vmd_at_ks.uiuc.edu

On Fri, Feb 24, 2006 at 03:53:27PM -0700, Anthony Cruz wrote:
> Hi:
> I am trying to make a selection of a sertain distance from de center of mass
> of my protein and count the atoms in the selection.
> I try this:
>
> set prot [atomselect top "protein"]
> set centw [measure center $prot weight mass]
> set sel1 [atomselect top "within 20 of $centw"]
>
> and I have the following error:
> syntax error
> atomselect: cannot parse selection text: within 20 of 51.0234680176
> 50.9984474182 51.1229171753
>
> How I cold do this??? It is possible to do?
>
> Best regard
> Anthony

-- 
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