How to retrieve material following formula ABX3

from mp_api.client import MPRester
import pandas as pd

with MPRester(“***”) as mpr:

fields = ["material_id", "nsites", "elements", "nelements", "composition", "volume",
          "density", "density_atomic", "structure", "energy_per_atom", "formation_energy_per_atom",
          "energy_above_hull", "is_stable", "band_gap", "cbm", "vbm", "efermi", "formula_pretty"]

A = ["Ba", "Ca", "Sr", "Bi", "Cd", "Sn", "Zn"]

B = ["Fe", "V", "Cr", "Mn", "Sc", "Co",
     "Ti", "Mg", "Ni", "Zr", "Ga", "Al",
     "Cu", "Pt", "Zn"]

X = ["F", "Cl", "Br", "I"]

for A_site_element in A:
    for B_site_element in B:
        for X_site_element in X:
            docs =
                                    band_gap=(0.5, 2.5),
            # 输出列表,并将列表保存为csv文件
            test = pd.DataFrame(docs)
            test.to_csv("E:\\python_study\\Materials Project\\ABX3.csv", encoding='gbk')

I came across this piece of code but apparently this cant be used. I want to retrieve all the matreials following formula ABX3 like CaTiO3, AlBO3, etc, their bandgaps and other info like a,b,c parameters and alpha,beta,gamma values.
Can someone help me what can I use instead of above written code?

This has been answered here: Get material of general formula Please search the forum for existing solutions before posting a new issue. Thanks!

1 Like