Skip to content

Conversation

@lan496
Copy link
Contributor

@lan496 lan496 commented Dec 25, 2025

Summary

  • Introduce _get_standardized_mlff (returns canonicalized MLFF) and hide a private function _get_formatted_ff_name
  • Use standardized MLFF in ForceFieldMixin for default calculator kwargs and task docs; remove redundant str(...) casts
  • Add mlff property to ForceFieldMixin and PhononMaker
  • Update forcefield flow makers to use mlff and remove _get_formatted_ff_name

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:

  • 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 ruff and ruff format on your new code. This will
    automatically reformat your code to PEP8 conventions and fix many linting issues.
  • Doc strings 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.

@lan496 lan496 marked this pull request as ready for review December 25, 2025 13:03
@JaGeo
Copy link
Member

JaGeo commented Dec 26, 2025

@lan496 thank you for this first contribution! To me, this looks fine but I will wait for @esoteric-ephemera final approval before merging.

In any case: Could you document the use of the new methods and modified forcefield flows within the documentation or tutorials? That would be highly appreciated.

@lan496
Copy link
Contributor Author

lan496 commented Dec 28, 2025

@JaGeo Thank you for your comment! I've introduced mlff property in the tutorial, fe54e06. I did not modify documentation for force fields because this page does not seem to be a place to describe APIs.

@lan496
Copy link
Contributor Author

lan496 commented Dec 28, 2025

BTW, my motivation of this PR is to enable the use of an externally defined calculator constructors with atomate2.forcefields on top of this change; For example, as follows

   calculator_meta = {
       "@module": "chgnet.model.dynamics",
       "@callable": "CHGNetCalculator",
   }
   maker = PhononMaker.from_force_field_name(
       force_field_name=calculator_meta,
   )

I am implementing this approach in a separate branch lan496@324fe30. I would appreciate it if the maintainers could consider this extension after this PR is merged.

@JaGeo
Copy link
Member

JaGeo commented Dec 28, 2025

@lan496 I will merge this PR as everything is backwards compatible.

I also really like the idea to simplify the usage of external calculators. Thus, I would highly welcome such a PR.

Thank you! Btw, feel free to add your name to the list of contributors in the documentation if you like.

With regard to documentation: we should likely introduce a section on forcefields in the future. I will open a separate issue to not lose track of it.

@esoteric-ephemera
Copy link
Collaborator

Thanks @lan496, I will take a look when I'm back in the office from the hoidays. If you want to merge now @JaGeo, please do. We can always put out a release candidate to test changes

@JaGeo JaGeo merged commit f85e91e into materialsproject:main Dec 28, 2025
15 checks passed
@JaGeo
Copy link
Member

JaGeo commented Dec 28, 2025

I merged!

I realized there is a section on forcefields already. @lan496 maybe you can extend this section with the next PR. I guess then usage of such external calculators needs to be documented more anyhow 😃

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.

3 participants