Add support for Torchsim#1335
Conversation
esoteric-ephemera
left a comment
There was a problem hiding this comment.
Some general comments besides the ones on specific lines:
- The TS prefixing in makers, enums, etc. is confusing given that TS is probably more familiar as "transition state" than "torchsim" - can you change this to
TorchSim? - Are you envisioning this being added as a separate (as its currently implemented) or additive module to the existing forcefields stuff? If the latter, the schemas would have to be merged for the job outputs
reduce redundancy in initialization logic
Good call.
I think this should be a separate module. It would be really messy to integrate it with the existing forcefields stuff. TorchSim generally expects many -> many calculations (list[structure] -> list[structure]) and has different output files and such. |
|
Encouraging! In that case, let me reframe. It looks like it would be possible, but I anticipate it would be a major headache, one I am reluctant to take on. Though they both run MLIPs, ASE and TorchSim are different software packages with pretty different APIs. I don't see a major reason to have them share schema or logic. The |
|
The motivation should always be the following: |
|
I hear you and I am sympathetic to that argument. In this case, I feel there is a tradeoff between the immediate adoptability of the TorchSim interface and it's overall quality. After looking back and forth at the ASE and TorchSim schema for the past 15 minutes, I don't think it's possible to adapt the TorchSim API to fit the ASE schemas without adding complexity, reducing readability, and making the overall API less natural and maintainable. I would love for users currently using ASE to be able to quickly and reliably switch to TorchSim but it's not clear to me that equating the schemas is the best way to do that. I would be happy to write a transition guide outlining the schema differences and how to transition from ASE -> TorchSim and add it to this PR. |
|
@JaGeo @esoteric-ephemera do you have any idea why the abinit tests might be failing here? This seems unrelated to any changes I made wrt TorchSim? |
|
I think you can safely ignore it, can happen with parallel runners and there should be a fix for this in the next release of abipy |
|
Other than the unrelated failing tests, I think this is ready to merge? The tests are passing locally and I think all the suggestions are addressed. |
|
Bumped a few comments for your consideration; totally OK if you disagree with the suggestions therein |
|
@orionarcher thanks! We now need to fix the tests. They are failing as the installations need to much cache. We might need to do some cache cleaning after certain workflows or come up with a different idea. |
|
Yeah, looks like TorchSim is the straw that broke the camels back. I could split the tests into a separate action but I don't know if that's the most sustainable route. What would you propose as a solution there? Would you like me to take a swing at it or would you like to try a fix? |
|
I don't have a good solution. Separate action sounds good for me for now. I won't be able to do much testing here myself for a couple of weeks. @esoteric-ephemera do you have any opinion here? Also with regard to usage of action time? |
|
I split the TorchSim stuff out into separate tests. It's dependent on I think it should all be good to go now? |
|
Separate workflow action / separate test sounds good to me. Also for the best given the torch version pin needed for some of the MLFFs, as you said @orionarcher Will take another look through and ping you if I see anything, thanks for your work on this so far! |
|
Fine from my side now. Once @esoteric-ephemera is happy, we can merge :) |
|
Thanks @esoteric-ephemera and @JaGeo! Looking forward to having this in! |
|
@esoteric-ephemera polite bump :) |
|
Have it on my calendar to look by tomorrow! |
c321cbc
into
materialsproject:main
Summary
This PR adds support for TorchSim, namely:
integrate,optimizeandstaticfunctionsintegrate,optimizeandstaticjobsNOTE: this PR uses StrEnum's which are not supported in python 3.10, see #1334
Additional dependencies introduced (if any)
Checklist
Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request
title.
Before a pull request can be merged, the following items must be checked:
The easiest way to handle this is to run the following in the correct sequence on
your local machine. Start with running
ruffandruff formaton your new code. This willautomatically reformat your code to PEP8 conventions and fix many linting issues.
Run ruff on your code.
type check your code.
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 installand a check will be run prior to allowing commits.