Acylation / obsidian-chem

Chemistry support for Obsidian. Rendering SMILES strings into chemistry structures.
MIT License
82 stars 4 forks source link

Bug in rendering? #19

Closed whytong closed 1 year ago

whytong commented 1 year ago

What happened?

I tried to embed the chemical structure of DTNB and it seems the plugin does not render the structure properly in certain cases. Particularly, I tried two SMILES of the same molecule, one seems to work, one seems to miss one oxygen. This one works:

C1=CC(=C(C=C1SSC2=CC(=C(C=C2)[N+](=O)[O-])C(=O)O)C(=O)O)[N+](=O)[O-]

This one is missing an oxygen in the nitro group.

O=C(O)C1=C([N+]([O-])=O)C=CC(SSC2=CC(C(O)=O)=C([N+]([O-])=O)C=C2)=C1

What did you expect to happen?

Both should have two N(+)O2 groups

How can we reproduce it (as minimally and precisely as possible)?

paste the two smiles snippets to obsidian.

Anything else we need to know?

No response

Plugin version

0.1.2

Obsidian version

1.3.5

Acylation commented 1 year ago

Yeah I tested it just now. This seems to be a image sizing problem in the upperstream package, smiles-drawer. You can also try your smiles strings out here: https://smilesdrawer.surge.sh/playground.html

There's an option called compact draw, with it enabled, the caboxylic group would be rendered as COOH and the nitro group would be rendered as N+O2 (actually this is also kind of unreasonable)

image1

However, when it comes to the original structure, that is, to disable the compact draw, you will get following structures. So the problem may take place in the resizing process.

image2

I just finish my finals and return to my keyboard. I will submit a issue to the smiles-drawer repo, and provide options for compact draw, as mentioned in the forum

Acylation commented 1 year ago

Mark as solved in version 0.2.0

Disable compact drawing by default can avoid this.