from gpaw.lcaotddft import LCAOTDDFT from gpaw.lcaotddft.dipolemomentwriter import DipoleMomentWriter # Read the ground-state file td_calc = LCAOTDDFT('gs.gpw') # Attach analysis tools DipoleMomentWriter(td_calc, 'dm_replayed.dat') # Replay the propagation td_calc.replay(name='wf.ulm', update='all')
from gpaw.lcaotddft import LCAOTDDFT from gpaw.lcaotddft.densitymatrix import DensityMatrix from gpaw.lcaotddft.frequencydensitymatrix import FrequencyDensityMatrix from gpaw.tddft.folding import frequencies # Read the ground-state file td_calc = LCAOTDDFT('gs.gpw') # Attach analysis tools dmat = DensityMatrix(td_calc) freqs = frequencies([1.12, 2.48], 'Gauss', 0.1) fdm = FrequencyDensityMatrix(td_calc, dmat, frequencies=freqs) # Replay the propagation td_calc.replay(name='wf.ulm', update='none') # Store the density matrix fdm.write('fdm.ulm')
# Restart from the restart point td_calc = LCAOTDDFT('td.gpw', txt='td2.out') DipoleMomentWriter(td_calc, 'dm.dat') WaveFunctionWriter(td_calc, 'wf.ulm') WaveFunctionWriter(td_calc, 'wf_split.ulm') td_calc.propagate(20, 3) td_calc.propagate(20, 3) td_calc.propagate(10, 3) photoabsorption_spectrum('dm.dat', 'spec.dat') world.barrier() ref_i = np.loadtxt('spec.dat').ravel() # Replay both wf*.ulm files for tag in ['', '_split']: td_calc = LCAOTDDFT('gs.gpw', txt='rep%s.out' % tag) DipoleMomentWriter(td_calc, 'dm_rep%s.dat' % tag) td_calc.replay(name='wf%s.ulm' % tag, update='density') photoabsorption_spectrum('dm_rep%s.dat' % tag, 'spec_rep%s.dat' % tag) world.barrier() # Check the spectrum files # Do this instead of dipolemoment files in order to see that the kick # was also written correctly in replaying data_i = np.loadtxt('spec_rep%s.dat' % tag).ravel() tol = 1e-10 equal(data_i, ref_i, tol)