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

Conformer generation error with specific RDKit version #229

Open
SergeiNikolenko opened this issue Jul 8, 2024 · 1 comment
Open

Conformer generation error with specific RDKit version #229

SergeiNikolenko opened this issue Jul 8, 2024 · 1 comment

Comments

@SergeiNikolenko
Copy link

Description:
The following code to generate conformers using datamol works fine with RDKit version 2022.09.5, but fails with RDKit version 2024.03.1. This inconsistency might be due to changes in RDKit which datamol has not yet adapted to.

Versions:

  • datamol: 0.12.4
  • rdkit: 2022.09.5 (works fine)
  • rdkit: 2024.03.1 (raises error)

Reproducible Code:

import datamol as dm

smiles = "[H]/C1=C(\\[H])C([H])([H])/N=C(\\[H])OC([H])([H])C1=O"
mol = dm.to_mol(smiles)
mol = dm.conformers.generate(mol, align_conformers=True, add_hs=True, n_confs=10)
mol = dm.add_hs(mol, add_coords=True)

Error Traceback:

ValueError                                Traceback (most recent call last)
Cell In[9], line 5
      3 smiles = "[H]/C1=C(\\[H])C([H])([H])/N=C(\\[H])OC([H])([H])C1=O"
      4 mol = dm.to_mol(smiles)
----> 5 mol = dm.conformers.generate(mol, align_conformers=True, add_hs=True, n_confs=10, method='ETKDG')
      6 mol = dm.add_hs(mol, add_coords=True)

File ~/.conda/envs/chem/lib/python3.11/site-packages/datamol/conformers/_conformers.py:171, in generate(mol, n_confs, use_random_coords, enforce_chirality, num_threads, rms_cutoff, clear_existing, align_conformers, minimize_energy, sort_by_energy, method, forcefield, ewindow, eratio, energy_iterations, warning_not_converged, random_seed, add_hs, ignore_failure, embed_params, verbose)
    167             logger.warning(
    168                 f"Conformers embedding failed for {convert.to_smiles(mol)}. Returning None because ignore_failure is set."
    169             )
    170         return None
--> 171     raise ValueError(f"Conformers embedding failed for {convert.to_smiles(mol)}")
    173 energies = None
    175 # Minimize energy

ValueError: Conformers embedding failed for [H]/C1=N\C([H])([H])/C([H])=C(\[H])C(=O)C([H])([H])O1

Steps to Reproduce:

  1. Install datamol version 0.12.4.
  2. Install rdkit version 2024.03.1.
  3. Run the provided code snippet.

Expected Behavior:
The conformers should be generated without any errors as it works with RDKit version 2022.09.5.

Actual Behavior:
The conformer generation raises a ValueError with RDKit version 2024.03.1.

@maclandrol
Copy link
Member

Good catch, thanks @SergeiNikolenko.

Are you able to propose a fix ? Otherwise, I can try to address this next week.

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

No branches or pull requests

2 participants