| 1 |
from gpaw import GPAW |
| 2 |
from gpaw.spherical_harmonics import names |
| 3 |
from ase.units import Ha |
| 4 |
|
| 5 |
calc = GPAW('pt-atom.gpw') |
| 6 |
setup = calc.setups[0] |
| 7 |
labels = [f'{n}{"spd"[l]}({names[l][m]})' |
| 8 |
for n, l in zip(setup.n_j, setup.l_j) |
| 9 |
for m in range(2 * l + 1)] |
| 10 |
|
| 11 |
lines = ['#,eig. [eV],occ,character,eig. [eV],occ,character'] |
| 12 |
for n in range(11): |
| 13 |
line = str(n) |
| 14 |
for spin in [0, 1]: |
| 15 |
kpt = calc.wfs.kpt_qs[0][spin] |
| 16 |
P_i = kpt.P_ani[0][n] |
| 17 |
i = abs(P_i).argmax() |
| 18 |
label = labels |
| 19 |
eig = kpt.eps_n[n] * Ha |
| 20 |
occ = kpt.f_n[n] |
| 21 |
line += f',{eig:.3f},{occ:.1f},{labels[i]}' |
| 22 |
lines.append(line) |
| 23 |
|
| 24 |
# Write csv-file: |
| 25 |
with open('pt-atom.csv', 'w') as fd: |
| 26 |
print('\n'.join(lines), file=fd) |