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

elk support? #144

Open
recohen opened this issue Apr 12, 2024 · 18 comments
Open

elk support? #144

recohen opened this issue Apr 12, 2024 · 18 comments

Comments

@recohen
Copy link

recohen commented Apr 12, 2024

I tried a simple dos with elk and get the below. But when I look at your parser page I don't even see elk.
Yet pyprocar is still listed on the elk web site

Very confused.

Thank you for any help,

Ron


pyprocar.dosplot(
code='elk',
mode='plain',
fermi=0.3568473976,
dirname="./")

ValueError Traceback (most recent call last)
Cell In[22], line 1
----> 1 pyprocar.dosplot(
2 code='elk',
3 mode='plain',
4 fermi=0.3568473976,
5 dirname=data_dir)

File /central/home/recohen/cohen_env/lib/python3.11/site-packages/pyprocar/scripts/scriptDosplot.py:278, in dosplot(code, dirname, mode, orientation, spins, atoms, orbitals, items, fermi, fermi_shift, elimit, dos_limit, savefig, labels, projection_mask, ax, show, print_plot_opts, **kwargs)
274 elif orientation[0].lower() == 'v':
275 orientation = 'vertical'
--> 278 parser = io.Parser(code = code, dir = dirname)
279 dos = parser.dos
280 structure = parser.structure

File /central/home/recohen/cohen_env/lib/python3.11/site-packages/pyprocar/io/parser.py:26, in Parser.init(self, code, dir)
23 self.code = code
24 self.dir = dir
---> 26 self.parse()

File /central/home/recohen/cohen_env/lib/python3.11/site-packages/pyprocar/io/parser.py:60, in Parser.parse(self)
57 self.ebs.bands += self.ebs.efermi
59 if self.dos:
---> 60 self.dos.energies += self.dos.efermi
61 return None

ValueError: non-broadcastable output operand with shape (500,) doesn't match the broadcast shape (4,1,16,2,500)

@lllangWV
Copy link
Collaborator

Hey,

sorry for the issue! Recently, we changed it so the fermi energy has to be given the DensityOfStates class to initialize. I forgot to update the elk code.

I pushed the update to GitHub so clone the repository from there to have the updates. Here are the commands for that:

pip uninstall pyprocar
git clone git@github.com:romerogroup/pyprocar.git
cd pyprocar
pip install .

I will try to get this in the Pypi version as soon as possible. There are some further additions to the elk interface I would like to add before updating PyPi.

code = "elk"
mag_type = ["non-spin-polarized","spin-polarized-colinear","non-colinear"][1]
data_dir = os.path.join(PROJECT_DIR,'data','examples',"SrVO3",code,mag_type, 'dos')
HARTREE_TO_EV = 27.211386245988
pyprocar.dosplot(
code=code,
mode='plain',
fermi=0.3218543102*HARTREE_TO_EV,
dirname=data_dir)

image

Here are the bands as well:

code = "elk"
mag_type = ["non-spin-polarized","spin-polarized-colinear","non-colinear"][1]
data_dir = os.path.join(PROJECT_DIR,'data','examples',"SrVO3",code,mag_type, 'ebs')

pyprocar.bandsplot(
code=code,
mode='plain',
spins=[0,1],
elimit=[-10,10],
fermi=0.3218543102*HARTREE_TO_EV,
dirname=data_dir)
image

Logan Lang

@recohen
Copy link
Author

recohen commented Apr 18, 2024 via email

@recohen
Copy link
Author

recohen commented Apr 21, 2024 via email

@recohen
Copy link
Author

recohen commented Apr 21, 2024 via email

@lllangWV
Copy link
Collaborator

Hey!

sorry for the late reply, I only have a couple of times a week to work on pyprocar. I looked into the issue, without going into details, it had to do with how the main parser got the DOS and Structure object.

This density of states looks a little strange with the giant peak near -5eV. I am just curious what does the band structure look like?

Here are the plots for the density of states for different modes:

pyprocar.dosplot(
                code=code,
                mode='parametric',
                orbitals=[4,5,6,7,8],
                # elimit=[-2,2],
                clim =[0,1],
                fermi=0.2561435077*HARTREE_TO_EV,
                dirname=data_dir)

