-
Notifications
You must be signed in to change notification settings - Fork 18
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
Simplify get_builder_from_protocol
in ProjwfcBandsWorkChain
#56
Simplify get_builder_from_protocol
in ProjwfcBandsWorkChain
#56
Conversation
All contributors have accepted the CLA ✅ You might need to click the "Update/Rebase branch" button to update the pull request and rerun the GitHub actions to pass the CLA check. |
e6ad2a2
to
717756b
Compare
I have read the CLA Document and I hereby accept the CLA |
@t-reents could you update the branch and also solve the issue with the CLA Assistant error ? , I already tested the branch and it works. |
717756b
to
852d7d3
Compare
This commit mainly simplifies the current version of the `get_builder_from_protocol` method in `ProjwfcBandsWorkChain`. Moreover, it adds support for overrides containing standard Python datatypes, e.g. `kpoints_distance` specified as a float`.
852d7d3
to
0db533e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! thank you for your job @t-reents !, I tested the PR no issues , @superstar54
protocol_inputs = cls.get_protocol_inputs( | ||
protocol=protocol, overrides=overrides | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @t-reents , thanks for the PR.
These lines should remain. They are used to read the protocol parameters from the file, projwfcbands.yaml
. For the moment, the file only specifies clean_workdir
. I think that's why you get identical results even after you remove them. However, more parameters may be added in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @superstar54
I see the point that one might create a specific protocol for this WorkChain. I also mentioned this in the PR description. My point was that this WorkChain doesn't implement any additional inputs and basically inherits the PwBandsWorkChain
only. I assumed that one would simply provide the individual changes via the overrides.
But yeah, it makes sense to have the possibility to specify a protocol to overwrite the defaults of the parents. Otherwise, one would always need to provide adjusted protocols for PwBandsWorkChain
and ProjwfcBaseWorkChain
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@superstar54 Coming back to the point, that the ProjwfcBandsWorkChain
doesn't have additional inputs, I'd suggest to load the protocol inputs and merge the relevant parts with the overrides for the subsequent calls of PwBandsWorkChain
and ProjwfcBaseWorkChain
. In this way, we still have the possibility to provide custom protocols but also fix the initial problem that the transformed values get overwritten by the Python base types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to me. If you do this, please also remove the projwfcbands.yaml
file, and then add a detailed comment in the code that the WorkChain uses the parent protocol setting.
It would be good that @qiaojunfeng could have a quick look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@superstar54 Do you know if there is any update about this PR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually picked this up again this morning. @superstar54 By using the protocol_inputs
as the overrides in the subsequent get_builder_from_protocols
calls, we now also allow additional inputs in the protocol file.
As a general comment, we realized that the issue would also be solved by upgrading to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, all good, thanks!
Hi @qiaojunfeng, thanks for this nice work!
We (well, mainly @AndresOrtegaGuerrero) are working on integrating the
ProjwfcBandsWorkChain
into AiiDAlab. Andres realized that it's not possible to provide Python datatypes in theoverrides
when using theget_builder_from_protocol
method (I could confirm this behavior). One example is passing afloat
forkpoints_distance
. However, this is possible in the AiiDA-QE plugin.The problem occurs in the following part:
aiida-wannier90-workflows/src/aiida_wannier90_workflows/workflows/projwfcbands.py
Line 157 in d6794cf
The
PwBandsWorkChain.get_builder_from_protocol
transformed the relevant inputs into AiiDA datatypes, but the aforementioned call ofrecursive_merge_container
merges the plain Python datatypes from theprotcol_inputs
again.I fixed this behavior in this PR and generally tried to simplify the
get_builder_from_protocol
. As theProjwfcBandsWorkChain
is a child class of thePwBandsWorkChain
, the majority of the preparation is already done inPwBandsWorkChain.get_builder_from_protocol
.For example, I'm not sure if the following is really needed:
aiida-wannier90-workflows/src/aiida_wannier90_workflows/workflows/projwfcbands.py
Lines 122 to 124 in d6794cf
The protocol inputs are anyway passed to the
get_builder_from_protocol
methods of the sub-workchains and theProjwfcBandsWorkChain
doesn't have any additional inputs that are specific to thisWorkChain
.I tested the changes and the results seem to be identical (at least within my tests). In case I removed parts that are necessary for the intended functionality because I misunderstood them, please let me know. I'm happy to revert certain changes/to adapt them.