From f45149a82b56275d3305a4c02966373214a2d8b9 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Wed, 21 May 2025 14:29:12 +0200 Subject: [PATCH] Aiida remove name parameter --- example_workflows/arithmetic/aiida.ipynb | 3 --- example_workflows/nfdi/aiida.ipynb | 2 +- example_workflows/quantum_espresso/aiida.ipynb | 14 +++++++------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/example_workflows/arithmetic/aiida.ipynb b/example_workflows/arithmetic/aiida.ipynb index 0741c99..3e7dcd9 100644 --- a/example_workflows/arithmetic/aiida.ipynb +++ b/example_workflows/arithmetic/aiida.ipynb @@ -63,7 +63,6 @@ "source": [ "get_prod_and_div_task = wg.add_task(\n", " task(outputs=['prod', 'div'])(_get_prod_and_div),\n", - " name=\"get_prod_and_div\",\n", " x=orm.Float(1),\n", " y=orm.Float(2),\n", ")" @@ -79,7 +78,6 @@ "source": [ "get_sum_task = wg.add_task(\n", " _get_sum,\n", - " name=\"get_sum\",\n", " x=get_prod_and_div_task.outputs.prod,\n", " y=get_prod_and_div_task.outputs.div,\n", ")" @@ -93,7 +91,6 @@ "source": [ "get_square_task = wg.add_task(\n", " _get_square,\n", - " name=\"get_square\",\n", " x=get_sum_task.outputs.result,\n", ")" ] diff --git a/example_workflows/nfdi/aiida.ipynb b/example_workflows/nfdi/aiida.ipynb index 05a2f85..f6d55f0 100644 --- a/example_workflows/nfdi/aiida.ipynb +++ b/example_workflows/nfdi/aiida.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.12.8","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"106ded66-d202-46ac-82b0-2755ca309bdd","cell_type":"markdown","source":"# Aiida\n\nhttps://github.com/BAMresearch/NFDI4IngScientificWorkflowRequirements","metadata":{}},{"id":"11e09b78-cb72-465f-9c8b-5b77f0aa729c","cell_type":"markdown","source":"## Define workflow with aiida","metadata":{}},{"id":"17173d54-dc76-4052-ab39-d44771ac903d","cell_type":"code","source":"import os","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"89c02460-b543-442c-a27e-f1757dc2262e","cell_type":"code","source":"from python_workflow_definition.aiida import write_workflow_json\n\nfrom aiida_workgraph import WorkGraph, task\nfrom aiida import orm, load_profile\nload_profile()","metadata":{"trusted":true},"outputs":[{"execution_count":2,"output_type":"execute_result","data":{"text/plain":"Profile"},"metadata":{}}],"execution_count":2},{"id":"6dac225a1ce86b25","cell_type":"code","source":"from workflow import (\n generate_mesh,\n convert_to_xdmf as _convert_to_xdmf,\n poisson as _poisson,\n plot_over_line,\n substitute_macros,\n compile_paper,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"c47205d289499756","cell_type":"code","source":"convert_to_xdmf = task(outputs=[\"xdmf_file\", \"h5_file\"])(_convert_to_xdmf)\npoisson = task(outputs=[\"numdofs\", \"pvd_file\", \"vtu_file\"])(_poisson)","metadata":{"trusted":true},"outputs":[],"execution_count":4},{"id":"37c9d988-1755-446c-9f7b-c32f99e280d4","cell_type":"code","source":"source_directory = orm.Str(os.path.abspath(os.path.join(os.curdir, \"source\")))","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"8d911f98-3b80-457f-a0f4-3cb37ebf1691","cell_type":"code","source":"domain_size = orm.Float(2.0)","metadata":{"trusted":true},"outputs":[],"execution_count":6},{"id":"1e7e14ba-c4a7-485f-9bd8-44625830cca0","cell_type":"code","source":"wg = WorkGraph(\"wg-nfdi\")","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"71d411b6-cbec-489e-99e3-ba71680bcb5b","cell_type":"code","source":"gmsh_output_file = wg.add_task(\n generate_mesh,\n name=\"generate_mesh\",\n domain_size=domain_size,\n source_directory=source_directory,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":8},{"id":"1d0d9804-f250-48b3-a5d0-a546d520f79b","cell_type":"code","source":"meshio_output_dict = wg.add_task(\n convert_to_xdmf,\n name=\"convert_to_xdmf\",\n gmsh_output_file=gmsh_output_file.outputs.result,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":9},{"id":"7b69bcff-e2b1-4d4a-b62c-6a1c86eeb590","cell_type":"code","source":"poisson_dict = wg.add_task(\n poisson,\n name=\"poisson\",\n meshio_output_xdmf=meshio_output_dict.outputs.xdmf_file, \n meshio_output_h5=meshio_output_dict.outputs.h5_file,\n source_directory=source_directory,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":10},{"id":"3c4a29b0-eb1e-490a-8be0-e03cfff15e0a","cell_type":"code","source":"pvbatch_output_file = wg.add_task(\n plot_over_line,\n name=\"plot_over_line\",\n poisson_output_pvd_file=poisson_dict.outputs.pvd_file, \n poisson_output_vtu_file=poisson_dict.outputs.vtu_file,\n source_directory=source_directory,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":11},{"id":"a0a4c233-322d-4723-9627-62ca2487bfa9","cell_type":"code","source":"macros_tex_file = wg.add_task(\n substitute_macros,\n name=\"substitute_macros\",\n pvbatch_output_file=pvbatch_output_file.outputs.result, \n ndofs=poisson_dict.outputs.numdofs, \n domain_size=domain_size,\n source_directory=source_directory,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":12},{"id":"c281408f-e63d-4380-a7e6-c595d49fbb8f","cell_type":"code","source":"paper_output = wg.add_task(\n compile_paper,\n name=\"compile_paper\",\n macros_tex=macros_tex_file.outputs.result, \n plot_file=pvbatch_output_file.outputs.result,\n source_directory=source_directory,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":13},{"id":"a384d70a-8ef5-4fdd-880c-56ac7eaf87b9","cell_type":"code","source":"wg","metadata":{"trusted":true},"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":"NodeGraphWidget(settings={'minimap': True}, style={'width': '90%', 'height': '600px'}, value={'name': 'wg-nfdi…","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":1,"model_id":"146d8dc7dfb641ca8d2e9d74c21dd397"}},"metadata":{}}],"execution_count":14},{"id":"fb23ad9c-76fd-4c0b-b546-e305d6c49796","cell_type":"code","source":"workflow_json_filename = \"aiida_nfdi.json\"","metadata":{"trusted":true},"outputs":[],"execution_count":15},{"id":"4139547a-9717-4708-b1a5-8202a0382d77","cell_type":"code","source":"write_workflow_json(wg=wg, file_name=workflow_json_filename)","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"490df6a3-e402-4620-acf2-dbcfa0c5d537","cell_type":"code","source":"!cat {workflow_json_filename}","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"{\n \"nodes\": [\n {\n \"id\": 0,\n \"type\": \"function\",\n \"value\": \"workflow.generate_mesh\"\n },\n {\n \"id\": 1,\n \"type\": \"function\",\n \"value\": \"workflow.convert_to_xdmf\"\n },\n {\n \"id\": 2,\n \"type\": \"function\",\n \"value\": \"workflow.poisson\"\n },\n {\n \"id\": 3,\n \"type\": \"function\",\n \"value\": \"workflow.plot_over_line\"\n },\n {\n \"id\": 4,\n \"type\": \"function\",\n \"value\": \"workflow.substitute_macros\"\n },\n {\n \"id\": 5,\n \"type\": \"function\",\n \"value\": \"workflow.compile_paper\"\n },\n {\n \"id\": 6,\n \"type\": \"input\",\n \"name\": \"domain_size\",\n \"value\": 2.0\n },\n {\n \"id\": 7,\n \"type\": \"input\",\n \"name\": \"source_directory\",\n \"value\": \"/home/jovyan/example_workflows/nfdi/source\"\n },\n {\n \"id\": 8,\n \"type\": \"output\",\n \"name\": \"result\"\n }\n ],\n \"edges\": [\n {\n \"target\": 1,\n \"targetPort\": \"gmsh_output_file\",\n \"source\": 0,\n \"sourcePort\": null\n },\n {\n \"target\": 2,\n \"targetPort\": \"meshio_output_xdmf\",\n \"source\": 1,\n \"sourcePort\": \"xdmf_file\"\n },\n {\n \"target\": 2,\n \"targetPort\": \"meshio_output_h5\",\n \"source\": 1,\n \"sourcePort\": \"h5_file\"\n },\n {\n \"target\": 3,\n \"targetPort\": \"poisson_output_pvd_file\",\n \"source\": 2,\n \"sourcePort\": \"pvd_file\"\n },\n {\n \"target\": 3,\n \"targetPort\": \"poisson_output_vtu_file\",\n \"source\": 2,\n \"sourcePort\": \"vtu_file\"\n },\n {\n \"target\": 4,\n \"targetPort\": \"pvbatch_output_file\",\n \"source\": 3,\n \"sourcePort\": null\n },\n {\n \"target\": 4,\n \"targetPort\": \"ndofs\",\n \"source\": 2,\n \"sourcePort\": \"numdofs\"\n },\n {\n \"target\": 5,\n \"targetPort\": \"macros_tex\",\n \"source\": 4,\n \"sourcePort\": null\n },\n {\n \"target\": 5,\n \"targetPort\": \"plot_file\",\n \"source\": 3,\n \"sourcePort\": null\n },\n {\n \"target\": 0,\n \"targetPort\": \"domain_size\",\n \"source\": 6,\n \"sourcePort\": null\n },\n {\n \"target\": 0,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 2,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 3,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 4,\n \"targetPort\": \"domain_size\",\n \"source\": 6,\n \"sourcePort\": null\n },\n {\n \"target\": 4,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 5,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 8,\n \"targetPort\": null,\n \"source\": 5,\n \"sourcePort\": null\n }\n ]\n}"}],"execution_count":17},{"id":"11a829e2-face-469f-b343-2c95763b1f13","cell_type":"markdown","source":"## Load Workflow with jobflow","metadata":{}},{"id":"4f3acabe-55df-479a-af4d-a23a80c4660d","cell_type":"code","source":"from python_workflow_definition.jobflow import load_workflow_json","metadata":{"trusted":true},"outputs":[],"execution_count":18},{"id":"b6ba9444-a2c8-451b-b74c-19b0f69ba369","cell_type":"code","source":"from jobflow.managers.local import run_locally","metadata":{"trusted":true},"outputs":[],"execution_count":19},{"id":"c3528d55-6bf7-47ed-a110-65c47446ba92","cell_type":"code","source":"flow = load_workflow_json(file_name=workflow_json_filename)","metadata":{"trusted":true},"outputs":[],"execution_count":20},{"id":"5ef48778-4209-425f-8c6b-85a4cd2f92ec","cell_type":"code","source":"result = run_locally(flow)\nresult","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2025-05-14 08:19:05,840 INFO Started executing jobs locally\n2025-05-14 08:19:06,092 INFO Starting job - generate_mesh (2b5d3769-0843-43a0-b074-2b307413b932)\n2025-05-14 08:19:07,248 INFO Finished job - generate_mesh (2b5d3769-0843-43a0-b074-2b307413b932)\n2025-05-14 08:19:07,249 INFO Starting job - convert_to_xdmf (60d93a50-60c8-4ebc-9822-fae5e9f6bf4b)\n2025-05-14 08:19:08,519 INFO Finished job - convert_to_xdmf (60d93a50-60c8-4ebc-9822-fae5e9f6bf4b)\n2025-05-14 08:19:08,521 INFO Starting job - poisson (06a30fcc-b3e5-4223-aa6e-1090166cd9c7)\n2025-05-14 08:19:11,239 INFO Finished job - poisson (06a30fcc-b3e5-4223-aa6e-1090166cd9c7)\n2025-05-14 08:19:11,240 INFO Starting job - plot_over_line (f899080b-495a-401e-a71c-3abba9e81a5b)\n2025-05-14 08:19:12,690 INFO Finished job - plot_over_line (f899080b-495a-401e-a71c-3abba9e81a5b)\n2025-05-14 08:19:12,691 INFO Starting job - substitute_macros (b1612cb4-0027-4140-95c2-8cb7581109ca)\n2025-05-14 08:19:13,570 INFO Finished job - substitute_macros (b1612cb4-0027-4140-95c2-8cb7581109ca)\n2025-05-14 08:19:13,571 INFO Starting job - compile_paper (c5e6caaa-9766-4079-a235-a774a6d5c7fa)\n2025-05-14 08:19:15,636 INFO Finished job - compile_paper (c5e6caaa-9766-4079-a235-a774a6d5c7fa)\n2025-05-14 08:19:15,637 INFO Finished executing jobs locally\n"},{"execution_count":21,"output_type":"execute_result","data":{"text/plain":"{'2b5d3769-0843-43a0-b074-2b307413b932': {1: Response(output='/home/jovyan/example_workflows/nfdi/preprocessing/square.msh', detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n '60d93a50-60c8-4ebc-9822-fae5e9f6bf4b': {1: Response(output={'xdmf_file': '/home/jovyan/example_workflows/nfdi/preprocessing/square.xdmf', 'h5_file': '/home/jovyan/example_workflows/nfdi/preprocessing/square.h5'}, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n '06a30fcc-b3e5-4223-aa6e-1090166cd9c7': {1: Response(output={'numdofs': 357, 'pvd_file': '/home/jovyan/example_workflows/nfdi/processing/poisson.pvd', 'vtu_file': '/home/jovyan/example_workflows/nfdi/processing/poisson000000.vtu'}, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n 'f899080b-495a-401e-a71c-3abba9e81a5b': {1: Response(output='/home/jovyan/example_workflows/nfdi/postprocessing/plotoverline.csv', detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n 'b1612cb4-0027-4140-95c2-8cb7581109ca': {1: Response(output='/home/jovyan/example_workflows/nfdi/postprocessing/macros.tex', detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n 'c5e6caaa-9766-4079-a235-a774a6d5c7fa': {1: Response(output='/home/jovyan/example_workflows/nfdi/postprocessing/paper.pdf', detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))}}"},"metadata":{}}],"execution_count":21},{"id":"397b16a2-e1ec-4eec-8562-1c84f585c347","cell_type":"markdown","source":"## Load Workflow with pyiron_base","metadata":{}},{"id":"be4d5d93-e9f6-4072-a6be-0ee5dc93590f","cell_type":"code","source":"from python_workflow_definition.pyiron_base import load_workflow_json","metadata":{"trusted":true},"outputs":[],"execution_count":22},{"id":"4452a648-d4c3-4f5f-8678-ffb54bef17dc","cell_type":"code","source":"delayed_object_lst = load_workflow_json(file_name=workflow_json_filename)\ndelayed_object_lst[-1].draw()","metadata":{"trusted":true},"outputs":[{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\ncreate_function_job_9564f1c400f389023de93231c8a62a65\n\ncreate_function_job=<pyiron_base.project.delayed.DelayedObject object at 0x7e2106518c20>\n\n\n\nmacros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\nmacros_tex=<pyiron_base.project.delayed.DelayedObject object at 0x7e21065189b0>\n\n\n\nmacros_tex_4fdd7c93c52394e1a5aed103adf6dba4->create_function_job_9564f1c400f389023de93231c8a62a65\n\n\n\n\n\npvbatch_output_file_e4a68dc408161a17988f364b0337f341\n\npvbatch_output_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e2106518680>\n\n\n\npvbatch_output_file_e4a68dc408161a17988f364b0337f341->macros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\n\n\n\n\npoisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29\n\npoisson_output_pvd_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e21065183e0>\n\n\n\npoisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29->pvbatch_output_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nplot_file_e4a68dc408161a17988f364b0337f341\n\nplot_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e2106518680>\n\n\n\npoisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29->plot_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nplot_file_e4a68dc408161a17988f364b0337f341->create_function_job_9564f1c400f389023de93231c8a62a65\n\n\n\n\n\nmeshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e\n\nmeshio_output_xdmf=<pyiron_base.project.delayed.DelayedObject object at 0x7e21064e7d40>\n\n\n\nmeshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e->poisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29\n\n\n\n\n\npoisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4\n\npoisson_output_vtu_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e21065183b0>\n\n\n\nmeshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e->poisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4\n\n\n\n\n\nndofs_8b9741bf01bd3f1fc0fe9a772777a903\n\nndofs=<pyiron_base.project.delayed.DelayedObject object at 0x7e2106518710>\n\n\n\nmeshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e->ndofs_8b9741bf01bd3f1fc0fe9a772777a903\n\n\n\n\n\npoisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4->pvbatch_output_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\npoisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4->plot_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nndofs_8b9741bf01bd3f1fc0fe9a772777a903->macros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\n\n\n\n\ngmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1\n\ngmsh_output_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e21064e7dd0>\n\n\n\ngmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1->meshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e\n\n\n\n\n\nmeshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7\n\nmeshio_output_h5=<pyiron_base.project.delayed.DelayedObject object at 0x7e21064e7e90>\n\n\n\ngmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1->meshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7\n\n\n\n\n\nmeshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7->poisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29\n\n\n\n\n\nmeshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7->poisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4\n\n\n\n\n\nmeshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7->ndofs_8b9741bf01bd3f1fc0fe9a772777a903\n\n\n\n\n\ndomain_size_f12a7f1986b9dd058dfc666dbe230b20\n\ndomain_size=2.0\n\n\n\ndomain_size_f12a7f1986b9dd058dfc666dbe230b20->macros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\n\n\n\n\ndomain_size_f12a7f1986b9dd058dfc666dbe230b20->gmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696\n\nsource_directory=/home/jovyan/example_workflows/nfdi/source\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->create_function_job_9564f1c400f389023de93231c8a62a65\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->macros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->pvbatch_output_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->poisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->plot_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->poisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->ndofs_8b9741bf01bd3f1fc0fe9a772777a903\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->gmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1\n\n\n\n\n"},"metadata":{}}],"execution_count":23},{"id":"1c2760b6-96b4-4f44-ac49-a229d4a0cf67","cell_type":"code","source":"delayed_object_lst[-1].pull()","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"The job generate_mesh_47725c16637f799ac042e47468005db3 was saved and received the ID: 1\nThe job convert_to_xdmf_d6a46eb9a4ec352aa996e783ec3c785f was saved and received the ID: 2\nThe job poisson_3c147fc86db87cf0c0f94bda333f8cd8 was saved and received the ID: 3\nThe job plot_over_line_ef50933291910dadcc8311924971e127 was saved and received the ID: 4\nThe job substitute_macros_63766eafd6b1980c7832dd8c9a97c96e was saved and received the ID: 5\nThe job compile_paper_128d1d58374953c00e95b8de62cbb10b was saved and received the ID: 6\n"},{"execution_count":24,"output_type":"execute_result","data":{"text/plain":"'/home/jovyan/example_workflows/nfdi/postprocessing/paper.pdf'"},"metadata":{}}],"execution_count":24}]} \ No newline at end of file +{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.12.8","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"106ded66-d202-46ac-82b0-2755ca309bdd","cell_type":"markdown","source":"# Aiida\n\nhttps://github.com/BAMresearch/NFDI4IngScientificWorkflowRequirements","metadata":{}},{"id":"11e09b78-cb72-465f-9c8b-5b77f0aa729c","cell_type":"markdown","source":"## Define workflow with aiida","metadata":{}},{"id":"17173d54-dc76-4052-ab39-d44771ac903d","cell_type":"code","source":"import os","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"89c02460-b543-442c-a27e-f1757dc2262e","cell_type":"code","source":"from python_workflow_definition.aiida import write_workflow_json\n\nfrom aiida_workgraph import WorkGraph, task\nfrom aiida import orm, load_profile\nload_profile()","metadata":{"trusted":true},"outputs":[{"execution_count":2,"output_type":"execute_result","data":{"text/plain":"Profile"},"metadata":{}}],"execution_count":2},{"id":"6dac225a1ce86b25","cell_type":"code","source":"from workflow import (\n generate_mesh,\n convert_to_xdmf as _convert_to_xdmf,\n poisson as _poisson,\n plot_over_line,\n substitute_macros,\n compile_paper,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"c47205d289499756","cell_type":"code","source":"convert_to_xdmf = task(outputs=[\"xdmf_file\", \"h5_file\"])(_convert_to_xdmf)\npoisson = task(outputs=[\"numdofs\", \"pvd_file\", \"vtu_file\"])(_poisson)","metadata":{"trusted":true},"outputs":[],"execution_count":4},{"id":"37c9d988-1755-446c-9f7b-c32f99e280d4","cell_type":"code","source":"source_directory = orm.Str(os.path.abspath(os.path.join(os.curdir, \"source\")))","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"8d911f98-3b80-457f-a0f4-3cb37ebf1691","cell_type":"code","source":"domain_size = orm.Float(2.0)","metadata":{"trusted":true},"outputs":[],"execution_count":6},{"id":"1e7e14ba-c4a7-485f-9bd8-44625830cca0","cell_type":"code","source":"wg = WorkGraph(\"wg-nfdi\")","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"71d411b6-cbec-489e-99e3-ba71680bcb5b","cell_type":"code","source":"gmsh_output_file = wg.add_task(\n generate_mesh,\n domain_size=domain_size,\n source_directory=source_directory,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":8},{"id":"1d0d9804-f250-48b3-a5d0-a546d520f79b","cell_type":"code","source":"meshio_output_dict = wg.add_task(\n convert_to_xdmf,\n gmsh_output_file=gmsh_output_file.outputs.result,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":9},{"id":"7b69bcff-e2b1-4d4a-b62c-6a1c86eeb590","cell_type":"code","source":"poisson_dict = wg.add_task(\n poisson,\n meshio_output_xdmf=meshio_output_dict.outputs.xdmf_file, \n meshio_output_h5=meshio_output_dict.outputs.h5_file,\n source_directory=source_directory,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":10},{"id":"3c4a29b0-eb1e-490a-8be0-e03cfff15e0a","cell_type":"code","source":"pvbatch_output_file = wg.add_task(\n plot_over_line,\n poisson_output_pvd_file=poisson_dict.outputs.pvd_file, \n poisson_output_vtu_file=poisson_dict.outputs.vtu_file,\n source_directory=source_directory,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":11},{"id":"a0a4c233-322d-4723-9627-62ca2487bfa9","cell_type":"code","source":"macros_tex_file = wg.add_task(\n substitute_macros,\n pvbatch_output_file=pvbatch_output_file.outputs.result, \n ndofs=poisson_dict.outputs.numdofs, \n domain_size=domain_size,\n source_directory=source_directory,\n)","metadata":{"tags":[],"trusted":true},"outputs":[],"execution_count":12},{"id":"c281408f-e63d-4380-a7e6-c595d49fbb8f","cell_type":"code","source":"paper_output = wg.add_task(\n compile_paper,\n macros_tex=macros_tex_file.outputs.result, \n plot_file=pvbatch_output_file.outputs.result,\n source_directory=source_directory,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":13},{"id":"a384d70a-8ef5-4fdd-880c-56ac7eaf87b9","cell_type":"code","source":"wg","metadata":{"trusted":true},"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":"NodeGraphWidget(settings={'minimap': True}, style={'width': '90%', 'height': '600px'}, value={'name': 'wg-nfdi…","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":1,"model_id":"146d8dc7dfb641ca8d2e9d74c21dd397"}},"metadata":{}}],"execution_count":14},{"id":"fb23ad9c-76fd-4c0b-b546-e305d6c49796","cell_type":"code","source":"workflow_json_filename = \"aiida_nfdi.json\"","metadata":{"trusted":true},"outputs":[],"execution_count":15},{"id":"4139547a-9717-4708-b1a5-8202a0382d77","cell_type":"code","source":"write_workflow_json(wg=wg, file_name=workflow_json_filename)","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"490df6a3-e402-4620-acf2-dbcfa0c5d537","cell_type":"code","source":"!cat {workflow_json_filename}","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"{\n \"nodes\": [\n {\n \"id\": 0,\n \"type\": \"function\",\n \"value\": \"workflow.generate_mesh\"\n },\n {\n \"id\": 1,\n \"type\": \"function\",\n \"value\": \"workflow.convert_to_xdmf\"\n },\n {\n \"id\": 2,\n \"type\": \"function\",\n \"value\": \"workflow.poisson\"\n },\n {\n \"id\": 3,\n \"type\": \"function\",\n \"value\": \"workflow.plot_over_line\"\n },\n {\n \"id\": 4,\n \"type\": \"function\",\n \"value\": \"workflow.substitute_macros\"\n },\n {\n \"id\": 5,\n \"type\": \"function\",\n \"value\": \"workflow.compile_paper\"\n },\n {\n \"id\": 6,\n \"type\": \"input\",\n \"name\": \"domain_size\",\n \"value\": 2.0\n },\n {\n \"id\": 7,\n \"type\": \"input\",\n \"name\": \"source_directory\",\n \"value\": \"/home/jovyan/example_workflows/nfdi/source\"\n },\n {\n \"id\": 8,\n \"type\": \"output\",\n \"name\": \"result\"\n }\n ],\n \"edges\": [\n {\n \"target\": 1,\n \"targetPort\": \"gmsh_output_file\",\n \"source\": 0,\n \"sourcePort\": null\n },\n {\n \"target\": 2,\n \"targetPort\": \"meshio_output_xdmf\",\n \"source\": 1,\n \"sourcePort\": \"xdmf_file\"\n },\n {\n \"target\": 2,\n \"targetPort\": \"meshio_output_h5\",\n \"source\": 1,\n \"sourcePort\": \"h5_file\"\n },\n {\n \"target\": 3,\n \"targetPort\": \"poisson_output_pvd_file\",\n \"source\": 2,\n \"sourcePort\": \"pvd_file\"\n },\n {\n \"target\": 3,\n \"targetPort\": \"poisson_output_vtu_file\",\n \"source\": 2,\n \"sourcePort\": \"vtu_file\"\n },\n {\n \"target\": 4,\n \"targetPort\": \"pvbatch_output_file\",\n \"source\": 3,\n \"sourcePort\": null\n },\n {\n \"target\": 4,\n \"targetPort\": \"ndofs\",\n \"source\": 2,\n \"sourcePort\": \"numdofs\"\n },\n {\n \"target\": 5,\n \"targetPort\": \"macros_tex\",\n \"source\": 4,\n \"sourcePort\": null\n },\n {\n \"target\": 5,\n \"targetPort\": \"plot_file\",\n \"source\": 3,\n \"sourcePort\": null\n },\n {\n \"target\": 0,\n \"targetPort\": \"domain_size\",\n \"source\": 6,\n \"sourcePort\": null\n },\n {\n \"target\": 0,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 2,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 3,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 4,\n \"targetPort\": \"domain_size\",\n \"source\": 6,\n \"sourcePort\": null\n },\n {\n \"target\": 4,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 5,\n \"targetPort\": \"source_directory\",\n \"source\": 7,\n \"sourcePort\": null\n },\n {\n \"target\": 8,\n \"targetPort\": null,\n \"source\": 5,\n \"sourcePort\": null\n }\n ]\n}"}],"execution_count":17},{"id":"11a829e2-face-469f-b343-2c95763b1f13","cell_type":"markdown","source":"## Load Workflow with jobflow","metadata":{}},{"id":"4f3acabe-55df-479a-af4d-a23a80c4660d","cell_type":"code","source":"from python_workflow_definition.jobflow import load_workflow_json","metadata":{"trusted":true},"outputs":[],"execution_count":18},{"id":"b6ba9444-a2c8-451b-b74c-19b0f69ba369","cell_type":"code","source":"from jobflow.managers.local import run_locally","metadata":{"trusted":true},"outputs":[],"execution_count":19},{"id":"c3528d55-6bf7-47ed-a110-65c47446ba92","cell_type":"code","source":"flow = load_workflow_json(file_name=workflow_json_filename)","metadata":{"trusted":true},"outputs":[],"execution_count":20},{"id":"5ef48778-4209-425f-8c6b-85a4cd2f92ec","cell_type":"code","source":"result = run_locally(flow)\nresult","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2025-05-14 08:19:05,840 INFO Started executing jobs locally\n2025-05-14 08:19:06,092 INFO Starting job - generate_mesh (2b5d3769-0843-43a0-b074-2b307413b932)\n2025-05-14 08:19:07,248 INFO Finished job - generate_mesh (2b5d3769-0843-43a0-b074-2b307413b932)\n2025-05-14 08:19:07,249 INFO Starting job - convert_to_xdmf (60d93a50-60c8-4ebc-9822-fae5e9f6bf4b)\n2025-05-14 08:19:08,519 INFO Finished job - convert_to_xdmf (60d93a50-60c8-4ebc-9822-fae5e9f6bf4b)\n2025-05-14 08:19:08,521 INFO Starting job - poisson (06a30fcc-b3e5-4223-aa6e-1090166cd9c7)\n2025-05-14 08:19:11,239 INFO Finished job - poisson (06a30fcc-b3e5-4223-aa6e-1090166cd9c7)\n2025-05-14 08:19:11,240 INFO Starting job - plot_over_line (f899080b-495a-401e-a71c-3abba9e81a5b)\n2025-05-14 08:19:12,690 INFO Finished job - plot_over_line (f899080b-495a-401e-a71c-3abba9e81a5b)\n2025-05-14 08:19:12,691 INFO Starting job - substitute_macros (b1612cb4-0027-4140-95c2-8cb7581109ca)\n2025-05-14 08:19:13,570 INFO Finished job - substitute_macros (b1612cb4-0027-4140-95c2-8cb7581109ca)\n2025-05-14 08:19:13,571 INFO Starting job - compile_paper (c5e6caaa-9766-4079-a235-a774a6d5c7fa)\n2025-05-14 08:19:15,636 INFO Finished job - compile_paper (c5e6caaa-9766-4079-a235-a774a6d5c7fa)\n2025-05-14 08:19:15,637 INFO Finished executing jobs locally\n"},{"execution_count":21,"output_type":"execute_result","data":{"text/plain":"{'2b5d3769-0843-43a0-b074-2b307413b932': {1: Response(output='/home/jovyan/example_workflows/nfdi/preprocessing/square.msh', detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n '60d93a50-60c8-4ebc-9822-fae5e9f6bf4b': {1: Response(output={'xdmf_file': '/home/jovyan/example_workflows/nfdi/preprocessing/square.xdmf', 'h5_file': '/home/jovyan/example_workflows/nfdi/preprocessing/square.h5'}, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n '06a30fcc-b3e5-4223-aa6e-1090166cd9c7': {1: Response(output={'numdofs': 357, 'pvd_file': '/home/jovyan/example_workflows/nfdi/processing/poisson.pvd', 'vtu_file': '/home/jovyan/example_workflows/nfdi/processing/poisson000000.vtu'}, detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n 'f899080b-495a-401e-a71c-3abba9e81a5b': {1: Response(output='/home/jovyan/example_workflows/nfdi/postprocessing/plotoverline.csv', detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n 'b1612cb4-0027-4140-95c2-8cb7581109ca': {1: Response(output='/home/jovyan/example_workflows/nfdi/postprocessing/macros.tex', detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))},\n 'c5e6caaa-9766-4079-a235-a774a6d5c7fa': {1: Response(output='/home/jovyan/example_workflows/nfdi/postprocessing/paper.pdf', detour=None, addition=None, replace=None, stored_data=None, stop_children=False, stop_jobflow=False, job_dir=PosixPath('/home/jovyan/example_workflows/nfdi'))}}"},"metadata":{}}],"execution_count":21},{"id":"397b16a2-e1ec-4eec-8562-1c84f585c347","cell_type":"markdown","source":"## Load Workflow with pyiron_base","metadata":{}},{"id":"be4d5d93-e9f6-4072-a6be-0ee5dc93590f","cell_type":"code","source":"from python_workflow_definition.pyiron_base import load_workflow_json","metadata":{"trusted":true},"outputs":[],"execution_count":22},{"id":"4452a648-d4c3-4f5f-8678-ffb54bef17dc","cell_type":"code","source":"delayed_object_lst = load_workflow_json(file_name=workflow_json_filename)\ndelayed_object_lst[-1].draw()","metadata":{"trusted":true},"outputs":[{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\ncreate_function_job_9564f1c400f389023de93231c8a62a65\n\ncreate_function_job=<pyiron_base.project.delayed.DelayedObject object at 0x7e2106518c20>\n\n\n\nmacros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\nmacros_tex=<pyiron_base.project.delayed.DelayedObject object at 0x7e21065189b0>\n\n\n\nmacros_tex_4fdd7c93c52394e1a5aed103adf6dba4->create_function_job_9564f1c400f389023de93231c8a62a65\n\n\n\n\n\npvbatch_output_file_e4a68dc408161a17988f364b0337f341\n\npvbatch_output_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e2106518680>\n\n\n\npvbatch_output_file_e4a68dc408161a17988f364b0337f341->macros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\n\n\n\n\npoisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29\n\npoisson_output_pvd_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e21065183e0>\n\n\n\npoisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29->pvbatch_output_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nplot_file_e4a68dc408161a17988f364b0337f341\n\nplot_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e2106518680>\n\n\n\npoisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29->plot_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nplot_file_e4a68dc408161a17988f364b0337f341->create_function_job_9564f1c400f389023de93231c8a62a65\n\n\n\n\n\nmeshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e\n\nmeshio_output_xdmf=<pyiron_base.project.delayed.DelayedObject object at 0x7e21064e7d40>\n\n\n\nmeshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e->poisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29\n\n\n\n\n\npoisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4\n\npoisson_output_vtu_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e21065183b0>\n\n\n\nmeshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e->poisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4\n\n\n\n\n\nndofs_8b9741bf01bd3f1fc0fe9a772777a903\n\nndofs=<pyiron_base.project.delayed.DelayedObject object at 0x7e2106518710>\n\n\n\nmeshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e->ndofs_8b9741bf01bd3f1fc0fe9a772777a903\n\n\n\n\n\npoisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4->pvbatch_output_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\npoisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4->plot_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nndofs_8b9741bf01bd3f1fc0fe9a772777a903->macros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\n\n\n\n\ngmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1\n\ngmsh_output_file=<pyiron_base.project.delayed.DelayedObject object at 0x7e21064e7dd0>\n\n\n\ngmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1->meshio_output_xdmf_6ee525037bdcb254ca562ddfe379237e\n\n\n\n\n\nmeshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7\n\nmeshio_output_h5=<pyiron_base.project.delayed.DelayedObject object at 0x7e21064e7e90>\n\n\n\ngmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1->meshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7\n\n\n\n\n\nmeshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7->poisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29\n\n\n\n\n\nmeshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7->poisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4\n\n\n\n\n\nmeshio_output_h5_f154dadcde14b5da6730af6d0a4c9df7->ndofs_8b9741bf01bd3f1fc0fe9a772777a903\n\n\n\n\n\ndomain_size_f12a7f1986b9dd058dfc666dbe230b20\n\ndomain_size=2.0\n\n\n\ndomain_size_f12a7f1986b9dd058dfc666dbe230b20->macros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\n\n\n\n\ndomain_size_f12a7f1986b9dd058dfc666dbe230b20->gmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696\n\nsource_directory=/home/jovyan/example_workflows/nfdi/source\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->create_function_job_9564f1c400f389023de93231c8a62a65\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->macros_tex_4fdd7c93c52394e1a5aed103adf6dba4\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->pvbatch_output_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->poisson_output_pvd_file_7da70c04cc70bbdbd26f7da8deeaca29\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->plot_file_e4a68dc408161a17988f364b0337f341\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->poisson_output_vtu_file_fa01b3a624ada2dba805b7518365a6a4\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->ndofs_8b9741bf01bd3f1fc0fe9a772777a903\n\n\n\n\n\nsource_directory_053958014e7cd4a4df22cfa51c9fc696->gmsh_output_file_4b409dc4c5063e64794e38b2cd0b37e1\n\n\n\n\n"},"metadata":{}}],"execution_count":23},{"id":"1c2760b6-96b4-4f44-ac49-a229d4a0cf67","cell_type":"code","source":"delayed_object_lst[-1].pull()","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"The job generate_mesh_47725c16637f799ac042e47468005db3 was saved and received the ID: 1\nThe job convert_to_xdmf_d6a46eb9a4ec352aa996e783ec3c785f was saved and received the ID: 2\nThe job poisson_3c147fc86db87cf0c0f94bda333f8cd8 was saved and received the ID: 3\nThe job plot_over_line_ef50933291910dadcc8311924971e127 was saved and received the ID: 4\nThe job substitute_macros_63766eafd6b1980c7832dd8c9a97c96e was saved and received the ID: 5\nThe job compile_paper_128d1d58374953c00e95b8de62cbb10b was saved and received the ID: 6\n"},{"execution_count":24,"output_type":"execute_result","data":{"text/plain":"'/home/jovyan/example_workflows/nfdi/postprocessing/paper.pdf'"},"metadata":{}}],"execution_count":24}]} diff --git a/example_workflows/quantum_espresso/aiida.ipynb b/example_workflows/quantum_espresso/aiida.ipynb index 8e4abce..49698dd 100644 --- a/example_workflows/quantum_espresso/aiida.ipynb +++ b/example_workflows/quantum_espresso/aiida.ipynb @@ -98,7 +98,7 @@ }, { "cell_type": "code", - "source": "get_bulk_structure_task = wg.add_task(\n get_bulk_structure,\n name=\"get_bulk_structure\",\n element=element,\n a=a,\n cubic=cubic,\n)", + "source": "get_bulk_structure_task = wg.add_task(\n get_bulk_structure,\n element=element,\n a=a,\n cubic=cubic,\n)", "metadata": { "trusted": true }, @@ -107,7 +107,7 @@ }, { "cell_type": "code", - "source": "relax_prepare_input_dict_task = wg.add_task(\n get_dict,\n name=\"relax_get_dict\",\n structure=get_bulk_structure_task.outputs.result,\n calculation=calc_type_relax,\n kpts=kpts,\n pseudopotentials=pseudopotentials,\n smearing=smearing,\n)\n\nrelax_task = wg.add_task(\n calculate_qe,\n name=\"mini\",\n input_dict=relax_prepare_input_dict_task.outputs.result,\n working_directory=relax_workdir,\n)", + "source": "relax_prepare_input_dict_task = wg.add_task(\n get_dict,\n structure=get_bulk_structure_task.outputs.result,\n calculation=calc_type_relax,\n kpts=kpts,\n pseudopotentials=pseudopotentials,\n smearing=smearing,\n)\n\nrelax_task = wg.add_task(\n calculate_qe,\n input_dict=relax_prepare_input_dict_task.outputs.result,\n working_directory=relax_workdir,\n)", "metadata": { "trusted": true }, @@ -116,7 +116,7 @@ }, { "cell_type": "code", - "source": "generate_structures_task = wg.add_task(\n generate_structures,\n name=\"generate_structures\",\n structure=relax_task.outputs.structure,\n strain_lst=strain_lst,\n)", + "source": "generate_structures_task = wg.add_task(\n generate_structures,\n structure=relax_task.outputs.structure,\n strain_lst=strain_lst,\n)", "metadata": { "trusted": true }, @@ -125,7 +125,7 @@ }, { "cell_type": "code", - "source": "get_volumes_task = wg.add_task(get_list, name=\"get_volumes\")", + "source": "get_volumes_task = wg.add_task(get_list)", "metadata": { "trusted": true }, @@ -134,7 +134,7 @@ }, { "cell_type": "code", - "source": "get_energies_task = wg.add_task(get_list, name=\"get_energies\")", + "source": "get_energies_task = wg.add_task(get_list)", "metadata": { "trusted": true }, @@ -143,7 +143,7 @@ }, { "cell_type": "code", - "source": "strain_dir_tasks, scf_qe_tasks, scf_get_dict_tasks = [], [], []\n\nfor i, strain in enumerate(strain_lst):\n\n structure_key = f\"s_{i}\"\n strain_dir = orm.Str(f\"strain_{i}\")\n generate_structures_task.add_output(\"workgraph.any\", structure_key)\n\n scf_prepare_input_dict_task = wg.add_task(\n get_dict,\n name=f\"get_dict_{i}\",\n structure=generate_structures_task.outputs[structure_key],\n calculation=calc_type_scf,\n kpts=kpts,\n pseudopotentials=pseudopotentials,\n smearing=smearing,\n )\n\n scf_qe_task = wg.add_task(\n calculate_qe,\n name=f\"qe_{i}\",\n input_dict=scf_prepare_input_dict_task.outputs.result,\n working_directory=strain_dir,\n )\n\n # collect energy and volume\n get_energies_task.set({f\"{i}\": scf_qe_task.outputs.energy})\n get_volumes_task.set({f\"{i}\": scf_qe_task.outputs.volume})", + "source": "strain_dir_tasks, scf_qe_tasks, scf_get_dict_tasks = [], [], []\n\nfor i, strain in enumerate(strain_lst):\n\n structure_key = f\"s_{i}\"\n strain_dir = orm.Str(f\"strain_{i}\")\n generate_structures_task.add_output(\"workgraph.any\", structure_key)\n\n scf_prepare_input_dict_task = wg.add_task(\n get_dict,\n structure=generate_structures_task.outputs[structure_key],\n calculation=calc_type_scf,\n kpts=kpts,\n pseudopotentials=pseudopotentials,\n smearing=smearing,\n )\n\n scf_qe_task = wg.add_task(\n calculate_qe,\n input_dict=scf_prepare_input_dict_task.outputs.result,\n working_directory=strain_dir,\n )\n\n # collect energy and volume\n get_energies_task.set({f\"{i}\": scf_qe_task.outputs.energy})\n get_volumes_task.set({f\"{i}\": scf_qe_task.outputs.volume})", "metadata": { "trusted": true }, @@ -152,7 +152,7 @@ }, { "cell_type": "code", - "source": "plot_energy_volume_curve_task = wg.add_task(\n plot_energy_volume_curve,\n name=\"plot_energy_volume_curve\",\n volume_lst=get_volumes_task.outputs.result,\n energy_lst=get_energies_task.outputs.result,\n)", + "source": "plot_energy_volume_curve_task = wg.add_task(\n plot_energy_volume_curve,\n volume_lst=get_volumes_task.outputs.result,\n energy_lst=get_energies_task.outputs.result,\n)", "metadata": { "trusted": true },