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

MolToMolBlock writes "either" stereo for double bonds which shouldn't be stereo #6502

Closed
ricrogz opened this issue Jun 27, 2023 · 1 comment · Fixed by #6503
Closed

MolToMolBlock writes "either" stereo for double bonds which shouldn't be stereo #6502

ricrogz opened this issue Jun 27, 2023 · 1 comment · Fixed by #6503
Labels
Milestone

Comments

@ricrogz
Copy link
Contributor

ricrogz commented Jun 27, 2023

I think this was introduced in #6387 .

An example:

# coding: utf-8
from rdkit import Chem

mb = """
  MJ230800                      

 16 16  0  0  0  0  0  0  0  0999 V2000
  -12.8296    1.4763    0.0000 P   0  0  0  0  0  0  0  0  0  0  0  0
  -13.5918    1.1606    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
  -13.9075    0.3984    0.0000 P   0  0  0  0  0  0  0  0  0  0  0  0
  -13.5918   -0.3638    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
  -12.8296   -0.6795    0.0000 P   0  0  0  0  0  0  0  0  0  0  0  0
  -12.0674    1.1606    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
  -11.7516    0.3984    0.0000 P   0  0  0  0  0  0  0  0  0  0  0  0
  -12.0674   -0.3638    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
  -12.4647    2.2162    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  -13.1945    2.2162    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
  -11.0118    0.0335    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
  -11.0118    0.7632    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  -13.1945   -1.4194    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  -12.4647   -1.4194    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
  -14.6474    0.7632    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  -14.6474    0.0335    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
  1  6  2  0  0  0  0
  1  2  1  0  0  0  0
  2  3  2  0  0  0  0
  3  4  1  0  0  0  0
  4  5  2  0  0  0  0
  5  8  1  0  0  0  0
  6  7  1  0  0  0  0
  8  7  2  0  0  0  0
  1  9  1  0  0  0  0
  7 12  1  0  0  0  0
  5 13  1  0  0  0  0
  3 15  1  0  0  0  0
  1 10  1  0  0  0  0
  7 11  1  0  0  0  0
  5 14  1  0  0  0  0
  3 16  1  0  0  0  0
M  END
"""

m = Chem.MolFromMolBlock(mb)
print(Chem.MolToV3KMolBlock(m))

This prints:


     RDKit          2D

  0  0  0  0  0  0  0  0  0  0999 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 16 16 0 0 0
M  V30 BEGIN ATOM
M  V30 1 P -12.829600 1.476300 0.000000 0
M  V30 2 N -13.591800 1.160600 0.000000 0
M  V30 3 P -13.907500 0.398400 0.000000 0
M  V30 4 N -13.591800 -0.363800 0.000000 0
M  V30 5 P -12.829600 -0.679500 0.000000 0
M  V30 6 N -12.067400 1.160600 0.000000 0
M  V30 7 P -11.751600 0.398400 0.000000 0
M  V30 8 N -12.067400 -0.363800 0.000000 0
M  V30 9 C -12.464700 2.216200 0.000000 0
M  V30 10 O -13.194500 2.216200 0.000000 0
M  V30 11 O -11.011800 0.033500 0.000000 0
M  V30 12 C -11.011800 0.763200 0.000000 0
M  V30 13 C -13.194500 -1.419400 0.000000 0
M  V30 14 O -12.464700 -1.419400 0.000000 0
M  V30 15 C -14.647400 0.763200 0.000000 0
M  V30 16 O -14.647400 0.033500 0.000000 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 2 1 6 CFG=2
M  V30 2 1 1 2
M  V30 3 2 2 3 CFG=2
M  V30 4 1 3 4
M  V30 5 2 4 5 CFG=2
M  V30 6 1 5 8
M  V30 7 1 6 7
M  V30 8 2 8 7 CFG=2
M  V30 9 1 1 9
M  V30 10 1 7 12
M  V30 11 1 5 13
M  V30 12 1 3 15
M  V30 13 1 1 10
M  V30 14 1 7 11
M  V30 15 1 5 14
M  V30 16 1 3 16
M  V30 END BOND
M  V30 END CTAB
M  END

None of these double bonds should have the "CFG=2" specification, since the P atoms on one side of the bond are pentavalent, so CIS/TRANS stereo does not apply.

@ricrogz ricrogz added the bug label Jun 27, 2023
@ricrogz
Copy link
Contributor Author

ricrogz commented Jun 28, 2023

It's easier to see with a SMILES:

m2 = Chem.MolFromSmiles('CP1(O)=NP(C)(O)=NP(C)(O)=NP(C)(O)=N1')
print(Chem.MolToV3KMolBlock(m2))
----------------------------------------------------------------

     RDKit          2D

  0  0  0  0  0  0  0  0  0  0999 V3000
M  V30 BEGIN CTAB
M  V30 COUNTS 16 16 0 0 0
M  V30 BEGIN ATOM
M  V30 1 C 3.149874 0.913142 0.000000 0
M  V30 2 P 1.959844 0.000000 0.000000 0
M  V30 3 O 3.149874 -0.913142 0.000000 0
M  V30 4 N 1.385819 -1.385819 0.000000 0
M  V30 5 P -0.000000 -1.959844 0.000000 0
M  V30 6 C 0.913142 -3.149874 0.000000 0
M  V30 7 O -0.913142 -3.149874 0.000000 0
M  V30 8 N -1.385819 -1.385819 0.000000 0
M  V30 9 P -1.959844 0.000000 0.000000 0
M  V30 10 C -3.149874 -0.913142 0.000000 0
M  V30 11 O -3.149874 0.913142 0.000000 0
M  V30 12 N -1.385819 1.385819 0.000000 0
M  V30 13 P 0.000000 1.959844 0.000000 0
M  V30 14 C -0.913142 3.149874 0.000000 0
M  V30 15 O 0.913142 3.149874 0.000000 0
M  V30 16 N 1.385819 1.385819 0.000000 0
M  V30 END ATOM
M  V30 BEGIN BOND
M  V30 1 1 1 2
M  V30 2 1 2 3
M  V30 3 2 2 4 CFG=2
M  V30 4 1 4 5
M  V30 5 1 5 6
M  V30 6 1 5 7
M  V30 7 2 5 8 CFG=2
M  V30 8 1 8 9
M  V30 9 1 9 10
M  V30 10 1 9 11
M  V30 11 2 9 12 CFG=2
M  V30 12 1 12 13
M  V30 13 1 13 14
M  V30 14 1 13 15
M  V30 15 2 13 16 CFG=2
M  V30 16 1 16 2
M  V30 END BOND
M  V30 END CTAB
M  END

@ricrogz ricrogz mentioned this issue Jun 28, 2023
@greglandrum greglandrum added this to the 2023_03_3 milestone Jul 14, 2023
greglandrum pushed a commit that referenced this issue Jul 14, 2023
* add a test

* fix

* fix rxnTestCatch
greglandrum pushed a commit that referenced this issue Aug 17, 2023
* add a test

* fix

* fix rxnTestCatch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants