pckroon / pysmiles

A lightweight python-only library for reading and writing SMILES strings
Apache License 2.0
147 stars 21 forks source link

Make read_smiles complain when valences are wrong #44

Closed pckroon closed 3 months ago

pckroon commented 4 months ago

So a bit of context: the goal is to make read_smiles more strict about what it finds chemically valid smiles. After some discussion with dr. Corbet and dr. Broekman I've decided that finding a valence for d- and f-block elements is a fool's errant, and the meaning of valency is vague in these cases anyway. So for these cases we make no assumptions about possible valencies, and don't check it. The s- and p-block elements however, follow the octet rule decently well. This leaves hypervalency, which I approximate by promoting sp-electron pairs to higher orbitals. Strictly chemically incorrect, but seems to produce the right answer (in most cases?)