From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Thu Apr 23 2009 - 08:48:57 CDT

On Thu, 2009-04-23 at 10:15 +0200, Max wrote:
> Hi
>
> It worked with "eq" instead of "=" ;-)

max,
it didn't "work", you just got lucky!

it remains a very bad idea.

moreover, i fail to see why one would want to do
this kind of test in the first place. i suspect
that your script code is most likely not doing
something that could be done cleaner, safer, and
faster in a different way.

cheers,
   axel.

>
> > % set p [atomselect top "x eq -8.36200046539"]
>
> as suggested by Philippe.
>
> Thanks everybody
>
> Max
>
>
>
> On Wed, 22 Apr 2009 14:03:32 -0500, John Stone <johns_at_ks.uiuc.edu> wrote:
> > 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

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