Visualize the Wavefunction
Moderators: Global Moderator, Moderator
-
- Newbie
- Posts: 46
- Joined: Mon Mar 13, 2006 10:34 am
Visualize the Wavefunction
Dear Vasp Users.
I want to visualize calculated wave function, for example, the
lowest state of conduction band, or the highest state of valence
band.
Are there any 3D viewers suitable for VASP ?
Sincerely.
I want to visualize calculated wave function, for example, the
lowest state of conduction band, or the highest state of valence
band.
Are there any 3D viewers suitable for VASP ?
Sincerely.
Last edited by okuno on Mon Aug 17, 2009 10:03 am, edited 1 time in total.
-
- Administrator
- Posts: 2921
- Joined: Tue Aug 03, 2004 8:18 am
- License Nr.: 458
Visualize the Wavefunction
sorry, we have no plotting utilities for the wavefunction
Last edited by admin on Mon Oct 12, 2009 3:03 pm, edited 1 time in total.
Visualize the Wavefunction
You can parse the binary WAVECAR file knowing the DFT mesh and then format for a viewer like XCRYSDEN, this could give you the Fermi Surface, which would tell you the 3D band structure information. I am working on a script to automate this in python, if I have any success I will be happy to show you how to do this.
Last edited by panda on Mon Nov 09, 2009 5:07 am, edited 1 time in total.
Visualize the Wavefunction
panda - it would be grate. Where can I find your script if you make it?
I'm not sure what exactly you mean by "3D band structure", it is already stored in eigenvalues for each k-point, or not?
I'd like just simple real-space projection of molecular orbitals for simple molecules. May be just gamma k-point is enought.
I'm not sure what exactly you mean by "3D band structure", it is already stored in eigenvalues for each k-point, or not?
I'd like just simple real-space projection of molecular orbitals for simple molecules. May be just gamma k-point is enought.
Last edited by asija on Mon Nov 09, 2009 11:44 am, edited 1 time in total.
Visualize the Wavefunction
well "3D band structure" would actually be from the charge density, and the wave function could be mapped onto that surface. I have been meaning to set up a blog with some utilities but have been really busy lately. I have not completed this task by any means though, only a small portion.
Last edited by panda on Mon Nov 09, 2009 4:11 pm, edited 1 time in total.
Visualize the Wavefunction
OK, here is a start. I used python. You can perform some simple pack/unpack statements at the python interactive shell to get an idea of how to read a binary file. You can also google "python parsing binary file" and tons of hits will come up.
Something like this:
#!/usr/bin/python
import sys
from struct import unpack, pack
f = open('/path/to/WAVECAR/file, 'rb')
line = f.read()
Then you could do something like this to unpack the values:
for i in [j for j in r if j % 4 == 0 and j + 4 <= len(line)]:
print i
val = unpack('f', line[i:i+4])
val = val[0]
After that its up to you, specify your mesh, put it into a matrix, plot it, and away you go. OK, maybe not THAT simple, but at least this gives you some idea.
Disclaimer: **This is by no means a completed script and is meant only to serve as an example. Python formatting may not be correct
Something like this:
#!/usr/bin/python
import sys
from struct import unpack, pack
f = open('/path/to/WAVECAR/file, 'rb')
line = f.read()
Then you could do something like this to unpack the values:
for i in [j for j in r if j % 4 == 0 and j + 4 <= len(line)]:
print i
val = unpack('f', line[i:i+4])
val = val[0]
After that its up to you, specify your mesh, put it into a matrix, plot it, and away you go. OK, maybe not THAT simple, but at least this gives you some idea.
Disclaimer: **This is by no means a completed script and is meant only to serve as an example. Python formatting may not be correct
Last edited by panda on Wed Nov 11, 2009 1:59 am, edited 1 time in total.
-
- Newbie
- Posts: 46
- Joined: Mon Mar 13, 2006 10:34 am
Visualize the Wavefunction
Dear panda.
Thank you for reply.
If you made a python script for plotting WAVECAR file by
XCrysden, can you open the scripts for vasp users ?
Sincerely.
Thank you for reply.
If you made a python script for plotting WAVECAR file by
XCrysden, can you open the scripts for vasp users ?
Sincerely.
Last edited by okuno on Thu Nov 12, 2009 1:21 am, edited 1 time in total.
Visualize the Wavefunction
I will use it actually for calculating partially occupied Wannier Functions, and was planning on using matplotlib for plotting, but we can easily write a conversion utility for XCrysDen format. I will work on putting together a blog this weekend with the source code. Do you use python also? I am just now also learning Erlang and so plan to do more with it in the future, but so many nice utilities already exist for math and science in python.
Last edited by panda on Thu Nov 12, 2009 10:25 pm, edited 1 time in total.
-
- Newbie
- Posts: 10
- Joined: Thu Feb 24, 2011 7:54 pm
- Location: Boulder, Co, USA
Visualize the Wavefunction
Hi Everyone,
this looks like it could be a great help to a lot of people, Panda did you ever get the script working?
Thanks
Chris
this looks like it could be a great help to a lot of people, Panda did you ever get the script working?
Thanks
Chris
Last edited by cmuhich on Tue May 24, 2011 6:42 pm, edited 1 time in total.
-
- Newbie
- Posts: 24
- Joined: Wed Aug 04, 2010 12:19 pm
Visualize the Wavefunction
I don't want to open the new thread so I'll ask my questions here.
I am trying to parse the WAVECAR file, and by unpacking every 8 bytes to double precision floats I was able to to cast WAVECAR contents into a large array of floating point data.
Now I have a problem of parsing it. Usually, when WAVECAR is broken up, I would have large chunks of data, separated by large blocks of 0s and it is then not hard to parse it since for every k-point and every band, block holding corresponding wavefunction coefficients is between blocks of zeros, but sometimes it happens that blocks holding coefficients for different bands gets merged together, and the size of the block is larger then number_of_plane_waves(k) x number_of_bands(k) so I don't have simple way to separate them out.
Can anyone help me with this?
Thanks
I am trying to parse the WAVECAR file, and by unpacking every 8 bytes to double precision floats I was able to to cast WAVECAR contents into a large array of floating point data.
Now I have a problem of parsing it. Usually, when WAVECAR is broken up, I would have large chunks of data, separated by large blocks of 0s and it is then not hard to parse it since for every k-point and every band, block holding corresponding wavefunction coefficients is between blocks of zeros, but sometimes it happens that blocks holding coefficients for different bands gets merged together, and the size of the block is larger then number_of_plane_waves(k) x number_of_bands(k) so I don't have simple way to separate them out.
Can anyone help me with this?
Thanks
Last edited by tomic on Tue Aug 16, 2011 10:38 pm, edited 1 time in total.
-
- Newbie
- Posts: 24
- Joined: Wed Aug 04, 2010 12:19 pm
Visualize the Wavefunction
OK, I think I've figured out the structure so far. First 8 bytes specify the length of the record and record length is equal to the maximum number of plane waves for a k-point, as specified in the OUTCAR file. Though, what is puzzling is that first eight bytes are not long integers, as one would expect for size, but are double floats.
If I break WAVECAR into records I get some bytes at the end of the file as a remainder. Do those mean something, or I assume wrongly that WAVECAR is evenly broken up into records of same length?
Thanks
<span class='smallblacktext'>[ Edited Wed Aug 17 2011, 06:23PM ]</span>
If I break WAVECAR into records I get some bytes at the end of the file as a remainder. Do those mean something, or I assume wrongly that WAVECAR is evenly broken up into records of same length?
Thanks
<span class='smallblacktext'>[ Edited Wed Aug 17 2011, 06:23PM ]</span>
Last edited by tomic on Wed Aug 17, 2011 6:21 pm, edited 1 time in total.
-
- Administrator
- Posts: 2921
- Joined: Tue Aug 03, 2004 8:18 am
- License Nr.: 458
Visualize the Wavefunction
just to remind you: WAVECAR gives the wave function COEFFICIENTS, not the wavefunctions
Last edited by admin on Wed Aug 31, 2011 4:36 pm, edited 1 time in total.
Visualize the Wavefunction
yes, but if you get the coefficients of the wavefunction (C1, C2, etc.) then you can use those to calculate the Wannier functions, right?... correct me if I am wrong please, but this is what I thought you could do. However, I don't really understand the structure of the WAVECAR and where to parse to find the coefficients. I have the same problem as tomic - I can get the binary data into an array, but because I don't know the format of the file I don't know what to do with the data. Admin, could you shed some light on this please?
Last edited by panda on Thu Sep 01, 2011 6:53 pm, edited 1 time in total.
-
- Newbie
- Posts: 8
- Joined: Tue Jun 14, 2005 9:10 pm
Visualize the Wavefunction
Tools for reading and evaluating wavefunctions have been posted on the web at http://www.andrew.cmu.edu/user/feenstra/wavetrans/
Documentation at this site describes the format of the binary WAVECAR file. A Fortran program is given to read the WAVECAR and write a text file containing the wavefunction coefficients and their associated basis functions. An alternative program shows how to extract a specific wavefunction and evaluate it in real space.
Documentation at this site describes the format of the binary WAVECAR file. A Fortran program is given to read the WAVECAR and write a text file containing the wavefunction coefficients and their associated basis functions. An alternative program shows how to extract a specific wavefunction and evaluate it in real space.
Last edited by widom on Thu Jul 05, 2012 9:17 pm, edited 1 time in total.
-
- Newbie
- Posts: 2
- Joined: Mon Mar 18, 2013 3:40 pm
Visualize the Wavefunction
[quote="panda"]You can parse the binary WAVECAR file knowing the DFT mesh and then format for a viewer like XCRYSDEN, this could give you the Fermi Surface, which would tell you the 3D band structure information. I am working on a script to automate this in python, if I have any success I will be happy to show you how to do this. [/quote]
I want to draw fermi surface within VASP. Could you help me with the script.
I want to draw fermi surface within VASP. Could you help me with the script.
Last edited by xcid on Mon Mar 18, 2013 3:51 pm, edited 1 time in total.