diff --git a/gemd/__version__.py b/gemd/__version__.py index 254c1211..55f47b04 100644 --- a/gemd/__version__.py +++ b/gemd/__version__.py @@ -1 +1 @@ -__version__ = "2.1.9" +__version__ = "2.1.10" diff --git a/gemd/entity/value/empirical_formula.py b/gemd/entity/value/empirical_formula.py index b52d9cc0..fbfd9958 100644 --- a/gemd/entity/value/empirical_formula.py +++ b/gemd/entity/value/empirical_formula.py @@ -1,19 +1,25 @@ """An empirical chemical formula.""" +import re + from gemd.entity.value.composition_value import CompositionValue from gemd.entity.bounds import CompositionBounds __all__ = ["EmpiricalFormula"] -_all_elements = { - 'Tb', 'Be', 'Sb', 'Re', 'Sr', 'Ac', 'Ho', 'Ir', 'Cr', 'Os', 'S', 'Pt', 'Si', 'C', 'V', 'Bi', - 'U', 'Pr', 'B', 'O', 'Zn', 'Xe', 'N', 'Ni', 'No', 'Ti', 'Pa', 'Am', 'Cu', 'I', 'Al', 'Ba', - 'Pu', 'Ca', 'Bk', 'Ge', 'In', 'H', 'Es', 'Se', 'Cs', 'Te', 'Rn', 'Hf', 'Cm', 'Kr', 'Y', - 'Cf', 'Li', 'F', 'Hg', 'Sm', 'Nd', 'Br', 'Er', 'K', 'Zr', 'Pd', 'Au', 'Eu', 'Md', 'Ga', 'As', - 'Mn', 'Ag', 'Nb', 'Gd', 'Ru', 'Po', 'W', 'Na', 'Cl', 'Mo', 'Rh', 'Pm', 'Rb', 'Np', 'Lr', - 'Ce', 'Ra', 'Tm', 'Dy', 'Fr', 'Sc', 'Lu', 'Fe', 'Fm', 'Cd', 'Ar', 'Mg', 'P', 'Th', 'Co', - 'Tc', 'Pb', 'Ta', 'Tl', 'At', 'He', 'Yb', 'La', 'Sn', 'Ne' -} +_periodic_table = """ +H D T He +Li Be B C N O F Ne +Na Mg Al Si P S Cl Ar +K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr +Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe +Cs Ba Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn +Fr Ra Rf Db Sg Bh Hs Mt Ds Rg Cn Nh Fl Mc Lv Ts Og + +La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu +Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr +""" +_all_elements = re.split(r"\s+", _periodic_table.strip()) class EmpiricalFormula(CompositionValue, typ="empirical_formula"): diff --git a/tests/entity/value/test_empirical_formula.py b/tests/entity/value/test_empirical_formula.py index c4272702..30ec26f8 100644 --- a/tests/entity/value/test_empirical_formula.py +++ b/tests/entity/value/test_empirical_formula.py @@ -10,7 +10,7 @@ def test_all_elements(): """Check that list of all elements exists and has some select examples.""" for el in ["H", "He", "C", "Si", "Mg", "Al", "Co", "Ce"]: assert el in EmpiricalFormula.all_elements(), "Couldn't find {} in all_elements".format(el) - assert len(EmpiricalFormula.all_elements()) == 103, "Expected 103 elements" + assert len(EmpiricalFormula.all_elements()) == 120, "Expected 120 elements" def test_json():