Skip to content
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

feat(pt/dp): support three-body type embedding #4066

Merged
merged 11 commits into from
Aug 25, 2024

Conversation

iProzd
Copy link
Collaborator

@iProzd iProzd commented Aug 20, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new descriptor classes DescrptSeTTebd and DescrptBlockSeTTebd for enhanced molecular simulation capabilities.
    • Added advanced configuration options with descrpt_se_e3_tebd_args to customize descriptor behavior.
    • Launched the new "se_e3_tebd" descriptor for improved atomic configuration representation.
  • Bug Fixes

    • Improved integration of new descriptors into existing test frameworks, ensuring consistent functionality across multiple backends.
  • Tests

    • Implemented a comprehensive testing suite for DescrptSeTTebd, validating its performance across various configurations and frameworks.
  • Documentation

    • Updated public API documentation to include newly added descriptor classes and parameters for clarity and usability.
    • Created a detailed guide for implementing the se_e3_tebd descriptor in training models.
  • Chores

    • Added a structured configuration file input_torch.json for model training and evaluation.
    • Expanded test examples with the inclusion of a new input file path.

Copy link
Contributor

coderabbitai bot commented Aug 20, 2024

Walkthrough

Walkthrough

The recent changes introduce new descriptor classes, DescrptSeTTebd and DescrptBlockSeTTebd, to the molecular simulation framework, enhancing its capabilities by integrating angular information and type embeddings. Additional functions for parameter management and a comprehensive testing suite have been added to validate functionality across multiple backends. The public API has been expanded, allowing for more detailed configuration options suitable for machine learning applications.

Changes

Files Change Summary
deepmd/dpmodel/descriptor/__init__.py Added DescrptSeTTebd and DescrptBlockSeTTebd to __all__ list for public API exposure.
deepmd/dpmodel/descriptor/se_t_tebd.py Introduced DescrptSeTTebd and DescrptBlockSeTTebd classes, enhancing descriptor functionalities for molecular simulations.
deepmd/pt/model/descriptor/__init__.py Imported DescrptBlockSeTTebd and DescrptSeTTebd, updating __all__ list for public access.
deepmd/utils/argcheck.py Introduced descrpt_se_e3_tebd_args function for flexible descriptor configuration.
source/tests/consistent/descriptor/test_se_t_tebd.py New test suite for validating DescrptSeTTebd functionality across TensorFlow, DeepMD, and PyTorch.
source/tests/universal/dpmodel/descriptor/test_descriptor.py Added DescriptorParamSeTTebd and updated parameterization logic for enhanced descriptor handling.
source/tests/universal/dpmodel/model/test_model.py Enhanced tests to include new descriptors and their parameters, improving test coverage for DescrptSeTTebd.
source/tests/universal/pt/model/test_model.py Similar updates for integrating new descriptors into the testing logic, maintaining existing functionality.
doc/model/train-se-e3-tebd.md Introduced the "se_e3_tebd" descriptor, detailing its mathematical framework and training configuration.
examples/water/se_e3_tebd/input_torch.json New configuration file for model training parameters specific to the SE-E3-TEBD algorithm.
source/tests/common/test_examples.py Added path to new input file for expanded testing scenarios.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DescriptorManager
    participant Descriptor
    participant Backend

    User->>DescriptorManager: Create Descriptor
    DescriptorManager->>Descriptor: Initialize with params
    Descriptor->>Backend: Configure for simulation
    Backend->>Descriptor: Setup complete
    Descriptor->>User: Descriptor ready for use
Loading

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f238d5b and a38f126.

Files selected for processing (1)
  • doc/model/train-se-e3-tebd.md (1 hunks)
Additional context used
Markdownlint
doc/model/train-se-e3-tebd.md

62-62: Column: 1
Hard tabs

(MD010, no-hard-tabs)


75-75: Column: 1
Hard tabs

(MD010, no-hard-tabs)

Additional comments not posted (5)
doc/model/train-se-e3-tebd.md (5)

1-5: Add descriptor to the Table of Contents (TOC).

The descriptor "se_e3_tebd" is not included in the TOC.


7-8: Description section is clear and informative.

The explanation of the descriptor and its inputs is well-written.


18-31: Explain the switch function s.

The switch function s(r_{ij}) is not explained in the context of the descriptor.


51-59: Improve the comparison with another descriptor.

Consider using the following suggestion to improve clarity:

The training input script is very similar to that of [`se_e2_a`](train-se-e2-a.md). The only difference lies in the {ref}`descriptor <model/descriptor>` section.

78-78: Closing statement is clear and useful.

The reference to the descriptor type is helpful.


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
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 89.72603% with 60 lines in your changes missing coverage. Please review.

Project coverage is 83.02%. Comparing base (f6c1352) to head (a38f126).
Report is 4 commits behind head on devel.

Files Patch % Lines
deepmd/pt/model/descriptor/se_t_tebd.py 87.74% 37 Missing ⚠️
deepmd/dpmodel/descriptor/se_t_tebd.py 91.15% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #4066      +/-   ##
==========================================
+ Coverage   82.95%   83.02%   +0.07%     
==========================================
  Files         522      524       +2     
  Lines       51044    51628     +584     
  Branches     3028     3028              
==========================================
+ Hits        42343    42864     +521     
- Misses       7756     7816      +60     
- Partials      945      948       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
deepmd/dpmodel/descriptor/se_t_tebd.py (1)

139-140: Remove redundant code after raising an exception.

The del spin statement is unnecessary after raising NotImplementedError.

Consider removing it:

