Attachment 'plotwavefunction.py'
Download 1 #Saving the wave function as a .Cube file
2 #This does unfortunately only work for cubic unit cells. You should use VTK to plot wave functions in non cubic unit cells
3
4 import os
5 from Dacapo import Dacapo
6 from ASE import Atom, ListOfAtoms
7 from ASE.IO.Cube import WriteCube
8 atoms=Dacapo.ReadAtoms('filename')
9 calc=atoms.GetCalculator()
10 for band in range(6):
11 wavefunction_array=calc.GetWaveFunctionArray(band=band)
12 #The wave function cube file is written as the density array, with the only difference being that we include the phase of the wave function as either + or - so that wave functions with opposite phases have opposite signs
13 WriteCube(atoms,wavefunction_array,'wavefunctionarray_%d.cube' %band,real=True)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.