OEAnnotateValenceProblems
bool OEAnnotateValenceProblems(OE2DMolDisplay& disp)
Annotates potential valence problems on the molecule. An atom is considered to have a valence problem when its bond count exceeds the maximum valence defined by the MDL valence model for its atomic number and formal charge.
Note
Aromaticity must be perceived (e.g.via OEAssignAromaticFlags)
before calling this function. Without aromaticity perception, aromatic
ring atoms may be incorrectly flagged as having valence problems because
their bonds are treated as alternating single/double bonds.
- disp
The OE2DMolDisplay object being annotated.
The following code snippet show how to use the
OEAnnotateValenceProblems function.
See the generated image in Figure: Example of molecule with incorrect
valences.
OEGraphMol mol = new OEGraphMol();
oechem.OESmilesToMol(mol, "C[N+](=C)(C)C1CCCCl1");
oedepict.OEPrepareDepiction(mol);
int width = 200;
int height = 200;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
OE2DMolDisplay disp = new OE2DMolDisplay(mol, opts);
oedepict.OEAnnotateValenceProblems(disp);
oedepict.OERenderMolecule("OEAnnotateValenceProblems.png", disp);
Example of molecule with incorrect valences
Note
The OEAnnotateValenceProblems function uses
the MDL Valence Model.