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

Avoid overriding HubbardStructureData #1003

Open
npaulish opened this issue Dec 18, 2024 · 1 comment
Open

Avoid overriding HubbardStructureData #1003

npaulish opened this issue Dec 18, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@npaulish
Copy link

I want to use an already existing HubbardStructureData for a new calculation. If I upload it to qe-app and enable the Hubbard calculation, it asks me to provide Hubbard U values again and creates (surprisingly) a new HubbardStructureData. In my case, I had both U and V values and the V values were lost. Would it be possible to take the input HubbardStructureData as it is without the need to override the Hubbard parameters?

The workaround that we did with @mikibonacci in src/aiidalab_qe/workflows/__init__.py, starting from the line 135:

# Check if hubbard_dict is provided
        if hubbard_dict is not None:
            if isinstance(structure,HubbardStructureData):
                builder.structure = structure
            else:
                hubbard_parameters = hubbard_dict["hubbard_u"]
                hubbard_structure = HubbardStructureData.from_structure(structure)

                # Initialize on-site Hubbard values
                for key, value in hubbard_parameters.items():
                    kind, orbital = key.rsplit(" - ", 1)
                    hubbard_structure.initialize_onsites_hubbard(
                        atom_name=kind,
                        atom_manifold=orbital,
                        value=value,
                        hubbard_type="U",
                        use_kinds=True,
                    )

                # Determine whether to store and use hubbard_structure based on conditions
                if (
                    isinstance(structure, HubbardStructureData)
                    and hubbard_structure.hubbard == structure.hubbard
                ):
                    # If the structure is HubbardStructureData and hubbard parameters match, assign the original structure
                    builder.structure = structure
                else:
                    # In all other cases, store and assign hubbard_structure
                    hubbard_structure.store()
                    builder.structure = hubbard_structure
@npaulish npaulish added the enhancement New feature or request label Dec 18, 2024
@mikibonacci mikibonacci self-assigned this Dec 18, 2024
@AndresOrtegaGuerrero
Copy link
Member

This is weird since Qe app didn't have this behaviour. On the other hand, QE app shouldn't do a U + V calculation , since we dont have any way to assign them ( at the moment ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants