From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Sat Jan 17 2015 - 09:18:02 CST

Hi Ashar,

Its not hidden data, its the limitations of floating point arithmetic.
VMD reads in the decimal number, and stores it internally as the nearest
double precision floating point number. Since floating point uses base
2, not base 10, many decimal numbers cannot be cleanly expressed, and
are rounded internally to their closest floating point representation.
Tcl returns this floating point representation converted back to
decimal, which usually means a number with 15-16 digits after the
decimal place.

-Josh Vermaas

On 01/17/2015 05:57 AM, Michail Palaiokostas Avramidis wrote:
>
> My initial answer was based on the following:
>
>
> A PDB file is a txt file with a special structure, interpreted as a
> coordinate file by special programs. Other than that, it does not
> include any "hidden" data. What you see is what you get apart maybe
> from some special format characters such as \t, \n etc.
>
>
> Having said that, the "problem" must be on the interpretation program
> (so in this case VMD). As you can also see in the TCL wiki:
> http://wiki.tcl.tk/11969 ,what you observe is normal.
>
> Just to be safe however, try to initialize the variables first.
> Alternatively, try the example of the wiki. Make two variables, 0.1
> and 0.3, print them, sum them and see if what you get is exactly
> 0.400000000000.
>
>
> Best,
>
> Michalis
>
>
> -------------------------------------------------------------------
> Michail (Michalis) Palaiokostas-Avramidis
> PhD Student
> School of Engineering and Materials Science
> Queen Mary, University of London
> United Kingdom
> LinkedIn Profile
> <https://www.linkedin.com/pub/michalis-palaiokostas-avramidis/31/ba/312>
> -------------------------------------------------------------------
> ------------------------------------------------------------------------
> *From:* Ashar Malik <asharjm_at_gmail.com>
> *Sent:* Saturday, January 17, 2015 11:01 AM
> *To:* Michail Palaiokostas Avramidis; vmd-l_at_ks.uiuc.edu
> *Subject:* Re: vmd-l: Is a PDB file hiding something ???
> I would disagree with that.
>
> here is why:
>
> This is in the pdb:
> 71.696 112.940 -84.327
>
> after using the code the output is:
>
> {71.69599914550781 112.94000244140625 -84.3270034790039}
>
> If you observe the x-coordinates -- 71.696 is in the PDB which is
> being read into TCL by the script i sent earlier and it shows
> 71.695999 .,.. that means that PDB TEXT file was displaying a rounded
> off number. Where as -- somehow when the TCL script read the PDB TEXT
> file ... it produced -- 71.69599.. which is the un-rounded off number.
>
> On Sat, Jan 17, 2015 at 11:23 PM, Michail Palaiokostas Avramidis
> <m.palaiokostas_at_qmul.ac.uk <mailto:m.palaiokostas_at_qmul.ac.uk>> wrote:
>
> Hi Ashar,
>
> I think that a coordinate is stored as a double precision number
> in the memory. However the PDB file contains only a fraction of a
> double number's decimals. Therefore the rest are filled with what
> the memory had before. If it is important for you to have zero's
> in that level, I suppose you can find a way to initialize the
> variables in a way that gives 0 for all digits.
>
> Hope that helps.
>
> Best,
> Michail Palaiokostas
>
>
>
> ---- Ashar Malik wrote ----
>
>
> Hi,
>
> The coordinates in the PDB file of an atom are:
>
> 75.146 114.983 -86.817
>
> using
>
> for {set i $first} {$i < $last} {incr i} {
> set sel3 [atomselect top "resid $i and name C1'"]
> puts [$sel3 get {x y z}]
> }
>
> they are returned as:
>
> {75.14600372314453 114.98300170898438 -86.81700134277344}
>
> Question:
>
> Maybe I am missing some understanding of something here:
>
> How does VMD/TCL script get the higher precision??
>
> Any comments anyone ??
>
> --
> Best,
> /A
>
>
>
>
> --
> Best,
> /A