[gpaw-users] Eigen wave-function
Duy Le
ttduyle at gmail.com
Wed Apr 21 21:41:05 CEST 2010
Thank you. It produced with calc.wfs.kpt_u[ikpt].psit_nG[iband],
However, there seems to be a problem. The header of cube file is
different from that of charge cube file. I beleive that they must be
identical. Could you please explain to me what is written in wave
function cube file?
******Charge cube file's header:
cube file from ase
OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
2 0.000000 0.000000 0.000000
48 0.196846 0.000000 0.000000
48 0.000000 0.196846 0.000000
48 0.000000 0.000000 0.196846
6 0.000000 3.684966 4.724315 4.724315
8 0.000000 5.763664 4.724315 4.724315
***wave function cube file's header:
cube file from ase
OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
2 4.724315 0.000000 0.000000
1 4.724315 0.000000 0.000000
24 0.000000 0.393693 0.000000
24 0.000000 0.000000 0.393693
6 0.000000 3.684966 4.724315 4.724315
8 0.000000 5.763664 4.724315 4.724315
**** CO.py (generate CO.gpw)
##!/usr/bin/env python
from ase import *
from ase.lattice.surface import *
from ase.constraints import *
from gpaw import *
from gpaw.utilities.tools import cutoff2gridspacing, gridspacing2cutoff
d = 1.1 # bondlength of hydrogen molecule
a = 5.0 # sidelength of unit cell
c = a / 2
atoms = Atoms([Atom('C', [c - d / 2, c, c]),
Atom('O', [c + d / 2, c, c])],
cell=(a, a, a), pbc=True)
calc = GPAW(nbands=5, h=0.2, txt=None)
atoms.set_calculator(calc)
# Start a calculation:
energy = atoms.get_potential_energy()
# Save wave functions:
calc.write('CO.gpw', 'all')
*** CO.wave.py (to generate a charge cube file and wave function for k=0 band=1)
##!/usr/bin/env python
from ase import *
from ase.lattice.surface import *
from ase.constraints import *
from gpaw import *
from gpaw.utilities.tools import cutoff2gridspacing, gridspacing2cutoff
basename = 'CO'
# load nc binary file and get calculator
atoms, calc = restart(basename + '.gpw')
n = calc.get_all_electron_density(gridrefinement=2)
chg=basename+'.chg.cube'
write(chg,atoms , data=n)
k=0
band=1
wf1=calc.wfs.kpt_u[k].psit_nG[band],
fname1=basename+'.1.'+str(k)+'.'+str(band)+'.cube'
write(fname1, atoms, data=wf1)
wf2 = calc.get_pseudo_wave_function(band=band,kpt=k)
fname1=basename+'.2.'+str(k)+'.'+str(band)+'.cube'
write(fname2, atoms, data=wf2)
Note: I have never successfully get the 2nd wave function wf2.
--------------------------------------------------
Duy Le
PhD Student
Department of Physics
University of Central Florida.
"Men don't need hand to do things"
On Wed, Apr 21, 2010 at 1:58 PM, Jun Yan <juya at fysik.dtu.dk> wrote:
> Hi,
>
> Did you use calc.write('filename.gpw'.'all') command to write down the
> wavefunctions ?
> If you did and still have problems, can you attach your python file that
> used to generate this error ?
>
> A direct way to get the wavefunction is
> calc.wfs.kpt_u[ikpt].psit_nG[iband],
> while ikpt and iband are the number of kpoints and bands for the
> wavefunctions you want to get.
> Hope this helps.
>
> All the best,
> Jun Yan
>
> Duy Le wrote:
>
> Thanks. I have looked at that tutorial. I have never successfully
> obtained the wave function in cube format. It always ended up with the
> error "shape mismatch: objects cannot be broadcast to a single shape"
> (I asked yesterday, see in the end of this email).
> However, even if I successfully get cube file, I beleive that this
> will give Square of wavefunction. I want wavefunction only for my
> other analysis.
>
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "CO.wave.py", line 15, in ?
> wf = calc.get_pseudo_wave_function(band=band)
> File "/home/duyle/usr/lib64/python/gpaw/aseinterface.py", line 348, in
> get_pse
> udo_wave_function
> pad=False)
> File "/home/duyle/usr/lib64/python/gpaw/aseinterface.py", line 353, in
> get_pse
> udo_wave_function
> psit_G = self.wfs.get_wave_function_array(band, kpt, spin)
> File "/home/duyle/usr/lib64/python/gpaw/wavefunctions.py", line 405, in
> get_wa
> ve_function_array
> psit_G = self.gd.collect(psit1_G)
> File "/home/duyle/usr/lib64/python/gpaw/grid_descriptor.py", line 373, in
> coll
> ect
> A_xg[..., b0:e0, b1:e1, b2:e2] = a_xg
> ValueError: shape mismatch: objects cannot be broadcast to a single shape
> ----------------------------------------------------------------------
> --------------------------------------------------
> Duy Le
> PhD Student
> Department of Physics
> University of Central Florida.
>
> "Men don't need hand to do things"
>
>
>
> On Wed, Apr 21, 2010 at 12:19 PM, Ask Hjorth Larsen <askhl at fysik.dtu.dk>
> wrote:
>
>
> Dear Duy Le
>
>
>
> Dear all,
> I wonder if it is possible to get KS wave functions with gpaw? I want
> KS wave function to perform post processing.
>
>
> You can find an example in the wave function plotting tutorial:
>
> https://wiki.fysik.dtu.dk/gpaw/tutorials/plotting/plot_wave_functions.html
>
> This will get the pseudo wave functions, not the all-electron ones. The
> all-electron ones are normally too nasty.
>
> Regards
> Ask
>
>
>
> _______________________________________________
> gpaw-users mailing list
> gpaw-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
>
>
More information about the gpaw-users
mailing list