[CP2K-user] [CP2K:13619] Some questions about using RT-TDDFT method in cp2k code to calculate spectrum

Mario van Rooij mario.... at student.uva.nl
Fri Jul 10 16:29:27 UTC 2020


Dear Lin,

I am not at all an expert on the issue, but I do have this example file
online. Also once you obtain the dipole moment as a function of time, you
can perform a Fourier transform of the data. I have attached a python
script to transform the data. Make sure it works properly yourself and make
sure you read about why this works :-). The output you want for the
spectrum should be called something like ch2o_pbe_rtp-output-moments.dat. I
tried this for quantum dots and it didn't work. Maybe different timestep
and basis/ potential are needed. Also, I don't know if the script can
handle these small numbers.

Good luck,

Mario



On Fri, Jul 10, 2020 at 4:03 PM lin xiong <xiongl... at gmail.com> wrote:

> Hi all,
>
>
>     Recently I learned that cp2k code has two ways to calculate the
> absorption spectrum, namely real time propagation TDDFT and TDDFPT. I would
> like to ask some questions about using rt-TDDFT to calculate the spectra.
>
>     1. First of all, I would like to ask if my input file is correct? If
> the input file is correct, then there are two additional questions: 2. In
> which file (as shown in the figure below) is the data used to draw the
> spectrum stored? 3. How to use these data to plot the spectrum?
>
> [image: 25.jpg]
>
> --
> You received this message because you are subscribed to the Google Groups
> "cp2k" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cp... at googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cp2k/75ac4790-b50d-4289-b5aa-a8385584f19ao%40googlegroups.com
> <https://groups.google.com/d/msgid/cp2k/75ac4790-b50d-4289-b5aa-a8385584f19ao%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20200710/89a2dbbd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 25.jpg
Type: image/jpeg
Size: 71846 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20200710/89a2dbbd/attachment.jpg>
-------------- next part --------------
import numpy as np
from sys import argv
import matplotlib.pyplot as plt

z_dipoles = []
with open("ch2o_pbe_rtp-output-moments.dat") as f:
#with open(argv[1]) as f:
    lines = f.readlines()
    
    max_value = 0
    for line in lines:
        line = line.split(' ')
        line = filter(None, line)
        flip = 0
        for string in line:
            if string == 'Z=':
                flip = 1
                continue
            if flip == 1:
                z_dipoles.append(float(string))
                break

signal = np.array(z_dipoles, dtype=float)
fourier = np.fft.fft(signal)
n = signal.size
timestep = np.float64(0.025 * 10E-15) #2.419E-17
freq = np.fft.fftfreq(n, d=timestep) * np.float64(6.626E-34 * 6.24E18)


print(len(z_dipoles))
plt.plot(z_dipoles)
plt.show()
#y = range(len(z_dipoles))
#x = numpy.array(y, z_dipoles)
x = np.fft.rfft(z_dipoles)
plt.plot(freq[0:len(x[1:])],abs(x[1:]))
plt.show()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cp2k.in
Type: application/octet-stream
Size: 2683 bytes
Desc: not available
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20200710/89a2dbbd/attachment.obj>


More information about the CP2K-user mailing list