image

pyprocar.dosplot(
                code=code,
                mode='parametric_line',
                orbitals=[4,5,6,7,8],
                # elimit=[-5,5],
                clim =[0,1],
                fermi=0.2561435077*HARTREE_TO_EV,
                dirname=data_dir)

image

pyprocar.dosplot(
                code=code,
                mode='stack_orbitals',
                # elimit=[-5,5],
                fermi=0.2561435077*HARTREE_TO_EV,
                dirname=data_dir)

image

pyprocar.dosplot(
                code=code,
                mode='stack_species',
                orbitals=[4,5,6,7,8],
                # elimit=[-5,5],
                fermi=0.2561435077*HARTREE_TO_EV,
                dirname=data_dir)

image

pyprocar.dosplot(
                code=code,
                mode='overlay_orbitals',
                # elimit=[-5,5],
                fermi=0.2561435077*HARTREE_TO_EV,
                dirname=data_dir)

image

pyprocar.dosplot(
                code=code,
                mode='overlay_species',
                orbitals=[4,5,6,7,8],
                # elimit=[-5,5],
                fermi=0.2561435077*HARTREE_TO_EV,
                dirname=data_dir)

image

Logan Lang

@lllangWV
Copy link
Collaborator

I forgot to mention, I pushed these updates to Git Hub repo, so get the updated version from there.

Logan Lang

@recohen
Copy link
Author

recohen commented Apr 25, 2024 via email

@recohen
Copy link
Author

recohen commented Apr 25, 2024 via email

@lllangWV
Copy link
Collaborator

Hey!

We require users to specify the Fermi energy to maintain a consistent functional interface across various DFT codes. Our goal is for dosplot and bandsplot functions to have uniform arguments for all DFT codes, differing only in the code argument. However, there are challenges in standardizing the Fermi energy across different DFT codes.

For instance, with VASP, the Fermi energy in the bands or density of states directory is not the self-consistent Fermi energy, which is located in a different directory. This complicates maintaining a uniform interface.

While ELK naturally sets the Fermi energy to 0, solving this issue, we initially decided to standardize the interface by requiring all users, regardless of the DFT code, to specify the Fermi energy.

Thinking about this more, I am exploring alternative solutions that could exempt users from specifying the Fermi energy when it is available in the same directory used by bandsplot or dosplot. This would be the case for Quantum Espress and ELK.

I'll see what I can do, and let you know!

@recohen
Copy link
Author

recohen commented Apr 25, 2024 via email

@lllangWV
Copy link
Collaborator

For the overlay_orbtial not displaying the f orbitals. It should include f orbitals

image

@recohen
Copy link
Author

recohen commented Apr 25, 2024 via email

@recohen
Copy link
Author

recohen commented May 29, 2024 via email

@recohen
Copy link
Author

recohen commented May 29, 2024 via email

@recohen
Copy link
Author

recohen commented May 31, 2024 via email

@lllangWV
Copy link
Collaborator

Hey Ron,

I'll take a look! Hopefully, I can get to it today, but if not the next couple days I will.

Also, I don't understand what you
were saying about VASP needing two directories. It seems to me that the
Fermi level and DOS are in the same directory.

What I was referring to is if you compare the OUTCAR file when you run a non-self consistent to the OUTCAR file of a self-consistent file. They are not guaranteed to be the same. I have personally, noticed this in some calculations I have performed. Ideally, the Fermi energy in a non-self-consistent calculation should be very close to that of the self-consistent calculation if the charge density is well-converged and if the same k-points and smearing methods are used. However, there can be slight differences due to the different treatment of electron density updates.

This is not a problem in other codes because they have a system to retain the self-consistent fermi energy in subsequent non-self-consistent calculations.

Logan

@recohen
Copy link
Author

recohen commented Jun 3, 2024 via email

@lllangWV
Copy link
Collaborator

lllangWV commented Jun 3, 2024

Hey Ron,

I am sorry it slipped my mind. I'm taking a look at it now. Could you also send me the POSCAR file too, I can't plot without it.

I am having some problems with pyprocar and VASP for a spin-orbit
spin-polarized where only one spin is plotted. I seem to see two spin
projections in the PROCAR file but cannot get them to plot.

