-
Notifications
You must be signed in to change notification settings - Fork 868
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
Add is_radioactive
property to Element class
#3804
Conversation
WalkthroughThe recent updates to the Changes
Recent Review DetailsConfiguration used: .coderabbit.yaml Files selected for processing (2)
Files skipped from review as they are similar to previous changes (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: 2
tests/core/test_periodic_table.py
Outdated
@@ -237,6 +237,7 @@ def test_attributes(self): | |||
("U", "Pu"): "is_actinoid", | |||
("Si", "Ge"): "is_metalloid", | |||
("O", "Te"): "is_chalcogen", | |||
("Tc", "Po"): "is_radioactive", |
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.
Add tests for the new is_radioactive
property.
It seems that tests for the newly introduced is_radioactive
property are missing. Would you like me to help generate these tests or should I open a GitHub issue to track this task?
@@ -607,4 +608,4 @@ def test_get_el_sp(): | |||
def test_element_type(): | |||
assert isinstance(ElementType.actinoid, Enum) | |||
assert isinstance(ElementType.metalloid, Enum) | |||
assert len(ElementType) == 17 | |||
assert len(ElementType) == 18 |
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.
Update the expected count of ElementType
enum.
The test for the length of the ElementType
enum should reflect the addition of the new "radioactive" category. The expected count should be updated from 18 to 19 to accommodate this change.
- assert len(ElementType) == 18
+ assert len(ElementType) == 19
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 len(ElementType) == 18 | |
assert len(ElementType) == 19 |
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.
thanks for adding this! 👍
Agree upon which elements are considered radioactive. Currently, my PR has the following elements considered radioactive: Tc, Pm, and all elements with atomic number greater than 83 (Z>83) i.e. Po-Lr (Og).
looks good to me. is this not widely agreed upon?
I would say yes they are. |
Summary
Major changes:
is_radioactive
property to theElement
class which allows users to check if an Element is radioactive.contains_element_type
method in theComposition
class has radioactive as a possible category added, so users can check if a composition contains radioactive elements.Feature motivation:
Motivated by a recent publication (https://pubs.acs.org/doi/10.1021/acs.chemmater.4c00643) which identifies that some of the discovered compounds in the GNoME database (https://github.com/google-deepmind/materials_discovery) contain radioactive elements, it would be useful to be able to screen out compositions containing radioactive elements or to be able to characterise how many radioactive compositions exist in a dataset of compositions/structures.
Todos
Checklist
ruff
.mypy
.