Skip to content

Commit 6e33244

Browse files
committed
Bump WorkGraph to latest and fix a couple of issues
- Bump aiida-workgraph to 0.5.0a6 - pickle_node has default `result` output socket, and will be set to None when exporting to json - for the get_volumes and get_energies tasks, we add input sockets based on the index of strain
1 parent 37a6279 commit 6e33244

File tree

8 files changed

+305
-329
lines changed

8 files changed

+305
-329
lines changed

python_files/aiida_to_jobflow_qe.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,22 @@
2222

2323
load_profile()
2424

25-
get_bulk_structure = task.pythonjob(outputs=['structure'])(_get_bulk_structure)
25+
get_bulk_structure = task.pythonjob()(_get_bulk_structure)
2626
generate_structures = task.pythonjob()(_generate_structures)
27-
calculate_qe = task.pythonjob(outputs=["energy", "volume", "structure"])(
28-
_calculate_qe
29-
)
30-
plot_energy_volume_curve= task.pythonjob()(_plot_energy_volume_curve)
27+
calculate_qe = task.pythonjob(outputs=["energy", "volume", "structure"])(_calculate_qe)
28+
plot_energy_volume_curve = task.pythonjob()(_plot_energy_volume_curve)
3129

3230
strain_lst = [0.9, 0.95, 1.0, 1.05, 1.1]
3331

3432
wg = construct_wg_qe(
35-
get_dict=get_dict,
36-
get_list=get_list,
3733
get_bulk_structure=get_bulk_structure,
3834
calculate_qe=calculate_qe,
3935
generate_structures=generate_structures,
4036
plot_energy_volume_curve=plot_energy_volume_curve,
41-
strain_lst=strain_lst
37+
strain_lst=strain_lst,
4238
)
4339

40+
4441
# wg.to_html('aiida_to_jobflow_qe.html')
4542

4643

@@ -55,6 +52,7 @@
5552

5653
# %%
5754
result = run_locally(flow)
55+
print(result)
5856
result
5957

6058

python_files/aiida_to_pyiron_base_qe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
load_profile()
2525

26-
get_bulk_structure = task.pythonjob(outputs=["structure"])(_get_bulk_structure)
26+
get_bulk_structure = task.pythonjob()(_get_bulk_structure)
2727
generate_structures = task.pythonjob()(_generate_structures)
2828
calculate_qe = task.pythonjob(outputs=["energy", "volume", "structure"])(_calculate_qe)
2929
plot_energy_volume_curve = task.pythonjob()(_plot_energy_volume_curve)
Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# %%
2-
from python_workflow_definition.aiida import load_workflow_json
3-
2+
from python_workflow_definition.aiida import load_workflow_json, write_workflow_json
3+
from aiida import load_profile
4+
load_profile()
45
# %%
56
workgraph = load_workflow_json(filename='workflow_qe.json')
67

@@ -9,17 +10,33 @@
910
# TODO: Create inputs rather than tasks out of data nodes
1011
# workgraph
1112

12-
# %%
13-
workgraph.tasks.get_bulk_structure.inputs.element
1413

1514
# %%
16-
from aiida import load_profile
17-
load_profile()
18-
19-
workgraph.run()
15+
# workgraph.run()
2016

2117

2218
# %%
19+
# compare the two json files
20+
import json
21+
22+
with open('workflow_qe.json', 'r') as f:
23+
reference = json.loads(f.read())
24+
new_data = write_workflow_json(workgraph, file_name='workflow_qe_aiida.json')
25+
26+
def check_diff(reference, new_data):
27+
for key, data in reference['nodes'].items():
28+
if key not in new_data['nodes']:
29+
print(f"Key {key} not in new_data")
30+
if data != new_data['nodes'][key]:
31+
print(f"Data for key {key} is different")
32+
for data in reference['edges']:
33+
if data not in new_data['edges']:
34+
print(f"Data {data} not in new_data")
35+
36+
check_diff(reference, new_data)
37+
print("Reverse check")
38+
check_diff(new_data, reference)
39+
2340

2441

2542

python_workflow_definition/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ authors = [
1717
{ name = "Julian Geiger", email = "[email protected]" },
1818
]
1919
license = { text = "MIT" }
20-
dependencies = ["jobflow", "pyiron_base"]
20+
dependencies = ["jobflow", "pyiron_base", "aiida-workgraph>=0.5.0a6"]

0 commit comments

Comments
 (0)