Commit 97deb1c0 authored by kuismam's avatar kuismam

Update documentation with example about induced density

parent f9f419f1
def agts(queue):
basis = queue.add('', ncpus=1, walltime=1)
basis = queue.add('', ncpus=1, walltime=10)
ag55 = queue.add('', deps=[basis], ncpus=64, walltime=120)
queue.add('', deps=[ag55], creates='fig1.png')
induced = queue.add('', ncpus=4, walltime=60)
queue.add('', deps=[induced], ncpus=1, walltime=15)
......@@ -293,6 +293,26 @@ For more details, see [#Kuisma2015]_.
.. image:: fig1.png
Induced density
Plotting the induced density is especially interesting in case of plasmon resonances. As an example, we calculate a dummy Na8 wire and write density to a file on every iteration.
There is certain advantages in writing the density on every iteration instead of using the predefined frequencies and on-fly Fourier transformation: only one TDDFT run is required as any frequency can be analysed as a post processing operation.
Hard disk requirements are large, but tolerable (1-100GB) in usual cases.
.. literalinclude::
Files with extensions .sG and .asp are created, where .sG contains the density in coarse grid and .asp contains the atomic density matrix. With these, it is possible to reconstruct the full density.
This can now be fourier transformed at desired frequency. Here, we look from the produced spectrum file that plasmonic peak, and perform Fourier transform at that frequency.
.. literalinclude::
Two cube files are created, one for sin (imag) and cos (real) transform at the frequency. Usually, one is interested in the absorbing part i.e. imaginary part. Below is visualized the plasmon resonance
in Na8 wire.
.. image:: Na8_imag.png
Advanced tutorial - large organic molecule
......@@ -308,16 +328,13 @@ around the fermi level.
Here, we will calculate a small and a large organic molecule with lcao-tddft.
Induced density
Here we will obtain the induced density.
Kohn-Sham decomposition of the transition density matrix
Here we will analyse the origin of the transitions.
Soon it will be possible to analyse the origin of the transitions the same way as is commonly done in Casida-based codes.
The LCAO basis will be transformed to electron-hole basis of the Kohn-Sham system.
from gpaw.atom.generator import Generator
from gpaw.atom.configurations import parameters
from gpaw.atom.basis import BasisMaker
args = {'core': '[Kr]', 'rcut': 2.45}
print "Generating setup with following parameters", args
args = {'core': '[Kr]', 'rcut': 2.45}
generator = Generator('Ag', 'GLLBSC')
generator.N *= 2 # Increase grid resolution
generator.N *= 2 # Increase grid resolution**args)
bm = BasisMaker(generator, name='GLLBSC-dz', run=False)
basis = bm.generate(zetacount=2, polarizationcount=0,
from ase import Atoms
from gpaw.tddft import photoabsorption_spectrum
from gpaw import PoissonSolver
from gpaw.lcaotddft.tddfpt import TDDFPT, DensityCollector
from gpaw.lcaotddft import LCAOTDDFT
atoms = Atoms('Na8', positions=[ [i*3.0,0,0] for i in range(8) ])
# Calculate all bands
td_calc = LCAOTDDFT(basis='1.dzp', setups={'Na':'1'}, xc='LDA', h=0.3, nbands=4,
convergence = {'density':1e-7},
poissonsolver = PoissonSolver(eps=1e-14, remove_moment=1+3+5))
td_calc = LCAOTDDFT('Na8_gs.gpw', poissonsolver=PoissonSolver(eps=1e-14, remove_moment=1+3+5))
td_calc.attach(DensityCollector('Na8.TdDen', td_calc))
td_calc.absorption_kick([1e-4, 0.0, 0.0])
td_calc.propagate(20, 1000, '')
photoabsorption_spectrum('','Na8.spec', width=0.15)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment