-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Creating a list from node outputs #512
Comments
FWIW, I have already tried: wf.ASSYST_base_structures = collect_structures(node_list = [wf.ISIF2_job,
wf.ISIF5_job,
wf.ISIF7_job],
energy_diff_threshold = 0.1,
job_names=[f"{os.getcwd()}/{structure_folder}/ISIF2",
f"{os.getcwd()}/{structure_folder}/ISIF5",
f"{os.getcwd()}/{structure_folder}/ISIF7"]) but then it complains about trying to do something with NotData, which I assume means that the nodes have not run. |
Using: i2l = pwf.inputs_to_list(3)
wf.ISIF_vaspoutputs = i2l([wf.ISIF2_job.outputs.vasp_output, wf.ISIF5_job.outputs.vasp_output, wf.ISIF7_job.outputs.vasp_output]) yields ReadinessError: InputsToList3 received a run command but is not ready. The node should be neither running nor failed, and all input values should conform to type hints.
InputsToList3 readiness: False
STATE:
running: False
failed: False
INPUTS:
item_0 ready: True
item_1 ready: False
item_2 ready: False |
So the exception is perfectly expected -- you can't assign new nodes to the same label. MWE: import pyiron_workflow as pwf
wf = pwf.Workflow("label_is_taken")
wf.some_label = pwf.standard_nodes.UserInput(42)
try:
wf.some_label = pwf.standard_nodes.UserInput(43)
except AttributeError as e:
print("Everything is proceeding as I have foreseen --", e)
>>> Selection deleted
import pyiron_workflow as pwf
wf = pwf.Workflow("label_is_taken")
wf.some_label = pwf.standard_nodes.UserInput(42)
try:
wf.some_label = pwf.standard_nodes.UserInput(43)
except AttributeError as e:
print("Everything is proceeding as I have foreseen --", e)
>>> Everything is proceeding as I have foreseen -- some_label is already the label for a child. Please remove it before assigning another child to this label.
Good question/goal.
Do you know at the time of writing the graph how many of these structures you will have -- i.e. is it explicitly import pyiron_workflow as pwf
wf = pwf.Workflow("collect_fixed_set")
wf.d1 = pwf.standard_nodes.UserInput(10)
wf.d2 = pwf.standard_nodes.UserInput(20)
wf.d3 = pwf.standard_nodes.UserInput(30)
wf.as_list = pwf.inputs_to_list( # n: int, /, *node_args, ...
4,
wf.d3,
25, # Can mix and match data and connections, as usual
wf.d2,
wf.d1
)
wf()
>>> {'as_list__list': [30, 25, 20, 10]} I.e. we specify that we're collecting 4 things (under the hood this is dynamically subclassing a generic list node parent class to a subclass with fixed IO -- 4 inputs), then give input connections/data for where to get those things. If you need to do it where the length of the list is variable at run-time, then I think we need to figure out how to express your action as a "body node" and stick it in a I looked on pyiron_nodes for the assyst nodes but didn't see anything -- is this available somewhere I can read it? It's not necessary, but if we need to go to making a body node macro I won't be able to give any help on formulating it without access to the node package details. |
Yeah, the problem here is |
it complains:
How am I supposed do this? I want to collate the structures in a single list.
The text was updated successfully, but these errors were encountered: