question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Labelling fails if v-site handler added after library charge handler

See original GitHub issue

Describe the bug

Labelling a molecule with a FF that contains a library charge handler that was added after a v-site handler fails

This flag should likely be inside the next loop.

To Reproduce

from openff.toolkit.typing.engines.smirnoff import ForceField
from openff.toolkit.typing.engines.smirnoff.parameters import (
    LibraryChargeHandler,
    VirtualSiteHandler
)
from simtk import unit as simtk_unit

force_field = ForceField()
force_field.get_parameter_handler("Electrostatics")

vsite_handler: VirtualSiteHandler = force_field.get_parameter_handler(
    "VirtualSites"
)
vsite_handler.add_parameter(
    {
        "smirks": "[#6:1][#9:2]",
        "name": "EP",
        "type": "BondCharge",
        "distance": 1.0 * simtk_unit.angstrom,
        "match": "once",
        "charge_increment1": 0.2 * simtk_unit.elementary_charge,
        "charge_increment2": 0.1 * simtk_unit.elementary_charge,
        "sigma": 1.0 * simtk_unit.angstrom,
        "epsilon": 0.0 * simtk_unit.kilocalorie_per_mole,
    }
)

library_handler: LibraryChargeHandler = force_field.get_parameter_handler(
    "LibraryCharges"
)
library_handler.add_parameter(
    {
        "smirks": "[F:2][C:1]([H:3])([H:4])([H:5])",
        "charge": [
            0.3 * simtk_unit.elementary_charge,
            -0.15 * simtk_unit.elementary_charge,
            -0.05 * simtk_unit.elementary_charge,
            -0.05 * simtk_unit.elementary_charge,
            -0.05 * simtk_unit.elementary_charge
        ]
    }
)

print(force_field.label_molecules(Molecule.from_smiles("CF").to_topology()))

Output

                if param_is_list:
                    for match in matches:
>                       parameter_matches[match] = [
                            m.parameter_type for m in matches[match]
                        ]
E                       TypeError: '_Match' object is not iterable

/xxx/openff/toolkit/typing/engines/smirnoff/forcefield.py:1435: TypeError

Computing environment (please complete the following information):

  • Operating system
  • Output of running conda list
openff-toolkit-base       0.10.3             pyhd8ed1ab_0    conda-forge

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
j-wagscommented, Apr 27, 2022

Oh, I didn’t see that Simon had posted a proposed fix here - This may be quick so I’d be happy to give this a shot this morning @jthorton.

1reaction
jthortoncommented, Apr 27, 2022

Yeah, can confirm this is still broken with a fresh 0.10.6 install.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Consider marking event handler as 'passive' to make the page ...
Consider marking event handler as 'passive' to make the page more responsive. So I tried to add 'passive' to the listener like so....
Read more >
Configuring Loans - Ex Libris Knowledge Center
Handler options can be configured only if you select Handle Automatically or one of the Override by options. The block preferences Item has...
Read more >
Python Logging Guide - Best Practices and Hands-on Examples
The logging library is based on a modular approach and includes categories of components: loggers, handlers, filters, and formatters.
Read more >
Introduction to browser events - The Modern JavaScript Tutorial
An event is a signal that something has happened. All DOM nodes generate such signals (but events are not limited to DOM). Here's...
Read more >
Troubleshooting errors in AWS Glue
If AWS Glue returns an access denied error to an Amazon S3 bucket or object, it might be because the IAM role provided...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found