Depicting Polar Hydrogens
Problem
You want to depict your molecule with explicit polar hydrogens. See example in Figure 1.
Figure 1. Example of depicting polar hydrogens
Ingredients
|
Difficulty Level
🌶️
Solution
Before rendering a molecule, the OEPrepareDepiction function should be called which prepares the molecule for depiction. This function perceives atom and bond stereo information and suppresses or adds hydrogens if necessary. By default, the explicit hydrogens are suppressed by the OEPrepareDepiction function, see example (A) in Table: Example of default molecule depiction. Only hydrogens that are necessary to faithfully represent tetrahedral stereochemistry are added, see example (B) in Table 1.
( A ) |
( B ) |
If depicting polar hydrogens is required (Figure 1.) it is recommended to use the following function. It is important to call the OEPrepareDepiction function with clear_coords = True and suppressH = False parameters.
def depict_molecule_with_polar_hydrogens(
mol: oechem.OEMolBase, opts: oedepict.OE2DMolDisplayOptions, filename: str
) -> None:
"""Depict molecule with showing explicit polar hydrogens."""
# add explicit hydrogens and remove all that is not polar
oechem.OEAddExplicitHydrogens(mol)
retain_polar = True
oechem.OESuppressHydrogens(mol, retain_polar)
clear_coords = True
suppress_hydrogens = False # do not change hydrogens
oedepict.OEPrepareDepiction(mol, clear_coords, suppress_hydrogens)
disp = oedepict.OE2DMolDisplay(mol, opts)
oedepict.OERenderMolecule(filename, disp)
See also in OEChem TK manual
API
See also in OEDepict TK manual
Theory
Molecule Depiction chapter
API
OE2DMolDisplay class
OE2DMolDisplayOptions class
OEAddDepictionHydrogens function
OEPrepareDepiction function
OERenderMolecule function