Acylation / obsidian-chem

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

Add options for explicit hydrogen #58

Closed Acylation closed 7 months ago

Acylation commented 7 months ago

Closes #56

Test cases

Check these cases with the config enabled/disabled to see the difference:

Explaination

The term explicit hydrogen is a little bit confusing. Here's a brief intro quoted from https://www.herongyang.com/Cheminformatics/SMILES-Hydrogen-Representations.html

How Hydrogens Are Represented in SMILES? - Hydrogen are represented according to the following rules:

  1. Explicitly as Atoms - A hydrogen can be represented by its atomic symbol in square brackets [H]. For example, [H][O][H] for water; [2H]O[2H] for heavy water; [H][H] for hydrogen molecule.
  2. Explicitly as Counts - When hydrogens are connected to an atom, which is represented in square brackets, those hydrogens must be represented a count in the form of [xHn]. For example, "[OH2]" is the same as "O([H])[H]"
  3. Implicitly - When hydrogens are connected to an atom, which is represented without square brackets, those hydrogens are implicitly represented according to normal valence assumptions. For example, "O" is the same as "O([H])[H]"