Skip to content

Resonance form enumeration is slow #195

Description

@mattwthompson

The slowdown is in NetworkX calls during resonance enumeration - the below code runs quickly for larger molecules (C1000) but effectively hangs for yours:

from openff.nagl.molecule._graph.molecule import GraphMolecule
from openff.toolkit import Molecule
from openff.nagl_models import list_available_nagl_models

model = GNNModel.load(list_available_nagl_models()[-1])

molecule = Molecule.from_smiles(1000 * "C")

%%timeit
GraphMolecule.from_openff(
    molecule=molecule,
    atom_features=model.config.atom_features,
    bond_features=model.config.bond_features,
)

When I let this run on your molecule and kill it after a long time (order of hours) the traceback from the KeyboardInterrupt points to enumerate_resonance_forms which itself is dispatching to NetworkX calls.

This is not an optional step in the process of assigning partial charges, so this is only diagnostic (and I'm pretty sure Lily already knew this), but it's the first step towards a solution

Originally posted by @mattwthompson in #192

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions