materialsvirtuallab / matgl

Graph deep learning library for materials
BSD 3-Clause "New" or "Revised" License
232 stars 57 forks source link

CHGNet-matgl implementation #242

Closed BowenD-UCB closed 2 months ago

BowenD-UCB commented 3 months ago

Summary

CHGNet implementaion: with two pretrained weights released

Implemented Functions

Todos

Summary by CodeRabbit

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 87.90698% with 52 lines in your changes are missing coverage. Please review.

Project coverage is 97.67%. Comparing base (8ed58f9) to head (4a875e0).

:exclamation: Current head 4a875e0 differs from pull request most recent head 49c5193. Consider uploading reports for the commit 49c5193 to get more accurate results

Files Patch % Lines
src/matgl/layers/_graph_convolution.py 88.43% 20 Missing :warning:
src/matgl/utils/training.py 67.64% 11 Missing :warning:
src/matgl/models/_chgnet.py 90.65% 10 Missing :warning:
src/matgl/graph/data.py 84.09% 7 Missing :warning:
src/matgl/layers/_core.py 89.74% 4 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #242 +/- ## ========================================== - Coverage 98.80% 97.67% -1.13% ========================================== Files 33 35 +2 Lines 2752 3136 +384 ========================================== + Hits 2719 3063 +344 - Misses 33 73 +40 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

shyuep commented 3 months ago

This looks great!! @kenko911 will follow up with some suggestions and we can merge soon.

coderabbitai[bot] commented 3 months ago

Walkthrough

This update encompasses enhancements and refinements across various components of the MatGL framework, focusing on model training, graph operations, and API usability improvements. Key changes include the introduction of new normalization and graph convolution layers, modifications to model configurations for handling magnetic moments instead of site-wise properties, and updates to the ASE interface to support new calculations. Additionally, there are updates to documentation, testing, and example notebooks to align with the latest functionalities.

Changes

Files Change Summary
Mo.cif, Mo_hello.cif, Mo_relaxed.cif Defined crystal structures for Molybdenum with specific atomic positions and unit cell parameters.
.../CHGNet-MPtrj-2023.12.1-PES-2.7M/README.md, .../model.json Introduced a CHGNet model with specifics on the PyTorch implementation and data preprocessing for PES calculations.
.../CHGNet-MPtrj-2024.2.13-PES-11M/README.md, .../model.json Updated CHGNet model trained with enhanced architecture settings for advanced PES calculations in material science.
.../M3GNet-MP-2021.2.8-DIRECT-PES/model.json Shifted focus from site-wise property calculations to magnetic moments in the M3GNet model configuration.
pyproject.toml Added Bowen Deng and Luis Barroso-Luque to the list of authors.
src/matgl/apps/pes.py, src/matgl/cli.py, src/matgl/ext/ase.py Major updates to parameter naming, function logic, and extended support for magnetic moment calculations.
src/matgl/graph/..., src/matgl/layers/..., src/matgl/models/... Added new classes and methods enhancing graph convolution capabilities and normalization processes.
examples/... Updated API keys, Python versions, and import statements in example notebooks to reflect the latest library configurations.
tests/... Enhanced testing for new functionalities, including magnetic moment calculations and updated model configurations.

This table summarizes the changes made across the MatGL framework, highlighting the focus on enhancing model capabilities and refining the computational tools for materials science research.


Recent Review Details **Configuration used: .coderabbit.yaml** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between cc80907f55903a55c72130a7c1606f47165fc1b9 and 49c51934ad17b7e3129f8db6d8fe4f02f379d8e7.
Files selected for processing (1) * src/matgl/apps/pes.py (7 hunks)
Files skipped from review as they are similar to previous changes (1) * src/matgl/apps/pes.py
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
shyuep commented 2 months ago

@kenko911 Is this ready to be merged? You were supposed to review and provide comments.

kenko911 commented 2 months ago

Hi @shyuep, I already discussed this with Bowen and I am currently working on it. I will make a PR by the end of this week.

kenko911 commented 2 months ago

Hi @shyuep, I have restructured some MatGL modules and added more united tests for CHGNet implementations. I discussed this with Bowen and we both are happy about the current changes. Only 3 united tests fail due to the addition and refactoring of some variables in Potential class. When we perform the united test for loading pretrained PES models in MatGL, it fails with loading the previous model version from e.g. /home/runner/.cache/matgl/M3GNet-MP-2021.2.8-DIRECT-PES/model.json. I also updated the model veriosn of Potential class from 2 to 3 and I believe that it will be automatically fixed once we merge the changes to the main branch. Please have a look and let me know if any problems. Thanks!!