From 300f11fb9cc61c4a77a738412b110eb09de57203 Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Fri, 31 Jul 2026 17:55:33 -0700 Subject: [PATCH] fix: ELEMENTAL_TE_SOURCE parameter was never applied to the submitted job The notebook's cell 4.2 uses ELEMENTAL_TE_SOURCE to preview which total_energy properties would be resolved, but formation_workflow (the object actually passed to create_job) was never patched with it -- the Resolve Total Energies for Elemental Materials subworkflow always ran with its standata-hardcoded 'public' value regardless of the parameter, so the preview and the real computation could silently disagree. Patch the workflow's assign-source-of-te-for-an-element unit the same way SCF_KGRID already patches pw_scf, right after the workflow object is created and before it's saved/submitted. --- .../workflows/formation_energy.ipynb | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/other/materials_designer/workflows/formation_energy.ipynb b/other/materials_designer/workflows/formation_energy.ipynb index d2f8efc6..f7cf2f3a 100644 --- a/other/materials_designer/workflows/formation_energy.ipynb +++ b/other/materials_designer/workflows/formation_energy.ipynb @@ -457,9 +457,27 @@ ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, "id": "32", "metadata": {}, + "outputs": [], + "source": [ + "# Elemental total energy source: which owner's total_energy properties the\n", + "# job itself resolves at runtime, via the Resolve Total Energies for Elemental\n", + "# Materials subworkflow (index 2, same lookup cell 4.2 uses above). Must be\n", + "# patched here -- the cell 4.2 preview only reads properties for display, it\n", + "# does not affect the submitted job.\n", + "resolve_te_subworkflow = formation_workflow.subworkflows[2]\n", + "te_source_unit = resolve_te_subworkflow.get_unit_by_name(name=\"assign-source-of-te-for-an-element\")\n", + "te_source_unit.value = repr(ELEMENTAL_TE_SOURCE)\n", + "resolve_te_subworkflow.set_unit(te_source_unit)\n" + ] + }, + { + "cell_type": "markdown", + "id": "33", + "metadata": {}, "source": [ "### 5.4. Save workflow to collection\n" ] @@ -467,7 +485,7 @@ { "cell_type": "code", "execution_count": null, - "id": "33", + "id": "34", "metadata": {}, "outputs": [], "source": [ @@ -482,7 +500,7 @@ }, { "cell_type": "markdown", - "id": "34", + "id": "35", "metadata": {}, "source": [ "## 6. Create the compute configuration\n", @@ -492,7 +510,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35", + "id": "36", "metadata": {}, "outputs": [], "source": [ @@ -502,7 +520,7 @@ }, { "cell_type": "markdown", - "id": "36", + "id": "37", "metadata": {}, "source": [ "### 6.2. Create compute configuration\n" @@ -511,7 +529,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37", + "id": "38", "metadata": {}, "outputs": [], "source": [ @@ -528,7 +546,7 @@ }, { "cell_type": "markdown", - "id": "38", + "id": "39", "metadata": {}, "source": [ "## 7. Create the Formation Energy job\n", @@ -538,7 +556,7 @@ { "cell_type": "code", "execution_count": null, - "id": "39", + "id": "40", "metadata": {}, "outputs": [], "source": [ @@ -561,7 +579,7 @@ }, { "cell_type": "markdown", - "id": "40", + "id": "41", "metadata": {}, "source": [ "### 7.2. Submit the Formation Energy job and monitor the status\n" @@ -570,7 +588,7 @@ { "cell_type": "code", "execution_count": null, - "id": "41", + "id": "42", "metadata": {}, "outputs": [], "source": [ @@ -581,7 +599,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42", + "id": "43", "metadata": {}, "outputs": [], "source": [ @@ -592,7 +610,7 @@ }, { "cell_type": "markdown", - "id": "43", + "id": "44", "metadata": {}, "source": [ "## 8. Retrieve results\n", @@ -602,7 +620,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44", + "id": "45", "metadata": {}, "outputs": [], "source": [ @@ -615,7 +633,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45", + "id": "46", "metadata": {}, "outputs": [], "source": []