Skip to content

Commit 543cafb

Browse files
Use vasp_gam for 1x1x1 k-point grids regardless of whether it is gamma-centered or not (#375)
1 parent eb222a1 commit 543cafb

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

src/custodian/vasp/jobs.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,15 +1005,10 @@ def _gamma_point_only_check(vis: VaspInput) -> bool:
10051005
# Prevent VASP gamma from being run on DFPT tasks.
10061006
return False
10071007

1008-
if (
1009-
kpts is not None
1010-
and kpts.style == Kpoints.supported_modes.Gamma
1011-
and tuple(kpts.kpts[0]) == (1, 1, 1)
1012-
and all(abs(ks) < 1.0e-6 for ks in kpts.kpts_shift)
1013-
):
1008+
if kpts is not None and tuple(kpts.kpts[0]) == (1, 1, 1) and all(abs(ks) < 1.0e-6 for ks in kpts.kpts_shift):
10141009
return True
10151010

1016-
if (kspacing := vis["INCAR"].get("KSPACING")) is not None and vis["INCAR"].get("KGAMMA", True):
1011+
if (kspacing := vis["INCAR"].get("KSPACING")) is not None:
10171012
# Get number of kpoints per axis according to the formula given by VASP:
10181013
# https://www.vasp.at/wiki/index.php/KSPACING
10191014
# Note that the VASP definition of the closure relation between reciprocal

tests/vasp/test_jobs.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,18 @@ def test_gamma_checks(self) -> None:
201201

202202
vis = MPRelaxSet(structure=structure)
203203
assert vis.kpoints.kpts == [(1, 1, 1)]
204-
assert vis.kpoints.style.name == "Gamma"
205204
assert _gamma_point_only_check(vis.get_input_set())
206205

207206
# no longer Gamma-centered
208-
vis = MPRelaxSet(structure=structure, user_kpoints_settings=Kpoints(kpts_shift=(0.1, 0.0, 0.0)))
207+
vis = MPRelaxSet(structure=structure, user_kpoints_settings=Kpoints(kpts=[2, 1, 1]))
209208
assert not _gamma_point_only_check(vis.get_input_set())
210209

211-
# have to increase KSPACING or this will result in a non 1 x 1 x 1 grid
212-
vis = MPRelaxSet(structure=structure, user_incar_settings={"KSPACING": 0.5})
213-
assert _gamma_point_only_check(vis.get_input_set())
210+
vis = MPRelaxSet(structure=structure, user_kpoints_settings=Kpoints(kpts_shift=(0.1, 0.0, 0.0)))
211+
assert not _gamma_point_only_check(vis.get_input_set())
214212

215-
vis = MPRelaxSet(structure=structure, user_incar_settings={"KSPACING": 0.5, "KGAMMA": False})
213+
# KSPACING-related checks
214+
vis = MPRelaxSet(structure=structure, user_incar_settings={"KSPACING": 0.005})
216215
assert not _gamma_point_only_check(vis.get_input_set())
216+
217+
vis = MPRelaxSet(structure=structure, user_incar_settings={"KSPACING": 50})
218+
assert _gamma_point_only_check(vis.get_input_set())

0 commit comments

Comments
 (0)