| 1 |
from ase import Atoms |
| 2 |
from gpaw import GPAW |
| 3 |
from gpaw.fdtd.poisson_fdtd import FDTDPoissonSolver |
| 4 |
from gpaw.fdtd.polarizable_material import (PermittivityPlus, |
| 5 |
PolarizableMaterial, |
| 6 |
PolarizableSphere) |
| 7 |
from gpaw.tddft import TDDFT, DipoleMomentWriter, photoabsorption_spectrum |
| 8 |
from gpaw.inducedfield.inducedfield_tddft import TDDFTInducedField |
| 9 |
from gpaw.inducedfield.inducedfield_fdtd import FDTDInducedField |
| 10 |
from gpaw.mpi import world |
| 11 |
import numpy as np |
| 12 |
|
| 13 |
|
| 14 |
radius = 7.40 |
| 15 |
|
| 16 |
|
| 17 |
atom_center = np.array([30., 15., 15.]) |
| 18 |
sphere_center = np.array([15., 15., 15.]) |
| 19 |
simulation_cell = np.array([40., 30., 30.]) |
| 20 |
|
| 21 |
|
| 22 |
atoms = Atoms('Na2', atom_center + np.array([[-1.5, 0.0, 0.0], |
| 23 |
[1.5, 0.0, 0.0]])) |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
eps_gold = PermittivityPlus(data=[[0.2350, 0.1551, 95.62], |
| 28 |
[0.4411, 0.1480, -12.55], |
| 29 |
[0.7603, 1.946, -40.89], |
| 30 |
[1.161, 1.396, 17.22], |
| 31 |
[2.946, 1.183, 15.76], |
| 32 |
[4.161, 1.964, 36.63], |
| 33 |
[5.747, 1.958, 22.55], |
| 34 |
[7.912, 1.361, 81.04]]) |
| 35 |
|
| 36 |
|
| 37 |
classical_material = PolarizableMaterial() |
| 38 |
classical_material.add_component(PolarizableSphere(center=sphere_center, |
| 39 |
radius=radius, |
| 40 |
permittivity=eps_gold)) |
| 41 |
|
| 42 |
|
| 43 |
poissonsolver = FDTDPoissonSolver(classical_material=classical_material, |
| 44 |
qm_spacing=0.5, |
| 45 |
cl_spacing=2.0, |
| 46 |
cell=simulation_cell, |
| 47 |
communicator=world, |
| 48 |
remove_moments=(1, 1)) |
| 49 |
poissonsolver.set_calculation_mode('iterate') |
| 50 |
|
| 51 |
|
| 52 |
atoms.set_cell(simulation_cell) |
| 53 |
atoms, qm_spacing, gpts = poissonsolver.cut_cell(atoms, vacuum=4.0) |
| 54 |
|
| 55 |
|
| 56 |
gs_calc = GPAW(mode='fd', |
| 57 |
gpts=gpts, |
| 58 |
nbands=-1, |
| 59 |
poissonsolver=poissonsolver, |
| 60 |
symmetry={'point_group': False}) |
| 61 |
atoms.calc = gs_calc |
| 62 |
|
| 63 |
|
| 64 |
energy = atoms.get_potential_energy() |
| 65 |
|
| 66 |
|
| 67 |
gs_calc.write('gs.gpw', 'all') |
| 68 |
|
| 69 |
|
| 70 |
kick = [0.001, 0.000, 0.000] |
| 71 |
time_step = 10 |
| 72 |
iterations = 1500 |
| 73 |
|
| 74 |
td_calc = TDDFT('gs.gpw') |
| 75 |
DipoleMomentWriter(td_calc, 'dm.dat') |
| 76 |
|
| 77 |
|
| 78 |
frequencies = [2.05, 2.60] |
| 79 |
width = 0.15 |
| 80 |
cl_ind = FDTDInducedField(paw=td_calc, |
| 81 |
frequencies=frequencies, |
| 82 |
width=width) |
| 83 |
qm_ind = TDDFTInducedField(paw=td_calc, |
| 84 |
frequencies=frequencies, |
| 85 |
width=width) |
| 86 |
|
| 87 |
|
| 88 |
td_calc.absorption_kick(kick_strength=kick) |
| 89 |
td_calc.propagate(time_step, iterations) |
| 90 |
|
| 91 |
|
| 92 |
td_calc.write('td.gpw', 'all') |
| 93 |
cl_ind.write('cl.ind') |
| 94 |
qm_ind.write('qm.ind') |
| 95 |
|
| 96 |
photoabsorption_spectrum('dm.dat', 'spec.3.dat', width=width) |