aiidateam / aiida-common-workflows

A repository for the implementation of common workflow interfaces across materials-science codes and plugins
https://aiida-common-workflows.readthedocs.io
MIT License
52 stars 30 forks source link

Bands common workflow #222

Open bosonie opened 3 years ago

bosonie commented 3 years ago

Issue to discuss details of the implementation of a common workflows to compute electronic bands.

As a first question: what do we pass to the workflow in input? The structure and a list of high symmetry points (boundaries of band lines)? Or a complete list of kpoints?

espenfl commented 3 years ago

Thanks for raising the issue. Depends. How extensive do we want to be? In the VASP plugin we use the seekpath, but users can also pass explicit points. I suggest we keep it very simple but general if possible.

What is a bit important is that we have the option to pass an explicit list as sometimes that is needed. E.g. the pregenerated grid plus the points on which you want to calculate the bands. For some of the codes the numbers of bands might also be relevant.

bosonie commented 3 years ago

Some suggestions for the bands workflow implementation coming from the working group meeting on 28th Sept 2021.

To have a standalone workflow for bands rather than simply extend the CommonRelaxWorkChain

The interface for the bands workchain is going to be similar to the relaxation workchain: based around the concept of inputs generator carrying the common interface. The only changes will be:

There will be two mutually exclusive options for specifying the k-points:

  1. SeeK-path parameters: In this case the input generator will use SeeK-path and the structure to find the primitive cell and corresponding high-symmetry paths. This will most likely adapt the structure (change of structure in the input generator!! In a calcfunc??) and an extra SCF will be needed before the band structure calculation to obtain the correct charge density.
  2. Explicit k-points list (and attached labels for high symmetry points): In this case the structure will not be changed, and the k-points are expected to be defined in (direct) coordinates of the reciprocal space. This will also allow the user to optionally specify a remote_folder where a charge density / wave-functions to start from is stored. A check is needed that the remote_folder contains a calculation with the same code defined in engines.

NOTE: In this scenario the running of a relaxation and a subsequent band calculation is not so smooth. In fact, for some codes, one would like to use all the inputs of the relaxation for the bands, plus the output structure, the final magnetic configuration, the addition of the remote folder. However, at the level of the common interface, the inputs of the relaxation are not accessible since they are not stored. Stored are only the <Code>CommonRelaxWorkChain inputs. Also, the translation between some <Code>CommonRelaxWorkChain outputs (e.g. magnetic moments) into inputs of the bands workflow is not encoded anywhere. To fix this issue will be task of the higher level workchain (relax+ bands), but maybe the best solution is to allow directly in input of the input generator a previously run <Code>CommonRelaxWorkChain. This will require logic to manage the interplay with other inputs (protocol, remote_folder, etc).

Number of bands in input? In any case should be an optional input. Since all-electron codes have a lot more bands, specifying the number of bands you want to calculate is not sensible as an input. Alternatives for specifying the number of bands:

Notes for the oxides project. How to compare bands

Band reconstruction? This is not done by several codes, and not really an issue for comparing: we simply sort the energy levels in ascending order for each k-point and compare.

espenfl commented 3 years ago

Could not attend today, so here are some comments from me:

SeeK-path parameters: In this case the input generator will use SeeK-path and the structure to find the primitive cell and corresponding high-symmetry paths. This will most likely adapt the structure (change of structure in the input generator!! In a calcfunc??) and an extra SCF will be needed before the band structure calculation to obtain the correct charge density.

Yes, we need to make sure provenance is kept. What is nice with e.g. this approach is that for the configurations where multiple options are available for the representation, we settle on one.

Explicit k-points list (and attached labels for high symmetry points): In this case the structure will not be changed, and the k-points are expected to be defined in (direct) coordinates of the reciprocal space. This will also allow the user to optionally specify a remote_folder where a charge density / wave-functions to start from is stored. A check is needed that the remote_folder contains a calculation with the same code defined in engines.

Notice that we would also want to use the combination. E.g. fetch the high symmetry with seekpath and then fetch the explicit points and pass to the explicit list. This would typically be appended to the list used to generate the charge density.

Number of bands in input? In any case should be an optional input.

Yes, we would like to be able to use this. Different scenarios where this is convenient. Optional is fine. We would run with some defaults then.

Calculate effective electron mass

Which effective mass? There are different ways to calculate this. Density of states effective mass is fairly straightforward. We could do this based on density of states we calculate workflow side for the plugins/codes not having this intrinsically, or if we want to use a different method. Notice that e.g. the tetrahedron method is included in kspclib, which plays nicely with spglib and seekpath.

Band reconstruction? This is not done by several codes, and not really an issue for comparing: we simply sort the energy levels in ascending order for each k-point and compare.

You mean folding? Or do you mean solving the crossing problems? Yes, I think we should start simple. I would expect us to have plenty to do just getting the basics right across the code base for the bands etc.

Thanks a lot for updating the issue after the meeting. The overall approach sounds good.

bosonie commented 2 years ago

Thanks @espenfl for your comments.

Notice that we would also want to use the combination. E.g. fetch the high symmetry with seekpath and then fetch the explicit points and pass to the explicit list. This would typically be appended to the list used to generate the charge density.

But if seekpath changes the structure, the charge density becames unusable, isn't it?

Which effective mass? There are different ways to calculate this. Density of states effective mass is fairly straightforward. We could do this based on density of states we calculate workflow side for the plugins/codes not having this intrinsically, or if we want to use a different method. Notice that e.g. the tetrahedron method is included in kspclib, which plays nicely with spglib and seekpath.

We will go back to that later in the development of the oxides project

You mean folding? Or do you mean solving the crossing problems? Yes, I think we should start simple. I would expect us to have plenty to do just getting the basics right across the code base for the bands etc.

We meant solving crossing problems. Agree to start simple.

giovannipizzi commented 2 years ago

Thanks for the feedback! I agree in general with all points above (start simple, allow to pass other kpoints, ...).

I have a slightly different suggestion than the one in #235:

Then, we would immediately define a common WF that combines the common relax WF + common bands WF, and knows how to pass parameters between the two. This would expose the inputs of the common relax WF similarly to the EOS, and also the inputs of the common bands WF, and have two overrides for the two WFs; in addition, here it would allow to pass either an explicit k-points list, or allow to use seekpath.

This solves some points:

giovannipizzi commented 2 years ago

Regarding the point on selecting the number of bands:

We could pack all these options into a Dict node, but then we need to clearly define a 'schema' to validate the content of the Dict together with the input specs (e.g. in #235)