Dear Forum members,

I am trying to find a good way to convert CIF files to SMILES. Something similar to what happens when a CIF file is uploaded to the CSD depository and a 2D representation is shown. Is it possible to do that with CSD Python API?

Hi Gabriel,

Yes, but you need to convert the CIF file to mol2 file using conquest then to SMILES, here is a sample script using CSD Python API:

from ccdc import io, search
from import EntryReader, MoleculeWriter

import csv


database_file = # write here the directory to your mol2 file

CSD = io.EntryReader(database_file)

# Open the output .csv file
with open('output.csv', 'w') as outfile:
    # Set up the csv writer
    writer = csv.writer(outfile)
    # Set up the column titles in GSK
    writer.writerow(['Refcode', 'SMILES'])

    for entry in CSD.molecules():
          writer.writerow([entry.identifier, entry.smiles])


Another method, using conquest you can directly convert from CIF to SMILES.

You must be signed in to post in this forum.