openforcefield / protein-ligand-benchmark

Protein-Ligand Benchmark Dataset for Free Energy Calculations
MIT License
149 stars 15 forks source link

Error when trying to assign partial charges to the eg5 cofactor using openff-toolkit/openeye am1bccelf10 #107

Open hannahbaumann opened 8 months ago

hannahbaumann commented 8 months ago

I'm getting this error when assigning partial charges using openeye's am1bccelf1 via the openff-toolkit:

def gen_charges(smc):
    offmol = smc.to_openff()
    offmol.assign_partial_charges('am1bccelf10')
    print(offmol.partial_charges)
    return openfe.SmallMoleculeComponent.from_openff(offmol)

cofactor = gen_charges(c)

ValueError: No registered toolkits can provide the capability "assign_partial_charges" for args "()" and kwargs "{'molecule': Molecule with name '3L9H' with bad SMILES and Hill formula 'C10H12N5O10P2', 'partial_charge_method': 'am1bccelf10', 'use_conformers': None, 'strict_n_conformers': False, 'normalize_partial_charges': True, '_cls': <class 'openff.toolkit.topology.molecule.Molecule'>}"
Available toolkits are: [ToolkitWrapper around OpenEye Toolkit version 2023.2.3, ToolkitWrapper around The RDKit version 2023.09.5, ToolkitWrapper around AmberTools version 22.0, ToolkitWrapper around Built-in Toolkit version None]
 ToolkitWrapper around OpenEye Toolkit version 2023.2.3 <class 'openff.toolkit.utils.exceptions.InconsistentStereochemistryError'> : Programming error: OpenEye atom stereochemistry assumptions failed. The atom in the oemol has stereochemistry None and the atom in the offmol has stereochemistry S.
 ToolkitWrapper around The RDKit version 2023.09.5 <class 'openff.toolkit.utils.exceptions.ChargeMethodUnavailableError'> : partial_charge_method 'am1bccelf10' is not available from RDKitToolkitWrapper. Available charge methods are ['gasteiger', 'mmff94'] 
 ToolkitWrapper around AmberTools version 22.0 <class 'openff.toolkit.utils.exceptions.ChargeMethodUnavailableError'> : partial_charge_method 'am1bccelf10' is not available from AmberToolsToolkitWrapper. Available charge methods are ['am1bcc', 'am1-mulliken', 'gasteiger'] 
 ToolkitWrapper around Built-in Toolkit version None <class 'openff.toolkit.utils.exceptions.ChargeMethodUnavailableError'> : Partial charge method "am1bccelf10"" is not supported by the Built-in toolkit. Available charge methods are ['zeros', 'formal_charge']

It looks like this is related to stereocenter assignment. I was able to assign partial charges using am1bcc with the antechamber backend. Any ideas on how to solve this?

hannahbaumann commented 8 months ago

Update:

If I load in the .sdf

file = "cofactor.sdf"
off_cft = Molecule.from_file(file)
off_cft.assign_partial_charges('am1bccelf10')

Running this I'm getting following warning: Warning: 3L9H: Failed due to unspecified stereochemistry This seems to be an omega warning. Despite the warning, I'm getting a set of partial charges out. Looking into the code, I found the following: If omega fails (due to stereo problems, openff does this: https://github.com/openforcefield/openff-toolkit/blob/5ffcb58714c93143d8c00841c00e73f46a6c296f/openff/toolkit/utils/openeye_wrapper.py#L2185-L2195

# Don't generate random stereoisomer if not specified
        omega.SetStrictStereo(True) 
        status = omega(oemol)  # This is where I'm getting the warning

        if status is False:
            omega.SetStrictStereo(False)
            new_status = omega(oemol) # Now omega is generating 500 conformers 
            if new_status is False:
                raise ConformerGenerationError(
                    "OpenEye Omega conformer generation failed"
                )

After setting omega.SetStrictStereo(False) , omega runs successfully (500 conformers) and you get elf10 charges. Is it safe for me to use these partial charges, or is the warning telling me that I should not trust them and that potentially a different stereoisomer was used in the conformer generation than the one provided in the input?