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

Error with CdTe BS #34

Open
kavanase opened this issue Sep 20, 2022 · 4 comments
Open

Error with CdTe BS #34

kavanase opened this issue Sep 20, 2022 · 4 comments

Comments

@kavanase
Copy link
Collaborator

Hi!
This is a really useful and well put-together package! 🙌 Excited to see how it develops!

I was trying to run this with CdTe, in the same way as the GaAs example notebook, and I'm running into this issue (see attachments). Basically it seems that the MP bandstructure has a down-sampled 12x12x12 mesh (I think), so manually hard-coding the mesh to 6x6x6 works, but the default doesn't.

I've pulled my hair out for a few hours now trying to figure out what was going on here & where it was failing 😅, so I think I've found mostly where the issue is coming from but not how best to fix. Hopefully those who are more familiar with the code will be able to spot/fix the issue quicker!

CdTe_TAS_Error_MWE.ipynb.zip

@utf
Copy link
Collaborator

utf commented Sep 20, 2022

Which task_id did you use? The issue is that some MP calculations didn't use a uniform k-point mesh. They used a custom code to generate the symmetry adapted mesh which was broken and omitted random k-points. PyTASER requires a uniform k-point mesh (symmetry reduced is fine) to calculate the k-point weights. If you don't have a uniform mesh you can't reliably calculate the weights so unfortunately this isn't something we can fix.

You have two options:

  1. Sometimes there are multiple uniform BS tasks on MP for the same structure, you can try using one of the others.
  2. You can run PyTaser from your own DFT data. @youngwonwoo can help you with this.

@youngwonwoo
Copy link
Collaborator

Thanks, @kavanase. It's exciting to know you run the Pytaser with CdTe. We checked several materials, but this k-point mesh uniform issue from the MP band structure is new. Thanks for sharing.
With DOS and band structure calculation DFT data, you can easily run the Pytaser 🙂!

@kavanase
Copy link
Collaborator Author

Thanks both for the quick replies!

I just used the mp-406 material ID for Zinc Blende CdTe from the Materials Project. It's not critical so I can just use my own data, which I'll try now, was just noting in case it was an easy-ish fix for ppl using the Materials Project based PyTASer workflow!

I wonder in cases like this if it would be relatively easy to determine the subset of kpoints which form a uniform mesh. E.g. here it seems the reduced 12x12x12 mesh contains a uniform 6x6x6 mesh, which if you make PyTASer use this it seems to run ok (and I'd think the weights should be fine – might just need to be renormalised?), so could it be used?

@kavanase
Copy link
Collaborator Author

kavanase commented Feb 8, 2024

I checked again that this issue is still present for CdTe.
I had a look around and it seems there are no other task_ids for zinc blende CdTe bandstructures.

For now, I've added a warning to the Materials Project tutorial about this (dbe30a0). As mentioned in that last message ☝️ , I think downsampling the kpoint mesh would work as a solution here. I think something like this (in expand_kpoints) could work:

addresses = np.rint((kpoints + shift / (mesh * 2)) * mesh)
for factor in [1,2,3,4,6,8]:
    try:
        mesh = np.rint(mesh)/factor
        ...
        if n_mapped != n_expected:
            raise ValueError(f"Expected {n_expected} points but found {n_mapped}")
        break
    except ValueError as exc:
        if factor == 8:
            raise exc

to loop over possible uniform subsets of the broken full mesh (e.g. for CdTe would identify the 6x6x6 uniform mesh from the non-uniform 12x12x12 mesh). The kpoint weights would then just need to be renormalised based on the (relative) weights of this reduced uniform mesh, and the self.bs object might need to be adjusted somehow so its kpoint indices match that of the output kweights (with this reduced mesh), so e.g. the jdos() function works correctly.
I don't have the space for this, but just noting that / how I think it can be done.

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

No branches or pull requests

3 participants