Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def wf_bandstructure_plus_hse(structure, gap_only=True, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
if gap_only:
wf_src_name = "bandstructure_hsegap.yaml"
else:
wf_src_name = "bandstructure_hse.yaml"
wf = get_wf(structure, wf_src_name, vis=MPRelaxSet(structure, force_gamma=True),
common_params={"vasp_cmd": vasp_cmd, "db_file": db_file})
wf = add_common_powerups(wf, c)
if c.get("SMALLGAP_KPOINT_MULTIPLY", SMALLGAP_KPOINT_MULTIPLY):
wf = add_small_gap_multiply(wf, 0.5, 5, "static")
wf = add_small_gap_multiply(wf, 0.5, 5, "nscf")
if c.get("STABILITY_CHECK", STABILITY_CHECK):
wf = add_stability_check(wf, fw_name_constraint="structure optimization")
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf
vis=vis_relax)
vis_static = MPStaticSet(structure, force_gamma=True, lepsilon=False,
user_kpoints_settings=user_kpoints_settings,
user_incar_settings=uis_static)
# get the deformations wflow for bulk modulus calculation
wf_bm = get_wf_bulk_modulus(structure, eos=eos, user_kpoints_settings=user_kpoints_settings,
deformations=deformations, vasp_cmd=vasp_cmd, db_file=db_file, tag=tag,
vasp_input_set=vis_static)
# chain it
wf.append_wf(wf_bm, wf.leaf_fw_ids)
wf = add_modify_incar(wf, modify_incar_params={"incar_update": {"ENCUT": 600, "EDIFF": 1e-6}})
wf = add_common_powerups(wf, c)
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf
def wf_bandstructure_hse(structure, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
wf_src_name = "bandstructure_hse_full.yaml"
wf = get_wf(structure, wf_src_name, vis=MPHSERelaxSet(structure, force_gamma=True),
common_params={"vasp_cmd": vasp_cmd, "db_file": db_file})
wf = add_common_powerups(wf, c)
if c.get("SMALLGAP_KPOINT_MULTIPLY", SMALLGAP_KPOINT_MULTIPLY):
wf = add_small_gap_multiply(wf, 0.5, 5, "static")
if c.get("STABILITY_CHECK", STABILITY_CHECK):
wf = add_stability_check(wf, fw_name_constraint="structure optimization")
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf
def wf_bandstructure(structure, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
wf = get_wf(structure, "bandstructure.yaml", vis=MPRelaxSet(structure, force_gamma=True),
common_params={"vasp_cmd": vasp_cmd, "db_file": db_file})
wf = add_common_powerups(wf, c)
if c.get("SMALLGAP_KPOINT_MULTIPLY", SMALLGAP_KPOINT_MULTIPLY):
wf = add_small_gap_multiply(wf, 0.5, 5, "static")
wf = add_small_gap_multiply(wf, 0.5, 5, "nscf")
if c.get("STABILITY_CHECK", STABILITY_CHECK):
wf = add_stability_check(wf, fw_name_constraint="structure optimization")
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf
structure, user_incar_settings=user_incar_settings),
common_params={
"vasp_cmd": vasp_cmd,
"db_file": db_file
})
wf = use_custodian(
wf,
custodian_params={
"ediffg": ediffg,
"max_force_threshold": 0,
"half_kpts_first_relax": half_kpts,
"job_type": "metagga_opt_run",
"vasp_cmd": vasp_cmd
})
wf = add_common_powerups(wf, c)
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
if c.get("REMOVE_WAVECAR", REMOVE_WAVECAR):
wf = clean_up_files(wf)
return wf
c.update(c_defaults)
else:
c = c_defaults
wf = get_wf(structure, "magnetic_deformation.yaml", common_params=c, vis=vis)
fw_analysis = Firework(
MagneticDeformationToDb(
db_file=DB_FILE, wf_uuid=uuid, to_db=c.get("to_db", True)
),
name="MagneticDeformationToDb",
)
wf.append_wf(Workflow.from_Firework(fw_analysis), wf.leaf_fw_ids)
wf = add_common_powerups(wf, c)
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
wf = add_additional_fields_to_taskdocs(
wf,
{
"wf_meta": {
"wf_uuid": uuid,
"wf_name": "magnetic_deformation",
"wf_version": __magnetic_deformation_wf_version__,
}
},
)
return wf
def wf_structure_optimization(structure, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
user_incar_settings = c.get("USER_INCAR_SETTINGS")
wf = get_wf(structure, "optimize_only.yaml",
vis=MPRelaxSet(structure, force_gamma=True, user_incar_settings=user_incar_settings),
common_params={"vasp_cmd": vasp_cmd, "db_file": db_file})
wf = add_common_powerups(wf, c)
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf
# optimization only workflow
wf = get_wf(structure, "optimize_only.yaml",
params=[{"vasp_cmd": vasp_cmd, "db_file": db_file,
"name": "{} structure optimization".format(tag)}],
vis=vis_relax)
wf_thermal = get_wf_thermal_expansion(structure, user_kpoints_settings=user_kpoints_settings,
deformations=deformations, vasp_cmd=vasp_cmd, db_file=db_file,
eos=eos, pressure=pressure, tag=tag)
# chain it
wf.append_wf(wf_thermal, wf.leaf_fw_ids)
wf = add_modify_incar(wf, modify_incar_params={"incar_update": {"ENCUT": 600, "EDIFF": 1e-6}})
wf = add_common_powerups(wf, c)
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf
def wf_nmr(structure, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
wf = get_wf(structure, "nmr.yaml",
common_params={"vasp_cmd": vasp_cmd, "db_file": db_file})
wf = add_common_powerups(wf, c)
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf
def wf_bandstructure_no_opt(structure, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
wf = get_wf(structure, "bandstructure_no_opt.yaml",
vis=MPStaticSet(structure, force_gamma=True),
common_params={"vasp_cmd": vasp_cmd, "db_file": db_file})
wf = add_common_powerups(wf, c)
if c.get("SMALLGAP_KPOINT_MULTIPLY", SMALLGAP_KPOINT_MULTIPLY):
wf = add_small_gap_multiply(wf, 0.5, 5, "static")
wf = add_small_gap_multiply(wf, 0.5, 5, "nscf")
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf