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

Add MACE RelaxMaker and StaticMaker #611

Merged
merged 9 commits into from
Nov 15, 2023
Merged

Conversation

CompRhys
Copy link
Contributor

@CompRhys CompRhys commented Nov 15, 2023

Summary

Adds MACE RelaxMaker and StaticMaker, adds a 2Mb model for testing, could adopt MACE pattern and train a fixture in the test

Additional dependencies introduced (if any)

https://github.com/ACEsuit/mace added to strict and forcefield

Checklist

  • Code is in the standard Python style.
    The easiest way to handle this is to run the following in the correct sequence on
    your local machine. Start with running black on your new code. This will
    automatically reformat your code to PEP8 conventions and removes most issues. Then run
    ruff.
  • Docstrings have been added in the Numpy docstring format.
    Run ruff on your code.
  • Type annotations are highly encouraged. Run mypy to
    type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply run
pre-commit install and a check will be run prior to allowing commits.

@janosh janosh added enhancement Improvements to existing features forcefields Forcefield related labels Nov 15, 2023
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Merging #611 (60762ae) into main (2092a36) will decrease coverage by 0.05%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

❗ Current head 60762ae differs from pull request most recent head 877d256. Consider uploading reports for the commit 877d256 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #611      +/-   ##
==========================================
- Coverage   75.54%   75.49%   -0.05%     
==========================================
  Files          83       83              
  Lines        6808     6839      +31     
  Branches     1008     1010       +2     
==========================================
+ Hits         5143     5163      +20     
- Misses       1351     1363      +12     
+ Partials      314      313       -1     
Files Coverage Δ
src/atomate2/forcefields/jobs.py 93.95% <100.00%> (+1.58%) ⬆️

... and 1 file with indirect coverage changes

Comment on lines 81 to 82
# FIXME - brittle due to inability to adjust dtypes in M3GNetRelaxMaker
torch.set_default_dtype(torch.float32)
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need these? I think

        potential_kwargs={"default_dtype": "float64"},

should do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't see where the dtypes can be set in chgnet codebase so need to do globally, issue is MACE does it globally to 64 so tests using chg/m3g after mace jobs test were failing

Copy link
Member

Choose a reason for hiding this comment

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

But then this would affect production runs as well. It would be great to make is afe to use different types of potential in one go.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Pinging @ilyes319 and @davkovacs to see if this can be solved on MACE's side without changing global state?

For now, we'll wrap the test in try/finally and revert the torch.dtype at the end.

Copy link
Member

@janosh janosh Nov 15, 2023

Choose a reason for hiding this comment

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

It would be great to make it safe to use different types of potential in one go.

@JaGeo Strongly agree. I think we can figure something out with Ilyes and David.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes dtype conversion has haunted me for a long time...

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

Great work, thanks @CompRhys! 👍

@janosh janosh enabled auto-merge (squash) November 15, 2023 15:57
@janosh janosh disabled auto-merge November 15, 2023 16:41
@janosh janosh merged commit 2caf10c into materialsproject:main Nov 15, 2023
5 checks passed
@janosh janosh changed the title fea: add MACE RelaxMaker and StaticMaker Add MACE RelaxMaker and StaticMaker Nov 16, 2023
@JaGeo JaGeo mentioned this pull request Nov 16, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features forcefields Forcefield related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants