mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Print warning if no natural isotopes when using add_element and wrote unit test (#2938)
Co-authored-by: Catherine Yu <cathyy@umich.edu> Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
1d56adbc3d
commit
3370ce1978
2 changed files with 13 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import re
|
||||
import warnings
|
||||
|
||||
import lxml.etree as ET
|
||||
|
||||
|
|
@ -123,6 +124,10 @@ class Element(str):
|
|||
# Get the nuclides present in nature
|
||||
natural_nuclides = {name for name, abundance in natural_isotopes(self)}
|
||||
|
||||
# Issue warning if no existing nuclides
|
||||
if len(natural_nuclides) == 0:
|
||||
warnings.warn(f"No naturally occurring isotopes found for {self}.")
|
||||
|
||||
# Create dict to store the expanded nuclides and abundances
|
||||
abundances = {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue