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

PwRelaxWorkChain: Revisit work chain logic #952

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mbercx
Copy link
Member

@mbercx mbercx commented Jun 5, 2023

Fixes #733
Fixes #705

Will write full commit message when all changes are agreed upon.

@mbercx
Copy link
Member Author

mbercx commented Jun 5, 2023

@sphuber some initial notes/questions/decisions:

  1. Regarding the meta-convergence:

    • In PwRelaxWorkChain: Revisit meta iterations and final SCF #705, I forgot to describe one of the most important reasons to more away from using the volume for the meta iterations: although it's rare that the volume condition rarely doesn't catch an issue with Pulay stresses, it will often run another geometry optimization unnecessarily.
    • Regarding the condition on the kpoints mesh not changing: should we be very strict, and expect the same mesh, or is it fine in case the previous run was done with a denser mesh than the output structure would require? Of course kpoints convergence will be achieved in the latter case, but there might be use cases where the user wants the kpoints mesh to approach the desired density as close as possible. For now I've decided to be strict.
  2. Should the initial relaxation be run by default? Currently it is, and if we don't make it the default I'm wondering how to allow the user to enable it while also being able to provide a protocol for this step.

  3. Re the documenation: I was planning to describe the work chain Purpose and Logic in the Topics section. What do you think?

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 @mbercx . I think this is looking good. Left some comments.

Should the initial relaxation be run by default? Currently it is, and if we don't make it the default I'm wondering how to allow the user to enable it while also being able to provide a protocol for this step.

Is it the default? If the base_init_relax namespace is not defined at all, it won't be run. Do you maybe mean the default when using get_builder_from_protocol? If it works really well for most real use-cases, I think it makes sense to actually use it by default. We can add a note in the documentation how to skip it, which should not be complicated.

Re the documenation: I was planning to describe the work chain Purpose and Logic in the Topics section. What do you think?

Yeah, makes perfect sense.

Comment on lines +10 to +20
base_init_relax:
kpoints_distance: 0.3
meta_parameters:
conv_thr_per_atom: 1.e-6
etot_conv_thr_per_atom: 1.e-3
pw:
parameters:
CONTROL:
calculation: scf
forc_conv_thr: 0.5e-2
CELL:
press_conv_thr: 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an origin for these numbers other than your thumb? :D Not that I have any better ones per se, but just curious if these are already tested in someway

Copy link
Member Author

Choose a reason for hiding this comment

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

side-eye-monkey

src/aiida_quantumespresso/workflows/pw/relax.py Outdated Show resolved Hide resolved
}
}
new_kpts_mesh, _ = create_kpoints_from_distance(**inputs_create_kpoints).get_kpoints_mesh()
if tuple(input_kpts_mesh) != tuple(new_kpts_mesh):
Copy link
Contributor

Choose a reason for hiding this comment

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

EDIT: just saw your point in the PR description. Will leave this here because it contains some more thoughts on the exact criterion.

Should we maybe here check only that the new grid is not denser? If the new required grid is less dense, then there is no point in rerunning is there? The criterion for kpoints_distance that a minimum density is guaranteed in order to guarantee a minimum precision.

One tricky thing I guess might be if you have non isometric meshes, such as (2, 3, 1) and (3, 2, 1). Which one is denser? I guess there you would have to compute the actual distance between kpoints in 1/A for both both meshes in each direction and as soon as just one is larger for the new structure, we conclude we have to rerun.

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'm not sure how common that case last case is, but it's a fair point. Maybe we can accept when the new mesh is denser along every direction. This would not accept your last use case, but I think that's fine, and simpler than really calculating the density.

src/aiida_quantumespresso/workflows/pw/relax.py Outdated Show resolved Hide resolved
src/aiida_quantumespresso/workflows/pw/relax.py Outdated Show resolved Hide resolved
@mbercx mbercx marked this pull request as ready for review December 15, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants