Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow global toolkit conformer generation for assign_partial_charges #1863

Open
lilyminium opened this issue Apr 17, 2024 · 0 comments
Open

Comments

@lilyminium
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

When assigning partial charges with OpenEye, conformers are generated via the toolkit API using OpenEye:

self.generate_conformers(
mol_copy,
n_conformers=charge_method["rec_confs"],
rms_cutoff=0.25 * unit.angstrom,
make_carboxylic_acids_cis=True,
)

@ntBre and I have seen that there are some molecules that OpenEye can't handle that RDKit is perfectly happy to generate. Specifically we ran into this with [SX3+1] atoms, e.g.:

from openff.toolkit import Molecule, ForceField

mol = Molecule.from_smiles("C[S+](C)C")
mol.assign_partial_charges("am1bccelf10")

yields this warning:

Warning: OEMMFFParams::PrepMol() : unable to type atom 1 S on residue UNL-1
Warning: : Force field setup failed due to missing parameters
Warning: OEMMFFParams::PrepMol() : unable to type atom 1 S on residue UNL-1
Warning: : Force field setup failed due to missing parameters

and error:

ValueError: No registered toolkits can provide the capability "assign_partial_charges" for args "()" and kwargs "{'molecule': Molecule with name '' and SMILES '[H]C([H])([H])[S+](C([H])([H])[H])C([H])([H])[H]', '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 2022.1.1, ToolkitWrapper around The RDKit version 2024.03.1, ToolkitWrapper around Built-in Toolkit version None]
 ToolkitWrapper around OpenEye Toolkit version 2022.1.1 <class 'openff.toolkit.utils.exceptions.ConformerGenerationError'> : OpenEye Omega conformer generation failed

Describe the solution you'd like

One pathway to bypass this is to generate conformers with RDKit and pass them to OpenEye for charge assignment.

from openff.toolkit import Molecule, ForceField

mol = Molecule.from_smiles("C[S+](C)C")
mol.generate_conformers(n_conformers=10)
mol.assign_partial_charges("am1bccelf10", use_conformers=mol.conformers)

RDKit delivers a UFFTYPER warning but succeeds, and partial charges are assigned by OpenEye with no further complaints.

[14:21:45] UFFTYPER: Unrecognized charge state for atom: 1

Would it be possible to rearrange

self.generate_conformers(
mol_copy,
n_conformers=charge_method["rec_confs"],
rms_cutoff=0.25 * unit.angstrom,
make_carboxylic_acids_cis=True,
)
such that it uses the global toolkit registry, to allow conformer generation to fall back to RDKit? e.g.

mol_copy.generate_conformers(
    n_conformers=charge_method["rec_confs"],
    rms_cutoff=0.25 * unit.angstrom,
    make_carboxylic_acids_cis=True,
)

Describe alternatives you've considered

This is potentially a bad idea, if the conformers generated by RDKit aren't suitable for charge assignment.

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant