mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Changes to be consistent with PEP8 style
This commit is contained in:
parent
70b2f968f8
commit
abd8175a15
4 changed files with 23 additions and 23 deletions
|
|
@ -40,7 +40,7 @@ of an element, you specify the element itself. For example,
|
|||
|
||||
mat.add_element('C', 1.0)
|
||||
|
||||
This method can also accept element names, insensitive to case, such as
|
||||
This method can also accept case-insensitive element names such as
|
||||
|
||||
::
|
||||
|
||||
|
|
|
|||
|
|
@ -112,30 +112,30 @@ NATURAL_ABUNDANCE = {
|
|||
|
||||
# Dictionary to give element symbols from IUPAC names
|
||||
# (and some common mispellings)
|
||||
ELEMENT_SYMBOL = {'neutron': 'n', 'hydrogen': 'H', 'helium': 'He',
|
||||
'lithium': 'Li', 'beryllium': 'Be', 'boron': 'B',
|
||||
ELEMENT_SYMBOL = {'neutron': 'n', 'hydrogen': 'H', 'helium': 'He',
|
||||
'lithium': 'Li', 'beryllium': 'Be', 'boron': 'B',
|
||||
'carbon': 'C', 'nitrogen': 'N', 'oxygen': 'O', 'fluorine': 'F',
|
||||
'neon': 'Ne', 'sodium': 'Na', 'magnesium': 'Mg',
|
||||
'aluminium': 'Al', 'aluminum':'Al', 'silicon': 'Si',
|
||||
'phosphorus': 'P', 'sulfur': 'S', 'sulphur': 'S',
|
||||
'chlorine': 'Cl', 'argon': 'Ar', 'potassium': 'K',
|
||||
'aluminium': 'Al', 'aluminum': 'Al', 'silicon': 'Si',
|
||||
'phosphorus': 'P', 'sulfur': 'S', 'sulphur': 'S',
|
||||
'chlorine': 'Cl', 'argon': 'Ar', 'potassium': 'K',
|
||||
'calcium': 'Ca', 'scandium': 'Sc', 'titanium': 'Ti',
|
||||
'vanadium': 'V', 'chromium': 'Cr', 'manganese': 'Mn',
|
||||
'iron': 'Fe', 'cobalt': 'Co', 'nickel': 'Ni', 'copper': 'Cu',
|
||||
'zinc': 'Zn', 'gallium': 'Ga', 'germanium': 'Ge',
|
||||
'arsenic': 'As', 'selenium': 'Se', 'bromine': 'Br',
|
||||
'krypton': 'Kr', 'rubidium': 'Rb', 'strontium': 'Sr',
|
||||
'yttrium': 'Y', 'zirconium': 'Zr', 'niobium': 'Nb',
|
||||
'molybdenum': 'Mo', 'technetium': 'Tc', 'ruthenium': 'Ru',
|
||||
'rhodium': 'Rh', 'palladium': 'Pd', 'silver': 'Ag',
|
||||
'arsenic': 'As', 'selenium': 'Se', 'bromine': 'Br',
|
||||
'krypton': 'Kr', 'rubidium': 'Rb', 'strontium': 'Sr',
|
||||
'yttrium': 'Y', 'zirconium': 'Zr', 'niobium': 'Nb',
|
||||
'molybdenum': 'Mo', 'technetium': 'Tc', 'ruthenium': 'Ru',
|
||||
'rhodium': 'Rh', 'palladium': 'Pd', 'silver': 'Ag',
|
||||
'cadmium': 'Cd', 'indium': 'In', 'tin': 'Sn', 'antimony': 'Sb',
|
||||
'tellurium': 'Te', 'iodine': 'I', 'xenon': 'Xe',
|
||||
'caesium': 'Cs', 'cesium': 'Cs', 'barium': 'Ba',
|
||||
'lanthanum': 'La', 'cerium': 'Ce', 'praseodymium': 'Pr',
|
||||
'neodymium': 'Nd', 'promethium': 'Pm', 'samarium': 'Sm',
|
||||
'europium': 'Eu', 'gadolinium': 'Gd', 'terbium': 'Tb',
|
||||
'dysprosium': 'Dy', 'holmium': 'Ho', 'erbium': 'Er',
|
||||
'thulium': 'Tm', 'ytterbium': 'Yb', 'lutetium': 'Lu',
|
||||
'neodymium': 'Nd', 'promethium': 'Pm', 'samarium': 'Sm',
|
||||
'europium': 'Eu', 'gadolinium': 'Gd', 'terbium': 'Tb',
|
||||
'dysprosium': 'Dy', 'holmium': 'Ho', 'erbium': 'Er',
|
||||
'thulium': 'Tm', 'ytterbium': 'Yb', 'lutetium': 'Lu',
|
||||
'hafnium': 'Hf', 'tantalum': 'Ta', 'tungsten': 'W',
|
||||
'wolfram': 'W', 'rhenium': 'Re', 'osmium': 'Os',
|
||||
'iridium': 'Ir', 'platinum': 'Pt', 'gold': 'Au',
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ class Material(IDManagerMixin):
|
|||
"element's symbol or name, e.g., 'Zr', 'zirconium'")
|
||||
|
||||
# Allow for element identifier to be given as a symbol or name
|
||||
if len(element)>2:
|
||||
if len(element) > 2:
|
||||
el = element.lower()
|
||||
element = openmc.data.ELEMENT_SYMBOL.get(el)
|
||||
if element is None:
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ def test_elements():
|
|||
def test_elements_by_name():
|
||||
"""Test adding elements by name"""
|
||||
m = openmc.Material()
|
||||
m.add_element('woLfrAm',1.0)
|
||||
m.add_element('woLfrAm', 1.0)
|
||||
with pytest.raises(ValueError):
|
||||
m.add_element('uranum',1.0)
|
||||
m.add_element('uRaNiUm',1.0)
|
||||
m.add_element('Aluminium',1.0)
|
||||
m.add_element('uranum', 1.0)
|
||||
m.add_element('uRaNiUm', 1.0)
|
||||
m.add_element('Aluminium', 1.0)
|
||||
a = openmc.Material()
|
||||
b = openmc.Material()
|
||||
c = openmc.Material()
|
||||
a.add_element('sulfur',1.0)
|
||||
b.add_element('SulPhUR',1.0)
|
||||
c.add_element('S',1.0)
|
||||
a.add_element('sulfur', 1.0)
|
||||
b.add_element('SulPhUR', 1.0)
|
||||
c.add_element('S', 1.0)
|
||||
assert a._nuclides == b._nuclides
|
||||
assert b._nuclides == c._nuclides
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue