-
Notifications
You must be signed in to change notification settings - Fork 57
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
Included more united tests to improve code coverage #253
Conversation
…in TensorNet class
…oat_th and including linear layer in TensorNet to match the original implementations
WalkthroughThis update primarily involves modifications to the Changes
Recent Review DetailsConfiguration used: .coderabbit.yaml Files selected for processing (5)
Files skipped from review due to trivial changes (1)
Additional comments not posted (2)
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Out of diff range and nitpick comments (1)
src/matgl/graph/data.py (1)
[!TIP]
Codebase VerificationThe verification process has revealed that the
include_magmom
parameter is still being used in various parts of the codebase, including test scripts and within thecollate_fn_pes
function itself. This contradicts the initial assumption that removinginclude_magmom
would not affect other parts of the codebase. Here are the specific locations whereinclude_magmom
is still in use:
tests/utils/test_training.py
: The parameter is used in a partial function application.tests/graph/test_data.py
: Similar usage as intest_training.py
.src/matgl/graph/data.py
: The parameter is defined and used within thecollate_fn_pes
function and in setting up the default collate function based on dataset labels.Given this information, it is clear that the removal of
include_magmom
from thecollate_fn_pes
function would likely lead to issues unless these references are also updated or the design decision is reconsidered.Action Required:
- Review the necessity of the
include_magmom
parameter in the context of the entire project.- Update all references to
collate_fn_pes
that useinclude_magmom
or reconsider the removal of this parameter if it is deemed essential for certain functionalities.Analysis chain
Line range hint
1-603
: Removal ofinclude_magmom
fromcollate_fn_pes
simplifies the function as intended.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of removing `include_magmom` on other parts of the codebase. # Test: Search for any usage of `include_magmom`. Expect: No occurrences. rg --type python $'include_magmom'Length of output: 64
Script:
#!/bin/bash # Description: Verify the impact of removing `include_magmom` on other parts of the codebase. # Test: Search for any usage of `include_magmom` in Python files. Expect: No occurrences. rg --type py 'include_magmom'Length of output: 647
cg_rsh_0_without_pi = generate_clebsch_gordan_rsh(lmax_0, False) | ||
expected_cg_rsh_0_without_pi = torch.eye(1).unsqueeze(0) # Expected cg_rsh without parity invariance result | ||
assert torch.allclose( | ||
cg_rsh_0_without_pi, expected_cg_rsh_0_without_pi, atol=1e-4 | ||
) # Use torch.allclose for numerical comparisons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure consistency in testing for parity invariance.
The new test case added for generating Clebsch-Gordan coefficients without parity invariance (generate_clebsch_gordan_rsh(lmax_0, False)
) is a good addition for coverage. However, it's crucial to ensure that similar tests are added for other values of lmax
(e.g., lmax_1
, lmax_2
) to maintain consistency and thoroughness in test coverage.
Summary
Included more united tests to improve code coverage
Checklist
ruff
.mypy
.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: