Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong coordinates when using OpenBabel exporter #483

Closed
luancarvalhomartins opened this issue Jul 11, 2020 · 7 comments
Closed

Wrong coordinates when using OpenBabel exporter #483

luancarvalhomartins opened this issue Jul 11, 2020 · 7 comments
Labels

Comments

@luancarvalhomartins
Copy link

luancarvalhomartins commented Jul 11, 2020

Avogadro version: (please complete the following information from the About box):

  • Avogadrolibs: 1.93.0-28-g780d634
  • Qt: 5.12.18

Desktop version: (please complete the following information):

  • OS: Ubuntu 20.04
  • Version: kernel 5.4.0-40-generic, libc6 2.31-0ubuntu9
  • Compiler: gcc/cpp (Ubuntu 9.3.0-10ubuntu2) 9.3.0

Describe the bug
When exporting a molecule using File->Export->Molecule..., the coordinates are completely messed up.
In order to export the molecule, I had to first click on Save in the file selector, then click Cancel, because the file selector was shown again (but I was a bug report for it).
To Reproduce
Steps to reproduce the behavior:

  1. Draw a molecule (eg: methane)
  2. Go to File->Export->Molecule...
  3. Select a file name, use mol2 extension, or xyz but choose OpenBabel exporter; then click on "Save", the file chooser will show again (which is another bug, but already reported), then click "Cancel"
  4. Open file in Avogadro2 - or in another editor - the coordinates will be wrong

Expected behavior
The coordinates should match the ones which were drawn. But they are totally wrong.

Screenshots
Molecule as drawn
Screenshot_20200711_124209
Molecule loaded from exported file
Screenshot_20200711_124312

Additional context
The content of the mol2 file

@<TRIPOS>MOLECULE
*****
 6 5 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
      1 C          -3.0000    1.0000   -3.0000 C.3     1  UNL1        0.0330
      2 H          -3.0000    2.0000   -0.0000 H       1  UNL1        0.0521
      3 H          -3.0000    1.0000    1.0000 H       1  UNL1        0.0521
      4 H          -3.0000    0.0000   -0.0000 H       1  UNL1        0.0521
      5 O          -2.0000    1.0000   -0.0000 O.3     1  UNL1       -0.3982
      6 H          -2.0000    2.0000    0.0000 H       1  UNL1        0.2090
@<TRIPOS>BOND
     1     1     2    1
     2     1     3    1
     3     1     4    1
     4     1     5    1
     5     5     6    1
@welcome
Copy link

welcome bot commented Jul 11, 2020

Thanks for opening your first issue here! Please try to include example files and screenshots if possible. If you're looking for support, please post on our forum: https://discuss.avogadro.cc/

@luancarvalhomartins
Copy link
Author

luancarvalhomartins commented Jul 13, 2020

I would like add that using a native Avogadro exporter works, even for a format that OpenBabel does not, eg: mol, xyz.

@cryos
Copy link
Member

cryos commented Aug 30, 2020

I will take a look

@cryos cryos added the bug label Aug 30, 2020
@luancarvalhomartins
Copy link
Author

luancarvalhomartins commented Aug 30, 2020

I was working on a PR for this bug. The problem was caused by pugixml using a "," as decimal separator when generating the cml file. It was happening because I was using LC_NUMERIC=en_DK.UTF-8. I was looking for a fix forcing pugixml to use a dot as de decimal sep.

@cryos
Copy link
Member

cryos commented Aug 30, 2020

Ah, that explains how I could have missed something so obvious. I would be happy to look at a PR, if you get stuck I can try taking a closer look too - decimal separators cause far too many subtle bugs!

@github-actions
Copy link
Contributor

Here are the build results
macOS.dmg
Ubuntu1804.tar.gz
Ubuntu2004.tar.gz
Win64.exe
Artifacts will only be retained for 90 days.

ghutchis added a commit to ghutchis/avogadrolibs that referenced this issue Apr 23, 2021
Should fix OpenChemistry#483 - verified with testing on my Mac.

Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
@github-actions
Copy link
Contributor

Here are the build results
macOS.dmg
Ubuntu1804.tar.gz
Ubuntu2004.tar.gz
Win64.exe
Artifacts will only be retained for 90 days.

ghutchis added a commit that referenced this issue Apr 23, 2021
Fix #483 through stream-specific locale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants