| 1 |
# web-page: tc_000_with_08.00eV.txt |
| 2 |
# Start |
| 3 |
from ase.parallel import paropen |
| 4 |
from gpaw import GPAW |
| 5 |
from gpaw.lrtddft2 import LrTDDFT2 |
| 6 |
|
| 7 |
# Maximum energy difference for Kohn-Sham transitions |
| 8 |
# included in the calculation |
| 9 |
max_energy_diff = 8.0 # eV |
| 10 |
|
| 11 |
calc = GPAW('unocc.gpw') |
| 12 |
lr = LrTDDFT2('lr2', calc, |
| 13 |
fxc='LDA', |
| 14 |
max_energy_diff=max_energy_diff, |
| 15 |
txt='-') |
| 16 |
|
| 17 |
# Get and write spectrum |
| 18 |
spec = lr.get_spectrum('spectrum_with_%05.2feV.dat' |
| 19 |
% max_energy_diff, |
| 20 |
min_energy=0, |
| 21 |
max_energy=10, |
| 22 |
energy_step=0.01, |
| 23 |
width=0.1) |
| 24 |
|
| 25 |
# Get and write transitions |
| 26 |
trans = lr.get_transitions('transitions_with_%05.2feV.dat' |
| 27 |
% max_energy_diff, |
| 28 |
min_energy=0.0, |
| 29 |
max_energy=10.0) |
| 30 |
|
| 31 |
# Get and write transition contributions |
| 32 |
index = 0 |
| 33 |
f2 = lr.get_transition_contributions(index_of_transition=index) |
| 34 |
with paropen('tc_%03d_with_%05.2feV.txt' |
| 35 |
% (index, max_energy_diff), 'w') as f: |
| 36 |
f.write('Transition %d at %.2f eV\n' % (index, trans[0][index])) |
| 37 |
f.write(' %5s => %5s contribution\n' % ('occ', 'unocc')) |
| 38 |
for (ip, val) in enumerate(f2): |
| 39 |
if (val > 1e-3): |
| 40 |
f.write(' %5d => %5d %8.4f%%\n' % |
| 41 |
(lr.ks_singles.kss_list[ip].occ_ind, |
| 42 |
lr.ks_singles.kss_list[ip].unocc_ind, |
| 43 |
val / 2. * 100)) |