From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Apr 22 2009 - 14:03:32 CDT

Hi,
  Just FYI, using exact equality on any floating point value other than zero
is a very fragile selection method. Generally speaking, there can be
some variation introduced in the conversions between machine and
decimal representations, either in terms of precision, or rounding, or
both, and for any decimal number that doesn't directly map to a machine
number, much will depend on the behavior of the conversion routines
(in this case those in Tcl and libc). I would recommend using a selection
that uses an epsilon from the desired value instead, as someone had
previously mentioned.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Apr 22, 2009 at 07:52:07PM +0100, J. Rui Rodrigues wrote:
> Hi,
>
> It should work and indeed it works for me:
>
> vmd > set sel [atomselect top all]
> atomselect0
> vmd > set x [$sel get x]
> 12.557000160217285 13.237000465393066 12.70199966430664 11.204000473022461
> 11.133000373840332 13.10200023651123 13.505000114440918 13.784000396728516
> 13.553999900817871 13.701000213623047 13.12399959564209 13.390000343322754
> 14.135000228881836 12.986000061035156 12.812000274658203 14.23799991607666
> 14.350000381469727 10.718999862670898 9.791999816894531 12.61400032043457 12.88700008392334
> 14.199999809265137 15.277999877929688 14.515999794006348 13.720000267028809
> 13.409000396728516 14.256999969482422 14.23900032043457 14.019000053405762
> 11.902999877929688 10.61400032043457 10.887999534606934
> vmd > set p [atomselect top "x = 12.70199966430664"]
> atomselect1
> vmd > $p num
> 1
> vmd > $p get index
> 2
>
> That's strange... Maybe you should double-check your sequence of commands?
>
>
> Rui Rodrigues
>
>
>
> On Wed, 22 Apr 2009 13:09:16 +0200, Max wrote
> > Hi all,
> >
> > I tried to select atom indexes from their coordinates (x) but I could not.
> > Am I doing anything wrong?
> > Here's an example:
> >
> > >% set sel [atomselect 1 all]
> > atomselect32
> > >% set x [$sel get {x}]
> > -9.0 -8.36200046539 -9.02799987793 -10.0799999237 -9.35200023651
> > -10.7600002289 -10.4099998474 -12.0799999237 -11.1099996567 -13.029999733
> > -12.7399997711 -10.3599996567 -11.9200000763
> >
> > Now I tried to select the atom index from one of its coordinates and got
> > nothing.
> >
> > >% set p [atomselect 1 "x = -8.36200046539"]
> > atomselect33
> > >% $p get index
> > >%
> >
> > Thanks
> >
> > Max
>
>
> --
> Webmail ESTG de Leiria (http://webmail.estg.ipleiria.pt)
>

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