Skip to content

Commit

Permalink
Merge pull request #768 from fraricci/fix_magwf_static_2
Browse files Browse the repository at this point in the history
Fix for MagneticOrderingsWF static only
  • Loading branch information
Zhuoying authored Jul 25, 2023
2 parents 387938d + 0c100b6 commit f4060e5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions atomate/vasp/firetasks/parse_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ def run_task(self, fw_spec):
{"wf_meta.wf_uuid": uuid, "task_label": optimize_task_label}
)
)

# used to determine if ordering changed during relaxation
# stored for checking suitable convergence is reached
energy_diff_relax_static = (
Expand All @@ -1384,6 +1385,7 @@ def run_task(self, fw_spec):
)
else:
energy_diff_relax_static = None
optimize_task = d

input_structure = Structure.from_dict(optimize_task["input"]["structure"])
input_magmoms = optimize_task["input"]["incar"]["MAGMOM"]
Expand Down Expand Up @@ -1459,8 +1461,8 @@ def run_task(self, fw_spec):
d["calcs_reversed"][0]["output"]["outcar"]["total_magnetization"]
)
num_formula_units = sum(
d["calcs_reversed"][0]["composition_reduced"].values()
) / sum(d["calcs_reversed"][0]["composition_unit_cell"].values())
d["calcs_reversed"][0]["composition_unit_cell"].values()
) / sum(d["calcs_reversed"][0]["composition_reduced"].values())
total_magnetization_per_formula_unit = (
total_magnetization / num_formula_units
)
Expand Down
4 changes: 2 additions & 2 deletions atomate/vasp/fireworks/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def __init__(
vasptodb_kwargs["additional_fields"] = {}
vasptodb_kwargs["additional_fields"]["task_label"] = name

formula = structure.composition.reduced_formula if structure else "unknown"
formula = structure.composition.reduced_formula if structure is not None else "unknown"
fw_name = f"{formula}-{name}"

if spec_structure_key is not None:
Expand All @@ -364,7 +364,7 @@ def __init__(
CopyVaspOutputs(calc_loc=prev_calc_loc, contcar_to_poscar=True)
)
t.append(WriteVaspStaticFromPrev(other_params=vasp_input_set_params))
elif structure:
elif structure is not None:
vasp_input_set = vasp_input_set or MPStaticSet(
structure, **vasp_input_set_params
)
Expand Down
4 changes: 2 additions & 2 deletions atomate/vasp/workflows/base/magnetism.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ def _add_metadata(structure):
vasp_cmd=c["VASP_CMD"],
db_file=c["DB_FILE"],
name=name + " static",
prev_calc_loc=True,
parents=fws[-1],
prev_calc_loc = True if not self.static else False,
parents=fws[-1] if not self.static else None,
vasptodb_kwargs={"parse_chgcar": True, "parse_aeccar": True},
)
)
Expand Down

0 comments on commit f4060e5

Please sign in to comment.