-
Notifications
You must be signed in to change notification settings - Fork 82
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
PwBaseWorkChain
: improve restart from parent_folder
#722
Conversation
@sphuber this was quickly field tested and seems to work fine. Not sure if there is an important reason why the It's def possible that the user doesn't provide the correct parameters to actually make use of the (Also possible tests will fail, will fix when we agree) |
@sphuber thanks for the feedback! I've willingly introduced some scope creep in this PR to also deal with some of the issues in #691 (not sure if all though, and there are also some comments there that should be raised on the QE GitLab, so I wouldn't say that issue is fixed by this PR at this time.). I've mainly done two things:
Finally, some more notes/questions regarding the choice of the restart type:
Also pinging @ramirezfranciscof and @qiaojunfeng for comments and field testing! :) (will fix tests once the review has processed past the design stage) |
I think indeed having a |
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 @mbercx . I like the approach a lot, there are just a few minor issues still I think
b516b16
to
adf3365
Compare
@sphuber I think this is ready for another round of review. To summarize the logic of these changes a bit again:
I would still consider making the following changes to [4]:
|
@qiaojunfeng or @ramirezfranciscof maybe you'll have a chance to review this some time this week? If we all think the logic is solid, I can fix the tests and we can merge this for LUMI. |
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 @mbercx . Concept looks good to me, just some minor changes and then the validator contains quite a few problems, so would really like to see some unit tests there. Also, we are essentially coding the default values from QE in there. This may become a problem when they change. Not sure how likely that is and also don't really have an alternative solution for now, but just something we should be aware of.
adf3365
to
600681c
Compare
d57ff48
to
335da8f
Compare
Much obliged for the kind review, @sphuber! Nits have been picked, copy 🍝 has been untangled, and tests have been fixed and added for the validation. Extra notes on changes:
Final thing to do is to change the logic of the error handlers when the structure changes, on which I think we agree. Just a confirmation that you agree we should restart from the charge density for both:
And I'll update the logic/tests. |
@ramirezfranciscof @sphuber thanks once more for your reviewing efforts! The only question that now remains is the logic regarding starting from a changed structure. However, this was once implemented by someone, perhaps for a good reason, and since we not sure that starting from the charge density is a good approach, perhaps we should declare this logic change "beyond the scope of this PR" and open an issue for revisiting all the restart 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.
All looks good to me, I mainly checked the logics related to the restarting part, I took a look at the testing for the process handlers but that part I understand a bit less, but I assume @sphuber 's review of it should suffice.
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 to bother again, but since code got added, I have a few additional small comments
To restart nscf, although the current input works, but in theory the `startingpot = file` should be used, instead of `restart_mode = restart`. See aiidateam/aiida-quantumespresso#722
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.
Bombs away!
Remove some of the logic in the `PwBaseWorkChain` regarding restarting from a previous calculation using a `RemoteData` provided to the `pw.parent_folder` input. The current logic expected the `RemoteData` to have a `PwCalculation` creator, which is not always the case. Moreover, the `restart_mode` chosen by the user is overriden, which means that e.g. restarting from _only_ the charge density with `startingpot` is not possible.
e4f26af
to
2c08469
Compare
Darn, rebased 5 seconds too late! 😭 |
you mean too early ^^ |
Uhm, just merged another PR and forgot this was waiting. We can just squash merge this though with running tests again, I just updated the |
Merging with admin powers, how rude! ;D I think the badges are still messed up though. If you want to check the result without merging, you can always go to the branch of your PR, right? |
I did and it looked fine. But I realize now that I forgot to add empty rows for the Python version of older releases of |
@mbercx look at this deliciousness |
As I am too shy to merge with admin powers, I once again seek your approval @sphuber. 🙃 |
FULL = 'full' | ||
FROM_SCRATCH = 'from_scratch' | ||
FROM_CHARGE_DENSITY = 'from_charge_density' | ||
FROM_WAVE_FUNCTIONS = 'from_wave_functions' |
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 guys, I wanted just to point out that it could be useful to have also FROM_FILES
(or something like that), so that one can restart from the density and wave functions. I know that 'full' is meant to do so, but it will also read the atomic positions.
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.
My first inclination would be to say that restarting from the wave functions, it should be pretty fast for QE to recalculate the charge density. But if I remember correctly, QE doesn't actually do this, instead just plugging in the wave functions but for the potential calculated from the atomic charge density, correct?
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, should be like this. Two case scenario would be:
- electric enthalpy routine: it uses the wfcs to build the polarization operator (essentially you start with a slightly different hamiltonian)
- maybe in some restart when vc-relaxing?
But I do agree at the end it is not such a difference. I was just wondering, since the new implementation is so cool (great job!!! :D ), it would be quite easy to just add that one more, just in case one needs it.
Or do you think that the "experienced" user can still always tweak the inputs if that is the case?
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 for the clarification, @bastonero! Note that the restart types are only used for setting the restarts after an error has been handled using the set_restart_type
method. So if a user wants to restart from a previous calculation, the correct inputs have to be provided, not the restart type.
Happy to implement another restart type (not sure about the name, FROM_FILES
seems a bit too general, maybe FROM_CHARGE_AND_WFC
?). Do you think there is already a current error handler where this restart type would be used though?
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.
Ah ok, I see, thanks! For the moment, actually, I still don't have an example of handler where it would be useful. FROM_CHARGE_AND_WFC
sounds good anyway.
Improve the code regarding restarting in the `PwBaseWorkChain` in several ways: * Remove some of the logic in the `PwBaseWorkChain` regarding restarting from a previous calculation using a `RemoteData` provided to the `pw.parent_folder` input. The current logic expected the `RemoteData` to have a `PwCalculation` creator, which is not always the case. Moreover, the `restart_mode` chosen by the user was overriden, which means that e.g. restarting from _only_ the charge density with `startingpot` was not possible. * For users who want to restart in the first `PwCalculation`, the inputs are now validated to make sure that they are sensible. In case the calculation will still run correctly but the inputs are not consistent, a warning is raised during the validation. In case the inputs lead to failed calculation, an error is raised. * For restarts made by the `PwBaseWorkChain`, the restart logic is gathered inside the `set_restart_type` method. A new `Enum`, `RestartType` is added for the different modes of restarting. Each of the error handlers is updated to use this new method. * Only for the `sanity_check_insufficient_bands` error handler, the restart method is changed to restart from the charge density. Finally, the `validate_parameters` step in the outline of the `PwBaseWorkChain` is merged into the `setup` step, since no more validation is performed and the other code in this step is more at home in the `setup` step.
Fixes #721
Remove some of the logic in the
PwBaseWorkChain
regarding restartingfrom a previous calculation using a
RemoteData
provided to thepw.parent_folder
input.The current logic expected the
RemoteData
to have aPwCalculation
creator, which is not always the case. Moreover, the
restart_mode
chosen by the user is overriden, which means that e.g. restarting from
only the charge density with
startingpot
is not possible.