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

Virtual site impossible permutations error #1233

Closed
SimonBoothroyd opened this issue Mar 28, 2022 · 0 comments · Fixed by #1252
Closed

Virtual site impossible permutations error #1233

SimonBoothroyd opened this issue Mar 28, 2022 · 0 comments · Fixed by #1252

Comments

@SimonBoothroyd
Copy link
Contributor

Describe the bug

I'm seeing an impossible permutations error when trying to assign a simple divalent v-site to molecules similar to the example shown in this repro case.

To Reproduce

from openff.toolkit.topology import Molecule
from openff.toolkit.typing.engines.smirnoff import VirtualSiteHandler
from simtk import unit

molecule = Molecule.from_mapped_smiles("[H:4][C:1]1([N:2]=[N:3]1)[H:5]")

vsite_handler = VirtualSiteHandler(version="0.3")
vsite_handler.add_parameter(
    parameter=VirtualSiteHandler.VirtualSiteDivalentLonePairType(
        type="DivalentLonePair",
        smirks="[*:1]~[#7X2:2]~[*:3]",
        name="EP",
        distance=0.4 * unit.angstrom,
        outOfPlaneAngle=0.0 * unit.degrees,
        charge_increment=[0.0, 0.0, 0.0] * unit.elementary_charge,
        sigma=0.0 * unit.angstrom,
        epsilon=0.0 * unit.kilojoules_per_mole,
        match="once",
    )
)

matches = vsite_handler.find_matches(molecule.to_topology())
print(matches)

Output

Traceback (most recent call last):
  File "/xxx/repro.py", line 30, in <module>
    main()
  File "/xxx/repro.py", line 25, in main
    matches = vsite_handler.find_matches(molecule.to_topology())
  File "/xxx/openff/toolkit/typing/engines/smirnoff/parameters.py", line 5609, in find_matches
    return self._find_matches(
  File "/xxx/openff/toolkit/typing/engines/smirnoff/parameters.py", line 5445, in _find_matches
    index_of_key = tdc.index_of(key, possible=orders)
  File "/xxx/openff/toolkit/topology/topology.py", line 152, in index_of
    assert all([p in permutations for p in possible]), (
AssertionError: Possible permutations [(0, 1, 2), (2, 1, 0), (0, 2, 1), (1, 2, 0)] is impossible!

Computing environment (please complete the following information):

  • Operating system OSX
  • Output of running conda list
openff-toolkit-base       0.10.3
openeye-toolkits          2021.2.0

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

Successfully merging a pull request may close this issue.

1 participant