Wrong coordinates resolution

GROMACS version:
GROMACS modification: No

Good afternoon.

My name is Paula Antelo and I am student at the University of Santiago de Compostela. I have been using MDAnalysis, in order to analize molecular dynamics simulations, until I found the following inconvenient.

When realizing the mentioned simulations I use gromacs and obtain two different file types to work with: file.xtc and file.gro. The resolution that coordinates are saved with on the file.xtc is specified by myself when executing the simulation using gromacs (compressed-x-precission parameter in the file.mdp), that means that the number of decimals coordinates are saved with is completely determined. This in important to understand the problem I am about to introduce.

A universe is created using MDAnalysis, involving the file.xtc and the file.gro. The following step is to select atoms and to read their coordinates, for which I call the function Atom.position. When printing coordinates with a considerable number of decimals (exactly thirty in my sample) it may be observed that the number of decimals does not correspond with the one I had specified before when executing the simulation with gromacs. Here is an example of this: if I indicate that I want two decimals then I observe that two decimals are printed, followed by three ‘0’ values, but the following decimals are not zero, although they should according with what I had specified.

The important issue appears when a higher resolution is required, for example five decimals, since in that case I can not distinct any more what decimals are actually my atoms coordinates and which ones are added by Python or MDAnalysis.

For a clearer explanation an image is attached at the end of this email, where four examples of printed coordinates are illustrated, specifying the previously indicated resolution for their generation.

I would honestly feel thankful if a solution for this was reached, since it is important for my current work.

Thank you beforehand.

There is no solution to your problem as floating point arithmetic has limited precision. You can not store number with all decimals past 5 exactly zero in a float.

But I don’t think it is a good procedure to distinguish original and added coordinates based on if there are zeros or not (even if you would get zeros).

Thank you for your reply.

What would be a good procedure then? How could I distinguish between original coordinates and added coordinates? It would also help to know the origin of this, I am not certain if the responsible of this issue is gromacs or MDAnalysis.

Once coordinates are added, will they affect later calculus involving them, or are they completely random so their effects are cancelled through calculations?

Thank you in advance.

There must be another way of finding out what has been added. Distinguishing base on a numerical value have zero decimals is not a reliable procedure.

And there is no solution to the decimal “problem”. Computers do not have infinite precision. I also don’t see how those decimals would matter. If you add atoms, the system would need to be equilibrated anyhow. Three decimals suffice for all such cases.