Closed njzjz closed 5 years ago
What I mean is: can I use the following code to find two structures is the same:
if write_smiles(mol1) == write_smiles(mol2):
# same
else:
# isomer
Hi,
in a word: no. What you are describing is known as "canonical SMILES". The problem is that there are many ways of defining it.
However, the networkx isomorphism [1] functions contain functionality to see whether mol1 == mol2
. You will need to supply appropriate edge_match
and node_match
function to make sure e.g. elements and bond orders match.
I see. Thank you.
Your best bet might actually be going for a different library that can write Standard InChi. That should, in theory, also deal with things like resonance structures.
Will two identical structures have different SMILES? Could I use pysmiles to distinguish isomers?