qijingzheng / vaspbandunfolding Goto Github PK
View Code? Open in Web Editor NEWA collection of python scripts that deal with VASP outpts, e.g. WAVECAR, POTCAR etc.
A collection of python scripts that deal with VASP outpts, e.g. WAVECAR, POTCAR etc.
python elf.py
###################################################################
If you are using VESTA to view the resulting ELF, please rename the
output file as ELFCAR, otherwise there will be some error in the
isosurface plot!
When CHG*/PARCHG/*.vasp are read in to visualize isosurfaces and
sections, data values are divided by volume in the unit of bohr^3.
The unit of charge densities input by VESTA is, therefore, bohr^−3.
For LOCPOT/ELFCAR files, volume data are kept intact.
You can turn off this warning by setting "warn=False" in the "elf"
method.
###################################################################
/opt/intelpython2/lib/python2.7/site-packages/scipy/fftpack/basic.py:160: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)]
instead of arr[seq]
. In the future this will be interpreted as an array index, arr[np.array(seq)]
, which will result either in an error or a different result.
z[index] = x
Traceback (most recent call last):
File "elf.py", line 10, in
chi = wfc.elf(kptw=kptw, ngrid=[56, 56, 320])
File "/opt/VaspBandUnfolding/vaspwfc.py", line 748, in elf
tau += -phi_r * lap_phi_r.conj() * weight
TypeError: Cannot cast ufunc add output from dtype('complex128') to dtype('float64') with casting rule 'same_kind'
Hi, how are you? I am trying to do the unfolding part for a Silicon 4x4x4 supercell and it is not working. I tried before for Ga2O3 2x2x2 supercell and it worked fine, but now I am getting the following error:
"AssertionError: No. of planewaves not consistent! 31219 31263 91125"
Do you know what might be wrong? I think it could be one of the flags in VASP. I've been trying to decrease the number of plane waves (smaller ENCUT) but it hasn't worked yet.
Thanks in advance,
Igor Evangelista
Dear Professor Zheng,
Thanks for this excellent work!
Could you please add a citation option to this repository so I can cite your work in my publications?
Best,
Yifeng
Hello Qijing,
I tried to install your code but i didnt make it.
What I want to do, is to plot the wavefunctions in real space.
Could you please make me the instructions more clear?
Thank you sincerely!
Sotirios Fragkos
Suppose I would like to achieve the following purposes based on the wavefunction analysis from WAVRCAR:
I would like to know whether the method implemented in this package meets the above requirements.
See below for the related discussions:
https://www.vasp.at/forum/viewtopic.php?t=18177
See the related implementation below, which is based on this package:
https://github.com/SMTG-UCL/easyunfold/blob/main/easyunfold/wavecar.py
Regards,
Zhao
Dear QijingZheng,
I tried to run the example folder named as "unfold". With in this folder primitive calculations went fine. In sup_3x3x1 folder i have observed that the given POTCAR is incorrect. It is having other atoms also as shown below.
VRHFIN =Mo: 4p5s4d
VRHFIN =S : s2p4
VRHFIN =Se: s2p4
VRHFIN =W : 6s5d
I have created the supoer cell with 3x3x1 with the primitive POSCAR which is given in primitive folder.
i can able to get the converted KPOINTS file which is exactly same as in your example folder of sup_3x3x1.
After completion of the non-scf calculation i tried to run the below code for band sructure but ending with following error.
Processing k-point -0.4667 -0.4667 0.0000
Traceback (most recent call last):
File "band.py", line 39, in
sw = WaveSuper.spectral_weight(kpath)
File "/usr/local/lib/python2.7/dist-packages/unfold.py", line 454, in spectral_weight
for ik in range(NKPTS)])
File "/usr/local/lib/python2.7/dist-packages/unfold.py", line 344, in spectral_weight_k
ikpt = self.find_K_index(K0)
File "/usr/local/lib/python2.7/dist-packages/unfold.py", line 322, in find_K_index
'Cannot find the corresponding K-points in WAVECAR!'
ValueError: Cannot find the corresponding K-points in WAVECAR!
I did find any WAVECAR file in your sup_3x3x1 example folder to check the band part.
Please correct me where i went wrong.
Thanking you
Dear Prof. Zheng,
I want to use this code to get the IPR from the WAVECAR. What python script can I use?
I read the vaspwfc.py. I use the following script to obtain the ipr.npy file.
#!/usr/bin/env python
import numpy as np
from vaspwfc import vaspwfc
xx = vaspwfc('./WAVECAR')
ipr = xx.inverse_participation_ratio()
a=np.load('ipr.npy')
a.shape !a is a (1, 1, 672, 3) 4-D array.
What is the meaning of the 4-D array, particularly the last dimension? (nspin, NKPTS, NBANDS, ???)
I want to plot the "energy(x) vs IPR(y)" curlve. How can I deal with the data in ipr.npy?
Thanks!
The save2vesta
function borrows the CHGCAR format to visualize the wave function. Values in CHGCAR are multiplied with the cell volume V but save2vesta
doesn't follow this rule, and may result in extremely low charge density value in the output file.
Lines 14 to 56 in 03067e5
I think an operation psi *= pos.cell.volume
can solve this issue.
I want to use and learn VaspBandUnfolding code for band unfolding. In this sense, i downloaded your code and keep it in one of the directories. But i don't know how to install the code. As i am fresh Master student having a very little knowledge of python and Linux system installation and usage. Can you plz guide me step by step to install this code and then reproduce the examples as given by you. I would be very highly thankful to you.
Method readWFHeader in vaspwfc.py uses this code (currently lines 157-160):
self._recl, self._nspin, self._rtag = np.array(
np.fromfile(self._wfc, dtype=np.float, count=3),
dtype=int
)
It seems that for large WAVECARs dtype=int is not enough. I was getting overflow errors (don't remember all the details, I can try to reproduce the behaviour if needed).
Changing from dtype=int
to dtype=np.int64
fixed the issue.
Dear Prof. Qijing Zheng,
I'm having problems extracting the unfolded band energies in data form. After printing the spectral function after unfolding I'm still getting the folded bands. Could you please either direct me to the correct variables or add a function that also outputs the band structure in data form.
Thank you very much.
I was trying to parse WAVECAR myself and was trying to read both your program and Feenstra's program (http://www.andrew.cmu.edu/user/feenstra/wavetrans/source/WaveTrans.f90). It seems the following code assumes the lattice vectors are orthogonal:
Lines 178 to 180 in 8cd0a45
If the reciprocal lattice vectors are b1=[-0.99, 0.01, 0.0]
, b2=[0.99, 0.01, 0.0]
, b3=[0, 0, 1.0]
and the wave vector corresponding to the energy cutoff is G=10
, the norm of n*b1+n*b2
is smaller than G
as long as n<500
. But the above code would estimate n<=100
.
Hi Qijing,
Thanks for sharing the code with us. My team is recently working on extracting wave functions in real space using your code vaspwfc. And we check the 2-atom GaAs in rho cell. Since the |real part|^2+|imginary part|^2 of the wave function is the charge density, we compared the charge density calculated by the wave function and PARCHG generated by VASP itself for GaAs conduction band minimum. Here's the result we get.
charge density calculated by |real part|^2+|imginary part|^2
charge density by PARCHG at Gamma point pf conduction band minimum.
Do you know why there's a difference? Also, I can provide sample files if you would like.
Thank you very much again!
Qian
Hi.
Is it possible to unfold the band structure with spinor wavefunction like including spin-orbit coupling in VASP ? I tried this with your code but i got the error "Number of planewaves not consistent"
Thanks,
Anh
Dear Qi,
Your code is quite helpful, yet I have a question about transfomation matrix in the unfold class. You have written B = np.dot(np.linalg.inv(M).T, b) , but I found b=np.dot(M,B) i.e. B = np.dot(np.linalg.inv(M), b) in Phys. Rev. B 85, 085201 (2012), which lead differences of K sampling in supercell brillioun zone between two cases. Could you tell me why you choose transformation matrix M.T?
Thank you sincerely,
Xu
Dear Dr. Zheng,
I want to report an issue about procar.py, and along with a solution for it.
I noticed that when PROCAR is generated, there will be no space between signed numbers sometimes. Since the infomation is extracted by relative column numbers from the end, the procar.py will raise exception in these situations:
ValueError: could not convert string to float: ':'
For example, when PROCAR says
k-point 19 : 0.50000000-0.00000000 0.00000000 weight = 0.00231481
the line
in line 150 in procar.py will return
[':','0.50000000-0.00000000',‘0.00000000’]
instead of
['0.50000000','-0.00000000',‘0.00000000’]
and therefore, procar.py will exec float(':')
and thus will raise that ValueError.
To fix this issue, I suggest to fill this space before parsing PROCAR data. In detail, add these
for row in range(0,len(inp)):
inp[row] = re.sub(r'(?P<num1>[0-9]+)(?P<num2>[\+\-][0-9]+)','\g<num1> \g<num2>',inp[row])
at line 142 in procar.py. And the issue will be no more.
Best Regards,
Sun Sibai
IOPCAS L02
Hello.
When I run aewfc.py, I got the ModuleNotFoundError: No module named 'pysbt'.
How can I handle this error?
thanks...
Hello Qijing,
I've tried your elf method using the files you suggested to use (WAVECAR and ex.py) in "exemples - elf_test".
However, when running the program, I get the following error : "No. of planewaves not consistent! 1165 1166 3375". If I understand this correctly, it means that the calculated number of planewaves is not the same as the number of planewaves contained in the WAVECAR file.
Have you an idea where this error could come from ? I'm a beginner with the Vasp calculations so I have certainly misunderstood or misused something.
Thank you sincerely,
giorn
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.