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

Enforce non-negative percents for material.add_nuclide to prevent unintended ao/wo flipping #3075

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Enforce non-zero percents for add_element
  • Loading branch information
johvincau committed Jul 8, 2024
commit ee599c997a85dbb530b34dc436995b20581e0132
1 change: 1 addition & 0 deletions openmc/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ def add_element(self, element: str, percent: float, percent_type: str = 'ao',

cv.check_type('nuclide', element, str)
cv.check_type('percent', percent, Real)
cv.check_greater_than('percent', percent, 0, equality=True)
cv.check_value('percent type', percent_type, {'ao', 'wo'})

# Make sure element name is just that
Expand Down