maml icon indicating copy to clipboard operation
maml copied to clipboard

_mtp.py from_config() feature update

Open dsun980701 opened this issue 2 months ago • 3 comments

Summary

Major changes:

  • Feature 1: Added a default element ordering mechanism to the 'MTPotential.from_config()' method, based on the convention of Pauling electronegativity. Currently, when a trained MTP is loaded from a '.mtp' file using the 'MTPotential.from_config()' method, users must specify the elements in the correct order. However, there are no safeguards to ensure that the element order matches that of the trained MTP; inputting the elements in the wrong order renders the trained '.mtp' file irrelevant. The new feature automatically orders elements by their electronegativity, providing a relevant default ordering mechanism. Users can still specify their own order if desired.

Checklist

  • [x] Google format doc strings added. Check with ruff.
  • [x] Type annotations included. Check with mypy.
  • [x] Tests added for new features/fixes.
  • [ ] If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

Tip: Install pre-commit hooks to auto-check types and linting before every commit:

pip install -U pre-commit
pre-commit install

Summary by CodeRabbit

  • New Features

    • Introduced a configurable element ordering option in the MTPotential class based on Pauling electronegativity, enhancing consistency in molecular simulations.
  • Bug Fixes

    • Updated the get_sp_method function in the signal processing module to accept a more flexible range of callable types, improving its utility and compatibility.
  • Tests

    • Expanded test coverage for various configurations of the MTPotential class to ensure robustness and reliability.

dsun980701 avatar Apr 24 '24 06:04 dsun980701