File: bandstructure.py

package info (click to toggle)
python-ase 3.17.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,340 kB
  • sloc: python: 117,348; makefile: 91
file content (21 lines) | stat: -rw-r--r-- 664 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import matplotlib
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()
coords, labelcoords, labels = bs.get_labels()
print(labels)
bs.write('hmm.json')
bs = BandStructure.read('hmm.json')
coords, labelcoords, labels = bs.get_labels()
print(labels)
assert ''.join(labels) == 'GXWKGLUWLKUX'
matplotlib.use('Agg', warn=False)
bs.plot(emax=10, filename='bs.png')