Skip to content

Commit f970edf

Browse files
committed
revert core
1 parent ad6f430 commit f970edf

File tree

2 files changed

+36
-299
lines changed

2 files changed

+36
-299
lines changed

atomate/vasp/fireworks/core.py

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(self, structure, name="structure optimization",
8888
class StaticFW(Firework):
8989

9090
def __init__(self, structure=None, name="static", vasp_input_set=None, vasp_input_set_params=None,
91-
vasp_cmd="vasp", prev_calc_loc=True, prev_calc_dir=None, db_file=None, vasptodb_kwargs={}, parents=None, **kwargs):
91+
vasp_cmd="vasp", prev_calc_loc=True, prev_calc_dir=None, db_file=None, vasptodb_kwargs=None, parents=None, **kwargs):
9292
"""
9393
Standard static calculation Firework - either from a previous location or from a structure.
9494
@@ -107,11 +107,16 @@ def __init__(self, structure=None, name="static", vasp_input_set=None, vasp_inpu
107107
prev_calc_dir (str): Path to a previous calculation to copy from
108108
db_file (str): Path to file specifying db credentials.
109109
parents (Firework): Parents of this particular Firework. FW or list of FWS.
110+
vasptodb_kwargs (dict): kwargs to pass to VaspToDb
110111
\*\*kwargs: Other kwargs that are passed to Firework.__init__.
111112
"""
112113
t = []
113114

114115
vasp_input_set_params = vasp_input_set_params or {}
116+
vasptodb_kwargs = vasptodb_kwargs or {}
117+
if "additional_fields" not in vasptodb_kwargs:
118+
vasptodb_kwargs["additional_fields"] = {}
119+
vasptodb_kwargs["additional_fields"]["task_label"] = name
115120

116121
fw_name = "{}-{}".format(structure.composition.reduced_formula if structure else "unknown", name)
117122

@@ -134,7 +139,7 @@ def __init__(self, structure=None, name="static", vasp_input_set=None, vasp_inpu
134139
t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<"))
135140
t.append(PassCalcLocs(name=name))
136141
t.append(
137-
VaspToDb(db_file=db_file, additional_fields={"task_label": name}, **vasptodb_kwargs))
142+
VaspToDb(db_file=db_file, **vasptodb_kwargs))
138143
super(StaticFW, self).__init__(t, parents=parents, name=fw_name, **kwargs)
139144

140145

@@ -231,14 +236,16 @@ def __init__(self, parents=None, prev_calc_dir=None, structure=None, mode="gap",
231236

232237
class NonSCFFW(Firework):
233238

234-
def __init__(self, parents=None, prev_calc_dir=None, structure=None, name="nscf", mode="uniform", vasp_cmd="vasp",
235-
copy_vasp_outputs=True, db_file=None, **kwargs):
239+
def __init__(self, parents=None, prev_calc_dir=None, structure=None,
240+
name="nscf", mode="uniform", vasp_cmd="vasp",
241+
copy_vasp_outputs=True, db_file=None,
242+
input_set_overrides=None, **kwargs):
236243
"""
237-
Standard NonSCF Calculation Firework supporting both
238-
uniform and line modes.
244+
Standard NonSCF Calculation Firework supporting uniform and line modes.
239245
240246
Args:
241-
structure (Structure): Input structure - used only to set the name of the FW.
247+
structure (Structure): Input structure - used only to set the name
248+
of the FW.
242249
name (str): Name for the Firework.
243250
mode (str): "uniform" or "line" mode.
244251
vasp_cmd (str): Command to run vasp.
@@ -248,36 +255,48 @@ def __init__(self, parents=None, prev_calc_dir=None, structure=None, name="nscf"
248255
db_file (str): Path to file specifying db credentials.
249256
parents (Firework): Parents of this particular Firework.
250257
FW or list of FWS.
258+
input_set_overrides (dict): Arguments passed to the
259+
"from_prev_calc" method of the MPNonSCFSet. This parameter
260+
allows a user to modify the default values of the input set.
261+
For example, passing the key value pair
262+
{'reciprocal_density': 1000}
263+
will override default k-point meshes for uniform calculations.
251264
\*\*kwargs: Other kwargs that are passed to Firework.__init__.
252265
"""
253-
fw_name = "{}-{} {}".format(structure.composition.reduced_formula if structure else "unknown", name,
254-
mode)
266+
input_set_overrides = input_set_overrides or {}
267+
268+
fw_name = "{}-{} {}".format(structure.composition.reduced_formula if
269+
structure else "unknown", name, mode)
255270
t = []
256271

257272
if prev_calc_dir:
258-
t.append(CopyVaspOutputs(calc_dir=prev_calc_dir, additional_files=["CHGCAR"]))
273+
t.append(CopyVaspOutputs(calc_dir=prev_calc_dir,
274+
additional_files=["CHGCAR"]))
259275
elif parents:
260-
t.append(CopyVaspOutputs(calc_loc=True, additional_files=["CHGCAR"]))
276+
t.append(CopyVaspOutputs(calc_loc=True,
277+
additional_files=["CHGCAR"]))
261278
else:
262279
raise ValueError("Must specify previous calculation for NonSCFFW")
263280

264281
mode = mode.lower()
265282
if mode == "uniform":
266283
t.append(
267284
WriteVaspNSCFFromPrev(prev_calc_dir=".", mode="uniform",
268-
reciprocal_density=1000))
285+
**input_set_overrides))
269286
else:
270287
t.append(WriteVaspNSCFFromPrev(prev_calc_dir=".", mode="line",
271-
reciprocal_density=20))
288+
**input_set_overrides))
272289

