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

Update for upcoming OpenFF Toolkit API breaks #191

Merged
merged 4 commits into from
Aug 2, 2022

Conversation

mattwthompson
Copy link
Collaborator

Hi OpenMM developers,

I'm seeing some test failures in our example that uses openmmforcefields with our big biopolymer feature branch, probably due to Atom.element being removed in our upcoming API break. This change should fix that and be backwards-compatible.

Comment on lines +33 to +34
- pip:
- git+https://github.com/openforcefield/openff-toolkit.git@topology-biopolymer-refactor
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't want to shoulder the complexity of testing against an unreleased version, you can grab it with a similar command locally (pip install git+https://github.com/openforcefield/openff-toolkit.git@topology-biopolymer-refactor) and have a look around for yourself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And for the record: I'm not suggesting this change be merged in; I want to show in the context of this PR that it should pass with the new API. I will revert this before merging if approved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! We should test against both the current and preview versions, ideally. But to do that, we can't just eliminate testing the current version---I'll have to rework the test matrix.

@mattwthompson mattwthompson changed the title Toolkit update Update for upcoming OpenFF Toolkit API breaks Mar 31, 2022
element_counts = defaultdict(int)
for atom in molecule.atoms:
symbol = atom.element.symbol
symbol = atom.element.symbol if uses_old_api else atom.symbol
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's an unexpected change.

@mattwthompson, can you point to some information about the motivation for this? Is the idea that Atom objects don't have to be physical elements anymore?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if symbol supports non-physical elements or made-up symbols now, is there an API for telling whether the element is a real element or not?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the PR where the change happened: openforcefield/openff-toolkit#1182
It comes from switching to a different package.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jchodera this is the only modification needed to get openmmforcefields working with the changes in the openff-toolkit/openff-element and given they are done in a backwards compatible way, I am happy with them. If you are happy with it, I can make a new PR add this changes + tests the latest version of the openff-toolkit.

@jchodera
Copy link
Member

jchodera commented Apr 6, 2022

Thanks for this, @mattwthompson!

I'll need to finish up #182 first, but then will tackle integrating this PR.

@richardjgowers
Copy link
Contributor

It would be great if this could get merged, this is breaking stuff for openfe currently

Copy link
Member

@jchodera jchodera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jchodera jchodera merged commit 445c356 into openmm:master Aug 2, 2022
@mattwthompson
Copy link
Collaborator Author

Thanks!

@mattwthompson
Copy link
Collaborator Author

Unfortunately our tests are still failing; I think L966 in this loop needs a similar change:

# Generate atom types
atom_types = etree.SubElement(root, "AtomTypes")
for particle_index, particle in enumerate(molecule.particles):
# Create a new atom type for each atom in the molecule
paricle_indices = [particle_index]
atom_type = etree.SubElement(atom_types, "Type", name=particle.typename,
element=particle.element.symbol, mass=as_attrib(particle.element.mass))
atom_type.set('class', particle.typename) # 'class' is a reserved Python keyword, so use alternative API

if I had to guess, I didn't notice this previous because I was grepping around for atom.element.symbol or something similar - and at first glance the traceback looks like particle is an OpenMM object of sorts, not an OpenFF Atom object.

mattwthompson added a commit to mattwthompson/openmmforcefields that referenced this pull request Aug 9, 2022
@mattwthompson mattwthompson mentioned this pull request Sep 15, 2022
mikemhenry added a commit that referenced this pull request Sep 15, 2022
* Ensure 0.11.0 RC version of toolkit is installed

* Possible fix to finish #191

* Try to ensure bash args thing is passed through

* Naive unit refactor

* Work through tests

* Update CI matrix

* Use mamba for development

* Debug, add boilerplate .gitignore

* Fix syntax

* make sure the package didn't get installed before we install it

* Do not install Espaloma

* Fix some unit registries in tests

* install espaloma, but remove openmmforcefields

* add back in espaloma

* switch to micromamba

* Explicitly move ffxml sources into entry point

* Remove symlinking

* Add boilerplate `.gitignore`

* Update package installation in CI

* Fix finding Amber files in test

* Soft import whatever units module is used by the toolkit

* Switch to micromamba for setting up conda environment

Add boilerplate `.gitignore` file

Do not pull from non-standard labels

Install instead of update

Try to figure out why if: {{ false }} still triggers

Syntax?

Tinker

Bring in (full) mamba

Bash thing everywhere

Bring down old toolkit

Do not present un-loadable ff14SB port as available

More pins

* Fix YAML syntax

* Use pip

* More fixes

* No particles
* Fix unit serialization
* Fix Atom.element calls

* Update some tests

* Clean up un-used imports

* Fix more tests

* Fix more tests

* Exclude Python 3.10 on macOS

* Skip ff14SB being treated as a small molecule

* Fix test

* Track duration of longest 20 tests

* Update action versions

* Try to fix exclusions in CI matrix

* Fix pathing in Amber conversion

* Run `pyupgrade --py38-plus`

* Try directly uploading coverage report

* Fix syntax

* Add back some tests

* Debug

* Drop `pytest-xdist` arg

* Fiddle with path

* Just try to get stuff passing

* Try uploading again

* Switch back to codecov

* Simply coverage reporting

* Allow 0 coverage

* Simplify coverage arguments

* Add `__init__.py` in `/tests/` submodule

https://stackoverflow.com/a/60579142

* Add `__init__.py` in `/tests/` submodule

https://stackoverflow.com/a/60579142

* Simplify coverage arguments

* Add back durations argument

* Apply suggestions from code review

* only upload report if it is not scheduled

Co-authored-by: Matthew W. Thompson <mattwthompson@protonmail.com>
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 this pull request may close these issues.

None yet

4 participants