-
Notifications
You must be signed in to change notification settings - Fork 92
_mtp.py from_config() feature update #618
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
WalkthroughThe recent updates focus on improving element ordering control in Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
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 (
|
Signed-off-by: David <[email protected]>
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: 7
Out of diff range and nitpick comments (9)
tests/apps/pes/test_mtp.py (9)
Line range hint
1-1: Add a module-level docstring to provide an overview of the module's purpose and functionality.
Line range hint
25-25: Add a docstring to thesetUpClassmethod to explain its functionality, particularly how it sets up the test environment.
Line range hint
31-31: Add a docstring to thetearDownClassmethod to describe its role in cleaning up after tests are run.
Line range hint
35-35: Add a docstring to thesetUpmethod to explain how it initializes the conditions for each test.
Line range hint
49-49: Add a docstring to thetest_write_read_cfgsmethod to describe what this test verifies.
Line range hint
60-60: ReplaceassertAlmostEqualwith a regularassertfor consistency with other tests and to simplify the code.- self.assertAlmostEqual(energy1, energy2) + assert energy1 == energy2
Line range hint
66-66: Add a docstring to thetest_trainmethod to explain what aspects of thetrainmethod it tests.
Line range hint
79-79: Add a docstring to thetest_evaluatemethod to describe its purpose and the conditions under which it operates.
Line range hint
99-99: Add a docstring to thetest_predict_efsmethod to explain what this test checks and how it uses thepredict_efsmethod.
tests/apps/pes/test_mtp.py
Outdated
| mtp = MTPotential.from_config(config_file, elements=["Mo"]) | ||
| assert mtp.param is not None | ||
| mtp = MTPotential.from_config(config_file_4, elements=['Nb','O','Li','Cl']) | ||
| assert mtp.param is not None and mtp.elements == ['Li','Nb','Cl','O'] |
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.
Break down the assertion into multiple parts for clarity and to isolate which part of the assertion might fail.
- assert mtp.param is not None and mtp.elements == ['Li','Nb','Cl','O']
+ assert mtp.param is not None
+ assert mtp.elements == ['Li','Nb','Cl','O']Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| assert mtp.param is not None and mtp.elements == ['Li','Nb','Cl','O'] | |
| assert mtp.param is not None | |
| assert mtp.elements == ['Li','Nb','Cl','O'] |
tests/apps/pes/test_mtp.py
Outdated
| mtp = MTPotential.from_config(config_file_4, elements=['Nb','O','Li','Cl']) | ||
| assert mtp.param is not None and mtp.elements == ['Li','Nb','Cl','O'] | ||
| mtp = MTPotential.from_config(config_file_4, elements=['Nb','O','Li','Cl'], default_element_ordering=False) | ||
| assert mtp.param is not None and mtp.elements == ['Nb','O','Li','Cl'] |
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.
Break down the assertion into multiple parts for clarity and to isolate which part of the assertion might fail.
- assert mtp.param is not None and mtp.elements == ['Nb','O','Li','Cl']
+ assert mtp.param is not None
+ assert mtp.elements == ['Nb','O','Li','Cl']Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| assert mtp.param is not None and mtp.elements == ['Nb','O','Li','Cl'] | |
| assert mtp.param is not None | |
| assert mtp.elements == ['Nb','O','Li','Cl'] |
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)
tests/apps/pes/test_mtp.py (1)
20-20: Add a docstring to theconfig_file_4declaration to explain its purpose and usage.
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
Signed-off-by: David <[email protected]>
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
maml/apps/pes/_mtp.py
Outdated
| f"Order for the elements has been altered from {elements} to {ordered_elements} to ensure" | ||
| + " consistency with default element ordering in maml during MTP fitting. Change the" |
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.
Consider using implicit string concatenation for better readability.
- f"Order for the elements has been altered from {elements} to {ordered_elements} to ensure"
- + " consistency with default element ordering in maml during MTP fitting. Change the"
+ f"Order for the elements has been altered from {elements} to {ordered_elements} to ensure consistency with default element ordering in maml during MTP fitting. Change the"Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| f"Order for the elements has been altered from {elements} to {ordered_elements} to ensure" | |
| + " consistency with default element ordering in maml during MTP fitting. Change the" | |
| f"Order for the elements has been altered from {elements} to {ordered_elements} to ensure consistency with default element ordering in maml during MTP fitting. Change the" |
|
Thanks for the PR David @dsun980701. Please try to make the linting tests pass, and then we can ask Shyue Ping for a review. |
Signed-off-by: David <[email protected]>
|
Thank you for reviewing @JiQi535. I have changed my code to address the linting issue. However, as of now, the linting is failing not from my changes, but from "maml/apps/symbolic/init." and "maml/utils/_signal_processing.py". Please let me know if there is anything that I can do about these issues! |
Signed-off-by: David <[email protected]>
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: 0
Out of diff range and nitpick comments (1)
maml/utils/_signal_processing.py (1)
Line range hint
3-12: Consider sorting and formatting the import statements to improve readability and maintainability.
|
Hi @dsun980701, can you please try to pull the latest changes from the main branch? I think I have fixed the united tests and now at least the pytest should work. |
Summary
Major changes:
Checklist
ruff.mypy.duecredit@due.dcitedecorators to reference relevant papers by DOI (example)Tip: Install
pre-commithooks to auto-check types and linting before every commit:Summary by CodeRabbit
New Features
MTPotentialclass based on Pauling electronegativity, enhancing consistency in molecular simulations.Bug Fixes
get_sp_methodfunction in the signal processing module to accept a more flexible range of callable types, improving its utility and compatibility.Tests
MTPotentialclass to ensure robustness and reliability.