Select a specific the oxidation number of a specific atom in CompositionToOxiComposition function

Hi matminer users,

I try to find specific oxidation state of specific atom in any compound.
I have succeeded in creating a dataframe of oxidation states using CompositionToOxidComposition function,
but failed to filter only for a specific oxidation number of a specific atom.

I have made several attempts to do this:

Please give me a solution to this problem.

thank you.

I successed with the following code:

g_1 = [“Na”, “H”]
Sn_dict = {}

for cation in g_1:
criteria = {“elements”:{"$in":[cation],"$all":[“O”,“Sn”]},
properties = [‘material_id’,‘pretty_formula’]
with MPRester(“API Code”) as mpr:
data = mpr.query(criteria=criteria, properties=properties)
df = pd.DataFrame(data)
df1 = StrToComposition().featurize_dataframe(df,‘pretty_formula’)
df3 = pd.read_csv(“conversion.csv”)
Sn_oxi = df3[df3[‘composition_oxid’].str.contains(‘Sn2+’)]
Sn_oxi_numb = Sn_oxi.shape[0]
Sn_dict1 = {cation: Sn_oxi_numb}


1 Like