void OEAssignFormalCharges(OEMolBase &mol)

Sets the formal charge property of each atom in the molecule by calling OEAssignFormalCharges(OEAtomBase*)

void OEAssignFormalCharges(OEAtomBase *atm)

Sets the formal charge property of an atom, based upon a simplistic valence model. This function assumes that the bond orders and implicit hydrogen counts have been set on a molecule. For example, this function will place a single positive charge on a neutral four-valent nitrogen. Note that this function only modifies neutral atoms, with zero formal charge. This preserves any formal charges previously assigned, but requires the charge to be reset to zero in order to force a reassignment.

The assigned formal charge can be accessed by the OEAtomBase.GetFormalCharge method of OEAtomBase.

See also