Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user kpoints in NSCF calculations #1427

Merged
merged 4 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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