Hi Michal,

The old SDF format (aka V2000 CTAB) is column-based, as things often were
in the era of Fortran 77 and punch cards. Not only the precision but also
the exact position of each value on the line is specified! Here's what the
spec says:

The Atom Block is made up of atom lines, one line per atom with the
following format:

xxxxx.xxxxyyyyy.yyyyzzzzz.zzzz aaaddcccssshhhbbbvvvHHHrrriiimmmnnneee

which explains why you see four digits after the decimal point. Also note
that in a huge blow to readability, no spaces are required between the
coordinates; if you have coordinates with five digits before the decimal
point, the numbers run into each other, and if you have even more digits,
the number doesn't even fit! There are also limits in the number of atoms
for similar reasons. But I digress...

In the newer "V3000", the atom line is not column-based, which I believe
gives more freedom to implementers to decide the precision of the
coordinates. You can force RDKit to write in this format by calling
SetForceV3000(True) on your writer object. I tried it and I get 5 digits
after the decimal point instead of 4, so at least that's a start. Looking
at the RDKit code (function GetV3000MolFileAtomLine), it just writes the
coordinates without setting the precision, so what you get is the default
stringstream conversion. Here's where one could in principle adjust this
precision, but there's clearly no API to do so at the moment.

Hope this helps,
Ivan


On Fri, Oct 5, 2018 at 5:44 AM Michal Krompiec <michal.kromp...@gmail.com>
wrote:

> Hello,
> Is it possible to control the number of significant digits of XYZ
> coordinates? I am modifying coordinates of my molecules
> using SetAtomPosition but when I save them into an SDF it seems that the
> precision is limited to 4 digits after the decimal point (I'd like 10
> instead...).
> Best wishes,
> Michal
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to