-
Notifications
You must be signed in to change notification settings - Fork 102
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
Allow custom mace model by specifying "model" in calculator kwargs" #1017
Allow custom mace model by specifying "model" in calculator kwargs" #1017
Conversation
45d328c
to
3632b26
Compare
More context:
@janosh @utf, how does atomate2 intend to evolve the |
i think the latest version of |
3632b26
to
fd07d69
Compare
@orionarcher I will remove the orb stuff here and then merge. There is a separate pull request for the orb part in #1031 |
…ate2 into allow_custom_mace_model
Oh, there seems to be something wrong with the kwargs. Will check later and then merge. |
@esoteric-ephemera Could you shortly have a look at this failing test? To me, it looks like the symmetry does not change during relaxation with the latest mace version. At least, within the ASERelaxer, the correct "relax_cell" and "fix_symmetry" are set. |
@JaGeo sure! Will look at this soon |
model = kwargs.get("model") | ||
if isinstance(model, str | Path) and os.path.isfile(model): | ||
model_path = model | ||
calculator = MACECalculator( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we need to change this to:
device = kwargs.get("device") or "cpu"
calculator = MACECalculator(
model_paths=model_path,
device = device,
**kwargs
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. One needs to remove the "device" key from the kwargs. Otherwise, it will complain that it is set twice. Will do that.
OK so if the symmetry of a cell is fixed, we certainly should assert that the initial and final symmetries of the cell are the same But if we don't fix the symmetry, there's a distinct possibility that the symmetry of the cell remains the same. It could change, but unless the force convergence criterion is made tighter, there's a decent chance the structure barely changes For example, with the previous setting of Also worth noting that it seems like ASE's FixSymmetry isn't holding for more stringent force convergence criteria. I pushed |
@esoteric-ephemera so, you are okay with simply adapting the test, right? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1017 +/- ##
==========================================
+ Coverage 4.32% 66.58% +62.25%
==========================================
Files 178 178
Lines 12911 12921 +10
Branches 1278 1280 +2
==========================================
+ Hits 559 8604 +8045
+ Misses 12321 3838 -8483
- Partials 31 479 +448
|
@esoteric-ephemera @orionarcher Okay, I figured it out. |
@JaGeo good with adapting the test as needed but good to know it was a dtype issue |
…aterialsproject#1017) * allow custom mace model by specifying "model" in calculator kwargs" * fix error in trying to turn None into path * Add support for ORB model * Specify more dependencies * remove orb implementation * add line * add line * remove device * set device * fix set device * fix test * fix linting * restore test * remove os and rely on pathlib only --------- Co-authored-by: J. George <JaGeo@users.noreply.github.com> Co-authored-by: JaGeo <janinegeorge.ulfen@gmail.com>
Currently it's only possible to use the mace_mp model. This PR allows users to use a custom model by making the "model" kwarg a path to the model. If
model
is not aPath
, thenmace_mp
is used, thus this change should be backwards compatible.EDIT: More context:
mace==0.3.3
, the version currently used by atomate2, allows custom mace models inmace_mp
. So the current code does not need any changes to use custom models.mace==0.3.7
, the most recent version does not allow custom models in mace_mp, which is a breaking change. This PR will be needed whenatomate2
bumps the mace version. When that happens, many tests will likely need fixing.