16.1 Assigning Formal Charges

Normally, file formats such as SMILES, SLN or MDL's SDF format, specify the formal on each atom of a connection table. However, when reading from lesser file formats or when repairing "broken" molecules, it may be convenient to assign formal charges to each atom such that the atomic valence is consistent. OEChem provides this functionality via the OEAssignFormalCharges function. This function requires that bond orders and implicit hydrogen counts have been set on a molecule. It then adjusts the formal charge on each uncharged atom to correct common valence model mismatches. For example, quaternary nitrogens are assigned a +1 formal charge, and terminal oxygen connected only by a single bond (with no implicit hydrogens) is assigned a -1 formal charge.

A more technical discussion of the formal charges that are assigned by this function are described in the "OpenEye Charge Model" section of the "Valence Models" chapter of this document.