Skip to content

Commit

Permalink
Merge pull request #1427 from dyllamt/master
Browse files Browse the repository at this point in the history
Allow user kpoints in NSCF calculations
  • Loading branch information
shyuep authored Mar 26, 2019
2 parents 3c52f53 + 118397b commit c0b9ad7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pymatgen/io/vasp/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,12 @@ def kpoints(self):
style=Kpoints.supported_modes.Reciprocal,
num_kpts=len(ir_kpts),
kpts=kpts, kpts_weights=weights)

# override pymatgen kpoints if provided
user_kpoints = self.kwargs.get("user_kpoints_settings", None)
if isinstance(user_kpoints, Kpoints):
kpoints = user_kpoints

return kpoints

@classmethod
Expand Down
12 changes: 12 additions & 0 deletions pymatgen/io/vasp/tests/test_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,18 @@ def test_optics(self):
self.assertTrue(vis.incar["LOPTICS"])
self.assertEqual(vis.kpoints.style, Kpoints.supported_modes.Reciprocal)

def test_user_kpoint_override(self):
user_kpoints_override = Kpoints(
style=Kpoints.supported_modes.Gamma,
kpts=((1, 1, 1),)) # the default kpoints style is reciprocal

prev_run = self.TEST_FILES_DIR / "relaxation"
vis = MPNonSCFSet.from_prev_calc(
prev_calc_dir=prev_run, copy_chgcar=False, optics=True,
mode="Uniform", nedos=2001,
user_kpoints_settings=user_kpoints_override)
self.assertEqual(vis.kpoints.style, Kpoints.supported_modes.Gamma)

def tearDown(self):
shutil.rmtree(self.tmp)
warnings.simplefilter("default")
Expand Down

0 comments on commit c0b9ad7

Please sign in to comment.