from ase import Atoms from gpaw.tddft import photoabsorption_spectrum from gpaw import PoissonSolver from gpaw.lcaotddft.tddfpt import DensityCollector from gpaw.lcaotddft import LCAOTDDFT atoms = Atoms('Na8', positions=[[i * 3.0, 0, 0] for i in range(8)]) atoms.center(vacuum=5.0) # Calculate all bands td_calc = LCAOTDDFT(basis='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)) atoms.set_calculator(td_calc) atoms.get_potential_energy() td_calc.write('Na8_gs.gpw', mode='all') td_calc = LCAOTDDFT('Na8_gs.gpw') td_calc.attach(DensityCollector('Na8.TdDen', td_calc)) td_calc.absorption_kick([1e-4, 0.0, 0.0]) td_calc.propagate(20, 1000, 'Na8.dm') photoabsorption_spectrum('Na8.dm', 'Na8.spec', width=0.15)
from gpaw.lcaotddft import LCAOTDDFT from gpaw.lcaotddft.dipolemomentwriter import DipoleMomentWriter from gpaw.lcaotddft.wfwriter import WaveFunctionWriter # Read the ground-state file td_calc = LCAOTDDFT('gs.gpw', txt='td.out') # Attach any data recording or analysis tools DipoleMomentWriter(td_calc, 'dm.dat') WaveFunctionWriter(td_calc, 'wf.ulm') # Kick and propagate td_calc.absorption_kick([1e-5, 0., 0.]) td_calc.propagate(20, 1500) # Save the state for restarting later td_calc.write('td.gpw', mode='all')
convergence = {'density': 1e-6} # Increase accuracy of Poisson Solver and apply multipole corrections up to l=2 poissonsolver = PoissonSolver(eps=1e-14, remove_moment=1 + 3) td_calc = LCAOTDDFT(xc='GLLBSC', basis='GLLBSC.dz', h=0.3, nbands=352, convergence=convergence, poissonsolver=poissonsolver, occupations=FermiDirac(0.1), parallel={ 'sl_default': (8, 8, 32), 'band': 2 }) atoms.set_calculator(td_calc) # Relax the ground state atoms.get_potential_energy() # For demonstration purposes, save intermediate ground state result to a file td_calc.write('ag55.gpw', mode='all') td_calc = LCAOTDDFT('ag55.gpw', parallel={'sl_default': (8, 8, 32), 'band': 2}) td_calc.absorption_kick([1e-5, 0.0, 0.0]) td_calc.propagate(20, 500, 'ag55.dm') photoabsorption_spectrum('ag55.dm', 'ag55.spec', width=0.2)