Gains:
- Ability to identify molecules not by name but by structure representation (SMILES with humans, InChI/InChIKey with database)
- Ability to detect invalid or incorrect structures by parsing, validating and canonicalizing each SMILES given by artificial intelligence with RDKit
- Being able to understand that deterministic quantities such as molecular weight and formula should be obtained from the rule-based tool, not from the language model.
The first condition for using AI safely in chemistry is to write the molecule in a language that both the machine and the human can understand. You say "phenol", AI gets it right; but when you say "acid" there are thousands of possibilities. The names are ambiguous; structure representations are precise. In this unit, we will learn the two basic notations that translate the molecule into text (SMILES and InChI) and the tool that verifies them deterministically (RDKit). Our goal: to give the molecule to AI in a way that it will never misunderstand, and to confirm the structure produced by AI with a tool.
What is SMILES?
SMILES (Simplified Molecular-Input Line-Entry System) is a format of writing a molecule in a single line of text. Atoms are represented by letters, bonds by symbols, and rings by numbers. Examples:
- Ethanol: CCO (carbon–carbon–oxygen; hydrogens implicit).
- Benzene: c1ccccc1 (lowercase "c" indicates aromatic carbon; 1's close the ring).
- Aspirin: CC(=O)Oc1ccccc1C(=O)O.
- Caffeine: Cn1cnc2c1c(=O)n(C)c(=O)n2C.
The power of SMILES is that it carries the entire link structure in a single line; Its weakness is that the same molecule can have multiple valid SMILES (this is called non-canonicality). We will solve this with RDKit in a moment.
Hint: The "canonical SMILES" for a molecule is the single, standard spelling for that molecule. To see if two SMILES are the same molecule, canonicalize and compare them; They should not be equal textually, but they should be equal molecules.
What is InChI?
InChI (International Chemical Identifier) is a standard identifier developed by IUPAC. The difference from SMILES is that the same molecule always gives the same InChI; that is, it is canonical in nature. It is long and difficult to read, but is ideal for database matching. The abbreviated "InChIKey" (27-character digest) is used for searching.
- Aspirin InChIKey: BSYNRYMUTXBXSQ-UHFFFAOYSA-N.
Rule: People speak SMILES (read), machines and databases match InChI/InChIKey (exact). Give SMILES to the AI; Confirm in the database with InChIKey.
RDKit: deterministic verification engine
RDKit is an open source cheminformatics library. Unlike the language model, it is rule-based: parses SMILES, calculates molecular weight, generates canonical SMILES, returns InChI/InChIKey, draws the molecule. So RDKit "calculates" what the AI "predicts". This is the heart of the workflow: AI generates, RDKit verifies.
A basic verification flow:
from rdkit import Chemfrom rdkit.Chem import Descriptors, Drawsmiles = "CC(=O)Oc1ccccc1C(=O)O" Chem.MolToSmiles(mol)) print("Molecular formula:", Chem.rdMolDescriptors.CalcMolFormula(mol)) print("Molecular weight:", round(Descriptors.MolWt(mol), 2), "g/mol") print("InChIKey:", Chem.MolToInchiKey(mol))
If MolFromSmiles returns None, the AI has given you an invalid molecule; This alone is a very valuable warning. If valid, you no longer need to ask the language model for the molecular weight; It is in your hands deterministically.
Step by step: AI + RDKit interoperation
- Identify the molecule: Give the AI the name, ask for SMILES. For example, "verify canonical SMILES for paracetamol."
- Verify: Parse incoming SMILES with MolFromSmiles. If None, reject.
- Canonicalize: Retrieve canonical spelling with MolToSmiles; Always use this from now on.
- Calculate numbers: Get molecular weight, formula, number of rings, number of hydrogen bond donors/acceptors etc. from RDKit, not from AI.
- Fix ID: Generate InChIKey, search in database (PubChem), confirm that the molecule is indeed the compound you want.
Four copyable templates
1) Requesting SMILES (from noun to structure):
Task: Give the canonical SMILES for the following compound. Compound: paracetamol (acetaminophen). Rule: Give only the SMILES string and InChIKey, do not add any further explanation. If you are not sure, write "UNSURE", do not make up.
2) SMILES validation request (from structure to control):
Examine the SMILES below: CC(=O)Nc1ccc(O)cc1Questions:1) Is this a valid SMILES?2) What compound does it correspond to (common name)?3) What is the molecular formula?Note: I will calculate the exact molecular weight with RDKit; You just give your structure interpretation.
3) Comparing two representations:
I have two SMILES:A) OCCB) CCOTask: Are these the same molecule or different? Write your reasoning.Note: I will cross-check your answer by canonicalizing it in RDKit.
4) Structure explanation (for learning purposes):
SMILES: Cn1cnc2c1c(=O)n(C)c(=O)n2CTask: Read this SMILES piece by piece and explain what each symbol means (atom, bond, ring, aromaticity) in plain Turkish. Also tell which compound it is.
Weak prompt / Strong prompt
Weak:
Give the properties of acetaminophen.
"Feature" is vague; AI generates random numbers from molecular weight to melting point, some of which will be wrong.
Strong:
Compound: acetaminophen.1) Canonical SMILES and InChIKey ver.2) Give the molecular formula.Rule: DO NOT GIVE NUMERIC values such as molecular weight, melting point, etc.; I will get them with RDKit/PubChem. Just give the build ID.
Difference: We directed the AI towards what it is strong at (structure identity) and away from what it is weak at (experimental numbers).
Comparison of impressions
feature
SMILES
InChI / InChIKey
Readability
High (people friendly)
Low (machine friendly)
canonicity
Subject to change (needs canonization)
naturally single
Usage
human communication, drawing, input
Database match, identity
stereochemistry
Supports (@ symbols)
Supports (layered)
to give to AI
ideal
Ideal for confirmation
mini cases
Case 1 — Two names, one molecule. A student thought that "N-acetyl-para-aminophenol" and "paracetamol" were different compounds and planned two separate experiments. When canonicalized their SMILES in RDKit, they both turned out to be CC(=O)Nc1ccc(O)cc1; It was the same molecule. Lost: half a day of planning; gain: could have been avoided with a 2-minute canonicalization check.
Case 2 — Invalid SMILES capture. The AI returned CC(=O)Nc1ccc(O)cc1C( for a variant (brackets not closed). The student ran MolFromSmiles, it returned None, immediately saw the error and requested corrected SMILES. Without verification, the faulty structure would have spread to all accounts.
Case 3 — Incorrect molecular weight. YZ said "molecular weight 214.3 g/mol" for ibuprofen (C13H18O2). The RDKit calculation gave 206.28 g/mol. Difference for 0.1 mol: 21.43 g with YZ, actually 20.63 g. This difference of 3.9% would disrupt the stoichiometry and yield calculation. It brought deterministic calculus.
Common mistakes
- Giving the molecule by name. Synonyms/trade names are confused. Always include SMILES or InChI.
- Comparing SMILES without canonicalizing it. OCC and CCO are different in text but the same in molecules.
- Asking the molecular weight to the tongue model. This is a deterministic calculation; It is done from RDKit or manually from the formula.
- Not noticing invalid SMILES. Not checking the return of MolFromSmiles None and continuing with the wrong structure.
- Neglecting stereochemistry. The two enantiomers (mirror image isomers) may exhibit different biological effects; Skipping @/@@ signs in SMILES.
Attention: The same molecular formula does not mean different molecules. C2H6O is both ethanol (CCO) and dimethyl ether (COC). Equality of formula is not equality of identity; Use InChIKey for identification.
In summary
- Identify molecules by structure notation, not by name: SMILES with human, InChI/InChIKey with database.
- RDKit is deterministic; AI predicts, RDKit calculates and verifies.
- Parse each AI SMILES with MolFromSmiles and check for None, then canonicalize.
- Get numbers like molecular weight and formula from RDKit, not from the language model.
- Formula equality does not mean molecular identity; Use InChIKey for identification.
Application task
Choose three compounds (e.g. caffeine, ibuprofen, glycine). Ask the AI for canonical SMILES for each. Then write an RDKit script (use the template above) and generate: canonical SMILES, molecular formula, molecular weight, InChIKey. How many of the SMILES given by the AI were valid? If YZ also gave the molecular weight, calculate the difference as a percentage with the RDKit value. Plot your findings into a small table.
checklist
- [ ] I know what SMILES and InChI/InChIKey are and when to use them.
- [ ] I verify every SMILES given by AI with MolFromSmiles.
- [ ] I canonicalize SMILES before comparing them.
- [ ] I'm getting the molecular weight and formula from RDKit, not from the language model.
- [ ] I confirm the molecule identity in the database with InChIKey.
- [ ] I know situations where stereochemistry is important.