Skip to content

Commit

Permalink
Minor tests updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kavanase committed Oct 9, 2024
1 parent ca32f47 commit b303e97
Show file tree
Hide file tree
Showing 288 changed files with 306 additions and 307 deletions.
17 changes: 11 additions & 6 deletions doped/corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
eFNV) were developed, they should be used here.
"""

import contextlib
import os
import warnings
from typing import Optional, Union
Expand Down Expand Up @@ -518,12 +519,16 @@ def doped_make_efnv_correction(

core_potentials_dict = {}
for key, outcar in zip(["defect", "bulk"], [defect_outcar, bulk_outcar]):
total_energy = [
defect_entry.sc_entry.energy if key == "defect" else defect_entry.bulk_entry.energy,
defect_entry.calculation_metadata["run_metadata"][f"{key}_vasprun_dict"]["output"][
"ionic_steps"
][-1]["electronic_steps"][-1]["e_0_energy"],
]
total_energy = []
with contextlib.suppress(Exception):
total_energy.append(
defect_entry.sc_entry.energy if key == "defect" else defect_entry.bulk_entry.energy
)
total_energy.append(
defect_entry.calculation_metadata["run_metadata"][f"{key}_vasprun_dict"]["output"][
"ionic_steps"
][-1]["electronic_steps"][-1]["e_0_energy"]
)

if outcar is not None:
core_potentials_dict[key] = _check_if_pathlike_and_get_locpot_or_core_pots(
Expand Down
9 changes: 6 additions & 3 deletions doped/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ def __init__(
generate_supercell: bool = True,
charge_state_gen_kwargs: Optional[dict] = None,
supercell_gen_kwargs: Optional[dict[str, Union[int, float, bool]]] = None,
interstitial_gen_kwargs: Optional[dict] = None,
interstitial_gen_kwargs: Optional[Union[dict, bool]] = None,
target_frac_coords: Optional[list] = None,
processes: Optional[int] = None,
):
Expand Down Expand Up @@ -1210,7 +1210,7 @@ def __init__(
(such as ``min_dist``, ``clustering_tol``, ``symmetry_preference``,
``stol`` and ``tight_stol`` -- see its docstring), or
``InterstitialGenerator`` if ``interstitial_coords`` is specified.
If set to False, interstitial generation will be skipped entirely.
If set to ``False``, interstitial generation will be skipped entirely.
target_frac_coords (list):
Defects are placed at the closest equivalent site to these fractional
coordinates in the generated supercells. Default is [0.5, 0.5, 0.5]
Expand Down Expand Up @@ -1265,7 +1265,7 @@ def __init__(
"force_diagonal": False,
}
self.supercell_gen_kwargs.update(supercell_gen_kwargs if supercell_gen_kwargs is not None else {})
self.interstitial_gen_kwargs: dict[str, Union[int, float, bool]] = (
self.interstitial_gen_kwargs: Union[dict[str, Union[int, float, bool]], bool] = (
interstitial_gen_kwargs if interstitial_gen_kwargs is not None else {}
)
self.target_frac_coords = target_frac_coords if target_frac_coords is not None else [0.5, 0.5, 0.5]
Expand Down Expand Up @@ -1511,6 +1511,9 @@ def __init__(
# Interstitials:
self._element_list = host_element_list + extrinsic_elements # all elements in system
if self.interstitial_gen_kwargs is not False: # skip interstitials
self.interstitial_gen_kwargs = (
self.interstitial_gen_kwargs if isinstance(self.interstitial_gen_kwargs, dict) else {}
)
pbar.set_description("Generating interstitials")
if self.interstitial_coords:
# map interstitial coords to primitive structure, and get multiplicities
Expand Down
2 changes: 1 addition & 1 deletion doped/utils/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def _get_core_potentials_from_outcar_obj(
def _check_outcar_energy(
outcar: Union[Outcar, PathLike], total_energy: Optional[Union[list, float]] = None
):
if total_energy is not None:
if total_energy:
outcar_energy = (
outcar.final_energy if isinstance(outcar, Outcar) else _get_final_energy_from_outcar(outcar)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/CdTe_bulk/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 486.0
NSW = 0
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/CdTe_bulk/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 486.0
NSW = 0
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/CdTe_bulk/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 486.0
NKRED = 2
NSW = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/CdTe_bulk/vasp_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 486.0
NSW = 0
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+1/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 491.0
NSW = 200
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+1/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 491.0
NSW = 0
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+1/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 491.0
NKRED = 2
NSW = 200
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+1/vasp_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 491.0
NSW = 200
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+2/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 490.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+2/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 490.0
NSW = 0
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+2/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 490.0
NKRED = 2
NSW = 200
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+2/vasp_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 490.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+3/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 489.0
NSW = 200
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+3/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 489.0
NSW = 0
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+3/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 489.0
NKRED = 2
NSW = 200
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+3/vasp_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 489.0
NSW = 200
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+4/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 488.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+4/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 488.0
NSW = 0
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+4/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 488.0
NKRED = 2
NSW = 200
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_+4/vasp_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 488.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_0/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 492.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_0/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 492.0
NSW = 0
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_0/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 492.0
NKRED = 2
NSW = 200
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_Te_0/vasp_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 492.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_+1/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 497.0
NSW = 200
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_+1/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 497.0
NSW = 0
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_+1/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 497.0
NKRED = 2
NSW = 200
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_+1/vasp_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 497.0
NSW = 200
NUPDOWN = 1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_+2/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 496.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_+2/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 496.0
NSW = 0
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_+2/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 496.0
NKRED = 2
NSW = 200
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_+2/vasp_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 496.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_0/vasp_gam/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 498.0
NSW = 200
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_0/vasp_ncl/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LREAL = Auto
LSORBIT = True
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 498.0
NSW = 0
NUPDOWN = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CdTe/Cd_i_C3v_0/vasp_nkred_std/INCAR
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LORBIT = 11
LREAL = Auto
LVHAR = False
NCORE = 10
NEDOS = 2000
NEDOS = 3000
NELECT = 498.0
NKRED = 2
NSW = 200
Expand Down
Loading

0 comments on commit b303e97

Please sign in to comment.