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

seekpath_structure_analysis: HubbardStructureData compatibility #1007

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

mbercx
Copy link
Member

@mbercx mbercx commented Feb 12, 2024

Fixes #999

This PR was split off from #998. Look there for the initial discussion on the choices made in this PR.

hubbard_type=parameter.hubbard_type,
use_kinds=True,
)
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here we should add the NotImplementedError with a clear message to the user or implement a generalized function(s) for V

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 know. ^^ Just for future reference: I typically leave a PR in "Draft" status until it's ready for proper review, and request a review at that point. 🙃

Copy link
Collaborator

@AndresOrtegaGuerrero AndresOrtegaGuerrero Feb 12, 2024

Choose a reason for hiding this comment

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

ah yeah i know , i was putting a comment here just as a reminder , sorry :)

@mbercx
Copy link
Member Author

mbercx commented Feb 12, 2024

Alright, started working on this, but will wait until after #998 is merged so I can also refactor the structure fixtures a bit.

One thing to note is that the get_explicit_kpoints_path function also returns a conv_structure. But it seems that in the example test case I have it is the same as the primitive one, but different than the original which was constructed from a conventional FCC structure... 🤔 I'm probably too tired to understand this atm. ^^

@mbercx mbercx force-pushed the new/seekpath-hubbard branch from 0ecfdad to f7bf374 Compare February 13, 2024 11:09
@mbercx
Copy link
Member Author

mbercx commented Feb 13, 2024

@bastonero in this comment you mention moving the logic for finding the primitive HubbardStructureData to HubbardUtils. A couple of thoughts here:

  1. If I understand correctly, the purpose of the HubbardUtils class was to move QE-specific logic out of the HubbardStructureData class:

    class HubbardUtils:
    """Utility class for handling `HubbardStructureData` for QuantumESPRESSO."""

    But I suppose the logic for finding the primitive HubbardStructureData would be more generic, so perhaps we can add a method to HubbardStructureData instead?

  2. In the same vein, does the get_hubbard_for_supercell method contain any QE-specific logic?

  3. My first inclination would be to create a HubbardStructureData.get_primitive method or something similar in this case, but I'm not sure I like this approach. In the end the StructureData also doesn't have anything similar, we'd pass it into the seekpath_structure_analysis calculation function to also track the provenance.

So I'm inclined to keep the logic where it is for now? Especially since it'll be rather incomplete. Once we have implemented the holy grail HubbardStructureData.apply_hubbard_to_structure() method that works in all cases (if this is possible ^^), we can still adapt.

@bastonero
Copy link
Collaborator

  1. In the same vein, does the get_hubbard_for_supercell method contain any QE-specific logic?

I don't think it has any QE related logic, as it should be just a mapping.

  1. My first inclination would be to create a HubbardStructureData.get_primitive method or something similar in this case, but I'm not sure I like this approach. In the end the StructureData also doesn't have anything similar, we'd pass it into the seekpath_structure_analysis calculation function to also track the provenance.

Fine to me to keep it there for the moment being,

So I'm inclined to keep the logic where it is for now? Especially since it'll be rather incomplete. Once we have implemented the holy grail HubbardStructureData.apply_hubbard_to_structure() method that works in all cases (if this is possible ^^), we can still adapt.

I think it's possible to have a generic apply_hubbard_to_structure. One has to play around, but one consideration is that the structures should be "commensurate". With this I mean that the atoms should not be rotated, the only thing that rotates are the cell vectors (this means the Cartesian coordinates remain the same, i.e. same reference system).
So it involves a bit of thinking and time to implement it properly. Next time (:

@mbercx mbercx reopened this Feb 14, 2024
@mbercx mbercx marked this pull request as ready for review February 14, 2024 08:45
@mbercx
Copy link
Member Author

mbercx commented Feb 14, 2024

@bastonero @AndresOrtegaGuerrero I unfortunately don't have time to refactor the fixtures for generating structures, so the current test generates its own specific Hubbard structure.

I still don't really understand why the conv_structure is the same tbh.

@AndresOrtegaGuerrero
Copy link
Collaborator

AndresOrtegaGuerrero commented Feb 14, 2024

I still don't really understand why the conv_structure is the same tbh.

What do you mean by this ? (You mean why seekpath returns a different structure as conv_structure from the input structure you provide ?) , Because, i feel this is an issue of seekpath and spglib

@mbercx
Copy link
Member Author

mbercx commented Feb 14, 2024

What do you mean by this ? (You mean why seekpath returns a different structure as conv_structure from the input structure you provide ?)

That, and why the returned primitive and conventional structures are the same.

@AndresOrtegaGuerrero
Copy link
Collaborator

What do you mean by this ? (You mean why seekpath returns a different structure as conv_structure from the input structure you provide ?)

That, and why the returned primitive and conventional structures are the same.

Maybe we should open an issue an pin Giovanni for this ?

Copy link
Collaborator

@AndresOrtegaGuerrero AndresOrtegaGuerrero left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@bastonero bastonero 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. Maybe not in this PR, but we should block at the very beginning the usage of HubbardStructureData with intersites in the Bands workchain.

Just left a minor change request, then looks good.

"""Update the structure based on Hubbard parameters if the input structure is a HubbardStructureData."""
hubbard_structure = HubbardStructureData.from_structure(structure)

if any(parameter.hubbard_type == 'V' for parameter in orig_structure.hubbard.parameters):
Copy link
Collaborator

Choose a reason for hiding this comment

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

One can still have intersite parameters, but indicate U for instance. Why not using the utils.hubbard.is_intersite_hubbard method?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, thanks @bastonero. The is_intersite_hubbard function is perfect indeed.

@mbercx mbercx requested a review from bastonero February 19, 2024 11:44
@mbercx
Copy link
Member Author

mbercx commented Feb 19, 2024

@bastonero also added a test to check that structures with intersite parameters indeed raise a NotImplementedError.

@mbercx mbercx force-pushed the new/seekpath-hubbard branch from 93c5385 to 9b15578 Compare February 19, 2024 12:04
Copy link
Collaborator

@bastonero bastonero left a comment

Choose a reason for hiding this comment

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

Thanks a lot @mbercx, great job. Sorry to be a bit paranoid, but it would be good to have a test where the primitive structure is smaller then the original one. For instance, cubic Si? The input structure being 8-atoms, it should return the primitive structure with 2 atoms. Or you can also simply make a supercell using from ase.build import make_supercell if I remember correctly.

@mbercx
Copy link
Member Author

mbercx commented Feb 19, 2024

Thanks @bastonero. You mean an example where this fails (EDIT: i.e. with intersite interactions)? The current test_seekpath_analysis test already constructs a conventional Co structure with 4 sites and two kinds where the primitive structure only has two sites.

@bastonero
Copy link
Collaborator

Ann sorry @mbercx , didn't notice it was 4 sites. Good to go then!

Copy link
Collaborator

@bastonero bastonero left a comment

Choose a reason for hiding this comment

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

@mbercx thanks a lot, good for me!

@mbercx mbercx merged commit 9cb1cfa into aiidateam:main Feb 19, 2024
7 checks passed
@mbercx mbercx deleted the new/seekpath-hubbard branch February 19, 2024 13:56
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.

PwBandsWorkChain is not compatible with HubbardStructureData
3 participants