SiMolecule / centres

Perception and labelling of stereogenic centres in chemical structures
BSD 2-Clause "Simplified" License
16 stars 3 forks source link

Aromatic resonance bond support #12

Closed iclkevin closed 9 months ago

iclkevin commented 9 months ago

Is it intended for input to CENTRES always be kekulized? Does CENTRES support resonance bonds for aromatic rings, and how would such a bond be defined in BaseMol?

johnmay commented 9 months ago

Yes it's intended to be kekulized as per the CIP rules. I could add a Kekulization algorithm but I feel like this would just replicated what is in the underlying toolkits non?

iclkevin commented 9 months ago

In our CIP code, when setting up mancude rings, we don't look at the bond orders, but rather SMILES aromatic types for the ring atoms, which we can match against both the resonance and kekule drawings. Then when generating the molecular spanning tree, for all aromatic bonds (regardless of single, double or resonance type), are treated as a double bond and duplicate tree nodes are created.

This seems to work in all of the non-pseudo-asymmetric cases I have tested, but I am not able to test whether a larger spanning tree and SMARTS isomorphism are more efficient than just running a Kekulization algorithm (our Kekulization algorithm also uses the same SMILES SMARTS for best accuracy, so it mostly comes down to the larger spanning tree). I also don't know if this method is 100% accurate.

Resonance bonds may also introduce a problem where a user incorrectly forces an aromatic system (of say a ring of size 7), but then I would also question what the user is trying to do and what they intend to see as output.

Anyway, I was just implementing atropisomerism and noticed that resonance bonds didn't work, so I thought I would ask. I do not mind running a kekulization algorithm first, and we can close this ticket if you do not see any potential here. I definitely don't want to make the CENTRES algorithm less efficient.

johnmay commented 9 months ago

My understanding is mancude != aromatic, hence you would need to relax the definition to be officially correct. Even then I think it will give different answers in some cases.

kekulisation is essentially linear time algorithm (bipartite https://en.m.wikipedia.org/wiki/Matching_(graph_theory) in most cases) and should be very efficient and not an issue to run. It’s frustrating we need to mess about with all fractional atomic numbers but that is what the spec currently says.

iclkevin commented 9 months ago

Kekulizing beforehand is appropriate. I am closing this topic.