RDKit InterfaceΒΆ

RDKit is a powerful cheminformatics toolkit that provides extensive functionality for molecular manipulation, analysis, and property calculation. For more information about RDKit, please visit https://www.rdkit.org/docs/index.html

[1]:
from ase.collections import g2
from IPython.display import display

import rdkit2ase

rdkit2ase uses RDKit to create ase.Atoms objects from SMILES strings and convert them to ase.Atoms objects. But you can also use rdkit2ase to convert ase.Atoms objects back to RDKit Mol objects.

[2]:
nitroanilin = rdkit2ase.smiles2atoms(smiles="c1cc(c(cc1)N)N(=O)=O")
mol = rdkit2ase.ase2rdkit(nitroanilin)
print(mol)
mol
<rdkit.Chem.rdchem.Mol object at 0x11c2f23b0>
[2]:
_images/rdkit_tools_3_1.png

For example, you can convert ase.Atoms objects from the ase.collections.g2 database to RDKit Mol objects and display them or use any other RDKit functionality:

[3]:
for idx, (atoms, name) in enumerate(zip(g2, g2.names)):
    print(name)
    display(rdkit2ase.ase2rdkit(atoms, suggestions=[]))
    if idx == 10:
        break
PH3
_images/rdkit_tools_5_1.png
P2
_images/rdkit_tools_5_3.png
CH3CHO
_images/rdkit_tools_5_5.png
H2COH
_images/rdkit_tools_5_7.png
CS
_images/rdkit_tools_5_9.png
OCHCHO
_images/rdkit_tools_5_11.png
C3H9C
_images/rdkit_tools_5_13.png
CH3COF
_images/rdkit_tools_5_15.png
CH3CH2OCH3
_images/rdkit_tools_5_17.png
HCOOH
_images/rdkit_tools_5_19.png
HCCl3
_images/rdkit_tools_5_21.png
[ ]: