partridgejiang / Kekule.js

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

Extra explicit hydrogen being added to atoms in drawer #312

Closed Luckp1089 closed 9 months ago

Luckp1089 commented 9 months ago

Hello!

When working in the Chem Composer, instead of seeing a charge, an extra 'H' atom appears on Nitrogen and Chlorine when I add a bond that would usually result in a positive charge for the atom:

image

Is there any way to toggle this off so that the extra hydrogen atom does not appear? Or is there a way to have it automatically replaced with a positive charge?

Thanks!!

partridgejiang commented 9 months ago

Hi @Luckp1089, you may turn the implicit hydrogen calculation off to do this:

Kekule.globalOptions.structure.implicitHydrogenEstimationStrategy.targetElements['Cl'] = false;
Kekule.globalOptions.structure.implicitHydrogenEstimationStrategy.targetElements['N'] = false;

However, the charge still need to be added manually, there is no build-in automatic mechanism for this.

Luckp1089 commented 9 months ago

Excellent! Thank you for the response! Closing the issue now