Visualize the Wavefunction

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Message
Author
okuno
Newbie
Newbie
Posts: 46
Joined: Mon Mar 13, 2006 10:34 am

Visualize the Wavefunction

#1 Post by okuno » Mon Aug 17, 2009 10:03 am

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.
Last edited by okuno on Mon Aug 17, 2009 10:03 am, edited 1 time in total.

admin
Administrator
Administrator
Posts: 2921
Joined: Tue Aug 03, 2004 8:18 am
License Nr.: 458

Visualize the Wavefunction

#2 Post by admin » Mon Oct 12, 2009 3:03 pm

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.

panda

Visualize the Wavefunction

#3 Post by panda » Mon Nov 09, 2009 5:07 am

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.

asija

Visualize the Wavefunction

#4 Post by asija » Mon Nov 09, 2009 11:44 am

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.
Last edited by asija on Mon Nov 09, 2009 11:44 am, edited 1 time in total.

panda

Visualize the Wavefunction

#5 Post by panda » Mon Nov 09, 2009 4:11 pm

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.

panda

Visualize the Wavefunction

#6 Post by panda » Wed Nov 11, 2009 1:59 am

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 :D
Last edited by panda on Wed Nov 11, 2009 1:59 am, edited 1 time in total.

okuno
Newbie
Newbie
Posts: 46
Joined: Mon Mar 13, 2006 10:34 am

Visualize the Wavefunction

#7 Post by okuno » Thu Nov 12, 2009 1:21 am

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.
Last edited by okuno on Thu Nov 12, 2009 1:21 am, edited 1 time in total.

panda

Visualize the Wavefunction

#8 Post by panda » Thu Nov 12, 2009 10:25 pm

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.

cmuhich
Newbie
Newbie
Posts: 10
Joined: Thu Feb 24, 2011 7:54 pm
Location: Boulder, Co, USA

Visualize the Wavefunction

#9 Post by cmuhich » Tue May 24, 2011 6:42 pm

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
Last edited by cmuhich on Tue May 24, 2011 6:42 pm, edited 1 time in total.

tomic
Newbie
Newbie
Posts: 24
Joined: Wed Aug 04, 2010 12:19 pm

Visualize the Wavefunction

#10 Post by tomic » Tue Aug 16, 2011 10:38 pm

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
Last edited by tomic on Tue Aug 16, 2011 10:38 pm, edited 1 time in total.

tomic
Newbie
Newbie
Posts: 24
Joined: Wed Aug 04, 2010 12:19 pm

Visualize the Wavefunction

#11 Post by tomic » Wed Aug 17, 2011 6:21 pm

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>
Last edited by tomic on Wed Aug 17, 2011 6:21 pm, edited 1 time in total.

admin
Administrator
Administrator
Posts: 2921
Joined: Tue Aug 03, 2004 8:18 am
License Nr.: 458

Visualize the Wavefunction

#12 Post by admin » Wed Aug 31, 2011 4:36 pm

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.

panda

Visualize the Wavefunction

#13 Post by panda » Thu Sep 01, 2011 6:53 pm

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.

widom
Newbie
Newbie
Posts: 8
Joined: Tue Jun 14, 2005 9:10 pm

Visualize the Wavefunction

#14 Post by widom » Thu Jul 05, 2012 9:17 pm

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.
Last edited by widom on Thu Jul 05, 2012 9:17 pm, edited 1 time in total.

xcid
Newbie
Newbie
Posts: 2
Joined: Mon Mar 18, 2013 3:40 pm

Visualize the Wavefunction

#15 Post by xcid » Mon Mar 18, 2013 3:51 pm

[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.
Last edited by xcid on Mon Mar 18, 2013 3:51 pm, edited 1 time in total.

Post Reply