Skip to content

Commit

Permalink
Deal with failed MetricWorkChain for EOS analysis (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz authored Sep 19, 2023
1 parent 988c3ad commit 37be522
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aiida_sssp_workflow/statics/generatemapping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"import os\n",
"from aiida_sssp_workflow.utils import LANTHANIDE_ELEMENTS\n",
"from aiida_sssp_workflow.utils import ACTINIDE_ELEMENTS\n",
"from aiida_sssp_workflow.utils import M\n",
"from aiida_sssp_workflow.utils import MAGNETIC_ELEMENTS\n",
"\n",
"# We use Diamond for the convergence test for all elements.\n",
"# Because it usually give the lagrest cutoff energy, which is the most strict test.\n",
Expand Down
2 changes: 2 additions & 0 deletions aiida_sssp_workflow/workflows/convergence/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ def result_general_process(self, reference_node, sample_nodes, **kwargs) -> dict
ecutwfc_list.append(child_node.outputs.ecutwfc.value)
ecutrho_list.append(child_node.outputs.ecutrho.value)

# the helper_compare_result_extract_fun must be implemented in subclass and it can return empty dict, which will be ignored.
# The empty dict is used to skip the result of specific convergence test that give no result or irrational result.
res = self.helper_compare_result_extract_fun(
child_node, reference_node, **kwargs
)
Expand Down
5 changes: 4 additions & 1 deletion aiida_sssp_workflow/workflows/convergence/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def helper_delta_difference(
input_parameters: orm.Dict, ref_parameters: orm.Dict
) -> orm.Dict:
"""calculate the delta difference from parameters"""
res_delta = input_parameters["delta/natoms"]
res_delta = input_parameters.get_dict().get("delta/natoms", None)
# There is a change the delta cannot be calculated, e.g. the cutoff is too low.
if res_delta is None:
return orm.Dict(dict={})
ref_delta = ref_parameters["delta/natoms"]
absolute_diff = abs(res_delta - ref_delta)
relative_diff = abs((res_delta - ref_delta) / ref_delta) * 100
Expand Down

0 comments on commit 37be522

Please sign in to comment.