-
Notifications
You must be signed in to change notification settings - Fork 4
EpwPrepWorkChain: new sub-process epw_bands
#17
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
base: main
Are you sure you want to change the base?
Conversation
mbercx
left a comment
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.
Thanks @ymzhang0! Sorry for the slow review. I just have a few small comments, but most changes look great. 👍
src/aiida_epw/workflows/prep.py
Outdated
| ) | ||
| if "bands_kpoints" in self.ctx.workchain_w90_bands.inputs: | ||
| bands_kpoints = self.ctx.workchain_w90_bands.inputs.bands_kpoints | ||
| elif self.ctx.workchain_w90_bands: |
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.
Won't this always be true? Else the first if will already fail, no?
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.
Yes, I'll delete the second if. Actually this way of getting the kpoints for a band calculation is not so good. In W90BandWorkChain run_seekpath is optional upon whether band_kpoints is given in the inputs so I copy the logic here. But we can take the kpoints from the input of wannier90_pp subprocess any way. I'll see if I can fix it.
src/aiida_epw/workflows/prep.py
Outdated
| f"launching EpwBaseWorkChain<{workchain_node.pk}> in bands interpolation mode" | ||
| ) | ||
|
|
||
| return ToContext(workchain_epw_bands=workchain_node) |
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.
Note: I've used ToContext in the past a lot as well, but at some point I found out it's just a dictionary. 😅 You can also do:
| return ToContext(workchain_epw_bands=workchain_node) | |
| return {'workchain_epw_bands': workchain_node} |
And this is exactly the same. I think this is more understandable: you just return a dictionary mapping context keys to processes, and then the AiiDA engine will wait with executing the next step until the processes are completed. No magic ToContext needed. :)
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.
Good point. Now I have a question. How do I deal with that:
return ToContext(epw_interp=append_(workchain_node))
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.
ToContext is literally just defined as dict:
(I remember being quite annoyed when I saw that. No idea why you would make things so complicated, but that's often the case looking at old AiiDA code)
So you should be able to do:
return {'epw_interp': append_(workchain_node)}
But now I wonder if you can't even just literally append to the list in the context? 🤔
Anyways, we shouldn't make these changes for the SuperConWorkChain class in the same commit. I think it's best to keep the scope of a commit minimal, else it becomes difficult to explain why the changes are made. Adding unrelated changes to a commit is a bad idea: it can be confusing to future developers that are trying to understand the code. No need to make a new PR, but let's split up the changes here in multiple commits. As far as I can tell, you are doing multiple things in this PR:
- Fix bugs related to the fact that we put the
optionsat the top level of theEpwBaseWorkChain. - Add an optional bands interpolation step to the
EpwPrepWorkChain. - Fix a bug in the
EpwBaseWorkChainwhen exposing the inputs for the initial EPW run. - Update/add help to the
EpwPrepWorkChainandSuperConWorkChaininputs - Avoid using the useless
ToContextclass.
I wouldn't cram all these in a single commit. If it's ok with you, I can explain/show you how I would split them up once we're ready to merge all the changes.
Just as a note: when working on a PR, try to stay within the scope as much as possible. I also try to do this with my review (although I have not always in the past 🙈). It's great to do extra work of course, but it can make PRs drag on for longer, and then sometimes they never get merged. It's not such an issue here, but something to keep in mind.
|
Hi Marnik, I did make several mixed commits that might cause ambiguity in the future. I'll just roll back to the very beginning and make only one commit related to the new bands sub-process. I keep the modification on the always-true For the following changes:
I'll make 3 separate PR later. |
I added an additional `EpwBaseWorkChain` subprocess in EpwPrepWorkChain that do a subsequent `epw.x` interpolation of electron and phonon bands after bloch to wannier transformation. The related part in protocol yaml file is also modified accordingly.
68984f4 to
a3957d5
Compare
I added the new
EpwBaseWorkChainas a sub-process with labelepw-bandsin theEpwPrepWorkChain.This sub-process shares the same structure as
epwsub-processes.Problem in the protocol files is also fixed. All the
metadatanamespaces are removed so thatoptionis exposed at the top level.