So for a spin-orbit calculation in vasp, it will automatically turn the LNONCOLINEAR flag on, so you should only see one spin. This is because there is there is no definition of spin-up or spin-down in noncolinear calculations. What you see in the PROCAR is the projected magnetizations. You can find the exact definition here PROCAR at the bottom of the page.

The blocks represent the following:

  1. The first set is the total (absolute magnetization)
  2. The second is the x-projection of the spin
  3. The third is the y-projection
  4. The third is the z-projection

When you are dealing with a non-colinear calculation in pyprocar you can specify which projection you would like to see with the following.

In this plot, the color scale represents the contribution of the d-orbitals of the first atom to the total magnetization

atoms=[0]
orbitals=[4,5,6,7,8]
spins=[0]
pyprocar.dosplot(
code='vasp',
mode='parametric',
fermi=5.5962,
atoms=atoms,
orbitals=orbitals,
spins=spins,
dirname=data_dir)

Changing spins=[1] would represents the contribution of the d-orbitals of the first atom to the x-projection magnetization.
Changing spins=[2] would represents the contribution of the d-orbitals of the first atom to the y-projection magnetization.
Changing spins=[3] would represents the contribution of the d-orbitals of the first atom to the z-projection magnetization.

# of k-points:   90         # of bands:  128         # of ions:   14

 k-point     1 :    0.00000000 0.00000000 0.00000000     weight = 0.00195312

band     1 # energy  -27.58781017 # occ.  1.00000000
 
ion      s     py     pz     px    dxy    dyz    dz2    dxz  x2-y2  fy3x2   fxyz   fyz2    fz3   fxz2   fzx2    fx3    tot
    1  0.469  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.469
    2  0.469  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.469
    3  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    4  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    5  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    6  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    7  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    8  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    9  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   10  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   11  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   12  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   13  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   14  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
tot    0.941  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.941

    1 -0.000 -0.000 -0.000  0.000  0.000  0.000 -0.000  0.000 -0.000 -0.000  0.000  0.000 -0.000 -0.000  0.000  0.000 -0.000
    2  0.000 -0.000  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000 -0.000  0.000  0.000  0.000
    3 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
    4 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
    5  0.000 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    6  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    7  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    8 -0.000  0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
    9  0.000  0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   10  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   11 -0.000 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
   12 -0.000  0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
   13  0.000 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   14 -0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
tot    0.000 -0.000 -0.000  0.000 -0.000  0.000  0.000  0.000  0.000 -0.000  0.000  0.000 -0.000 -0.000  0.000  0.000  0.000

    1 -0.000  0.000 -0.000  0.000  0.000 -0.000  0.000  0.000  0.000  0.000 -0.000  0.000 -0.000 -0.000  0.000  0.000 -0.000
    2  0.000 -0.000 -0.000 -0.000 -0.000  0.000 -0.000 -0.000 -0.000 -0.000 -0.000 -0.000 -0.000 -0.000  0.000 -0.000  0.000
    3 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
    4 -0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
    5  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    6  0.000 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    7  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    8 -0.000  0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
    9  0.000  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   10  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   11 -0.000  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
   12 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
   13 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 -0.000
   14  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
tot   -0.000 -0.000  0.000  0.000  0.000  0.000 -0.000  0.000 -0.000 -0.000 -0.000  0.000 -0.000 -0.000  0.000 -0.000 -0.000

    1  0.469  0.000 -0.000  0.000  0.000 -0.000  0.000 -0.000  0.000  0.000 -0.000 -0.000 -0.000  0.000 -0.000 -0.000  0.469
    2  0.469  0.000 -0.000  0.000  0.000 -0.000  0.000 -0.000  0.000 -0.000 -0.000  0.000 -0.000 -0.000 -0.000  0.000  0.469
    3  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    4  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    5  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    6  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    7  0.000 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    8  0.000 -0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
    9  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   10  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   11  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   12  0.000  0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   13  0.000 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
   14  0.000 -0.000 -0.000 -0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
tot    0.941  0.000 -0.000  0.000  0.000 -0.000  0.000 -0.000  0.000  0.000 -0.000 -0.000 -0.000 -0.000 -0.000  0.000  0.941

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