openforcefield / openff-toolkit

The Open Forcefield Toolkit provides implementations of the SMIRNOFF format, parameterization engine, and other tools. Documentation available at http://open-forcefield-toolkit.readthedocs.io
http://openforcefield.org
MIT License
302 stars 88 forks source link

Flaky CI with toolkit showcase #1767

Closed mattwthompson closed 7 months ago

mattwthompson commented 8 months ago

Describe the bug

AmberTools + RDKit often has a hard time assigning charges to the ligand used in the toolkit showcase.

ValueError: No registered toolkits can provide the capability "assign_partial_charges" for args "()" and kwargs "{'molecule': Molecule with name '163' and SMILES '[H][O][C@@]1([H])[c]2[c]([c]([O][c]3[c]([H])[c]([F])[c]([H])[c]([C]#[N])[c]3[H])[c]([H])[c]([H])[c]2[S](=[O])(=[O])[C]([H])([H])[H])[C]([H])([H])[C]1([F])[F]', 'partial_charge_method': 'am1bcc', 'use_conformers': None, 'strict_n_conformers': False, 'normalize_partial_charges': True, '_cls': <class 'openff.toolkit.topology.molecule.Molecule'>}"
Available toolkits are: [ToolkitWrapper around The RDKit version 2023.03.3, ToolkitWrapper around AmberTools version 22.0, ToolkitWrapper around Built-in Toolkit version None]
 ToolkitWrapper around The RDKit version 2023.03.3 <class 'openff.toolkit.utils.exceptions.ChargeMethodUnavailableError'> : partial_charge_method 'am1bcc' is not available from RDKitToolkitWrapper. Available charge methods are ['gasteiger', 'mmff94'] 
 ToolkitWrapper around AmberTools version 22.0 <class 'subprocess.CalledProcessError'> : Command '['antechamber', '-i', 'molecule.sdf', '-fi', 'sdf', '-o', 'charged.mol2', '-fo', 'mol2', '-pf', 'yes', '-dr', 'n', '-c', 'bcc', '-nc', '0.0']' returned non-zero exit status 1.

This is only in the non-OpenEye runs.

To Reproduce

I can't reproduce this locally:

from openff.toolkit.utils.toolkits import toolkit_registry_manager, RDKitToolkitWrapper, AmberToolsToolkitWrapper, ToolkitRegistry

molecule = Molecule.from_smiles(
    "[H][O][C@@]1([H])[c]2[c]([c]([O][c]3[c]([H])[c]([F])[c]([H])[c]([C]#[N])[c]3[H])[c]([H])[c]([H])[c]2[S](=[O])(=[O])[C]([H])([H])[H])[C]([H])([H])[C]1([F])[F]",
    allow_undefined_stereo=True,
)

with toolkit_registry_manager(
    ToolkitRegistry(
        [AmberToolsToolkitWrapper(), RDKitToolkitWrapper(),]
    )
):
    molecule.assign_partial_charges(partial_charge_method="am1bcc")
    # No error

Additional context

Simply re-starting the action several times tends to help - though this is not a solution.