You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wf=Workflow('simple_lammps_calculation')
structure=wf.create.atomistics.Bulk(cubic=True, name="Cu", label='structure')
lammps_job=wf.create.lammps.LammpsStaticNode(label='lammps_job')
lammps_job.inputs.structure=structurelammps_job.inputs.potential.list# show all potentials compatible to structurelammps_job.list_potentials# alternative syntax (list_potentials would be a node in a workflow that is not called when running the workflow but only when calling it explicitly)
potential starts
Issue: Having nodes that are not part of the main workflow but that can be used by the user to extract/provide information when explicitly called would be very helpful.
Ah, I checked out your branch (#856) and I see what you're saying. You created exactly such a node (ListPotentialsNode) and (after I uncomment a line) it exists inside your LammpsStaticNode macro.
The problem, of course, is that if I simply run the node -- lammps_job.list_potentials() -- it doesn't yet have any input, so the result is an error. If I first run the workflow, it will crash and give an ugly error, but, provided the "information node" runs in the macro before the macro crashes (it does in this case), I can look at its output. I.e. on your branch after uncommenting wf.list_potentials = wf.create.lammps.ListPotentialsNode(structure=wf.structure) in lammps_static_node, I can do this:
Certainly this is more hoops that we want the user to jump through -- they should never need to intentionally cause errors to get what they want -- but at least it is possible.
Fundamentally, I think we're facing the tension between delayed and aggressive execution again. What we'd really like is for the structure to propagate through so that the list_potentials node just has its input right away. While this isn't possible in a fully delayed framework, I do think implementing pull (#836) gives us a sufficiently good solution. With pull, we can replace the wf() call above with the following:
Thus getting the desired result without ever causing the workflow to crash. IMO this would be a satisfactory solution, so any PR that closes #12 should also close this.
An aside on node empowerment
An alternative solution is to directly empower nodes by defining them as classes instead of using the decorators. For instance, in this case I could replace the decorated lammps_static_node function with
This is spiritually similar to how we extended Node with .draw() method, giving users an extra tool accessible from the node. In this particular example I think I prefer your approach of an information-carrying-sub-node, but there may be situations where adding a method is superior.
The text was updated successfully, but these errors were encountered:
From @JNmpi in pyiron/pyiron_contrib#855
Ah, I checked out your branch (#856) and I see what you're saying. You created exactly such a node (
ListPotentialsNode
) and (after I uncomment a line) it exists inside yourLammpsStaticNode
macro.The problem, of course, is that if I simply run the node --
lammps_job.list_potentials()
-- it doesn't yet have any input, so the result is an error. If I first run the workflow, it will crash and give an ugly error, but, provided the "information node" runs in the macro before the macro crashes (it does in this case), I can look at its output. I.e. on your branch after uncommentingwf.list_potentials = wf.create.lammps.ListPotentialsNode(structure=wf.structure)
inlammps_static_node
, I can do this:Which crashes as expected since I never specified a potential, but populates the following:
Certainly this is more hoops that we want the user to jump through -- they should never need to intentionally cause errors to get what they want -- but at least it is possible.
Fundamentally, I think we're facing the tension between delayed and aggressive execution again. What we'd really like is for the structure to propagate through so that the
list_potentials
node just has its input right away. While this isn't possible in a fully delayed framework, I do think implementingpull
(#836) gives us a sufficiently good solution. Withpull
, we can replace thewf()
call above with the following:Thus getting the desired result without ever causing the workflow to crash. IMO this would be a satisfactory solution, so any PR that closes #12 should also close this.
An aside on node empowerment
An alternative solution is to directly empower nodes by defining them as classes instead of using the decorators. For instance, in this case I could replace the decorated
lammps_static_node
function withThen there's a number of possibilities, but presuming again that
pull
has been implemented, I could do something like this:This is spiritually similar to how we extended
Node
with.draw()
method, giving users an extra tool accessible from the node. In this particular example I think I prefer your approach of an information-carrying-sub-node, but there may be situations where adding a method is superior.The text was updated successfully, but these errors were encountered: