Debian Codegraph @

doc/tutorialsexercises/energetics/cohesive_energy/pt.py

raw
1 from ase import Atoms
2 from ase.build import bulk
3 from gpaw import GPAW
4
5 atom = Atoms('Pt')
6 atom.center(vacuum=6.0)
7 atom.calc = GPAW(
8 xc='PBE',
9 mode={'name': 'pw', 'ecut': 600.0},
10 nbands=-2,
11 mixer={'backend': 'no-mixing'},
12 occupations={'name': 'fixed-uniform'},
13 hund=True,
14 eigensolver={'name': 'etdm-fdpw', 'converge_unocc': True},
15 symmetry='off',
16 txt='pt-atom.txt')
17 e_atom = atom.get_potential_energy()
18 atom.calc.write('pt-atom.gpw')
19
20 bulk = bulk('Pt', 'fcc', a=3.92)
21 k = 8
22 bulk.calc = GPAW(
23 xc='PBE',
24 mode={'name': 'pw', 'ecut': 600.0},
25 kpts=(k, k, k),
26 txt='pt-bulk.txt')
27 e_bulk = bulk.get_potential_energy()
28
29 e_cohesive = e_atom - e_bulk
30 print(e_cohesive, 'eV')