materialsproject / pymatgen-analysis-defects

Defect analysis modules for pymatgen
https://materialsproject.github.io/pymatgen-analysis-defects
Other
39 stars 10 forks source link

[Feature Request]: Customizing pd_entries in FormationEnergyDiagram #204

Open misaraty opened 2 months ago

misaraty commented 2 months ago

Problem

I'd like to customize pd_entries in the FormationEnergyDiagram setup as shown below:

ents = MPR.get_entries_in_chemsys(['Mg', 'Ga', 'N']) or ents = loadfn("Ga_Mg_N.json")
sc_dir = "Mg_Ga/"
fed = FormationEnergyDiagram.with_directories(
    directory_map={
        "bulk": sc_dir + "bulk_sc",
        0: sc_dir + "q=0",
        -1: sc_dir + "q=-1",
        1: sc_dir + "q=1",
    },
    defect=ens,
    pd_entries=ents,
    dielectric=10,
)

I have locally calculated the decomposition phases and competing phases (e.g., mp-1095013 MgGa, mp-844 POSCAR_Ca3N2, mp-1184449 POSCAR_CaMg149, mp-25 POSCAR_N2). I'm wondering if I should modify the pd_entries similar to this:

pd_entries = [
    {"Data": {"run_type": "GGA", "mp-1095013-GGA ComputedStructureEntry": "Mg2 Ga2 (MgGa)", "Energy (Final)": "-8.1302 eV (-2.0325 eV/atom)"}},
    {"Data": {"run_type": "GGA", "mp-1094626-GGA ComputedStructureEntry": "Mg5 Ga1 (Mg5Ga)", "Energy (Final)": "-11.1926 eV (-1.8654 eV/atom)"}}
]

or

pd_entries = [
    {"Mg2 Ga2 (MgGa)", "-8.1302 eV"},
    {"Mg5 Ga1 (Mg5Ga)", "-11.1926 eV"}
]

Thank you!

Proposed Solution

What would be the simplest way to write pd_entries for locally calculated competing phases? Thank you once again!

Alternatives

No response

jmmshn commented 1 week ago

If I understand correctly. I would recommend and you write a function that takes the dictionaries from your local calculations and convert it to ComputedEntry's from pymatgen I think that will make the subsequent steps the same.