From c1bc545dee79354bd488b8c1cb6a323227953a85 Mon Sep 17 00:00:00 2001 From: Maxwell Dylla Date: Thu, 14 Mar 2019 12:56:26 -0700 Subject: [PATCH 1/3] nscf-fw input set overrides --- atomate/vasp/firetasks/write_inputs.py | 4 +-- atomate/vasp/fireworks/core.py | 40 +++++++++++++++++--------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/atomate/vasp/firetasks/write_inputs.py b/atomate/vasp/firetasks/write_inputs.py index 7035684b0..9bf963482 100644 --- a/atomate/vasp/firetasks/write_inputs.py +++ b/atomate/vasp/firetasks/write_inputs.py @@ -307,14 +307,14 @@ def run_task(self, fw_spec): prev_calc_dir=self.get("prev_calc_dir", "."), copy_chgcar=self.get("copy_chgcar", False), nbands_factor=self.get("nbands_factor", 1.2), - reciprocal_density=self.get("reciprocal_density", 100), + reciprocal_density=self.get("reciprocal_density", 1000), kpoints_line_density=self.get("kpoints_line_density", 20), small_gap_multiply=self.get("small_gap_multiply", None), standardize=self.get("standardize", False), sym_prec=self.get("sym_prec", 0.1), international_monoclinic=self.get("international_monoclinic", True), mode=self.get("mode", "uniform"), - nedos=self.get("nedos", 601), + nedos=self.get("nedos", 2001), optics=self.get("optics", False), **self.get("other_params", {})) vis.write_input(".") diff --git a/atomate/vasp/fireworks/core.py b/atomate/vasp/fireworks/core.py index ca7d78da8..6c0244217 100644 --- a/atomate/vasp/fireworks/core.py +++ b/atomate/vasp/fireworks/core.py @@ -231,14 +231,16 @@ def __init__(self, parents=None, prev_calc_dir=None, structure=None, mode="gap", class NonSCFFW(Firework): - def __init__(self, parents=None, prev_calc_dir=None, structure=None, name="nscf", mode="uniform", vasp_cmd="vasp", - copy_vasp_outputs=True, db_file=None, **kwargs): + def __init__(self, parents=None, prev_calc_dir=None, structure=None, + name="nscf", mode="uniform", vasp_cmd="vasp", + copy_vasp_outputs=True, db_file=None, + input_set_overrides=None, **kwargs): """ - Standard NonSCF Calculation Firework supporting both - uniform and line modes. + Standard NonSCF Calculation Firework supporting uniform and line modes. Args: - structure (Structure): Input structure - used only to set the name of the FW. + structure (Structure): Input structure - used only to set the name + of the FW. name (str): Name for the Firework. mode (str): "uniform" or "line" mode. vasp_cmd (str): Command to run vasp. @@ -248,16 +250,26 @@ def __init__(self, parents=None, prev_calc_dir=None, structure=None, name="nscf" db_file (str): Path to file specifying db credentials. parents (Firework): Parents of this particular Firework. FW or list of FWS. + input_set_overrides (dict): Arguments passed to the + "from_prev_calc" method of the MPNonSCFSet. This parameter + allows a user to modify the default values of the input set. + For example, passing the key value pair + {'reciprocal_density': 1000} + will override default k-point meshes for uniform claculations. \*\*kwargs: Other kwargs that are passed to Firework.__init__. """ - fw_name = "{}-{} {}".format(structure.composition.reduced_formula if structure else "unknown", name, - mode) + input_set_overrides = input_set_overrides or {} + + fw_name = "{}-{} {}".format(structure.composition.reduced_formula if + structure else "unknown", name, mode) t = [] if prev_calc_dir: - t.append(CopyVaspOutputs(calc_dir=prev_calc_dir, additional_files=["CHGCAR"])) + t.append(CopyVaspOutputs(calc_dir=prev_calc_dir, + additional_files=["CHGCAR"])) elif parents: - t.append(CopyVaspOutputs(calc_loc=True, additional_files=["CHGCAR"])) + t.append(CopyVaspOutputs(calc_loc=True, + additional_files=["CHGCAR"])) else: raise ValueError("Must specify previous calculation for NonSCFFW") @@ -265,19 +277,21 @@ def __init__(self, parents=None, prev_calc_dir=None, structure=None, name="nscf" if mode == "uniform": t.append( WriteVaspNSCFFromPrev(prev_calc_dir=".", mode="uniform", - reciprocal_density=1000)) + **input_set_overrides)) else: t.append(WriteVaspNSCFFromPrev(prev_calc_dir=".", mode="line", - reciprocal_density=20)) + **input_set_overrides)) - t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<")) + t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, + auto_npar=">>auto_npar<<")) t.append(PassCalcLocs(name=name)) t.append(VaspToDb(db_file=db_file, additional_fields={"task_label": name + " " + mode}, parse_dos=(mode == "uniform"), bandstructure_mode=mode)) - super(NonSCFFW, self).__init__(t, parents=parents, name=fw_name, **kwargs) + super(NonSCFFW, self).__init__(t, parents=parents, name=fw_name, + **kwargs) class LepsFW(Firework): From 22910a48e50d3afbff2bf841e32dd40a2589a7c7 Mon Sep 17 00:00:00 2001 From: Anubhav Jain Date: Wed, 20 Mar 2019 16:40:10 -0700 Subject: [PATCH 2/3] spelling typo --- atomate/vasp/fireworks/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atomate/vasp/fireworks/core.py b/atomate/vasp/fireworks/core.py index 6c0244217..075a56e5f 100644 --- a/atomate/vasp/fireworks/core.py +++ b/atomate/vasp/fireworks/core.py @@ -255,7 +255,7 @@ def __init__(self, parents=None, prev_calc_dir=None, structure=None, allows a user to modify the default values of the input set. For example, passing the key value pair {'reciprocal_density': 1000} - will override default k-point meshes for uniform claculations. + will override default k-point meshes for uniform calculations. \*\*kwargs: Other kwargs that are passed to Firework.__init__. """ input_set_overrides = input_set_overrides or {} From 3afe75e031eaecffc9d18f51f0a192fc5eaeaf37 Mon Sep 17 00:00:00 2001 From: Anubhav Jain Date: Wed, 20 Mar 2019 16:45:27 -0700 Subject: [PATCH 3/3] revert reciprocal density to PMG default --- atomate/vasp/firetasks/write_inputs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atomate/vasp/firetasks/write_inputs.py b/atomate/vasp/firetasks/write_inputs.py index 9bf963482..54af1f2d0 100644 --- a/atomate/vasp/firetasks/write_inputs.py +++ b/atomate/vasp/firetasks/write_inputs.py @@ -307,7 +307,7 @@ def run_task(self, fw_spec): prev_calc_dir=self.get("prev_calc_dir", "."), copy_chgcar=self.get("copy_chgcar", False), nbands_factor=self.get("nbands_factor", 1.2), - reciprocal_density=self.get("reciprocal_density", 1000), + reciprocal_density=self.get("reciprocal_density", 100), kpoints_line_density=self.get("kpoints_line_density", 20), small_gap_multiply=self.get("small_gap_multiply", None), standardize=self.get("standardize", False),