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

Band plot data (some questions) #164

Open
BlessedAkarat opened this issue Sep 5, 2024 · 1 comment
Open

Band plot data (some questions) #164

BlessedAkarat opened this issue Sep 5, 2024 · 1 comment

Comments

@BlessedAkarat
Copy link

BlessedAkarat commented Sep 5, 2024

Hi,
I wanted to ask you a bit about band plots, so I created this issue.

Main question is this.
How can I figure out the exact (or near) k-point positions of the bands that cross the Fermi level?

Usually, when using Quantum ESPRESSO for a band plot, the calculations are carried out with the pw.x package.
After performing a self-consistent calculation (SCF), the band structure is calculated, and finally, the kpdos is computed using the projwfc.x package to draw the bands.

In this case I can check the band data for each k-points at the scf.out (self-consistent calculation output file) like below fig.
image

And in bands.in, the input file of band calculation, I wrote the k-point option with high symmetry point.
After finish band calculation, bands.out include only few information like calculation methods, cell information, and calculation time.

After all calculations, including the kpdos, I can see that the k.pdos_atm#~ and k.pdos_tot files have been created in the directory.
But non of these seems like to show the band value for each k-points.
So in the end, this system is using the k-points and band values from the scf.out file to create a graph, and the high symmetry points specified in bands.in are meant to mark each point when plotting the bands.
image

But importantly, in the case of a point moving from Gamma - M in the HCP structure, the point changes from (0, 0, 0) to (0.5, 0, 0), but in the actual scf.out file, ky, kz are fixed as 0, and there is no k-point that changes only kx.
image

So I wonder, how can I find the k-point of bands that cross the Fermi level.

Thank you for read this.
Best regards,
G. H.

@lllangWV
Copy link
Member

lllangWV commented Sep 7, 2024

Hi @BlessedAkarat,

After all calculations, including the kpdos, I can see that the k.pdos_atm#~ and k.pdos_tot files have been created in the directory. But none of these seem to show the band values for each k-point.

The PDOS files contain the partial density of states. In Quantum ESPRESSO, these values are obtained through an interpolation method for both the projections and the energies. This explains why you won’t find the usual band values within these files.

So, in the end, this system is using the k-points and band values from the scf.out file to create a graph, and the high-symmetry points specified in bands.in are meant to mark each point when plotting the bands. But importantly, in the case of a point moving from Gamma to M in the HCP structure, the point changes from (0, 0, 0) to (0.5, 0, 0), but in the actual scf.out file, ky and kz are fixed as 0, and there is no k-point that changes only kx.

That’s correct. However, we actually obtain the band and k-point information from the {prefix}.xml file. The high-symmetry point names, on the other hand, come from the bands.in file.

So I wonder, how can I find the k-points of bands that cross the Fermi level?

You can achieve this using the ElectronicBandStructure object. Below is a code snippet that demonstrates how to find the indices of k-points where bands cross the Fermi level:

import pyprocar

parser = pyprocar.io.Parser(code=code, dir=data_dir)
ebs = parser.ebs

def find_kpoints_crossing_fermi(bands, fermi_level, tolerance=1e-5):
    nk, nbands, nspin = bands.shape
    kpoints_crossing_fermi = []

    for iband in range(nbands):
        for k in range(1, nk):  # Start from 1 to compare with the previous k-point
            # Band energies at consecutive k-points
            energy_k = bands[k, iband, 0]
            energy_k_prev = bands[k - 1, iband, 0]

            # Check if the band crosses the Fermi level
            if (energy_k - fermi_level) * (energy_k_prev - fermi_level) < 0:
                kpoints_crossing_fermi.append(k)

    return kpoints_crossing_fermi

kpoint_indices = find_kpoints_crossing_fermi(ebs.bands, fermi_level)
print("K-points crossing the Fermi level:", kpoint_indices)

kpoints_crossing = ebs.kpoints[kpoint_indices, :]

This function checks for sign changes in the energy levels relative to the Fermi level, indicating a crossing. Let me know if this works for you.

Best,
Logan Lang

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

2 participants