| 1 |
from ase import Atoms |
| 2 |
from gpaw import GPAW |
| 3 |
from gpaw.tddft import TDDFT, DipoleMomentWriter, RestartFileWriter |
| 4 |
from gpaw.inducedfield.inducedfield_tddft import TDDFTInducedField |
| 5 |
|
| 6 |
# Na2 cluster |
| 7 |
atoms = Atoms(symbols='Na2', |
| 8 |
positions=[(0, 0, 0), (3.0, 0, 0)], |
| 9 |
pbc=False) |
| 10 |
atoms.center(vacuum=6.0) |
| 11 |
|
| 12 |
# Standard ground state calculation |
| 13 |
calc = GPAW(mode='fd', nbands=2, h=0.4, setups={'Na': '1'}, |
| 14 |
symmetry={'point_group': False}) |
| 15 |
atoms.calc = calc |
| 16 |
energy = atoms.get_potential_energy() |
| 17 |
calc.write('na2_gs.gpw', mode='all') |
| 18 |
|
| 19 |
# Standard time-propagation initialization |
| 20 |
time_step = 10.0 |
| 21 |
iterations = 3000 |
| 22 |
kick_strength = [1.0e-3, 0.0, 0.0] |
| 23 |
td_calc = TDDFT('na2_gs.gpw') |
| 24 |
DipoleMomentWriter(td_calc, 'na2_td_dm.dat') |
| 25 |
RestartFileWriter(td_calc, 'na2_td.gpw') |
| 26 |
|
| 27 |
# Create and attach InducedField object |
| 28 |
frequencies = [1.0, 2.08] # Frequencies of interest in eV |
| 29 |
folding = 'Gauss' # Folding function |
| 30 |
width = 0.1 # Line width for folding in eV |
| 31 |
ind = TDDFTInducedField(paw=td_calc, |
| 32 |
frequencies=frequencies, |
| 33 |
folding=folding, |
| 34 |
width=width, |
| 35 |
restart_file='na2_td.ind') |
| 36 |
|
| 37 |
# Propagate as usual |
| 38 |
td_calc.absorption_kick(kick_strength=kick_strength) |
| 39 |
td_calc.propagate(time_step, iterations) |
| 40 |
|
| 41 |
# Save TDDFT and InducedField objects |
| 42 |
td_calc.write('na2_td.gpw', mode='all') |
| 43 |
ind.write('na2_td.ind') |