Skip to content
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

from_scratch for bands calculation #891

Closed
wants to merge 1 commit into from

Conversation

unkcpz
Copy link
Member

@unkcpz unkcpz commented Feb 24, 2023

fixes #877

Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @unkcpz . I agree that this change is correct (QE docs say not to use restart for non-scf calculations https://www.quantum-espresso.org/Doc/INPUT_PW.html#idm65). Just please remove the print statement

@@ -168,6 +168,7 @@ def validate_inputs_base(value, _):
if parameters.get('ELECTRONS', {}).get('startingpot', 'file') != 'file':
return f'`startingpot` should be set to `file` for a `{calculation_type}` calculation.'
if parameters.get('CONTROL', {}).get('restart_mode', 'from_scratch') != 'from_scratch':
print(parameters)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print(parameters)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. Please ignore my comment. I write it at the same time as your comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.
I also make a mistake by pushing directly to main. Hopefully, (and please pretend) you didn't notice @sphuber 😿

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know nothing

@@ -168,6 +168,7 @@ def validate_inputs_base(value, _):
if parameters.get('ELECTRONS', {}).get('startingpot', 'file') != 'file':
return f'`startingpot` should be set to `file` for a `{calculation_type}` calculation.'
if parameters.get('CONTROL', {}).get('restart_mode', 'from_scratch') != 'from_scratch':
print(parameters)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I print here and it shows the parameter is set to "restart", I don't know where this is set from.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still true? Or is the value now actually correctly getting set to from_scratch? I am confused whether this is now working as intended and fixes the issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is now working. I test locally and the warning disappeared. More importantly, the restart_mode of band calcualtion is from_scratch if check from the remote folder.

@unkcpz unkcpz force-pushed the fix/877/bands-from-scratch branch from 3d056d9 to 4854aa7 Compare February 24, 2023 16:20
@unkcpz unkcpz requested a review from sphuber February 24, 2023 16:21
@unkcpz unkcpz added pr/blocked PR is blocked by another PR that should be merged first and removed pr/blocked PR is blocked by another PR that should be merged first labels Feb 24, 2023
@mbercx
Copy link
Member

mbercx commented Apr 6, 2023

I remain somewhat opposed to the approach of setting/overriding inputs inside the steps of the work chain in case it can be avoided. A couple of thoughts:

  1. Overriding inputs inside the work chain can lead to confusion in case the user has explicitly set a different value, and will prohibit the user from changing it unless logic is implemented to respect explicitly provided inputs. In some cases it's true that it seems you have to set a certain value (e.g. from_scratch for a bands calculation), but perhaps we don't know the use case (this was also the reason for removing the line that sets the restart_mode in PwBandsWorkChain: do not define restart_mode in bands step #475).
  2. If you set/override inputs inside the work chain, it's more difficult for the user to find where this value comes from when he/she is checking the input files. We already have a place for setting the inputs of a work chain: the protocol files. So I think it makes sense to explicitly set default values there. This also respects the original "separation of church and state" principle which lead to the concept of defining a protocol.

@sphuber @unkcpz if you agree, I can work on a PR that implements these concepts more broadly for the PwBandsWorkChain.

@unkcpz
Copy link
Member Author

unkcpz commented Apr 6, 2023

Thanks @mbercx, please go ahead. I agree the interface needs to be more unified and better to be only in one place for all override changes.

@mbercx
Copy link
Member

mbercx commented Apr 6, 2023

Another reason to put these inputs in the protocol instead: the builder repr now looks like this:

Process class: PwBandsWorkChain
Inputs:
bands:
  metadata: {}
  pw:
    code: Plane wave Quantum ESPRESSO v7.2 - local compilation
    metadata:
      options:
        max_wallclock_seconds: 43200
        resources:
          num_machines: 1
        stash: {}
        withmpi: true
    monitors: {}
    parameters:
      CONTROL:
        calculation: scf
<...>

So it looks like we'd actually be running an scf for the bands step, but this is updated inside the work chain...

@mbercx
Copy link
Member

mbercx commented Apr 6, 2023

See #902

@mbercx
Copy link
Member

mbercx commented Apr 17, 2023

Superseded by #902

@mbercx mbercx closed this Apr 17, 2023
@unkcpz unkcpz deleted the fix/877/bands-from-scratch branch April 17, 2023 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

restart_mode should be set to from_scratch for a bands calculation.
3 participants