[gpaw-users] Tutorial of Band calculation craches with TypeError

Jens Jørgen Mortensen jensj at fysik.dtu.dk
Wed Feb 15 13:26:38 CET 2017


On 02/13/2017 04:15 PM, Maxim Skripnik via gpaw-users wrote:
> I think there is a mistake in the tutorial. The GPAW object needs the 
> k-points in a different format. You first have to create a k-point 
> path with ASE and then pass it path to GPAW().

The band-structure tutorial has been changed quite a bit (it's much 
simpler now).  Could you try out the new tutorial with the latest 
GPAW-1.2.0 and ASE-3.13.0?

https://wiki.fysik.dtu.dk/gpaw/tutorials/bandstructures/bandstructures.html

Jens Jørgen

>
> Example (Si):
>
> from __future__ import print_function
>
> ################################################################################################## 
>
> # Perform standard ground state calculation (with plane wave basis)
>
> from ase.build import bulk
> from gpaw import GPAW, PW, FermiDirac
>
> si = bulk('Si', 'diamond', 5.43)
> calc = GPAW(mode=PW(200),
>             xc='PBE',
>             kpts=(8, 8, 8),
>             random=True,  # random guess (needed if many empty bands 
> required)
>             occupations=FermiDirac(0.01),
>             txt='Si_gs.txt')
> si.calc = calc
> si.get_potential_energy()
> ef = calc.get_fermi_level()
> calc.write('Si_gs.gpw')
>
> ################################################################################################## 
>
> # calculate the band structure
>
> nband = 8
>
> import numpy
> from ase.dft.kpoints import ibz_points, get_bandpath
> from gpaw import PW, FermiDirac
>
> # Restart from ground state and fix potential:
> calc = GPAW('Si_gs.gpw',
>             nbands=nband+10,
>             convergence={'bands': nband},
>             fixdensity=True,
>             symmetry='off')
>
> # Use ase.dft module for obtaining k-points along high symmetry 
> directions
> points = ibz_points['hexagonal']
> G = points['Gamma']
> M = points['M']
> K = points['K']
> kpts, x, X = get_bandpath([G, M, K, G], calc.atoms.cell, npoints=40)
>
> calc.set(kpts=kpts)
> calc.get_potential_energy()
> e_kn = numpy.array([calc.get_eigenvalues(k) for k in range(len(kpts))])
>
> ################################################################################################## 
>
> # save the band structure
>
> e_kn -= ef
> emin = e_kn.min() - 1.0
> emax = e_kn[:, nband-1].max() + 1.0
>
> fd = open('bands.data', 'w')
> for i in range(len(x)):
>     print('%5.2f ' % x[i], file=fd, end="")
>     for j in range(len(e_kn[i])):
>         print('%5.2f ' % e_kn[i][j], file=fd, end="")
>     print('', file=fd)
> fd.close()
> _______________________________________________
> 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