@@ -20,41 +20,8 @@ def test_adsorption(mock_vasp, clean_dir, test_dir):
20
20
"adsorption static maker - static configuration 2" : "Au_adsorption/ads_static_3_3" ,
21
21
}
22
22
23
- # settings passed to fake_run_vasp; adjust these to check for certain INCAR settings
24
23
fake_run_vasp_kwargs = {
25
- "bulk relaxation maker - bulk relaxation job" : {
26
- "incar_settings" : ["NSW" , "ISIF" ]
27
- },
28
- "molecule relaxation maker - molecule relaxation job" : {
29
- "incar_settings" : ["NSW" , "ISIF" ]
30
- },
31
- "adsorption relaxation maker - slab relaxation job" : {
32
- "incar_settings" : ["NSW" , "ISIF" ]
33
- },
34
- "molecule static maker - molecule static job" : {
35
- "incar_settings" : ["NSW" , "ISIF" ]
36
- },
37
- "adsorption static maker - slab static job" : {
38
- "incar_settings" : ["NSW" , "ISIF" ]
39
- },
40
- "adsorption relaxation maker - configuration 0" : {
41
- "incar_settings" : ["NSW" , "ISIF" ]
42
- },
43
- "adsorption relaxation maker - configuration 1" : {
44
- "incar_settings" : ["NSW" , "ISIF" ]
45
- },
46
- "adsorption relaxation maker - configuration 2" : {
47
- "incar_settings" : ["NSW" , "ISIF" ]
48
- },
49
- "adsorption static maker - static configuration 0" : {
50
- "incar_settings" : ["NSW" , "ISIF" ]
51
- },
52
- "adsorption static maker - static configuration 1" : {
53
- "incar_settings" : ["NSW" , "ISIF" ]
54
- },
55
- "adsorption static maker - static configuration 2" : {
56
- "incar_settings" : ["NSW" , "ISIF" ]
57
- },
24
+ path : {"incar_settings" : ["ISIF" , "NSW" ]} for path in ref_paths
58
25
}
59
26
60
27
# automatically use fake VASP and write POTCAR.spec during the test
@@ -80,12 +47,12 @@ def test_adsorption(mock_vasp, clean_dir, test_dir):
80
47
# Run the flow or job and ensure that it finished running successfully
81
48
responses = run_locally (flow , create_folders = True , ensure_success = True )
82
49
83
- # Check that the correct number of jobs are created
84
- assert (
85
- len (responses ) == 16 or len (responses ) == 9
86
- ), "Unexpected number of jobs in the flow."
50
+ job_names = []
51
+ for job_uuid , job_responses in responses .items ():
52
+ for response_index , response in job_responses .items ():
53
+ if hasattr (response .output , "task_label" ):
54
+ job_names .append (response .output .task_label )
87
55
88
- # Verify job names and order
89
56
expected_job_names = [
90
57
"bulk relaxation maker - bulk relaxation job" ,
91
58
"molecule relaxation maker - molecule relaxation job" ,
@@ -99,10 +66,18 @@ def test_adsorption(mock_vasp, clean_dir, test_dir):
99
66
"adsorption static maker - static configuration 1" ,
100
67
"adsorption static maker - static configuration 2" ,
101
68
]
102
- for response , expected_name in zip (responses , expected_job_names ):
103
- assert (
104
- response .name == expected_name
105
- ), f"Job '{ response .name } ' does not match expected '{ expected_name } '."
69
+ for actual_name in expected_job_names :
70
+ assert actual_name in job_names , f"Job '{ actual_name } ' not found."
71
+
72
+ assert (
73
+ flow [- 1 ].uuid in responses
74
+ ), "adsorption calculation job not found in responses"
106
75
107
- # assert flow[-2].uuid in responses
108
- # assert flow[-1].uuid in responses
76
+ adsorption_calculation_job = responses .get (flow [- 1 ].uuid )
77
+ for response_index , response in adsorption_calculation_job .items ():
78
+ adsorption_energy = response .output .get ("adsorption_energy" )
79
+ assert adsorption_energy == [
80
+ - 3.0084328299999967 ,
81
+ - 2.9288308699999916 ,
82
+ - 2.092973299999997 ,
83
+ ], "adsorption energy not found in response"
0 commit comments