Atomic Orbitals Errors

How do I extract the atomic orbitals using AtomicOrbitals?
I make the following script and I get an error

from matminer.featurizers.composition import AtomicOrbitals
ao_feat = AtomicOrbitals ()
ao_feat.featurize_dataframe (df, “composition_oxid”)

Hey Luis,

Please post your code and the error you get. Also include the system, python version, and matminer version you are using.

I am able to successfully use AtomicOrbitals:

In:

from matminer.datasets import load_dataset
from matminer.featurizers.composition import AtomicOrbitals
from matminer.featurizers.conversions import StrToComposition, CompositionToOxidComposition

ao_feat = AtomicOrbitals()
stc = StrToComposition()
coc = CompositionToOxidComposition()

df = load_dataset("matbench_expt_gap")
df = df.rename(columns={"composition": "strcomposition"})
df = stc.featurize_dataframe(df, "strcomposition")
df = coc.featurize_dataframe(df, "composition", ignore_errors=True)
df = ao_feat.featurize_dataframe(df, "composition_oxid", ignore_errors=True, return_errors=True)

print(df[ao_feat.feature_labels()])

Out:

 HOMO_character HOMO_element  ...  LUMO_energy    gap_AO
0                 p            S  ...    -0.261676  0.000000
1                 d            W  ...    -0.220603  0.000000
2               NaN          NaN  ...          NaN       NaN
3               NaN          NaN  ...          NaN       NaN
4                 s           Ag  ...    -0.157407  0.000000
         ...          ...  ...          ...       ...
4599              p            N  ...    -0.182464  0.083833
4600              s           Zr  ...    -0.150673  0.011718
4601              d           Ti  ...    -0.170010  0.000000
4602              d           Ti  ...    -0.170010  0.000000
4603              d            W  ...    -0.220603  0.000000

Note that some of them failed, mostly because they didn’t have integer subscripts in the composition. You can get around that pretty easily but I didn’t here. I would bet your problem is exactly that, the compositions didn’t have integer subscripts.

Thanks,
Alex