Skip to content

Commit dfc171e

Browse files
authored
Merge pull request #223 from CitrineInformatics/maintain/add-elements
Update the list of supported elements
2 parents f3cd227 + 5ce5363 commit dfc171e

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

gemd/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.1.9"
1+
__version__ = "2.1.10"

gemd/entity/value/empirical_formula.py

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
"""An empirical chemical formula."""
2+
import re
3+
24
from gemd.entity.value.composition_value import CompositionValue
35
from gemd.entity.bounds import CompositionBounds
46

57
__all__ = ["EmpiricalFormula"]
68

79

8-
_all_elements = {
9-
'Tb', 'Be', 'Sb', 'Re', 'Sr', 'Ac', 'Ho', 'Ir', 'Cr', 'Os', 'S', 'Pt', 'Si', 'C', 'V', 'Bi',
10-
'U', 'Pr', 'B', 'O', 'Zn', 'Xe', 'N', 'Ni', 'No', 'Ti', 'Pa', 'Am', 'Cu', 'I', 'Al', 'Ba',
11-
'Pu', 'Ca', 'Bk', 'Ge', 'In', 'H', 'Es', 'Se', 'Cs', 'Te', 'Rn', 'Hf', 'Cm', 'Kr', 'Y',
12-
'Cf', 'Li', 'F', 'Hg', 'Sm', 'Nd', 'Br', 'Er', 'K', 'Zr', 'Pd', 'Au', 'Eu', 'Md', 'Ga', 'As',
13-
'Mn', 'Ag', 'Nb', 'Gd', 'Ru', 'Po', 'W', 'Na', 'Cl', 'Mo', 'Rh', 'Pm', 'Rb', 'Np', 'Lr',
14-
'Ce', 'Ra', 'Tm', 'Dy', 'Fr', 'Sc', 'Lu', 'Fe', 'Fm', 'Cd', 'Ar', 'Mg', 'P', 'Th', 'Co',
15-
'Tc', 'Pb', 'Ta', 'Tl', 'At', 'He', 'Yb', 'La', 'Sn', 'Ne'
16-
}
10+
_periodic_table = """
11+
H D T He
12+
Li Be B C N O F Ne
13+
Na Mg Al Si P S Cl Ar
14+
K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr
15+
Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe
16+
Cs Ba Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn
17+
Fr Ra Rf Db Sg Bh Hs Mt Ds Rg Cn Nh Fl Mc Lv Ts Og
18+
19+
La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu
20+
Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr
21+
"""
22+
_all_elements = re.split(r"\s+", _periodic_table.strip())
1723

1824

1925
class EmpiricalFormula(CompositionValue, typ="empirical_formula"):

tests/entity/value/test_empirical_formula.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_all_elements():
1010
"""Check that list of all elements exists and has some select examples."""
1111
for el in ["H", "He", "C", "Si", "Mg", "Al", "Co", "Ce"]:
1212
assert el in EmpiricalFormula.all_elements(), "Couldn't find {} in all_elements".format(el)
13-
assert len(EmpiricalFormula.all_elements()) == 103, "Expected 103 elements"
13+
assert len(EmpiricalFormula.all_elements()) == 120, "Expected 120 elements"
1414

1515

1616
def test_json():

0 commit comments

Comments
 (0)