-        del spin
deepmd/pt/model/descriptor/se_t_tebd.py (1)

154-156: Remove redundant code after raising an exception.

The del spin statement is unnecessary after raising NotImplementedError.

Consider removing it:

-        del spin

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (3)
examples/water/se_e3_tebd/input_torch.json (1)

2-2: Consider removing or expanding the comment.

The comment "_comment": "that's all" is repeated multiple times throughout the file. Consider removing it or providing more meaningful comments to enhance clarity.

doc/model/train-se-e3-tebd.md (2)

46-46: Consider using "to" instead of "of".

The phrase "as an extra input of the embedding network" might be clearer as "as an extra input to the embedding network."

- The type embeddings of neighboring atoms $\mathcal{A}^j$ and $\mathcal{A}^k$ are added as an extra input of the embedding network.
+ The type embeddings of neighboring atoms $\mathcal{A}^j$ and $\mathcal{A}^k$ are added as an extra input to the embedding network.
Tools
LanguageTool

[uncategorized] ~46-~46: The preposition “to” seems more likely in this position.
Context: ...thcal{A}^k$ are added as an extra input of the embedding network. The notation $:$...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION)


60-60: Avoid using hard tabs in Markdown.

Replace hard tabs with spaces to ensure consistent formatting.

-	"descriptor": {
+  "descriptor": {

Also applies to: 73-73

Tools
Markdownlint

60-60: Column: 1
Hard tabs

(MD010, no-hard-tabs)

deepmd/utils/argcheck.py Outdated Show resolved Hide resolved
deepmd/utils/argcheck.py Outdated Show resolved Hide resolved
deepmd/pt/model/descriptor/se_t_tebd.py Outdated Show resolved Hide resolved
doc/model/train-se-e3-tebd.md Show resolved Hide resolved
doc/model/train-se-e3-tebd.md Outdated Show resolved Hide resolved
source/tests/consistent/descriptor/test_se_t_tebd.py Outdated Show resolved Hide resolved
deepmd/pt/model/descriptor/se_t_tebd.py Show resolved Hide resolved
deepmd/pt/model/descriptor/se_t_tebd.py Show resolved Hide resolved
deepmd/dpmodel/descriptor/se_t_tebd.py Outdated Show resolved Hide resolved
deepmd/dpmodel/descriptor/se_t_tebd.py Outdated Show resolved Hide resolved
@iProzd iProzd requested a review from njzjz August 21, 2024 09:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Outside diff range, codebase verification and nitpick comments (1)
doc/model/train-se-e3-tebd.md (1)

62-75: Replace hard tabs with spaces in JSON configuration.

The JSON configuration example uses hard tabs, which should be replaced with spaces to adhere to Markdownlint rules and maintain consistency.

Use this diff to fix the issue:

-	"descriptor": {
+  "descriptor": {
Tools
Markdownlint

62-62: Column: 1
Hard tabs

(MD010, no-hard-tabs)


75-75: Column: 1
Hard tabs

(MD010, no-hard-tabs)

deepmd/dpmodel/descriptor/se_t_tebd.py Show resolved Hide resolved
deepmd/dpmodel/descriptor/se_t_tebd.py Show resolved Hide resolved
deepmd/dpmodel/descriptor/se_t_tebd.py Show resolved Hide resolved
deepmd/pt/model/descriptor/se_t_tebd.py Show resolved Hide resolved
deepmd/pt/model/descriptor/se_t_tebd.py Show resolved Hide resolved
deepmd/pt/model/descriptor/se_t_tebd.py Show resolved Hide resolved
deepmd/pt/model/descriptor/se_t_tebd.py Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

doc/model/train-se-e3-tebd.md Show resolved Hide resolved
@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Aug 25, 2024
Merged via the queue into deepmodeling:devel with commit 67ae5fe Aug 25, 2024
60 checks passed
njzjz added a commit to njzjz/deepmd-kit that referenced this pull request Sep 9, 2024
As discussed in deepmodeling#4066

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
github-merge-queue bot pushed a commit that referenced this pull request Sep 11, 2024
As discussed in #4066

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Documentation**
- Updated the description of the `se_e3` notation for improved clarity
regarding its relation to three-body embedding in DeepPot-SE.
- Enhanced explanation of bond-angle information in the context of the
embedding.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this pull request Sep 18, 2024
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Introduced new descriptor classes `DescrptSeTTebd` and
`DescrptBlockSeTTebd` for enhanced molecular simulation capabilities.
- Added advanced configuration options with `descrpt_se_e3_tebd_args` to
customize descriptor behavior.
- Launched the new `"se_e3_tebd"` descriptor for improved atomic
configuration representation.

- **Bug Fixes**
- Improved integration of new descriptors into existing test frameworks,
ensuring consistent functionality across multiple backends.

- **Tests**
- Implemented a comprehensive testing suite for `DescrptSeTTebd`,
validating its performance across various configurations and frameworks.

- **Documentation**
- Updated public API documentation to include newly added descriptor
classes and parameters for clarity and usability.
- Created a detailed guide for implementing the `se_e3_tebd` descriptor
in training models.

- **Chores**
- Added a structured configuration file `input_torch.json` for model
training and evaluation.
  - Expanded test examples with the inclusion of a new input file path.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this pull request Sep 18, 2024
As discussed in deepmodeling#4066

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Documentation**
- Updated the description of the `se_e3` notation for improved clarity
regarding its relation to three-body embedding in DeepPot-SE.
- Enhanced explanation of bond-angle information in the context of the
embedding.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants