partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
250 stars 61 forks source link

3 in-plane bonds and one wedge or one dashed bond unexpectedly match #116

Open MrDarkHorse opened 5 years ago

MrDarkHorse commented 5 years ago
screen shot 2019-03-05 at 8 42 56 am
partridgejiang commented 5 years ago

Hi @MrDarkHorse, actually, in my opinion, the (R) configuration can still be recognized from the second structure (supposing the C-C/C-C/C-H bonds are on the same plane and C-O towards the observer). Since the topological structure of molecule is not a quantitative but just a qualitative expression of the real stereo, the second structure is not quite "wrong". Anyway, a new option is added to the stereo atom perception process. For example:

var isSame = mol1.equalStructure(mol2, {
  strictStereoAtomGeometry: true,   // turn this option on
  clearHydrogens: false  // also turn off this option, otherwise the C-H bond will be ignored in your case
});  // isSame == false now

This new option has been applied in the latest release files. It also should be noted that the implementation of this option still need some refinement and may be modified a little in the future.