Skip to content

Commit

Permalink
Minor updates to match most recent pymatgen
Browse files Browse the repository at this point in the history
  • Loading branch information
kavanase committed May 4, 2024
1 parent e1f05d6 commit 4886aa0
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 74 deletions.
4 changes: 2 additions & 2 deletions doped/utils/supercells.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def _get_min_image_distance_from_matrix(matrix: np.ndarray) -> float:
eff_cubic_length = lattice.volume ** (1 / 3)
max_min_dist = eff_cubic_length * (2 ** (1 / 6)) # max hypothetical min image distance in 3D lattice

zipped_fcoords_dist_idx_image = lattice.get_points_in_sphere(
[[0, 0, 0]], [0, 0, 0], r=max_min_dist * 1.01
zipped_fcoords_dist_idx_image = list(
lattice.get_points_in_sphere([[0, 0, 0]], [0, 0, 0], r=max_min_dist * 1.01)
)

# sort zipped list by dist:
Expand Down
4 changes: 2 additions & 2 deletions doped/vasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def _test_potcar_functional_choice(
symbols = ["Mg"]
try:
test_potcar = _get_potcar(tuple(symbols), potcar_functional=potcar_functional)
except OSError as e:
except (OSError, RuntimeError) as e: # updated to RuntimeError in pymatgen 2024.5.1
# try other functional choices:
if potcar_functional.startswith("PBE"):
for pbe_potcar_string in ["PBE", "PBE_52", "PBE_54"]:
with contextlib.suppress(OSError):
with contextlib.suppress(OSError, RuntimeError):
potcar_functional = pbe_potcar_string
test_potcar = _get_potcar(tuple(symbols), potcar_functional=potcar_functional)
break
Expand Down
2 changes: 1 addition & 1 deletion examples/CdTe/CdTe_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/CdTe/CdTe_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/Sb2Si2Te6/Sb2Si2Te6_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/Sb2Si2Te6/Sb2Si2Te6_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/YTOS/YTOS_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/YTOS/YTOS_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/N_diamond_defect_gen.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/Sb2Se3/Sb2Se3_O_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/Sb2Se3/defect/Sb2Se3_O_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/V2O5/V2O5_example_defect_dict.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/V2O5/V2O5_example_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/ZnS/ZnS_thermo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/agcu_defect_gen.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/cd_i_supercell_defect_gen.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/lmno_defect_gen.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/data/ytos_defect_gen.json

Large diffs are not rendered by default.

98 changes: 50 additions & 48 deletions tests/test_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def setUp(self):
v_Cd_Cs_Te2.83Cd4.62Cd5.36 [+1,0,-1] [0.555,0.111,0.111] 9b
v_Cd_Cs_Te2.83Cd4.62Te5.42a [+1,0,-1] [0.222,0.111,0.111] 9b
v_Cd_Cs_Te2.83Cd4.62Te5.42b [+1,0,-1] [0.111,0.222,0.222] 9b
v_Cd_Cs_Te2.83Cd4.62Te5.42c [+1,0,-1] [0.444,0.222,0.222] 9b
v_Cd_Cs_Te2.83Cd4.62Te5.42c [+1,0,-1] [0.445,0.222,0.222] 9b
v_Te_C1 [+1,0,-1] [0.333,0.333,0.250] 18c
v_Te_C3v_Cd2.83Cd4.25 [+1,0,-1] [0.000,0.000,0.583] 3a
v_Te_C3v_Cd2.83Te4.62Cd5.42a [+1,0,-1] [0.000,0.000,0.250] 3a
Expand Down Expand Up @@ -373,7 +373,7 @@ def setUp(self):
Te_Cd_Cs_Te2.83Cd4.62Cd5.36 [+4,+3,+2,+1,0,-1,-2] [0.555,0.111,0.111] 9b
Te_Cd_Cs_Te2.83Cd4.62Te5.42a [+4,+3,+2,+1,0,-1,-2] [0.222,0.111,0.111] 9b
Te_Cd_Cs_Te2.83Cd4.62Te5.42b [+4,+3,+2,+1,0,-1,-2] [0.111,0.222,0.222] 9b
Te_Cd_Cs_Te2.83Cd4.62Te5.42c [+4,+3,+2,+1,0,-1,-2] [0.444,0.222,0.222] 9b
Te_Cd_Cs_Te2.83Cd4.62Te5.42c [+4,+3,+2,+1,0,-1,-2] [0.445,0.222,0.222] 9b
Interstitials Guessed Charges Conv. Cell Coords Wyckoff
---------------------------- --------------------- ------------------- ---------
Expand All @@ -384,7 +384,7 @@ def setUp(self):
Cd_i_C1_Cd2.71Te2.71Cd4.25c [+2,+1,0] [0.167,0.167,0.625] 18c
Cd_i_C1_Cd2.71Te2.71Cd4.25d [+2,+1,0] [0.167,0.167,0.958] 18c
Cd_i_C1_Cd2.71Te2.71Cd4.25e [+2,+1,0] [0.056,0.278,0.069] 18c
Cd_i_C1_Cd2.71Te2.71Cd4.25f [+2,+1,0] [0.278,0.056,0.180] 18c
Cd_i_C1_Cd2.71Te2.71Cd4.25f [+2,+1,0] [0.278,0.055,0.180] 18c
Cd_i_C1_Cd2.71Te2.71Cd4.25g [+2,+1,0] [0.389,0.111,0.069] 18c
Cd_i_C1_Cd2.71Te2.71Cd4.25h [+2,+1,0] [0.445,0.056,0.180] 18c
Cd_i_C1_Cd2.83 [+2,+1,0] [0.333,0.333,0.083] 18c
Expand Down Expand Up @@ -429,7 +429,7 @@ def setUp(self):
Te_i_C1_Cd2.71Te2.71Cd4.25c [+4,+3,+2,+1,0,-1,-2] [0.167,0.167,0.625] 18c
Te_i_C1_Cd2.71Te2.71Cd4.25d [+4,+3,+2,+1,0,-1,-2] [0.167,0.167,0.958] 18c
Te_i_C1_Cd2.71Te2.71Cd4.25e [+4,+3,+2,+1,0,-1,-2] [0.056,0.278,0.069] 18c
Te_i_C1_Cd2.71Te2.71Cd4.25f [+4,+3,+2,+1,0,-1,-2] [0.278,0.056,0.180] 18c
Te_i_C1_Cd2.71Te2.71Cd4.25f [+4,+3,+2,+1,0,-1,-2] [0.278,0.055,0.180] 18c
Te_i_C1_Cd2.71Te2.71Cd4.25g [+4,+3,+2,+1,0,-1,-2] [0.389,0.111,0.069] 18c
Te_i_C1_Cd2.71Te2.71Cd4.25h [+4,+3,+2,+1,0,-1,-2] [0.445,0.056,0.180] 18c
Te_i_C1_Cd2.83 [+4,+3,+2,+1,0,-1,-2] [0.333,0.333,0.083] 18c
Expand Down Expand Up @@ -484,10 +484,10 @@ def setUp(self):
v_C_C1_C1.54C2.52C2.95c [+1,0,-1] [0.278,0.222,0.222] 18c
v_C_C1_C1.54C2.52C2.95d [+1,0,-1] [0.333,0.333,0.028] 18c
v_C_C1_C1.54C2.52C2.95e [+1,0,-1] [0.333,0.333,0.111] 18c
v_C_C1_C1.54C2.52C2.95f [+1,0,-1] [0.167,0.167,0.444] 18c
v_C_C1_C1.54C2.52C2.95g [+1,0,-1] [0.167,0.167,0.694] 18c
v_C_C1_C1.54C2.52C2.95f [+1,0,-1] [0.167,0.167,0.445] 18c
v_C_C1_C1.54C2.52C2.95g [+1,0,-1] [0.167,0.167,0.695] 18c
v_C_C1_C1.54C2.52C2.95h [+1,0,-1] [0.167,0.167,0.778] 18c
v_C_C1_C1.54C2.52C2.95i [+1,0,-1] [0.055,0.278,0.000] 18c
v_C_C1_C1.54C2.52C2.95i [+1,0,-1] [0.056,0.278,0.000] 18c
v_C_C1_C1.54C2.52C2.95j [+1,0,-1] [0.278,0.056,0.139] 18c
v_C_C1_C1.54C2.52C2.95k [+1,0,-1] [0.056,0.278,0.250] 18c
v_C_C1_C1.54C2.52C2.95l [+1,0,-1] [0.389,0.111,0.000] 18c
Expand All @@ -497,43 +497,43 @@ def setUp(self):
v_C_C1_C1.54C2.52C2.95p [+1,0,-1] [0.445,0.056,0.139] 18c
v_C_C1_C1.54C2.52C2.95q [+1,0,-1] [0.389,0.111,0.250] 18c
v_C_C1_C1.54C2.52C2.95r [+1,0,-1] [0.445,0.056,0.222] 18c
v_C_C1_C1.54C2.52C2.95s [+1,0,-1] [0.056,0.445,0.250] 18c
v_C_C1_C1.54C2.52C2.95s [+1,0,-1] [0.056,0.444,0.250] 18c
v_C_C1_C1.54C2.52N2.52 [+1,0,-1] [0.167,0.167,0.361] 18c
v_C_C3v_C1.54C2.52C2.95a [+1,0,-1] [0.000,0.000,0.028] 3a
v_C_C3v_C1.54C2.52C2.95b [+1,0,-1] [0.000,0.000,0.111] 3a
v_C_C3v_C1.54C2.52C2.95c [+1,0,-1] [0.000,0.000,0.694] 3a
v_C_C3v_C1.54C2.52C2.95c [+1,0,-1] [0.000,0.000,0.695] 3a
v_C_C3v_C1.54C2.52C2.95d [+1,0,-1] [0.000,0.000,0.778] 3a
v_C_C3v_C1.54N1.54 [+1,0,-1] [0.000,0.000,0.444] 3a
v_C_C3v_C1.54N1.54 [+1,0,-1] [0.000,0.000,0.445] 3a
v_C_Cs_C1.54C2.52C2.95a [+1,0,-1] [0.111,0.222,0.222] 9b
v_C_Cs_C1.54C2.52C2.95b [+1,0,-1] [0.445,0.222,0.222] 9b
v_C_Cs_C1.54C2.52C2.95b [+1,0,-1] [0.444,0.222,0.222] 9b
v_C_Cs_C1.54C2.52C2.95c [+1,0,-1] [0.611,0.222,0.222] 9b
v_C_Cs_C1.54C2.52C2.95d [+1,0,-1] [0.500,0.500,0.028] 9b
v_C_Cs_C1.54C2.52C2.95e [+1,0,-1] [0.500,0.500,0.111] 9b
v_C_Cs_C1.54C2.52C2.95f [+1,0,-1] [0.500,0.500,0.361] 9b
v_C_Cs_C1.54C2.52C2.95g [+1,0,-1] [0.500,0.500,0.445] 9b
v_C_Cs_C1.54C2.52C2.95g [+1,0,-1] [0.500,0.500,0.444] 9b
v_C_Cs_C1.54C2.52C2.95h [+1,0,-1] [0.500,0.500,0.694] 9b
v_C_Cs_C1.54C2.52C2.95i [+1,0,-1] [0.500,0.500,0.778] 9b
v_C_Cs_C1.54C2.52C2.95j [+1,0,-1] [0.056,0.111,0.000] 9b
v_C_Cs_C1.54C2.52C2.95k [+1,0,-1] [0.111,0.055,0.139] 9b
v_C_Cs_C1.54C2.52C2.95k [+1,0,-1] [0.111,0.056,0.139] 9b
v_C_Cs_C1.54C2.52C2.95l [+1,0,-1] [0.222,0.111,0.000] 9b
v_C_Cs_C1.54C2.52C2.95m [+1,0,-1] [0.111,0.055,0.222] 9b
v_C_Cs_C1.54C2.52C2.95m [+1,0,-1] [0.111,0.056,0.222] 9b
v_C_Cs_C1.54C2.52C2.95n [+1,0,-1] [0.111,0.222,0.139] 9b
v_C_Cs_C1.54C2.52C2.95o [+1,0,-1] [0.222,0.111,0.250] 9b
v_C_Cs_C1.54C2.52C2.95p [+1,0,-1] [0.222,0.111,0.333] 9b
v_C_Cs_C1.54C2.52C2.95q [+1,0,-1] [0.445,0.222,0.139] 9b
v_C_Cs_C1.54C2.52C2.95q [+1,0,-1] [0.444,0.222,0.139] 9b
v_C_Cs_C1.54C2.52C2.95r [+1,0,-1] [0.111,0.222,0.472] 9b
v_C_Cs_C1.54C2.52C2.95s [+1,0,-1] [0.222,0.445,0.250] 9b
v_C_Cs_C1.54C2.52C2.95t [+1,0,-1] [0.556,0.111,0.000] 9b
v_C_Cs_C1.54C2.52C2.95u [+1,0,-1] [0.111,0.055,0.556] 9b
v_C_Cs_C1.54C2.52C2.95v [+1,0,-1] [0.055,0.111,0.583] 9b
v_C_Cs_C1.54C2.52C2.95w [+1,0,-1] [0.111,0.222,0.556] 9b
v_C_Cs_C1.54C2.52C2.95x [+1,0,-1] [0.555,0.111,0.250] 9b
v_C_Cs_C1.54C2.52C2.95s [+1,0,-1] [0.222,0.444,0.250] 9b
v_C_Cs_C1.54C2.52C2.95t [+1,0,-1] [0.555,0.111,0.000] 9b
v_C_Cs_C1.54C2.52C2.95u [+1,0,-1] [0.111,0.056,0.556] 9b
v_C_Cs_C1.54C2.52C2.95v [+1,0,-1] [0.056,0.111,0.583] 9b
v_C_Cs_C1.54C2.52C2.95w [+1,0,-1] [0.111,0.555,0.222] 9b
v_C_Cs_C1.54C2.52C2.95x [+1,0,-1] [0.556,0.111,0.250] 9b
v_C_Cs_C1.54C2.52C2.95y [+1,0,-1] [0.556,0.278,0.000] 9b
v_C_Cs_C1.54C2.52C2.95z [+1,0,-1] [0.611,0.222,0.139] 9b
v_C_Cs_C1.54C2.52C2.95{ [+1,0,-1] [0.556,0.278,0.250] 9b
v_C_Cs_C1.54C2.52N2.52a [+1,0,-1] [0.055,0.111,0.250] 9b
v_C_Cs_C1.54C2.52N2.52b [+1,0,-1] [0.111,0.055,0.472] 9b
v_C_Cs_C1.54N1.54 [+1,0,-1] [0.055,0.111,0.333] 9b
v_C_Cs_C1.54C2.52N2.52a [+1,0,-1] [0.056,0.111,0.250] 9b
v_C_Cs_C1.54C2.52N2.52b [+1,0,-1] [0.111,0.056,0.472] 9b
v_C_Cs_C1.54N1.54 [+1,0,-1] [0.056,0.111,0.333] 9b
v_N [+1,0,-1] [0.000,0.000,0.361] 3a
Substitutions Guessed Charges Conv. Cell Coords Wyckoff
Expand All @@ -544,10 +544,10 @@ def setUp(self):
N_C_C1_C1.54C2.52C2.95c [+1,0,-1] [0.278,0.222,0.222] 18c
N_C_C1_C1.54C2.52C2.95d [+1,0,-1] [0.333,0.333,0.028] 18c
N_C_C1_C1.54C2.52C2.95e [+1,0,-1] [0.333,0.333,0.111] 18c
N_C_C1_C1.54C2.52C2.95f [+1,0,-1] [0.167,0.167,0.444] 18c
N_C_C1_C1.54C2.52C2.95g [+1,0,-1] [0.167,0.167,0.694] 18c
N_C_C1_C1.54C2.52C2.95f [+1,0,-1] [0.167,0.167,0.445] 18c
N_C_C1_C1.54C2.52C2.95g [+1,0,-1] [0.167,0.167,0.695] 18c
N_C_C1_C1.54C2.52C2.95h [+1,0,-1] [0.167,0.167,0.778] 18c
N_C_C1_C1.54C2.52C2.95i [+1,0,-1] [0.055,0.278,0.000] 18c
N_C_C1_C1.54C2.52C2.95i [+1,0,-1] [0.056,0.278,0.000] 18c
N_C_C1_C1.54C2.52C2.95j [+1,0,-1] [0.278,0.056,0.139] 18c
N_C_C1_C1.54C2.52C2.95k [+1,0,-1] [0.056,0.278,0.250] 18c
N_C_C1_C1.54C2.52C2.95l [+1,0,-1] [0.389,0.111,0.000] 18c
Expand All @@ -557,43 +557,43 @@ def setUp(self):
N_C_C1_C1.54C2.52C2.95p [+1,0,-1] [0.445,0.056,0.139] 18c
N_C_C1_C1.54C2.52C2.95q [+1,0,-1] [0.389,0.111,0.250] 18c
N_C_C1_C1.54C2.52C2.95r [+1,0,-1] [0.445,0.056,0.222] 18c
N_C_C1_C1.54C2.52C2.95s [+1,0,-1] [0.056,0.445,0.250] 18c
N_C_C1_C1.54C2.52C2.95s [+1,0,-1] [0.056,0.444,0.250] 18c
N_C_C1_C1.54C2.52N2.52 [+1,0,-1] [0.167,0.167,0.361] 18c
N_C_C3v_C1.54C2.52C2.95a [+1,0,-1] [0.000,0.000,0.028] 3a
N_C_C3v_C1.54C2.52C2.95b [+1,0,-1] [0.000,0.000,0.111] 3a
N_C_C3v_C1.54C2.52C2.95c [+1,0,-1] [0.000,0.000,0.694] 3a
N_C_C3v_C1.54C2.52C2.95c [+1,0,-1] [0.000,0.000,0.695] 3a
N_C_C3v_C1.54C2.52C2.95d [+1,0,-1] [0.000,0.000,0.778] 3a
N_C_C3v_C1.54N1.54 [+1,0,-1] [0.000,0.000,0.444] 3a
N_C_C3v_C1.54N1.54 [+1,0,-1] [0.000,0.000,0.445] 3a
N_C_Cs_C1.54C2.52C2.95a [+1,0,-1] [0.111,0.222,0.222] 9b
N_C_Cs_C1.54C2.52C2.95b [+1,0,-1] [0.445,0.222,0.222] 9b
N_C_Cs_C1.54C2.52C2.95b [+1,0,-1] [0.444,0.222,0.222] 9b
N_C_Cs_C1.54C2.52C2.95c [+1,0,-1] [0.611,0.222,0.222] 9b
N_C_Cs_C1.54C2.52C2.95d [+1,0,-1] [0.500,0.500,0.028] 9b
N_C_Cs_C1.54C2.52C2.95e [+1,0,-1] [0.500,0.500,0.111] 9b
N_C_Cs_C1.54C2.52C2.95f [+1,0,-1] [0.500,0.500,0.361] 9b
N_C_Cs_C1.54C2.52C2.95g [+1,0,-1] [0.500,0.500,0.445] 9b
N_C_Cs_C1.54C2.52C2.95g [+1,0,-1] [0.500,0.500,0.444] 9b
N_C_Cs_C1.54C2.52C2.95h [+1,0,-1] [0.500,0.500,0.694] 9b
N_C_Cs_C1.54C2.52C2.95i [+1,0,-1] [0.500,0.500,0.778] 9b
N_C_Cs_C1.54C2.52C2.95j [+1,0,-1] [0.056,0.111,0.000] 9b
N_C_Cs_C1.54C2.52C2.95k [+1,0,-1] [0.111,0.055,0.139] 9b
N_C_Cs_C1.54C2.52C2.95k [+1,0,-1] [0.111,0.056,0.139] 9b
N_C_Cs_C1.54C2.52C2.95l [+1,0,-1] [0.222,0.111,0.000] 9b
N_C_Cs_C1.54C2.52C2.95m [+1,0,-1] [0.111,0.055,0.222] 9b
N_C_Cs_C1.54C2.52C2.95m [+1,0,-1] [0.111,0.056,0.222] 9b
N_C_Cs_C1.54C2.52C2.95n [+1,0,-1] [0.111,0.222,0.139] 9b
N_C_Cs_C1.54C2.52C2.95o [+1,0,-1] [0.222,0.111,0.250] 9b
N_C_Cs_C1.54C2.52C2.95p [+1,0,-1] [0.222,0.111,0.333] 9b
N_C_Cs_C1.54C2.52C2.95q [+1,0,-1] [0.445,0.222,0.139] 9b
N_C_Cs_C1.54C2.52C2.95q [+1,0,-1] [0.444,0.222,0.139] 9b
N_C_Cs_C1.54C2.52C2.95r [+1,0,-1] [0.111,0.222,0.472] 9b
N_C_Cs_C1.54C2.52C2.95s [+1,0,-1] [0.222,0.445,0.250] 9b
N_C_Cs_C1.54C2.52C2.95t [+1,0,-1] [0.556,0.111,0.000] 9b
N_C_Cs_C1.54C2.52C2.95u [+1,0,-1] [0.111,0.055,0.556] 9b
N_C_Cs_C1.54C2.52C2.95v [+1,0,-1] [0.055,0.111,0.583] 9b
N_C_Cs_C1.54C2.52C2.95w [+1,0,-1] [0.111,0.222,0.556] 9b
N_C_Cs_C1.54C2.52C2.95x [+1,0,-1] [0.555,0.111,0.250] 9b
N_C_Cs_C1.54C2.52C2.95s [+1,0,-1] [0.222,0.444,0.250] 9b
N_C_Cs_C1.54C2.52C2.95t [+1,0,-1] [0.555,0.111,0.000] 9b
N_C_Cs_C1.54C2.52C2.95u [+1,0,-1] [0.111,0.056,0.556] 9b
N_C_Cs_C1.54C2.52C2.95v [+1,0,-1] [0.056,0.111,0.583] 9b
N_C_Cs_C1.54C2.52C2.95w [+1,0,-1] [0.111,0.555,0.222] 9b
N_C_Cs_C1.54C2.52C2.95x [+1,0,-1] [0.556,0.111,0.250] 9b
N_C_Cs_C1.54C2.52C2.95y [+1,0,-1] [0.556,0.278,0.000] 9b
N_C_Cs_C1.54C2.52C2.95z [+1,0,-1] [0.611,0.222,0.139] 9b
N_C_Cs_C1.54C2.52C2.95{ [+1,0,-1] [0.556,0.278,0.250] 9b
N_C_Cs_C1.54C2.52N2.52a [+1,0,-1] [0.055,0.111,0.250] 9b
N_C_Cs_C1.54C2.52N2.52b [+1,0,-1] [0.111,0.055,0.472] 9b
N_C_Cs_C1.54N1.54 [+1,0,-1] [0.055,0.111,0.333] 9b
N_C_Cs_C1.54C2.52N2.52a [+1,0,-1] [0.056,0.111,0.250] 9b
N_C_Cs_C1.54C2.52N2.52b [+1,0,-1] [0.111,0.056,0.472] 9b
N_C_Cs_C1.54N1.54 [+1,0,-1] [0.056,0.111,0.333] 9b
\n"""
"The number in the Wyckoff label is the site multiplicity/degeneracy of that defect in the "
"conventional ('conv.') unit cell, which comprises 3 formula unit(s) of C215N.\n"
Expand Down Expand Up @@ -2694,9 +2694,9 @@ def agcu_defect_gen_check(self, agcu_defect_gen, generate_supercell=True):
assert self.structure_matcher.fit(agcu_defect_gen.primitive_structure, self.agcu)

supercell_matrix = np.array(
[[2, 2, -2], [-4, 4, 0], [-4, 0, 4]]
[[2, -2, 2], [4, 0, 0], [0, 4, 0]]
if generate_supercell
else [[-1, 1, 1], [1, -1, 1], [1, 1, -1]]
else [[1, -1, 1], [0, -2, 0], [2, 0, 0]]
)
assert any(np.isclose(agcu_defect_gen.min_image_distance, i, atol=0.01) for i in [10.21, 5.11])
np.testing.assert_allclose(agcu_defect_gen.supercell_matrix, supercell_matrix)
Expand Down Expand Up @@ -2737,7 +2737,9 @@ def agcu_defect_gen_check(self, agcu_defect_gen, generate_supercell=True):
)
assert agcu_defect_gen.defect_entries["Cu_i_C3v_Cu1.56Ag1.56Cu2.99b_+1"].wyckoff == "6c"
assert agcu_defect_gen.defect_entries["Cu_i_C3v_Cu1.56Ag1.56Cu2.99b_+1"].defect.multiplicity == 2
sc_frac_coords = np.array([0.4375, 0.4375, 0.375] if generate_supercell else [0.375, 0.375, 0.375])
sc_frac_coords = np.array(
[0.4375, 0.4375, 0.5625] if generate_supercell else [0.125, 0.625, 0.625]
)
np.testing.assert_allclose(
agcu_defect_gen.defect_entries["Cu_i_C3v_Cu1.56Ag1.56Cu2.99b_+1"].sc_defect_frac_coords,
sc_frac_coords, # closest to [0.5, 0.5, 0.5]
Expand All @@ -2756,7 +2758,7 @@ def agcu_defect_gen_check(self, agcu_defect_gen, generate_supercell=True):
)
np.testing.assert_allclose(
agcu_defect_gen.defect_entries["Cu_i_C3v_Cu1.56Ag1.56Cu2.99b_+1"].defect.site.frac_coords,
np.array([0.375, 0.375, 0.375]),
np.array([0.375, 0.625, 0.125]),
rtol=1e-2,
)

Expand Down
12 changes: 6 additions & 6 deletions tests/test_vasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def _generate_and_check_dds(self, struct, incar_check=True, **dds_kwargs):

def kpts_nelect_nupdown_check(self, dds, kpt, nelect, nupdown):
if isinstance(kpt, int):
assert dds.kpoints.kpts == [[kpt, kpt, kpt]]
assert dds.kpoints.kpts == [(kpt, kpt, kpt)]
else:
assert dds.kpoints.kpts == kpt
if _potcars_available():
Expand Down Expand Up @@ -451,7 +451,7 @@ def test_file_writing_with_without_POTCARs(self):
self._write_and_check_dds_files(dds)
self._write_and_check_dds_files(dds, potcar_spec=True) # can only test potcar_spec w/neutral
self._write_and_check_dds_files(dds, unperturbed_poscar=False)
self.kpts_nelect_nupdown_check(dds, [[2, 2, 1]], 1584, 0)
self.kpts_nelect_nupdown_check(dds, [(2, 2, 1)], 1584, 0)
# reciprocal_density = 100/Å⁻³ for YTOS

if not _potcars_available():
Expand All @@ -463,7 +463,7 @@ def test_file_writing_with_without_POTCARs(self):

# check changing charge state
dds = self._generate_and_check_dds(self.ytos_bulk_supercell.copy(), charge_state=1)
self.kpts_nelect_nupdown_check(dds, [[2, 2, 1]], 1583, 1)
self.kpts_nelect_nupdown_check(dds, [(2, 2, 1)], 1583, 1)
# reciprocal_density = 100/Å⁻³ for YTOS
self._write_and_check_dds_files(dds, output_path="YTOS_test_dir")
self._write_and_check_dds_files(dds, unperturbed_poscar=False)
Expand Down Expand Up @@ -1313,7 +1313,7 @@ def test_CdTe_files(self):
# test DefectDictSet objects:
for _defect_species, defect_relax_set in defects_set.defect_sets.items():
for defect_dict_set in [defect_relax_set.vasp_gam, defect_relax_set.bulk_vasp_gam]:
assert defect_dict_set.kpoints.kpts == [[1, 1, 1]]
assert defect_dict_set.kpoints.kpts == [(1, 1, 1)]
for defect_dict_set in [
defect_relax_set.vasp_std,
defect_relax_set.bulk_vasp_std,
Expand All @@ -1322,7 +1322,7 @@ def test_CdTe_files(self):
defect_relax_set.vasp_ncl,
defect_relax_set.bulk_vasp_ncl,
]:
assert defect_dict_set.kpoints.kpts == [[2, 2, 2]]
assert defect_dict_set.kpoints.kpts == [(2, 2, 2)]

# test custom POTCAR and KPOINTS choices (INCAR already tested): also tests dictionary input to
# DefectsSet
Expand Down Expand Up @@ -1350,7 +1350,7 @@ def test_CdTe_files(self):

for subfolder in ["vasp_std", "vasp_nkred_std", "vasp_ncl"]:
kpoints = Kpoints.from_file(f"{folder}/{subfolder}/KPOINTS")
assert kpoints.kpts == [[4, 4, 4]] # 4x4x4 with 54-atom 3x3x3 prim supercell,
assert kpoints.kpts == [(4, 4, 4)] # 4x4x4 with 54-atom 3x3x3 prim supercell,
# 3x3x3 with 64-atom 2x2x2 conv supercell

def test_write_files_single_defect_entry(self):
Expand Down

0 comments on commit 4886aa0

Please sign in to comment.