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

Magpie data updates #289

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 26 additions & 0 deletions smact/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ class Element:

Element.HHI_r (float) : Hirfindahl-Hirschman Index for elemental reserves

Element.mendeleev (int): Mendeleev number

Element.AtomicWeight (float): Atomic weight

Element.MeltingT (float): Melting temperature in K

Element.num_valence (int): Number of valence electrons



Raises:
NameError: Element not found in element.txt
Warning: Element not found in Eigenvalues.csv
Expand Down Expand Up @@ -140,6 +150,18 @@ def __init__(
else:
sse_Pauling = None

magpie_data = data_loader.lookup_element_magpie_data(symbol)
if magpie_data:
mendeleev = magpie_data["MendeleevNumber"]
AtomicWeight = magpie_data["AtomicWeight"]
MeltingT = magpie_data["MeltingT"]
num_valence = magpie_data["NValence"]
else:
mendeleev = None
AtomicWeight = None
MeltingT = None
num_valence = None

for attribute, value in (
("coord_envs", coord_envs),
("covalent_radius", dataset["r_cov"]),
Expand Down Expand Up @@ -174,6 +196,10 @@ def __init__(
("SSE", sse),
("SSEPauling", sse_Pauling),
("symbol", symbol),
("mendeleev", mendeleev),
("AtomicWeight", AtomicWeight),
("MeltingT", MeltingT),
("num_valence", num_valence),
# ('vdw_radius', dataset['RVdW']),
):
setattr(self, attribute, value)
Expand Down
98 changes: 98 additions & 0 deletions smact/data/magpie.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
element,Number,MendeleevNumber,AtomicWeight,MeltingT,Column,Row,CovalentRadius,Electronegativity,NsValence,NpValence,NdValence,NfValence,NValence,NsUnfilled,NpUnfilled,NdUnfilled,NfUnfilled,NUnfilled,GSvolume_pa,GSbandgap,GSmagmom,SpaceGroupNumber
H,1.0,92.0,1.00794,14.01,1.0,1.0,31.0,2.2,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,6.615,7.853,0.0,194.0
He,2.0,98.0,4.002602,1211.4,18.0,1.0,28.0,1.63,2.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,12.305,18.098,0.0,225.0
Li,3.0,1.0,6.941,453.69,1.0,2.0,128.0,0.98,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,16.5933333333,0.0,0.0,229.0
Be,4.0,67.0,9.012182,1560.0,2.0,2.0,96.0,1.57,2.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,7.89,0.0,0.0,194.0
B,5.0,72.0,10.811,2348.0,13.0,2.0,84.0,2.04,2.0,1.0,0.0,0.0,3.0,0.0,5.0,0.0,0.0,5.0,7.1725,1.524,0.0,166.0
C,6.0,77.0,12.0107,3823.0,14.0,2.0,76.0,2.55,2.0,2.0,0.0,0.0,4.0,0.0,4.0,0.0,0.0,4.0,5.64,4.496,0.0,194.0
N,7.0,82.0,14.0067,63.05,15.0,2.0,71.0,3.04,2.0,3.0,0.0,0.0,5.0,0.0,3.0,0.0,0.0,3.0,14.76875,6.437,0.0,194.0
O,8.0,87.0,15.9994,54.8,16.0,2.0,66.0,3.44,2.0,4.0,0.0,0.0,6.0,0.0,2.0,0.0,0.0,2.0,9.105,0.0,0.0,12.0
F,9.0,93.0,18.9984032,53.5,17.0,2.0,57.0,3.98,2.0,5.0,0.0,0.0,7.0,0.0,1.0,0.0,0.0,1.0,9.7075,1.97,0.0,15.0
Ne,10.0,99.0,20.1791,24.56,18.0,2.0,58.0,1.63,2.0,6.0,0.0,0.0,8.0,0.0,0.0,0.0,0.0,0.0,12.64,13.088,0.0,225.0
Na,11.0,2.0,22.98976928,370.87,1.0,3.0,166.0,0.93,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,29.2433333333,0.0,0.0,229.0
Mg,12.0,68.0,24.305,923.0,2.0,3.0,141.0,1.31,2.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,22.89,0.0,0.0,194.0
Al,13.0,73.0,26.9815386,933.47,13.0,3.0,121.0,1.61,2.0,1.0,0.0,0.0,3.0,0.0,5.0,0.0,0.0,5.0,16.48,0.0,0.0,225.0
Si,14.0,78.0,28.0855,1687.0,14.0,3.0,111.0,1.9,2.0,2.0,0.0,0.0,4.0,0.0,4.0,0.0,0.0,4.0,20.44,0.773,0.0,227.0
P,15.0,83.0,30.973762,317.3,15.0,3.0,107.0,2.19,2.0,3.0,0.0,0.0,5.0,0.0,3.0,0.0,0.0,3.0,22.5702380952,1.625,0.0,2.0
S,16.0,88.0,32.065,388.36,16.0,3.0,105.0,2.58,2.0,4.0,0.0,0.0,6.0,0.0,2.0,0.0,0.0,2.0,25.786875,2.202,0.0,70.0
Cl,17.0,94.0,35.453,171.6,17.0,3.0,102.0,3.16,2.0,5.0,0.0,0.0,7.0,0.0,1.0,0.0,0.0,1.0,24.4975,2.493,0.0,64.0
Ar,18.0,100.0,39.948,83.8,18.0,3.0,106.0,1.63,2.0,6.0,0.0,0.0,8.0,0.0,0.0,0.0,0.0,0.0,28.54,9.26,0.0,225.0
K,19.0,3.0,39.0983,336.53,1.0,4.0,203.0,0.82,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,73.1066666667,0.0,0.0,229.0
Ca,20.0,7.0,40.078,1115.0,2.0,4.0,176.0,1.0,2.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,37.77,0.0,0.0,225.0
Sc,21.0,11.0,44.955912,1814.0,3.0,4.0,170.0,1.36,2.0,0.0,1.0,0.0,3.0,0.0,0.0,9.0,0.0,9.0,22.235,0.0,6.35e-06,194.0
Ti,22.0,43.0,47.867,1941.0,4.0,4.0,160.0,1.54,2.0,0.0,2.0,0.0,4.0,0.0,0.0,8.0,0.0,8.0,16.69,0.0,2.25333333333e-05,194.0
V,23.0,46.0,50.9415,2183.0,5.0,4.0,153.0,1.63,2.0,0.0,3.0,0.0,5.0,0.0,0.0,7.0,0.0,7.0,13.01,0.0,0.0,229.0
Cr,24.0,49.0,51.9961,2180.0,6.0,4.0,139.0,1.66,1.0,0.0,5.0,0.0,6.0,1.0,0.0,5.0,0.0,6.0,11.19,0.0,0.0,229.0
Mn,25.0,52.0,54.938045,1519.0,7.0,4.0,139.0,1.55,2.0,0.0,5.0,0.0,7.0,0.0,0.0,5.0,0.0,5.0,10.4875862069,0.0,0.000310120689655,217.0
Fe,26.0,55.0,55.845,1811.0,8.0,4.0,132.0,1.83,2.0,0.0,6.0,0.0,8.0,0.0,0.0,4.0,0.0,4.0,10.73,0.0,2.1106628,229.0
Co,27.0,58.0,58.933195,1768.0,9.0,4.0,126.0,1.88,2.0,0.0,7.0,0.0,9.0,0.0,0.0,3.0,0.0,3.0,10.245,0.0,1.5484712,194.0
Ni,28.0,61.0,58.6934,1728.0,10.0,4.0,124.0,1.91,2.0,0.0,8.0,0.0,10.0,0.0,0.0,2.0,0.0,2.0,10.32,0.0,0.5953947,225.0
Cu,29.0,64.0,63.546,1357.77,11.0,4.0,132.0,1.9,1.0,0.0,10.0,0.0,11.0,1.0,0.0,0.0,0.0,1.0,11.07,0.0,0.0,225.0
Zn,30.0,69.0,65.38,692.68,12.0,4.0,122.0,1.65,2.0,0.0,10.0,0.0,12.0,0.0,0.0,0.0,0.0,0.0,13.96,0.0,0.0,194.0
Ga,31.0,74.0,69.723,302.91,13.0,4.0,122.0,1.81,2.0,1.0,10.0,0.0,13.0,0.0,5.0,0.0,0.0,5.0,18.8575,0.0,0.0,64.0
Ge,32.0,79.0,72.64,1211.4,14.0,4.0,120.0,2.01,2.0,2.0,10.0,0.0,14.0,0.0,4.0,0.0,0.0,4.0,23.005,0.383,0.0,225.0
As,33.0,84.0,74.9216,1090.0,15.0,4.0,119.0,2.18,2.0,3.0,10.0,0.0,15.0,0.0,3.0,0.0,0.0,3.0,22.175,0.0,0.0,166.0
Se,34.0,89.0,78.96,494.0,16.0,4.0,120.0,2.55,2.0,4.0,10.0,0.0,16.0,0.0,2.0,0.0,0.0,2.0,25.92,0.799,0.0,14.0
Br,35.0,95.0,79.904,265.8,17.0,4.0,120.0,2.96,2.0,5.0,10.0,0.0,17.0,0.0,1.0,0.0,0.0,1.0,29.48,1.457,0.0,64.0
Kr,36.0,101.0,83.798,115.79,18.0,4.0,116.0,3.0,2.0,6.0,10.0,0.0,18.0,0.0,0.0,0.0,0.0,0.0,36.06,7.535,0.0,225.0
Rb,37.0,4.0,85.4678,312.46,1.0,5.0,220.0,0.82,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,90.7225,0.0,0.0,229.0
Sr,38.0,8.0,87.62,1050.0,2.0,5.0,195.0,0.95,2.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,54.23,0.0,0.0,225.0
Y,39.0,12.0,88.90585,1799.0,3.0,5.0,190.0,1.22,2.0,0.0,1.0,0.0,3.0,0.0,0.0,9.0,0.0,9.0,32.365,0.0,0.0,194.0
Zr,40.0,44.0,91.224,2128.0,4.0,5.0,175.0,1.33,2.0,0.0,2.0,0.0,4.0,0.0,0.0,8.0,0.0,8.0,23.195,0.0,0.0,194.0
Nb,41.0,47.0,92.90638,2750.0,5.0,5.0,164.0,1.6,1.0,0.0,4.0,0.0,5.0,1.0,0.0,6.0,0.0,7.0,18.18,0.0,0.0,229.0
Mo,42.0,50.0,95.96,2896.0,6.0,5.0,154.0,2.16,1.0,0.0,5.0,0.0,6.0,1.0,0.0,5.0,0.0,6.0,15.69,0.0,0.0,229.0
Tc,43.0,53.0,98.0,2430.0,7.0,5.0,147.0,1.9,2.0,0.0,5.0,0.0,7.0,0.0,0.0,5.0,0.0,5.0,14.285,0.0,0.0,194.0
Ru,44.0,56.0,101.07,2607.0,8.0,5.0,146.0,2.2,1.0,0.0,7.0,0.0,8.0,1.0,0.0,3.0,0.0,4.0,13.51,0.0,0.0,194.0
Rh,45.0,59.0,102.9055,2237.0,9.0,5.0,142.0,2.28,1.0,0.0,8.0,0.0,9.0,1.0,0.0,2.0,0.0,3.0,13.64,0.0,0.0,225.0
Pd,46.0,62.0,106.42,1828.05,10.0,5.0,139.0,2.2,0.0,0.0,10.0,0.0,10.0,0.0,0.0,0.0,0.0,0.0,14.41,0.0,0.0,225.0
Ag,47.0,65.0,107.8682,1234.93,11.0,5.0,145.0,1.93,1.0,0.0,10.0,0.0,11.0,1.0,0.0,0.0,0.0,1.0,16.33,0.0,0.0,225.0
Cd,48.0,70.0,112.411,594.22,12.0,5.0,144.0,1.69,2.0,0.0,10.0,0.0,12.0,0.0,0.0,0.0,0.0,0.0,19.495,0.0,0.0,194.0
In,49.0,75.0,114.818,429.75,13.0,5.0,142.0,1.78,2.0,1.0,10.0,0.0,13.0,0.0,5.0,0.0,0.0,5.0,24.26,0.0,0.0,139.0
Sn,50.0,80.0,118.71,505.08,14.0,5.0,139.0,1.96,2.0,2.0,10.0,0.0,14.0,0.0,4.0,0.0,0.0,4.0,33.285,0.0,0.0,141.0
Sb,51.0,85.0,121.76,903.78,15.0,5.0,139.0,2.05,2.0,3.0,10.0,0.0,15.0,0.0,3.0,0.0,0.0,3.0,31.56,0.0,0.0,166.0
Te,52.0,90.0,127.6,722.66,16.0,5.0,138.0,2.1,2.0,4.0,10.0,0.0,16.0,0.0,2.0,0.0,0.0,2.0,34.7633333333,0.464,0.0,152.0
I,53.0,96.0,126.90447,386.85,17.0,5.0,139.0,2.66,2.0,5.0,10.0,0.0,17.0,0.0,1.0,0.0,0.0,1.0,43.015,1.062,0.0,64.0
Xe,54.0,102.0,131.293,161.3,18.0,5.0,140.0,2.6,2.0,6.0,10.0,0.0,18.0,0.0,0.0,0.0,0.0,0.0,53.65,6.456,0.0,225.0
Cs,55.0,5.0,132.9054519,301.59,1.0,6.0,244.0,0.79,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,115.765,0.0,0.0,229.0
Ba,56.0,9.0,137.327,1000.0,2.0,6.0,215.0,0.89,2.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,63.59,0.0,0.0,229.0
La,57.0,13.0,138.90547,1193.0,3.0,6.0,207.0,1.1,2.0,0.0,1.0,0.0,3.0,0.0,0.0,9.0,0.0,9.0,36.8975,0.0,0.0,194.0
Ce,58.0,15.0,140.116,1071.0,3.0,6.0,204.0,1.12,2.0,0.0,1.0,1.0,4.0,0.0,0.0,9.0,13.0,22.0,37.24,0.0,0.0,194.0
Pr,59.0,17.0,140.90765,1204.0,3.0,6.0,203.0,1.13,2.0,0.0,0.0,3.0,5.0,0.0,0.0,0.0,11.0,11.0,35.675,0.0,0.0,194.0
Nd,60.0,19.0,144.242,1294.0,3.0,6.0,201.0,1.14,2.0,0.0,0.0,4.0,6.0,0.0,0.0,0.0,10.0,10.0,34.81,0.0,0.0,194.0
Pm,61.0,21.0,145.0,1373.0,3.0,6.0,199.0,1.155,2.0,0.0,0.0,5.0,7.0,0.0,0.0,0.0,9.0,9.0,33.8425,0.0,0.0,194.0
Sm,62.0,23.0,150.36,1345.0,3.0,6.0,198.0,1.17,2.0,0.0,0.0,6.0,8.0,0.0,0.0,0.0,8.0,8.0,33.23,0.0,0.0,166.0
Eu,63.0,25.0,151.964,1095.0,3.0,6.0,198.0,1.185,2.0,0.0,0.0,7.0,9.0,0.0,0.0,0.0,7.0,7.0,36.46,0.0,0.0,229.0
Gd,64.0,27.0,157.25,1586.0,3.0,6.0,196.0,1.2,2.0,0.0,1.0,7.0,10.0,0.0,0.0,9.0,7.0,16.0,32.05,0.0,0.0,194.0
Tb,65.0,29.0,158.92535,1629.0,3.0,6.0,194.0,1.21,2.0,0.0,0.0,9.0,11.0,0.0,0.0,0.0,5.0,5.0,31.7366666667,0.0,0.0,194.0
Dy,66.0,31.0,162.5,1685.0,3.0,6.0,192.0,1.22,2.0,0.0,0.0,10.0,12.0,0.0,0.0,0.0,4.0,4.0,31.24,0.0,0.0,194.0
Ho,67.0,33.0,164.93032,1747.0,3.0,6.0,192.0,1.23,2.0,0.0,0.0,11.0,13.0,0.0,0.0,0.0,3.0,3.0,30.7333333333,0.0,0.0,194.0
Er,68.0,35.0,167.259,1770.0,3.0,6.0,189.0,1.24,2.0,0.0,0.0,12.0,14.0,0.0,0.0,0.0,2.0,2.0,30.585,0.0,0.0,194.0
Tm,69.0,37.0,168.93421,1818.0,3.0,6.0,190.0,1.25,2.0,0.0,0.0,13.0,15.0,0.0,0.0,0.0,1.0,1.0,29.78,0.0,0.0,194.0
Yb,70.0,39.0,173.054,1092.0,3.0,6.0,187.0,1.26,2.0,0.0,0.0,14.0,16.0,0.0,0.0,0.0,0.0,0.0,34.12,0.0,0.0,225.0
Lu,71.0,41.0,174.9668,1936.0,3.0,6.0,187.0,1.27,2.0,0.0,1.0,14.0,17.0,0.0,0.0,9.0,0.0,9.0,28.865,0.0,0.0022471,194.0
Hf,72.0,45.0,178.49,2506.0,4.0,6.0,175.0,1.3,2.0,0.0,2.0,14.0,18.0,0.0,0.0,8.0,0.0,8.0,22.2,0.0,0.0,194.0
Ta,73.0,48.0,180.94788,3290.0,5.0,6.0,170.0,1.5,2.0,0.0,3.0,14.0,19.0,0.0,0.0,7.0,0.0,7.0,18.12,0.0,0.0,229.0
W,74.0,51.0,183.84,3695.0,6.0,6.0,162.0,2.36,2.0,0.0,4.0,14.0,20.0,0.0,0.0,6.0,0.0,6.0,16.05,0.0,0.0,229.0
Re,75.0,54.0,186.207,3459.0,7.0,6.0,151.0,1.9,2.0,0.0,5.0,14.0,21.0,0.0,0.0,5.0,0.0,5.0,14.655,0.0,0.0,194.0
Os,76.0,57.0,190.23,3306.0,8.0,6.0,144.0,2.2,2.0,0.0,6.0,14.0,22.0,0.0,0.0,4.0,0.0,4.0,14.09,0.0,0.0,194.0
Ir,77.0,60.0,192.217,2739.0,9.0,6.0,141.0,2.2,2.0,0.0,7.0,14.0,23.0,0.0,0.0,3.0,0.0,3.0,14.21,0.0,0.0,225.0
Pt,78.0,63.0,195.084,2041.4,10.0,6.0,136.0,2.28,1.0,0.0,9.0,14.0,24.0,1.0,0.0,1.0,0.0,2.0,15.02,0.0,0.0,225.0
Au,79.0,66.0,196.966569,1337.33,11.0,6.0,136.0,2.54,1.0,0.0,10.0,14.0,25.0,1.0,0.0,0.0,0.0,1.0,16.7,0.0,0.0,225.0
Hg,80.0,71.0,200.59,234.32,12.0,6.0,132.0,2.0,2.0,0.0,10.0,14.0,26.0,0.0,0.0,0.0,0.0,0.0,25.2375862069,0.0,0.0,166.0
Tl,81.0,76.0,204.3833,577.0,13.0,6.0,145.0,1.62,2.0,1.0,10.0,14.0,27.0,0.0,5.0,0.0,0.0,5.0,26.91,0.0,0.0,194.0
Pb,82.0,81.0,207.2,600.61,14.0,6.0,146.0,2.33,2.0,2.0,10.0,14.0,28.0,0.0,4.0,0.0,0.0,4.0,28.11,0.0,0.0,225.0
Bi,83.0,86.0,208.9804,544.4,15.0,6.0,148.0,2.02,2.0,3.0,10.0,14.0,29.0,0.0,3.0,0.0,0.0,3.0,32.95,0.0,0.0,12.0
Po,84.0,91.0,209.0,527.0,16.0,6.0,140.0,2.0,2.0,4.0,10.0,14.0,30.0,0.0,2.0,0.0,0.0,2.0,38.73125,0.0,0.0,221.0
At,85.0,97.0,210.0,575.0,17.0,6.0,150.0,2.2,2.0,5.0,10.0,14.0,31.0,0.0,1.0,0.0,0.0,1.0,38.73125,0.0,0.0,194.0
Rn,86.0,103.0,222.0,202.0,18.0,6.0,150.0,1.63,2.0,6.0,10.0,14.0,32.0,0.0,0.0,0.0,0.0,0.0,38.73125,0.0,0.0,194.0
Fr,87.0,6.0,223.0,1211.4,1.0,7.0,260.0,0.7,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,38.73125,0.0,0.0,194.0
Ra,88.0,10.0,226.0,973.0,2.0,7.0,221.0,0.9,2.0,0.0,0.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,38.73125,0.0,0.0,229.0
Ac,89.0,14.0,227.0,1323.0,3.0,7.0,215.0,1.1,2.0,0.0,1.0,0.0,3.0,0.0,0.0,9.0,0.0,9.0,44.5125,0.0,0.0,225.0
Th,90.0,16.0,232.03806,2023.0,3.0,7.0,206.0,1.3,2.0,0.0,2.0,0.0,4.0,0.0,0.0,8.0,0.0,8.0,32.37,0.0,0.0,225.0
Pa,91.0,18.0,231.03586,1845.0,3.0,7.0,200.0,1.5,2.0,0.0,1.0,2.0,5.0,0.0,0.0,9.0,12.0,21.0,25.18,0.0,0.0,139.0
U,92.0,20.0,238.02891,1408.0,3.0,7.0,196.0,1.38,2.0,0.0,1.0,3.0,6.0,0.0,0.0,9.0,11.0,20.0,20.025,0.0,0.0,63.0
Np,93.0,22.0,237.0,917.0,3.0,7.0,190.0,1.36,2.0,0.0,1.0,4.0,7.0,0.0,0.0,9.0,10.0,19.0,18.45375,0.0,0.0,62.0
Pu,94.0,24.0,244.0,913.0,3.0,7.0,187.0,1.28,2.0,0.0,0.0,6.0,8.0,0.0,0.0,0.0,8.0,8.0,18.08,0.0,0.3180036375,11.0
Am,95.0,26.0,243.0,1449.0,3.0,7.0,180.0,1.3,2.0,0.0,0.0,7.0,9.0,0.0,0.0,0.0,7.0,7.0,18.08,0.0,0.3180036375,194.0
Cm,96.0,28.0,247.0,1618.0,3.0,7.0,169.0,1.3,2.0,0.0,1.0,7.0,10.0,0.0,0.0,9.0,7.0,16.0,18.08,0.0,0.3180036375,194.0
Bk,97.0,30.0,247.0,1323.0,3.0,7.0,146.0,1.3,2.0,0.0,0.0,9.0,11.0,0.0,0.0,0.0,5.0,5.0,18.08,0.0,0.3180036375,194.0
82 changes: 82 additions & 0 deletions smact/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import csv
import os

import pandas as pd

from smact import data_directory

# Module-level switch: print "verbose" warning messages
Expand Down Expand Up @@ -822,3 +824,83 @@
)

return None


_element_magpie_data = None


def lookup_element_magpie_data(symbol: str, copy: bool = True):
"""
Retrieve element data contained in the Magpie representation.

Taken from Ward, L., Agrawal, A., Choudhary, A. et al.
A general-purpose machine learning framework for
predicting properties of inorganic materials.
npj Comput Mater 2, 16028 (2016).
https://doi.org/10.1038/npjcompumats.2016.28

Args:
symbol : the atomic symbol of the element to look up.
copy: if True (default), return a copy of the data dictionary,
rather than a reference to a cached object -- only use
copy=False in performance-sensitive code and where you are
certain the dictionary will not be modified!

Returns:
list:
Magpie features.
Returns None if the element was not found among the external
data.

Magpie features are dictionaries with the keys:




"""

global _element_magpie_data

if _element_magpie_data is None:
_element_magpie_data = {}

df = pd.read_csv(os.path.join(data_directory, "magpie.csv"))
for _index, row in df.iterrows():
key = row.iloc[0]

dataset = {
"Number": int(row.iloc[1]),
"MendeleevNumber": int(row.iloc[2]),
"AtomicWeight": float(row.iloc[3]),
"MeltingT": float(row.iloc[4]),
"Column": int(row.iloc[5]),
"Row": int(row.iloc[6]),
"CovalentRadius": float(row.iloc[7]),
"Electronegativity": float(row.iloc[8]),
"NsValence": int(row.iloc[9]),
"NpValence": int(row.iloc[10]),
"NdValence": int(row.iloc[11]),
"NfValence": int(row.iloc[12]),
"NValence": int(row.iloc[13]),
"NsUnfilled": int(row.iloc[14]),
"NpUnfilled": int(row.iloc[15]),
"NdUnfilled": int(row.iloc[16]),
"NfUnfilled": int(row.iloc[17]),
"NUnfilled": int(row.iloc[18]),
"GSvolume_pa": float(row.iloc[19]),
"GSbandgap": float(row.iloc[20]),
"GSmagmom": float(row.iloc[21]),
"SpaceGroupNumber": int(row.iloc[22]),
}
_element_magpie_data[key] = dataset

if symbol in _element_magpie_data:
return _element_magpie_data[symbol]
else:
if _print_warnings:
print(

Check warning on line 901 in smact/data_loader.py

View check run for this annotation

Codecov / codecov/patch

smact/data_loader.py#L901

Added line #L901 was not covered by tests
"WARNING: Magpie data for element {} not "
"found.".format(symbol)
)

return None