def get_band_structure(self, atoms=None, calc=None): """ This is band structure function. It is compatible to ase dft module """ from ase.dft import band_structure if type(self['kpts']) is tuple: self['kpts'] = self.get_kpoints(band_kpath=self['band_kpath']) return band_structure.get_band_structure(self.atoms, self, )
def band_structure(self): """Create band-structure object for plotting.""" from ase.dft.band_structure import get_band_structure # XXX This calculator is supposed to just have done a band structure # calculation, but the calculator may not have the correct Fermi level # if it updated the Fermi level after changing k-points. # This will be a problem with some calculators (currently GPAW), and # the user would have to override this by providing the Fermi level # from the selfconsistent calculation. return get_band_structure(calc=self)
for i, k in enumerate(kpts): # Restart from ground state and fix potential: calc = GPAW( datapath + 'graphene_bilayer_sc_' + str(RRA) + '.gpw', fixdensity=True, kpts=[k], symmetry='off', txt=datapath + 'graphene_bilayer_bs_' + str(RRA) + '.txt', parallel=dict( band=5, # band parallelization augment_grids=True, # use all cores for XC/Poisson sl_auto=True) # enable parallel ScaLAPACK ) grap_bilayer.calc = calc en2 = calc.get_potential_energy() bs = get_band_structure(grap_bilayer, _bandpath=path).todict() ref.append(bs['reference']) energies.append(bs['energies'][0][0]) parprint(i, end=' ', flush=True) parprint('\nFinished band structure calculation.') parprint('Energy self-consistent:', en1, '\nEnergy band structure:', en2) bs = BandStructure(path, [energies], reference=ref[0]) bs.write(datapath + 'bandstructure_rot' + str(RRA) + '.json') path.write(datapath + 'bandpath_rot' + str(RRA) + '.json') parprint('Saved band structure file.')
calc.set( nbands=8, # 4 occupied and 4 unoccupied bands fixdensity=True, eigensolver=CG(niter=5), symmetry='off', kpts={ 'path': 'WGKL', 'npoints': 20 }, convergence={'bands': 'all'}, ) calc.get_potential_energy() path = bandpath('WGKL', atoms.get_cell(), npoints=20) bs_dft = get_band_structure(atoms=atoms, calc=calc, path=path, reference=evbm) write_json('bs_dft.json', bs_dft) bs_dft = read_json('bs_dft.json') bs_dft.plot(filename='bs_dft.png', show=False, emax=bs_dft.reference + 10, emin=bs_dft.reference - 20) dpbs = DftbPlusBandStructure(Hamiltonian_SCC='Yes', Hamiltonian_OrbitalResolvedSCC='No', Hamiltonian_MaxAngularMomentum_='', Hamiltonian_MaxAngularMomentum_N='p', Hamiltonian_MaxAngularMomentum_O='p', Hamiltonian_PolynomialRepulsive='SetForAll {Yes}',