Open TomokiUchiyama opened 1 year ago
Hey TomokiUchiyama,
sorry for the very late response. My schedule has been very crazy in the last 3 weeks. I finally had time to look into this issue.
The issue was the unfolding was out of date with the current parsing methods. I just pushed the updates to Git Hub. I did an example of MgB2 in a 2 2 2 supercell here is the function call to do this
pyprocar.unfold( code='vasp', mode='plain', unfold_mode='both', dirname= data_dir, orbitals=[1,2,3], elimit=[-15,5], supercell_matrix=np.diag([2, 2, 2]))
Here, are the bands in the primitive cell: pyprocar.bandsplot( code='vasp', mode='plain', dirname= prim_data_dir, elimit=[-15,5])
I plan on making an example of this for the example gallery. However, this is going to take me another week.
Again, sorry for the late response.
Logan Lang
Hi Logan Lang,
Thanks for help despite your busy schedule !
Tomoki Uchiyama
Hi, I'm now trying to unfold energy band of LiNbO3 (2x2x1 supercell), calculated by VASP, but it fail as shown below. INCAR,KPOINTS files are also attached. Please help me if you have any ideas.
input===========
Band unfolding
import pyprocar import numpy as np data_dir = r"C:\Users\tomok\Desktop\pyprocar\test2" pyprocar.unfold(dirname=data_dir, fname='PROCAR', poscar='POSCAR', outcar='OUTCAR', supercell_matrix=np.diag([2, 2, 1]), ispin=1, # None for non-spin polarized calculation. For spin polarized case, ispin=1: up, ispin=2: down efermi=None, shift_efermi=True, elimit=(-5, 15), kticks=[0, 36, 54, 86, 110, 147, 165, 199], knames=['$\Gamma$', 'K', 'M', '$\Gamma$', 'A', 'H', 'L', 'A'], print_kpts=False, show_band=True, width=4, color='blue', savetab='unfolding.csv', savefig='unfolded_band.png', exportplt=False)
output============================
ValueError
Traceback (most recent call last) Cell In[1], line 5 3 import numpy as np 4 data_dir = r"C:\Users\tomok\Desktop\pyprocar\test2" ----> 5 pyprocar.unfold(dirname=data_dir, 6 fname='PROCAR', 7 poscar='POSCAR', 8 outcar='OUTCAR', 9 supercell_matrix=np.diag([2, 2, 1]), 10 ispin=4, # None for non-spin polarized calculation. For spin polarized case, ispin=1: up, ispin=2: down 11 efermi=None, 12 shift_efermi=True, 13 elimit=(-5, 15), 14 kticks=[0, 36, 54, 86, 110, 147, 165, 199], 15 knames=['$\Gamma$', 'K', 'M', '$\Gamma$', 'A', 'H', 'L', 'A'], 16 print_kpts=False, 17 show_band=True, 18 width=4, 19 color='blue', 20 savetab='unfolding.csv', 21 savefig='unfolded_band.png', 22 exportplt=False)
File ~\AppData\Roaming\jupyterlab-desktop\jlab_server\lib\site-packages\pyprocar\scripts\scriptUnfold.py:110, in unfold(procar, poscar, outcar, vaspxml, abinit_output, dirname, transformation_matrix, kpoints, elkin, code, mode, unfold_mode, spins, atoms, orbitals, items, projection_mask, unfold_mask, fermi, interpolation_factor, interpolation_type, vmax, vmin, kticks, knames, kdirect, elimit, ax, show, savefig, old, savetab, **kwargs) 80 settings.ebs.modify(settings.unfold.config) 82 # if code == "vasp": 83 # if outcar is not None: 84 # outcar = io.vasp.Outcar(outcar) (...) 108 # interpolation_factor=interpolation_factor, 109 # ) --> 110 parser = io.Parser(code = code, dir = dirname) 111 ebs = parser.ebs 113 ebs_plot = EBSPlot(ebs, kpath, ax, spins)
File ~\AppData\Roaming\jupyterlab-desktop\jlab_server\lib\site-packages\pyprocar\io\parser.py:27, in Parser.init(self, code, dir) 24 self.code = code 25 self.dir = dir ---> 27 self.parse()
File ~\AppData\Roaming\jupyterlab-desktop\jlab_server\lib\site-packages\pyprocar\io\parser.py:49, in Parser.parse(self) 46 self.parse_siesta() 48 elif self.code == "vasp": ---> 49 self.parse_vasp() 51 elif self.code == "elk": 52 self.parse_elk()
File ~\AppData\Roaming\jupyterlab-desktop\jlab_server\lib\site-packages\pyprocar\io\parser.py:239, in Parser.parse_vasp(self) 234 except: 235 self.kpath=None --> 239 procar = vasp.Procar( 240 filename=procar, 241 structure=poscar.structure, 242 reciprocal_lattice=poscar.structure.reciprocal_lattice, 243 kpath=self.kpath, 244 n_kx=outcar.n_kx, 245 n_ky=outcar.n_ky, 246 n_kz=outcar.n_kz, 247 efermi=outcar.efermi, 248 interpolation_factor=1 249 ) 251 try: 252 vasprun = vasp.VaspXML(filename = vasprun)
File ~\AppData\Roaming\jupyterlab-desktop\jlab_server\lib\site-packages\pyprocar\io\vasp.py:613, in Procar.init(self, filename, structure, reciprocal_lattice, kpath, n_kx, n_ky, n_kz, efermi, interpolation_factor) 610 self.orbitalName_short = ["s", "p", "d", "f", "tot"] 611 self.labels = self.orbitalName_old[:-1] --> 613 self._read()
614 if self.has_phase: 615 self.carray = self.spd_phase[:, :, :, :-1, 1:-1]
File ~\AppData\Roaming\jupyterlab-desktop\jlab_server\lib\site-packages\pyprocar\io\vasp.py:756, in Procar._read(self) 754 self._read_orbitals() 755 if self.has_phase: --> 756 self._read_phases() 757 rf.close() 758 return
File ~\AppData\Roaming\jupyterlab-desktop\jlab_server\lib\site-packages\pyprocar\io\vasp.py:1108, in Procar._read_phases(self) 1106 up, down = np.vsplit(self.spd_phase, 2) 1107 # ispin = 1 for a while, we will made the distinction -> 1108 up = up.reshape( 1109 self.kpointsCount, 1110 int(self.bandsCount / 2), 1111 1, 1112 self.ionsCount+1, 1113 self.orbitalCount 2, 1114 ) 1115 down = down.reshape( 1116 self.kpointsCount, 1117 int(self.bandsCount / 2), (...) 1120 self.orbitalCount 2, 1121 ) 1122 # concatenating bandwise. Density and magntization, their 1123 # meaning is obvious, and do uses 2 times more memory than 1124 # required, but I WANT to keep it as close as possible to the 1125 # non-collinear or non-polarized case
ValueError: cannot reshape array of size 15681600 into shape (12,270,1,121,20)
INCAR.txt KPOINTS.txt