QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: pshinyeong on August 21, 2024, 05:11

Title: How to use workflow iteration for multiple calculation with one calculator?
Post by: pshinyeong on August 21, 2024, 05:11
Hello,

I'm working on a workflow where I aim to perform calculations on multiple configurations using a single calculator instance. My goals are to:

1. Understand why the script generated from my workflow isn't functioning as expected. (See attached files 1, 2, and 3, which show the process of optimizing a Cu slab with different thicknesses.)
2. Clarify if the memory consumption for the script is simply the sum of the memory required for each individual calculation. If that's the case, what strategies can I use to reduce the overall memory footprint?

Additionally, when I attempted to use the iteration block (instead of the iteration table block), I encountered an error that prevented script generation. Here is the error message:
Code
Traceback (most recent call last):
File "zipdir/NL/GUI/Tools/WorkflowTool/WorkflowSendToMenu.py", line 180, in onActionTriggered
File apd/N/601./azWindow/lanindowpy Line 785, in showtool
File "zipdir/NL/GUI/Tools/WorkflowTool/WorkflowBuilder.py", line 176, in deactivate
File "zipdir/NL/GUI/Tools/WorkflowTool/WorkflowBuilderWidget.py", line 206,
saveCurrent
File "zipdir/NL/GUI/Workflow/InteractiveWorkflow.py", line 379, in saveStateString
File "zipdir/NL/GUI/Workflow/FlowTree.py", line 128, in saveStateString File "zipdir/NL/GUI/Workflow/Blocks/Block.py", line 846, in saveStateString File "zipdir/NL/GUI/Store/Utilities.py", line 198, in uniqueString File "zipdir/NL/GUI/Store/Utilities.py", line 219, in uniqueString File "zipdir/NL/GUI/Store/Utilities.py", line 219, in uniqueString File "zipdir/NL/GUI/Store/Utilities.py", line 198, in uniqueString File "zipdir/NL/GUI/Store/Utilities.py", line 219, in uniqueString File "zipdir/NL/GUI/Store/Utilities.py", line 219, in uniqueString File "zipdir/NL/GUI/Store/Utilities.py", line 191, in uniqueString NL. ComputerScienceUtilities.Exceptions.NLNotImplementedError: value ConfigurationListBlock(23375294451984) requires a uniqueString handling

Any insights or advice on these issues would be greatly appreciated!

Thank you!
Title: Re: How to use workflow iteration for multiple calculation with one calculator?
Post by: Anders Blom on August 27, 2024, 01:46
First of all, I'm happy to see that you are embracing the new workflow tool. It takes a bit of learning, but once you get the hang of it, it can really make life easier. Or frustrating, when it's not working - I've been there myself!

In your case, the trick for the first issue (script not running) is to connect the table iteration to the configurations, not their names. That is, click the connection icons (colorful squares and circles) on the TableIteration block, and connect the Table to configuration_table, instead of as now configuration_names_table.

On the last issue, I think the problem is that variables in Python cannot start with numbers. Therefore the titles of 6AL, 8AL etc all get translated to "al", instead of being unique for each configuration. Try using AL6, AL8 etc instead.

Finally, for memory, since the variable "configuration" is updated each step in the loop with a new geometry, memory will not accumulate in this specific script.
Title: Re: How to use workflow iteration for multiple calculation with one calculator?
Post by: pshinyeong on August 29, 2024, 06:43
Thank you for your answer! I did as you told me and it worked!

One more question, is it possible to use iteration block instead of table iteration for such calculation?
I am curious if there is any difference and also why it keeps on giving me the same "unique string" error even though the names of configurations were adjusted.

Thanks!

+ The main problem is solved but I ask this because I am trying to get used to the features in workflow
Title: Re: How to use workflow iteration for multiple calculation with one calculator?
Post by: Anders Blom on August 31, 2024, 00:02
I am trying to get used to the features in workflow
Me too!

An iteration block is more used to loop over some parameter in the calculator but keeping the configuration the same.

Can you share the generated Python script? Or just look at it, and adjust the names manually...
Title: Re: How to use workflow iteration for multiple calculation with one calculator?
Post by: pshinyeong on September 5, 2024, 07:55
I can't share the script since the error pops up (the same 'unique string error' ) when I try to create the script :( Also, I've already adjusted the names manually so that the first letter of names for each configuration is not a number.
Also since you mentioned that it is more used to loop over parameters in calculator instead of configuration, maybe iteration block is not used for my needs because I wanted to use different configurations.
Thanks!
Title: Re: How to use workflow iteration for multiple calculation with one calculator?
Post by: Anders Blom on September 5, 2024, 21:19
Can you share the HDF5 file that defines the workflow which gives the error?
Title: Re: How to use workflow iteration for multiple calculation with one calculator?
Post by: pshinyeong on September 6, 2024, 06:56
I have attached the workflow(I provided a link since hdf5 file cannot be attached in the forum) and screenshots below.
However, the workflow resets with "unique string error" whenever I leave the worfklow screen to builder or clicking on any other window.
Basically I created the workflow by
1. Add iteration block
2. attach lcao calculator and optimize geometry block under iteration block
3. Click iteration block and add 4 configurations (tick/unitick iterator, same error appears)

Any additional click on other workflow, or sending the script, will result in an error as shown in the 2nd screenshot attached.

Workflow: https://drive.google.com/file/d/1jBxA2FUcORFVzzFn-nrCRf2Hqkz4gYuH/view?usp=sharing
Title: Re: How to use workflow iteration for multiple calculation with one calculator?
Post by: Anders Blom on September 6, 2024, 08:48
Thanks for your diligence in reporting all details. I can reproduce the error based on your instructions. I think it's a bug, I will report it. For now, I suggest just using the Table instead for configurations.
Title: Re: How to use workflow iteration for multiple calculation with one calculator?
Post by: Anders Blom on September 27, 2024, 20:15
This issue is fixed in the W-2024.09 release