bool OEAssignCharges(OEChem::OEMolBase &mol, const OEChargeEngineBase &chargeEngine) bool OEAssignCharges(OEChem::OEMCMolBase &mcMol, const OEChargeEngineBase &chargeEngine)
This function is designed to replace the legacy function
This function sets the charge of each atom in the
mol based on the specific nature of the
passed as the second argument. In general, charge engine implementations place
scalar partial charges on atoms, but could be implemented to perform
other roles such as assign multi-pole charges.
Listing 1: Assigning MMFF Partial Charges to a Molecule
if oequacpac.OEAssignCharges(mol, oequacpac.OEMMFF94Charges()): # ...
Listing 2: Assigning Unoptimized AM1 Partial Charges
optimizationSetting = False if oequacpac.OEAssignCharges(mol, oequacpac.OEAM1Charges(optimizationSetting)): # ...
The objects used by this function, derived from the abstract base class
OEChargeEngineBase, can be thought of as “options objects”
which describe the details of a specific charge model.
OEAssignCharges analyzes these options
and may need to add explicit hydrogens or perceive residues before assigning
Listing 3: Assigning Non-symmetrized AM1BCC Partial Charges
chargeEngine = oequacpac.OEAM1BCCCharges() chargeEngine.SetSymmetrize(False) if oequacpac.OEAssignCharges(mol, chargeEngine): # ...
Some prerequisites, such as setting the aromaticity model, would alter the input molecule in ways that are incidental to the calculation. In this case, a copy of the input molecule is made before the alterations are made and the charges are transferred back to the input molecule after the calculation. This ensures that only charges, explicit hydrogens, residue perception, residue names, and the number of conformations returned can change on the input molecule.
This function returns
false if does not succeed.