273-
t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<"))
290+
t.append(RunVaspCustodian(vasp_cmd=vasp_cmd,
291+
auto_npar=">>auto_npar<<"))
274292
t.append(PassCalcLocs(name=name))
275293
t.append(VaspToDb(db_file=db_file,
276294
additional_fields={"task_label": name + " " + mode},
277295
parse_dos=(mode == "uniform"),
278296
bandstructure_mode=mode))
279297

280-
super(NonSCFFW, self).__init__(t, parents=parents, name=fw_name, **kwargs)
298+
super(NonSCFFW, self).__init__(t, parents=parents, name=fw_name,
299+
**kwargs)
281300

282301

283302
class LepsFW(Firework):
@@ -538,9 +557,7 @@ def __init__(self, structure, transformations, transformation_params=None,
538557
vasp_input_set=None, prev_calc_dir=None,
539558
name="structure transmuter", vasp_cmd="vasp",
540559
copy_vasp_outputs=True, db_file=None,
541-
parents=None, bandstructure_mode=None,
542-
override_default_vasp_params=None,
543-
defect_wf_parsing=None, **kwargs):
560+
parents=None, override_default_vasp_params=None, **kwargs):
544561
"""
545562
Apply the transformations to the input structure, write the input set corresponding
546563
to the transformed structure, and run vasp on them. Note that if a transformation yields
@@ -561,14 +578,7 @@ def __init__(self, structure, transformations, transformation_params=None,
561578
prev_calc_dir (str): Path to a previous calculation to copy from
562579
db_file (string): Path to file specifying db credentials.
563580
parents (Firework): Parents of this particular Firework. FW or list of FWS.
564-
bandstructure_mode (str): Set to "uniform" for uniform band structure.
565-
Set to "line" for line mode. If not set, band structure will not
566-
be parsed.
567581
override_default_vasp_params (dict): additional user input settings for vasp_input_set.
568-
defect_wf_parsing (Site): If Site is provided, drone considers Procar and
569-
Wavecar localization parsing relative to the position of Site.
570-
Useful for consideration of defect localization
571-
Defaults to None (no extra procar or wavecar parsing occurs for VaspToDb)
572582
\*\*kwargs: Other kwargs that are passed to Firework.__init__.
573583
"""
574584
fw_name = "{}-{}".format(structure.composition.reduced_formula, name)
@@ -612,9 +622,7 @@ def __init__(self, structure, transformations, transformation_params=None,
612622
"task_label": name,
613623
"transmuter": {"transformations": transformations,
614624
"transformation_params": transformation_params}
615-
},
616-
bandstructure_mode=bandstructure_mode,
617-
defect_wf_parsing=defect_wf_parsing))
625+
}))
618626

619627
super(TransmuterFW, self).__init__(t, parents=parents,
620628
name=fw_name, **kwargs)

0 commit comments

Comments
 (0)