add should_run_scf for PwBandsWorkChain - #1016
Conversation
should_run_scf for PwBandsorkchainshould_run_scf for PwBandsWorkChain
sphuber
left a comment
There was a problem hiding this comment.
Thanks @superstar54 . Does this currently actually work? I believe if you skip the SCF step, then there won't be a parent_folder as input to the bands step, and the user also cannot specify it in the inputs since it is excluded. Besides that, as @mbercx mentioned during the meeting, if we strip out the SCF step, it is not much of a workflow anymore. If the user already has an SCF completed and wants the band structure, wouldn't they just be better off running a PwBaseWorkChain specifying the input parameters themselves? Using the get_builder_from_protocol they can get all inputs preset and then just switch the calculation to bands. The logic in PwBandsWorkChain specific to the bands is not very intricate anyway, it is just to define the total number of bands, which is just based on a top-level user input anyway.
| # override the parent_folder if the scf was run | ||
| if 'scf' in self.inputs: | ||
| inputs.pw.parent_folder = self.ctx.current_folder |
There was a problem hiding this comment.
How would the parent_folder be defined though? It is excluded from the bands input namespace, and if scf is skipped this will therefore not be set?
There was a problem hiding this comment.
Thanks for pointing out this. I didn't notice that the parent_folder is excluded. I run a simple example with Si by setting the parent_folder, it's strange that no error is reported, and the process finished successfully! Here is the process detail:
$ verdi process show 28038
Property Value
----------- ------------------------------------
type PwBandsWorkChain
state Finished [0]
pk 28038
uuid 94b2d315-6a72-4f73-ae87-5a3b50d86d07
label
description
ctime 2024-03-21 15:34:17.077194+00:00
mtime 2024-03-21 15:34:24.276367+00:00
Inputs PK Type
---------------------- ----- -------------
bands
pw
code 216 InstalledCode
pseudos
Si 19 UpfData
parameters 28034 Dict
parent_folder 28029 RemoteData
max_iterations 28035 Int
bands_kpoints_distance 28036 Float
clean_workdir 28037 Bool
structure 28020 StructureData
Outputs PK Type
------------------- ----- -------------
band_parameters 28054 Dict
band_structure 28052 BandsData
primitive_structure 28042 StructureData
seekpath_parameters 28040 Dict
Called PK Type
-------- ----- ---------------------------
seekpath 28039 seekpath_structure_analysis
bands 28046 PwBaseWorkChain
Log messages
---------------------------------------------
There are 3 log messages for this calculation
Run 'verdi process report 28038' to see themYou see that the parent_folder is set. Here is the node graph

|
@superstar54 do you still think this is a value feature to have, considering @sphuber's comments above? Happy to discuss your use case, but if not I'll close this PR if that's alright. |
|
Hi @mbercx , thanks for looking at this PR again. Initially, we wanted the aiida-qe to provide such an option, so that we could use the workchain from aiida-quantumespresso directly. But recently, we wrote a lot of workchains inside the aiidalab-qe directly, either wrapping the one from aiida-qe, or creating a new workchain. So it's fine for me to close this PR, and we can write this one inside aiidalab-qe. Apart from aiidalab-qe, this could also be a possible use case: if a user runs a Pdos calculation using PdosWorkChain, later he wants to run a band calculation using the PwBandsWorkChain, he needs to run the |
|
@superstar54 I'm going to add this to the v5.0 milestone. I'm also considering removing the While reworking the |
|
Hi @mbercx , thanks for looking at this again. |
|
@superstar54 I've had some time to think about this, and I'm now leaning towards accepting these changes (EDIT: or, I was; see edit below 😅 ), especially if we implement #1146 (for which I'd love to hear your opinion btw ^^). Although it's true you only run a single
What I would do is make the API more explicit and add a top-level EDIT: Looking at the implementation, I do wonder about the logic for seekpath. Now seekpath is run when the
This is of course why seekpath is run before the SCF. So you calculate the charge density for the correct structure that you have the k-path for. This means that advantage [1] above is not valid: the user will have to provide This also means the use case you describe is not so simple. the So, I'm not quite convinced I no longer want to make the SCF optional (sorry for the rollercoaster ride!). The benefits it brings to the user are not worth the added complexity on the API and code, and potentially can lead to an incorrect calculation if the user doesn't understand what they are doing. So I'll close this PR, but we can always reopen it if you disagree. :) More importantly: are we sure we are doing this correctly in the QEapp? I suppose you'd run seekpath right after the relaxation, and then run the pdos and bands? |
|
Hi @mbercx, I see your point that if the user provides the My understanding is: this is an opt-in feature. The users still run the original workflow, but if they want to avoid duplicate scf (as in aiidalab-qe case), they can choose this feature, while the validation of the inputs also makes sure they are not running I can add this validation if you think this is reasonable. |
This PR sets the
scfstep as an option in thePwBandsWorkChain.Use case:
scfin the main workflow, then pass theremote_folderto plugins, such asbandsandpdos. This requires that thescfcalculation is an option in thePwBandsWorkChain.#Run one SCF calculation for all plugins aiidalab/aiidalab-qe#631