|
34 | 34 | }, |
35 | 35 | { |
36 | 36 | "cell_type": "code", |
37 | | - "execution_count": null, |
| 37 | + "execution_count": 6, |
38 | 38 | "id": "79098139", |
39 | 39 | "metadata": {}, |
40 | | - "outputs": [], |
| 40 | + "outputs": [ |
| 41 | + { |
| 42 | + "data": { |
| 43 | + "text/plain": [ |
| 44 | + "Profile<uuid='60b17659a9844c4bbd3bef8de0a8f417' name='presto'>" |
| 45 | + ] |
| 46 | + }, |
| 47 | + "execution_count": 6, |
| 48 | + "metadata": {}, |
| 49 | + "output_type": "execute_result" |
| 50 | + } |
| 51 | + ], |
41 | 52 | "source": [ |
42 | 53 | "from aiida import load_profile\n", |
43 | 54 | "load_profile()" |
44 | 55 | ] |
45 | 56 | }, |
46 | 57 | { |
47 | 58 | "cell_type": "code", |
48 | | - "execution_count": null, |
| 59 | + "execution_count": 7, |
49 | 60 | "id": "3bc2cf3b", |
50 | 61 | "metadata": {}, |
51 | 62 | "outputs": [], |
|
57 | 68 | }, |
58 | 69 | { |
59 | 70 | "cell_type": "code", |
60 | | - "execution_count": null, |
| 71 | + "execution_count": 8, |
61 | 72 | "id": "a89ba5dd", |
62 | 73 | "metadata": {}, |
63 | 74 | "outputs": [], |
|
72 | 83 | }, |
73 | 84 | { |
74 | 85 | "cell_type": "code", |
75 | | - "execution_count": null, |
| 86 | + "execution_count": 9, |
76 | 87 | "id": "ae62816f", |
77 | 88 | "metadata": {}, |
78 | 89 | "outputs": [], |
|
83 | 94 | }, |
84 | 95 | { |
85 | 96 | "cell_type": "code", |
86 | | - "execution_count": null, |
| 97 | + "execution_count": 10, |
87 | 98 | "id": "1795dd41", |
88 | 99 | "metadata": {}, |
89 | 100 | "outputs": [], |
|
108 | 119 | }, |
109 | 120 | { |
110 | 121 | "cell_type": "code", |
111 | | - "execution_count": null, |
| 122 | + "execution_count": 11, |
112 | 123 | "id": "0e4c78c9", |
113 | 124 | "metadata": {}, |
114 | 125 | "outputs": [], |
|
129 | 140 | }, |
130 | 141 | { |
131 | 142 | "cell_type": "code", |
132 | | - "execution_count": null, |
| 143 | + "execution_count": 12, |
133 | 144 | "id": "21af0bab", |
134 | 145 | "metadata": {}, |
135 | 146 | "outputs": [], |
|
145 | 156 | }, |
146 | 157 | { |
147 | 158 | "cell_type": "code", |
148 | | - "execution_count": null, |
| 159 | + "execution_count": 13, |
149 | 160 | "id": "62f8322b", |
150 | 161 | "metadata": {}, |
151 | 162 | "outputs": [], |
|
156 | 167 | }, |
157 | 168 | { |
158 | 169 | "cell_type": "code", |
159 | | - "execution_count": null, |
| 170 | + "execution_count": 14, |
160 | 171 | "id": "f7960170", |
161 | 172 | "metadata": {}, |
162 | | - "outputs": [], |
| 173 | + "outputs": [ |
| 174 | + { |
| 175 | + "name": "stdout", |
| 176 | + "output_type": "stream", |
| 177 | + "text": [ |
| 178 | + "defining outputnode\n" |
| 179 | + ] |
| 180 | + } |
| 181 | + ], |
163 | 182 | "source": [ |
164 | 183 | "descriptors_calc = wg.add_task(\n", |
165 | 184 | " descriptorsCalc,\n", |
|
170 | 189 | }, |
171 | 190 | { |
172 | 191 | "cell_type": "code", |
173 | | - "execution_count": null, |
| 192 | + "execution_count": 15, |
174 | 193 | "id": "88d2a75b", |
175 | 194 | "metadata": {}, |
176 | 195 | "outputs": [], |
|
186 | 205 | }, |
187 | 206 | { |
188 | 207 | "cell_type": "code", |
189 | | - "execution_count": null, |
| 208 | + "execution_count": 16, |
190 | 209 | "id": "db0cfc8d", |
191 | 210 | "metadata": {}, |
192 | | - "outputs": [], |
| 211 | + "outputs": [ |
| 212 | + { |
| 213 | + "data": { |
| 214 | + "application/vnd.jupyter.widget-view+json": { |
| 215 | + "model_id": "36fa943708554437995c919e7b85b18d", |
| 216 | + "version_major": 2, |
| 217 | + "version_minor": 1 |
| 218 | + }, |
| 219 | + "text/plain": [ |
| 220 | + "NodeGraphWidget(settings={'minimap': True}, style={'width': '90%', 'height': '600px'}, value={'name': 'MD_work…" |
| 221 | + ] |
| 222 | + }, |
| 223 | + "execution_count": 16, |
| 224 | + "metadata": {}, |
| 225 | + "output_type": "execute_result" |
| 226 | + } |
| 227 | + ], |
193 | 228 | "source": [ |
194 | 229 | "wg" |
195 | 230 | ] |
196 | 231 | }, |
197 | 232 | { |
198 | 233 | "cell_type": "code", |
199 | | - "execution_count": null, |
| 234 | + "execution_count": 17, |
200 | 235 | "id": "85f26ee7", |
201 | 236 | "metadata": {}, |
202 | | - "outputs": [], |
| 237 | + "outputs": [ |
| 238 | + { |
| 239 | + "data": { |
| 240 | + "text/plain": [ |
| 241 | + "NodeCollection(parent = \"MD_workgraph\", nodes = [\"graph_inputs\", \"graph_outputs\", \"graph_ctx\", \"md_calc\", \"descriptors_calc\", \"split_data\"])" |
| 242 | + ] |
| 243 | + }, |
| 244 | + "execution_count": 17, |
| 245 | + "metadata": {}, |
| 246 | + "output_type": "execute_result" |
| 247 | + } |
| 248 | + ], |
203 | 249 | "source": [ |
204 | 250 | "wg.tasks" |
205 | 251 | ] |
|
224 | 270 | }, |
225 | 271 | { |
226 | 272 | "cell_type": "code", |
227 | | - "execution_count": null, |
| 273 | + "execution_count": 22, |
| 274 | + "id": "06aa6a12", |
| 275 | + "metadata": {}, |
| 276 | + "outputs": [ |
| 277 | + { |
| 278 | + "data": { |
| 279 | + "text/plain": [ |
| 280 | + "dict_keys(['_attrs', 'remote_folder', 'remote_stash', 'retrieved', 'std_output', 'log_output', 'results_dict', 'summary', 'stats_file', 'traj_file', 'traj_output', 'final_structure'])" |
| 281 | + ] |
| 282 | + }, |
| 283 | + "execution_count": 22, |
| 284 | + "metadata": {}, |
| 285 | + "output_type": "execute_result" |
| 286 | + } |
| 287 | + ], |
| 288 | + "source": [ |
| 289 | + "mdCalc.get_description()[\"spec\"][\"outputs\"].keys()" |
| 290 | + ] |
| 291 | + }, |
| 292 | + { |
| 293 | + "cell_type": "code", |
| 294 | + "execution_count": 40, |
| 295 | + "id": "f541d398", |
| 296 | + "metadata": {}, |
| 297 | + "outputs": [ |
| 298 | + { |
| 299 | + "name": "stdout", |
| 300 | + "output_type": "stream", |
| 301 | + "text": [ |
| 302 | + "SocketAny(name='traj_output', value=None)\n" |
| 303 | + ] |
| 304 | + }, |
| 305 | + { |
| 306 | + "ename": "GraphDeferredIllegalOperationError", |
| 307 | + "evalue": "Illegal operation on a future value (Socket): boolean evaluation\nSocket: result of node 'op_eq'\n\nFix:\nYou used a future in a boolean context (if/while/assert/and/or).\nWrap logic in a nested @node.graph.\n\nGeneral guidance:\n • Wrap logic in a nested @node.graph.\n • Or use the WorkGraph If zone for branching on predicates.\n • Or for loops, use the While zone or Map zone.", |
| 308 | + "output_type": "error", |
| 309 | + "traceback": [ |
| 310 | + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", |
| 311 | + "\u001b[31mGraphDeferredIllegalOperationError\u001b[39m Traceback (most recent call last)", |
| 312 | + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[40]\u001b[39m\u001b[32m, line 3\u001b[39m\n\u001b[32m 1\u001b[39m trajectory = md_calc.outputs.traj_output\n\u001b[32m 2\u001b[39m \u001b[38;5;28mprint\u001b[39m(trajectory)\n\u001b[32m----> \u001b[39m\u001b[32m3\u001b[39m output= StructureData(ase=\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtrajectory\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[43m=\u001b[49m\u001b[32;43m1\u001b[39;49m\u001b[43m)\u001b[49m)\n\u001b[32m 4\u001b[39m \u001b[38;5;28mprint\u001b[39m(output)\n", |
| 313 | + "\u001b[36mFile \u001b[39m\u001b[32m~/aiida-mlip/.venv/lib/python3.12/site-packages/ase/io/formats.py:776\u001b[39m, in \u001b[36mread\u001b[39m\u001b[34m(filename, index, format, parallel, do_not_split_by_at_sign, **kwargs)\u001b[39m\n\u001b[32m 774\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(filename, PurePath):\n\u001b[32m 775\u001b[39m filename = \u001b[38;5;28mstr\u001b[39m(filename)\n\u001b[32m--> \u001b[39m\u001b[32m776\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m filename == \u001b[33m'\u001b[39m\u001b[33m-\u001b[39m\u001b[33m'\u001b[39m:\n\u001b[32m 777\u001b[39m filename = sys.stdin\n\u001b[32m 778\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(index, \u001b[38;5;28mstr\u001b[39m):\n", |
| 314 | + "\u001b[36mFile \u001b[39m\u001b[32m~/aiida-mlip/.venv/lib/python3.12/site-packages/node_graph/socket.py:266\u001b[39m, in \u001b[36mOperatorSocketMixin.__bool__\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 265\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34m__bool__\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[32m--> \u001b[39m\u001b[32m266\u001b[39m \u001b[43m_raise_illegal\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mboolean evaluation\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_tip_bool\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", |
| 315 | + "\u001b[36mFile \u001b[39m\u001b[32m~/aiida-mlip/.venv/lib/python3.12/site-packages/node_graph/socket.py:104\u001b[39m, in \u001b[36m_raise_illegal\u001b[39m\u001b[34m(sock, what, tips)\u001b[39m\n\u001b[32m 99\u001b[39m msg = (\n\u001b[32m 100\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mIllegal operation on a future value (Socket): \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mwhat\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m\"\u001b[39m\n\u001b[32m 101\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mSocket: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00msocket_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m of node \u001b[39m\u001b[33m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnode_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m'\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 102\u001b[39m )\n\u001b[32m 103\u001b[39m msg += \u001b[33m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33mFix:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m\"\u001b[39m + \u001b[33m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m\"\u001b[39m.join(tips + [\u001b[33m\"\u001b[39m\u001b[33m\"\u001b[39m] + common)\n\u001b[32m--> \u001b[39m\u001b[32m104\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m GraphDeferredIllegalOperationError(msg)\n", |
| 316 | + "\u001b[31mGraphDeferredIllegalOperationError\u001b[39m: Illegal operation on a future value (Socket): boolean evaluation\nSocket: result of node 'op_eq'\n\nFix:\nYou used a future in a boolean context (if/while/assert/and/or).\nWrap logic in a nested @node.graph.\n\nGeneral guidance:\n • Wrap logic in a nested @node.graph.\n • Or use the WorkGraph If zone for branching on predicates.\n • Or for loops, use the While zone or Map zone." |
| 317 | + ] |
| 318 | + } |
| 319 | + ], |
| 320 | + "source": [ |
| 321 | + "trajectory = md_calc.outputs.traj_output\n", |
| 322 | + "print(trajectory)\n", |
| 323 | + "output= StructureData(ase=read(trajectory, index=1))\n", |
| 324 | + "print(output)" |
| 325 | + ] |
| 326 | + }, |
| 327 | + { |
| 328 | + "cell_type": "code", |
| 329 | + "execution_count": 26, |
| 330 | + "id": "bc9180ee", |
| 331 | + "metadata": {}, |
| 332 | + "outputs": [ |
| 333 | + { |
| 334 | + "name": "stdout", |
| 335 | + "output_type": "stream", |
| 336 | + "text": [ |
| 337 | + "outputs of mdCalc: TaskSocketNamespace(name='outputs', sockets=['remote_folder', 'remote_stash', 'retrieved', 'std_output', 'log_output', 'results_dict', 'summary', 'stats_file', 'traj_file', 'traj_output', 'final_structure', '_outputs', '_wait'])\n" |
| 338 | + ] |
| 339 | + } |
| 340 | + ], |
| 341 | + "source": [ |
| 342 | + "print('outputs of mdCalc:', md_calc.outputs)" |
| 343 | + ] |
| 344 | + }, |
| 345 | + { |
| 346 | + "cell_type": "code", |
| 347 | + "execution_count": 29, |
| 348 | + "id": "74a8a0f9", |
| 349 | + "metadata": {}, |
| 350 | + "outputs": [ |
| 351 | + { |
| 352 | + "ename": "AttributeError", |
| 353 | + "evalue": "'SocketAny' object has no attribute 'open'", |
| 354 | + "output_type": "error", |
| 355 | + "traceback": [ |
| 356 | + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", |
| 357 | + "\u001b[31mAttributeError\u001b[39m Traceback (most recent call last)", |
| 358 | + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[29]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;66;03m# read the trajectory data with iread\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[43mmd_calc\u001b[49m\u001b[43m.\u001b[49m\u001b[43moutputs\u001b[49m\u001b[43m.\u001b[49m\u001b[43mtraj_output\u001b[49m\u001b[43m.\u001b[49m\u001b[43mopen\u001b[49m(mode=\u001b[33m\"\u001b[39m\u001b[33mr\u001b[39m\u001b[33m\"\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m traj_file:\n\u001b[32m 3\u001b[39m traj = \u001b[38;5;28mlist\u001b[39m(iread(traj_file, \u001b[38;5;28mformat\u001b[39m=\u001b[33m\"\u001b[39m\u001b[33mextxyz\u001b[39m\u001b[33m\"\u001b[39m)) \n\u001b[32m 4\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mNumber of frames in trajectory: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlen\u001b[39m(traj)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n", |
| 359 | + "\u001b[31mAttributeError\u001b[39m: 'SocketAny' object has no attribute 'open'" |
| 360 | + ] |
| 361 | + } |
| 362 | + ], |
| 363 | + "source": [ |
| 364 | + "# read the trajectory data with iread\n", |
| 365 | + "with md_calc.outputs.traj_output.open(mode=\"r\") as traj_file:\n", |
| 366 | + " traj = list(iread(traj_file, format=\"extxyz\")) \n", |
| 367 | + "print(f\"Number of frames in trajectory: {len(traj)}\")" |
| 368 | + ] |
| 369 | + }, |
| 370 | + { |
| 371 | + "cell_type": "code", |
| 372 | + "execution_count": 51, |
228 | 373 | "id": "27bfe04a", |
229 | 374 | "metadata": {}, |
230 | | - "outputs": [], |
| 375 | + "outputs": [ |
| 376 | + { |
| 377 | + "ename": "GraphDeferredIllegalOperationError", |
| 378 | + "evalue": "Illegal operation on a future value (Socket): boolean evaluation\nSocket: result of node 'op_eq'\n\nFix:\nYou used a future in a boolean context (if/while/assert/and/or).\nWrap logic in a nested @node.graph.\n\nGeneral guidance:\n • Wrap logic in a nested @node.graph.\n • Or use the WorkGraph If zone for branching on predicates.\n • Or for loops, use the While zone or Map zone.", |
| 379 | + "output_type": "error", |
| 380 | + "traceback": [ |
| 381 | + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", |
| 382 | + "\u001b[31mGraphDeferredIllegalOperationError\u001b[39m Traceback (most recent call last)", |
| 383 | + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[51]\u001b[39m\u001b[32m, line 17\u001b[39m\n\u001b[32m 13\u001b[39m \u001b[38;5;66;03m# output=StructureData(ase=read(trajectory, index=\":\"))\u001b[39;00m\n\u001b[32m 14\u001b[39m \u001b[38;5;66;03m# for i in enumerate(output):\u001b[39;00m\n\u001b[32m 16\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[32m1\u001b[39m):\n\u001b[32m---> \u001b[39m\u001b[32m17\u001b[39m output=StructureData(ase=\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtrajectory\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[43m=\u001b[49m\u001b[43mi\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[32m 18\u001b[39m \u001b[38;5;66;03m# Descriptors on intermediate structures\u001b[39;00m\n\u001b[32m 19\u001b[39m desc_task = wg.add_task(\n\u001b[32m 20\u001b[39m descriptorsCalc,\n\u001b[32m 21\u001b[39m name=\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mdescriptors_\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mi\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m,\n\u001b[32m (...)\u001b[39m\u001b[32m 30\u001b[39m \n\u001b[32m 31\u001b[39m )\n", |
| 384 | + "\u001b[36mFile \u001b[39m\u001b[32m~/aiida-mlip/.venv/lib/python3.12/site-packages/ase/io/formats.py:776\u001b[39m, in \u001b[36mread\u001b[39m\u001b[34m(filename, index, format, parallel, do_not_split_by_at_sign, **kwargs)\u001b[39m\n\u001b[32m 774\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(filename, PurePath):\n\u001b[32m 775\u001b[39m filename = \u001b[38;5;28mstr\u001b[39m(filename)\n\u001b[32m--> \u001b[39m\u001b[32m776\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m filename == \u001b[33m'\u001b[39m\u001b[33m-\u001b[39m\u001b[33m'\u001b[39m:\n\u001b[32m 777\u001b[39m filename = sys.stdin\n\u001b[32m 778\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(index, \u001b[38;5;28mstr\u001b[39m):\n", |
| 385 | + "\u001b[36mFile \u001b[39m\u001b[32m~/aiida-mlip/.venv/lib/python3.12/site-packages/node_graph/socket.py:266\u001b[39m, in \u001b[36mOperatorSocketMixin.__bool__\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 265\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34m__bool__\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[32m--> \u001b[39m\u001b[32m266\u001b[39m \u001b[43m_raise_illegal\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mboolean evaluation\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_tip_bool\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", |
| 386 | + "\u001b[36mFile \u001b[39m\u001b[32m~/aiida-mlip/.venv/lib/python3.12/site-packages/node_graph/socket.py:104\u001b[39m, in \u001b[36m_raise_illegal\u001b[39m\u001b[34m(sock, what, tips)\u001b[39m\n\u001b[32m 99\u001b[39m msg = (\n\u001b[32m 100\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mIllegal operation on a future value (Socket): \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mwhat\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m\"\u001b[39m\n\u001b[32m 101\u001b[39m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mSocket: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00msocket_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m of node \u001b[39m\u001b[33m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnode_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m'\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 102\u001b[39m )\n\u001b[32m 103\u001b[39m msg += \u001b[33m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33mFix:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m\"\u001b[39m + \u001b[33m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m\"\u001b[39m.join(tips + [\u001b[33m\"\u001b[39m\u001b[33m\"\u001b[39m] + common)\n\u001b[32m--> \u001b[39m\u001b[32m104\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m GraphDeferredIllegalOperationError(msg)\n", |
| 387 | + "\u001b[31mGraphDeferredIllegalOperationError\u001b[39m: Illegal operation on a future value (Socket): boolean evaluation\nSocket: result of node 'op_eq'\n\nFix:\nYou used a future in a boolean context (if/while/assert/and/or).\nWrap logic in a nested @node.graph.\n\nGeneral guidance:\n • Wrap logic in a nested @node.graph.\n • Or use the WorkGraph If zone for branching on predicates.\n • Or for loops, use the While zone or Map zone." |
| 388 | + ] |
| 389 | + } |
| 390 | + ], |
231 | 391 | "source": [ |
232 | 392 | "from aiida_workgraph import WorkGraph\n", |
233 | 393 | "\n", |
|
239 | 399 | " name=\"md\",\n", |
240 | 400 | " **inputs\n", |
241 | 401 | " )\n", |
242 | | - " \n", |
| 402 | + " trajectory = md_task.outputs.traj_output\n", |
| 403 | + " \n", |
| 404 | + " # output=StructureData(ase=read(trajectory, index=\":\"))\n", |
| 405 | + " # for i in enumerate(output):\n", |
| 406 | + "\n", |
| 407 | + " for i in range(1):\n", |
| 408 | + " output=StructureData(ase=read(trajectory, index=i))\n", |
| 409 | + " # Descriptors on intermediate structures\n", |
| 410 | + " desc_task = wg.add_task(\n", |
| 411 | + " descriptorsCalc,\n", |
| 412 | + " name=f\"descriptors_{i}\",\n", |
| 413 | + " code=inputs['code'],\n", |
| 414 | + " model=inputs['model'],\n", |
| 415 | + " arch=inputs['arch'],\n", |
| 416 | + " device=inputs['device'],\n", |
| 417 | + " metadata=inputs['metadata'],\n", |
| 418 | + " calc_per_element=Bool(True),\n", |
| 419 | + " struct=md_task.outputs.final_structure,\n", |
| 420 | + " trajectory_data=output,\n", |
| 421 | + " \n", |
| 422 | + " )\n", |
| 423 | + " # # Descriptors on final structure\n", |
243 | 424 | " \n", |
244 | | - " # Descriptors on final structure\n", |
245 | | - " desc_task = wg.add_task(\n", |
246 | | - " descriptorsCalc,\n", |
247 | | - " name=\"descriptors\",\n", |
248 | | - " code=inputs['code'],\n", |
249 | | - " model=inputs['model'],\n", |
250 | | - " arch=inputs['arch'],\n", |
251 | | - " device=inputs['device'],\n", |
252 | | - " metadata=inputs['metadata'],\n", |
253 | | - " calc_per_element=Bool(True),\n", |
254 | | - " struct=md_task.outputs.final_structure\n", |
255 | | - " )\n", |
| 425 | + " # desc_task = wg.add_task(\n", |
| 426 | + " # descriptorsCalc,\n", |
| 427 | + " # name=\"descriptors\",\n", |
| 428 | + " # code=inputs['code'],\n", |
| 429 | + " # model=inputs['model'],\n", |
| 430 | + " # arch=inputs['arch'],\n", |
| 431 | + " # device=inputs['device'],\n", |
| 432 | + " # metadata=inputs['metadata'],\n", |
| 433 | + " # calc_per_element=Bool(True),\n", |
| 434 | + " # struct=md_task.outputs.final_structure,\n", |
| 435 | + " # )\n", |
256 | 436 | "\n", |
257 | 437 | "wg.run()" |
258 | 438 | ] |
259 | 439 | }, |
260 | 440 | { |
261 | 441 | "cell_type": "code", |
262 | | - "execution_count": null, |
| 442 | + "execution_count": 52, |
263 | 443 | "id": "c3069b29", |
264 | 444 | "metadata": {}, |
265 | | - "outputs": [], |
| 445 | + "outputs": [ |
| 446 | + { |
| 447 | + "data": { |
| 448 | + "application/vnd.jupyter.widget-view+json": { |
| 449 | + "model_id": "46ad262faf0e42cdbc843cdfc79c7e89", |
| 450 | + "version_major": 2, |
| 451 | + "version_minor": 1 |
| 452 | + }, |
| 453 | + "text/plain": [ |
| 454 | + "NodeGraphWidget(settings={'minimap': True}, style={'width': '90%', 'height': '600px'}, value={'name': 'MD_Simp…" |
| 455 | + ] |
| 456 | + }, |
| 457 | + "execution_count": 52, |
| 458 | + "metadata": {}, |
| 459 | + "output_type": "execute_result" |
| 460 | + } |
| 461 | + ], |
266 | 462 | "source": [ |
267 | 463 | "wg" |
268 | 464 | ] |
|
0 commit comments