Skip to content

♻️ EpwPrepWorkChain: Make reference_bands optional for PDWF (ATOMIC_PROJECTORS_QE) #42

Description

@ymzhang0

Currently, when performing PDWF, we enforce the provision of reference_bands if the projection type is ATOMIC_PROJECTORS_QE:

@classmethod
    def get_builder_from_protocol(
...
        if wannier_projection_type == WannierProjectionType.ATOMIC_PROJECTORS_QE:
            if reference_bands is None:
                raise ValueError(
                    f"reference_bands must be specified for {wannier_projection_type}"
                )

However, since we can decide whether to optimize the projection windows in PDWF (via optimize_disproj), this hardcoded requirement is actually unnecessary. I have been planning to remove this if clause so that we can mute this optimization when we, for example, test the workchain.

In the recent merge of the mobility workchain, this dependency was reinforced. The logic now relies on reference_bands to determine the gap of the QE band structure:

        if wannier_projection_type == WannierProjectionType.ATOMIC_PROJECTORS_QE:
            ...
            w90_params = w90_bands.wannier90.wannier90.parameters.get_dict()
            gap_info = detect_bandgap_from_bands(
                reference_bands,
                structure,
                _pf,
                exclude_bands=w90_params.get("exclude_bands", None),
            )

This implementation essentially makes reference_bands mandatory again, which conflicts with the goal of making it optional.

@LIU-Binbin 🤔 Could we figure out a way to refactor or reroute the detect_bandgap_from_bands? The goal is to ensure reference_bands can safely remain optional, even when using PDWF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions