Skip to content

Commit

Permalink
Use new MP API key explicitly in chempot grid test
Browse files Browse the repository at this point in the history
  • Loading branch information
kavanase committed Jan 21, 2025
1 parent aa5728f commit 2641eb4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tests/test_chemical_potentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ def setUp(self):
self.EXAMPLE_DIR = os.path.join(cwd, "../examples")
self.chempots = loadfn(os.path.join(self.EXAMPLE_DIR, "Cu2SiSe3/Cu2SiSe3_chempots.json"))
self.grid = chemical_potentials.ChemicalPotentialGrid(self.chempots)
self.new_MP_api_key = "UsPX9Hwut4drZQXPTxk4CwlCstrAAjDv"

def test_init(self):
assert isinstance(self.grid.vertices, pd.DataFrame)
Expand Down Expand Up @@ -948,7 +949,7 @@ def test_Na2FePO4F_chempot_grid(self):
Test ``ChemicalPotentialGrid`` generation and plotting for a complex
quinary system (Na2FePO4F).
"""
na2fepo4f_cp = chemical_potentials.CompetingPhases("Na2FePO4F")
na2fepo4f_cp = chemical_potentials.CompetingPhases("Na2FePO4F", api_key=self.new_MP_api_key)
na2fepo4f_doped_chempots = chemical_potentials.get_doped_chempots_from_entries(
na2fepo4f_cp.entries, "Na2FePO4F"
)
Expand Down
14 changes: 9 additions & 5 deletions tests/test_thermodynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2786,8 +2786,8 @@ def setUpClass(cls):
cls.defect_dict = loadfn(
os.path.join(cls.module_path, "data/CdTe_LZ_defect_dict_v2.3_wout_meta.json.gz")
)
cls.defect_thermo = DefectThermodynamics(cls.defect_dict)
cls.defect_thermo.chempots = cls.CdTe_chempots
cls.orig_defect_thermo = DefectThermodynamics(cls.defect_dict)
cls.orig_defect_thermo.chempots = cls.CdTe_chempots

cls.fermi_dos = get_fermi_dos(
os.path.join(cls.CdTe_EXAMPLE_DIR, "CdTe_prim_k181818_NKRED_2_vasprun.xml.gz")
Expand All @@ -2806,7 +2806,7 @@ def setUpClass(cls):
e_conc,
h_conc,
conc_df,
) = cls.defect_thermo.get_fermi_level_and_concentrations(
) = cls.orig_defect_thermo.get_fermi_level_and_concentrations(
# quenching to 300K (default)
cls.fermi_dos,
limit="Te-rich",
Expand All @@ -2818,7 +2818,7 @@ def setUpClass(cls):
annealing_fermi_level,
annealing_e_conc,
annealing_h_conc,
) = cls.defect_thermo.get_equilibrium_fermi_level(
) = cls.orig_defect_thermo.get_equilibrium_fermi_level(
scissored_dos,
limit="Te-rich",
temperature=anneal_temp,
Expand All @@ -2834,7 +2834,11 @@ def setUpClass(cls):
"conc_df": conc_df,
}

cls.defect_thermo.bulk_dos = cls.fermi_dos # reset FermiDos
cls.orig_defect_thermo.bulk_dos = cls.fermi_dos # reset FermiDos

def setUp(self):
# avoid any overwriting (e.g. when using k10 DOS):
self.defect_thermo = deepcopy(self.orig_defect_thermo)

def belas_linear_fit(self, T): # linear fit of CdTe gap dependence with temperature
return 1.6395 - 0.000438 * T
Expand Down

0 comments on commit 2641eb4

Please sign in to comment.