File: bandstructure.py

package info (click to toggle)
python-ase 3.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,192 kB
  • ctags: 8,112
  • sloc: python: 93,375; sh: 99; makefile: 94
file content (19 lines) | stat: -rw-r--r-- 585 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from ase.build import bulk
from ase.calculators.test import FreeElectrons
from ase.dft.kpoints import special_paths
from ase.dft.band_structure import BandStructure

a = bulk('Cu')
path = special_paths['fcc']
a.calc = FreeElectrons(nvalence=1,
                       kpts={'path': path, 'npoints': 200})
a.get_potential_energy()
bs = a.calc.band_structure()
print(bs.labels)
bs.write('hmm.json')
bs = BandStructure(filename='hmm.json')
print(bs.labels)
assert ''.join(bs.labels) == 'GXWKGLUWLKUX'
import matplotlib
matplotlib.use('Agg', warn=False)
bs.plot(emax=10, filename='bs.png')