| 1 |
from gpaw import GPAW |
| 2 |
from gpaw.lrtddft import LrTDDFT, photoabsorption_spectrum |
| 3 |
from gpaw.inducedfield.inducedfield_lrtddft import LrTDDFTInducedField |
| 4 |
|
| 5 |
# Load LrTDDFT object |
| 6 |
lr = LrTDDFT.read('na2_lr.dat.gz') |
| 7 |
|
| 8 |
# Calculate photoabsorption spectrum as usual |
| 9 |
folding = 'Gauss' |
| 10 |
width = 0.1 |
| 11 |
e_min = 0.0 |
| 12 |
e_max = 4.0 |
| 13 |
photoabsorption_spectrum(lr, 'na2_casida_spectrum.dat', |
| 14 |
folding=folding, width=width, |
| 15 |
e_min=e_min, e_max=e_max, delta_e=1e-2) |
| 16 |
|
| 17 |
# Load GPAW object |
| 18 |
calc = GPAW('na2_gs_casida.gpw') |
| 19 |
|
| 20 |
# Calculate induced field |
| 21 |
frequencies = [1.0, 2.08] # Frequencies of interest in eV |
| 22 |
folding = 'Gauss' # Folding function |
| 23 |
width = 0.1 # Line width for folding in eV |
| 24 |
kickdir = 0 # Kick field direction 0, 1, 2 for x, y, z |
| 25 |
ind = LrTDDFTInducedField(paw=calc, |
| 26 |
lr=lr, |
| 27 |
frequencies=frequencies, |
| 28 |
folding=folding, |
| 29 |
width=width, |
| 30 |
kickdir=kickdir) |
| 31 |
ind.calculate_induced_field(gridrefinement=2, from_density='comp') |
| 32 |
ind.write('na2_casida_field.ind', mode='field') |