From: Ramon Mendoza Uriarte (ramendoza_at_uchicago.edu)
Date: Sun Mar 21 2021 - 15:58:22 CDT

Hi Peter,

Ah, I see so the coordinates are only ever precise to the thousandth place. For instance, from the coordinates file one of the coordinates is read as -12.172, but the machine understands it as -12.17199993133545.

Thank you all for explaining this to me!

Thank you,
Ramon
________________________________
From: owner-vmd-l_at_ks.uiuc.edu <owner-vmd-l_at_ks.uiuc.edu> on behalf of Peter Freddolino <petefred_at_umich.edu>
Sent: Sunday, March 21, 2021 8:36 AM
To: Ramon Mendoza Uriarte <ramendoza_at_uchicago.edu>
Cc: Ashar Malik <asharjm_at_gmail.com>; Axel Kohlmeyer <akohlmey_at_gmail.com>; vmd-l_at_ks.uiuc.edu <vmd-l_at_ks.uiuc.edu>
Subject: Re: vmd-l: Why do the coordinates of my atoms change when writing to a pdb file?

Hi Ramon,
Have a look at what a pdb file actually contains and I think you'll understand. There are only three decimal places in those coordinates, so it is pretty clear that the very first coordinate in your file (originally -12.171550750732422) must be stored in the pdb file as -12.172 (you can look in a text editor to confirm). Then, due to the way floating point numbers work, that won't be read into memory precisely as -12.172, but is converted to the nearest representable value, roughly -12.17199993133545. If you find this part surprising, have a look at how IEEE 754 floating point numbers work. You can save yourself from all manner of headaches by understanding this. You may find this website enlightening: https://urldefense.com/v3/__https://www.h-schmidt.net/FloatConverter/IEEE754.html__;!!DZ3fjg!uPXhuHgf6X-ZjCX_HrSyNDsjxVNI4PNmLHZwqEMMfRrovAXedXgPxXehRWzlZJB9OA$ <https://urldefense.com/v3/__https://www.h-schmidt.net/FloatConverter/IEEE754.html__;!!DZ3fjg!rC_hTECH-v91bXi2bpozk4Af-RYfwbIvIfDZBgFflYCrtHQAazrZNmK0roLQmPhfJA$>
Best,
Peter

On Sun, Mar 21, 2021 at 3:09 AM Ramon Mendoza Uriarte <ramendoza_at_uchicago.edu<mailto:ramendoza_at_uchicago.edu>> wrote:
Hello Ashar and Axel,

Thank you to the both of you for your comments. I was not aware the coordinates would change depending on the machine or to precession. I would have thought the coordinates would be unchanging once the output was written.

Thank you,
Ramon
________________________________
From: Ashar Malik <asharjm_at_gmail.com<mailto:asharjm_at_gmail.com>>
Sent: Saturday, March 20, 2021 10:20 PM
To: Ramon Mendoza Uriarte <ramendoza_at_uchicago.edu<mailto:ramendoza_at_uchicago.edu>>
Subject: Re: vmd-l: Why do the coordinates of my atoms change when writing to a pdb file?

Hi Ramon,

This is related to precision.
Was the coor file generated on the same computer? If you stick with the same machine this will not happen.

Depending on what you are doing - this may or may not be ignorable.

Regards,
/A

On Sun, Mar 21, 2021 at 12:31 PM Ramon Mendoza Uriarte <ramendoza_at_uchicago.edu<mailto:ramendoza_at_uchicago.edu>> wrote:
Hello VMD Community,

I loaded a molecule with its respective .psf and .coor files, where the .coor file was read as a NAMD Binary Coordinates file. I then wanted to write out the pdb file; for example, by doing the following in the TkConsole:

set all [atomselect top "all"]
$all writepdb new.pdb

However, I found it surprising that this yields slightly different coordinates and box dimensions. For instance:

>From .coor: (-12.171550750732422, 5.363558769226074, -15.094483375549316), (-11.626058578491211, 4.931212425231934, -15.867215156555176),
                      (-12.769146919250488, 6.002536773681641, -15.656786918640137) <--- A small subset of all the coordinates
                      cellBasisVector1 87.59627914428711 0 0
                      cellBasisVector2 0 88.96563339233398 0
                      cellBasisVector3 0 0 97.37928009033203
                      cellOrigin 0.1676909178495407 0.361166387796402 0.04699717089533806

>From new.pdb: (-12.17199993133545, 5.363999843597412, -15.093999862670898), (-11.62600040435791, 4.931000232696533, -15.866999626159668),
                            (-12.769000053405762, 6.002999782562256, -15.656999588012695) <--- A small subset of all the coordinates
                            cellBasisVector1 87.59599685668945 0 0
                            cellBasisVector2 0 88.96599960327148 0
                            cellBasisVector3 0 0 97.37999725341797
                            cellOrigin 0.16769009828567505 0.36116769909858704 0.04699849709868431

So far, I have tried a Google and VMD archive search; however, I have not determined why this occurred. Additionally, I am using VMD for LINUXAMD64, version 1.9.4a51. Any comments on why this occurred would be appreciated.

Thank you,
Ramon