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

bug: fix spin nlist in spin_model #3718

Merged
merged 8 commits into from
May 8, 2024

Conversation

iProzd
Copy link
Collaborator

@iProzd iProzd commented Apr 29, 2024

Summary by CodeRabbit

  • New Features

    • Expanded backend support to include PyTorch and DP in the energy spin training documentation.
    • Updated spin settings for TensorFlow and PyTorch/DP in the energy spin training documentation.
    • Added new sections for loss functions and data preparation in the energy spin training documentation.
  • Bug Fixes

    • Adjusted test conditions and initialization parameters in various model tests to align with updated functionalities.
  • Tests

    • Increased selection values in permutation tests to enhance test coverage and reliability.

@iProzd iProzd changed the title Fix spin nlist bug in spin_model bug: fix spin nlist in spin_model Apr 29, 2024
Copy link

coderabbitai bot commented Apr 29, 2024

Walkthrough

Walkthrough

The changes encompass enhancing the handling of atom neighbors in spin_model.py by introducing distinctions between real and spin atom neighbors. The test suite adjustments involve refining setup methods by adding and removing variable assignments to align with the updated model behaviors.

Changes

File Path Change Summary
.../model/spin_model.py Reorganized atom neighbor calculations; introduced self_real to differentiate real and spin neighbors; adjusted neighbor list concatenation.
.../tests/.../test_forward_lower.py Updated setUp methods: removed self.type_split; added self.test_spin for specific test classes; modified parameters and conditions in test methods for spin model classes.
.../tests/.../test_permutation.py Updated repinit_nsel from 30 to 100 and repformer_nsel from 20 to 40 in test_permutation.py.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 8cdf464 and c91db52.
Files selected for processing (1)
  • doc/model/train-energy-spin.md (3 hunks)
Additional Context Used
LanguageTool (3)
doc/model/train-energy-spin.md (3)

Near line 24: In this context, ‘type’ should agree in number with the noun after ‘of’.
Context: ...tion, which sets the magnetism for each type of atoms as described in the following sections....


Near line 44: Possible missing article found.
Context: ...al_len>` specifies the distance between virtual atom and the belonging real atom. - {re...


Near line 49: It seems that a comma is missing.
Context: ...pin implementation is more flexible and so far supports the following descriptors: - ...


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.

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 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.

@iProzd
Copy link
Collaborator Author

iProzd commented Apr 29, 2024

@hztttt Please review this PR, which fixes the nlist bugs in DPA2. (It seems I can not explicitly assign you as a reviewer.)

Copy link

codecov bot commented May 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.25%. Comparing base (6f06adb) to head (c91db52).

Additional details and impacted files
@@           Coverage Diff           @@
##            devel    #3718   +/-   ##
=======================================
  Coverage   82.25%   82.25%           
=======================================
  Files         513      513           
  Lines       47653    47654    +1     
  Branches     2980     2980           
=======================================
+ Hits        39199    39200    +1     
  Misses       7543     7543           
  Partials      911      911           

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

@iProzd
Copy link
Collaborator Author

iProzd commented May 7, 2024

Two bugs:

  1. need buffer region for spin nlist.
  2. sel is too small for dpa2 with spin (rcut 6.0 with sel 30), where they may sometimes select different self images on the bondary with the same distances (which may cause the same g but different r during grrg update). When there's no spin, sel needed is half less that, so it was ok.

@github-actions github-actions bot added the Docs label May 8, 2024
@iProzd iProzd requested review from wanghan-iapcm and removed request for wanghan-iapcm May 8, 2024 14:13
Copy link

@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: 3

Out of diff range and nitpick comments (1)
doc/model/train-energy-spin.md (1)

Line range hint 96-104: Replace hard tabs with spaces to maintain consistency with the project's coding standards.

-	"type":		        "ener_spin",
-	"start_pref_e":	    0.02,
-	"limit_pref_e":	    1,
-	"start_pref_fr":	1000,
-    "limit_pref_fr":	1.0,
-	"start_pref_fm":	10000,
-	"limit_pref_fm":	10.0,
-	"start_pref_v":	    0,
-	"limit_pref_v":	    0,
+    "type":             "ener_spin",
+    "start_pref_e":     0.02,
+    "limit_pref_e":     1,
+    "start_pref_fr":    1000,
+    "limit_pref_fr":    1.0,
+    "start_pref_fm":    10000,
+    "limit_pref_fm":    10.0,
+    "start_pref_v":     0,
+    "limit_pref_v":     0,

doc/model/train-energy-spin.md Show resolved Hide resolved
doc/model/train-energy-spin.md Show resolved Hide resolved
doc/model/train-energy-spin.md Show resolved Hide resolved
@iProzd
Copy link
Collaborator Author

iProzd commented May 8, 2024

c91db52 adds docs for spin in PyTroch/DP. But the data format (old/new) stills need a detail doc, i've opened a issue (#3760 ) about that. Need help from @hztttt . Maybe in a seperate PR.

@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue May 8, 2024
Merged via the queue into deepmodeling:devel with commit 6d0874e May 8, 2024
60 checks passed
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.

[Feature Request] test: test consistency between forward and forward_lower
3 participants