<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Best report ever
Everything you see here is either markdown, LaTex, Python or BASH.
The spectral function
It looks like this
Step1:  Now I can run my script
Step2:  Not very elegant, I know. It's just for demo pourposes.
Step3:  I have first to import a few modules/set up a few things
Step4:  Next I can read the data from a local folder
Step5:  Now I can plot the stored arrays.
Step6:  Creating a PDF document
I can create a PDF version of this notebook from itself, using the command line
<ASSISTANT_TASK:>
Python Code:
!gvim data/SF_Si_bulk/invar.in
Explanation: Best report ever
Everything you see here is either markdown, LaTex, Python or BASH.
The spectral function
It looks like this:
\begin{equation}
 A(\omega) = \mathrm{Im}|G(\omega)|
\end{equation}
GW vs Cumulant
Mathematically very different:
\begin{equation}
 G^{GW} (\omega) = \frac1{ \omega - \epsilon - \Sigma (\omega) } 
\end{equation}
\begin{equation}
 G^C(t_1, t_2) = G^0(t_1, t_2) e^{ i \int_{t_1}^{t_2} \int_{t'}^{t_2} dt' dt'' W (t', t'') }
\end{equation}
BUT they connect through $\mathrm{Im} W (\omega) = \frac1\pi \mathrm{Im} \Sigma ( \epsilon - \omega )$.
Implementation
Using a multi-pole representation for $\Sigma^{GW}$:
\begin{equation}
 \mathrm{Im} W (\omega) = \frac1\pi \mathrm{Im} \Sigma ( \epsilon - \omega )
\end{equation}
\begin{equation}
 W (\tau) = - i \lambda \bigl[ e^{ i \omega_p \tau } \theta ( - \tau ) + e^{ - i \omega_p \tau } \theta ( \tau ) \bigr]
\end{equation}
GW vs Cumulant
GW:
\begin{equation}
 A(\omega) = \frac1\pi \frac{\mathrm{Im}\Sigma (\omega)} 
 { [ \omega - \epsilon - \mathrm{Re}\Sigma (\omega) ]^2 + 
 [ \mathrm{Im}\Sigma (\omega) ]^2}
\end{equation}
Cumulant:
\begin{equation}
 A(\omega) = \frac1\pi \sum_{n=0}^{\infty} \frac{a^n}{n!} \frac{\Gamma}{ (\omega - \epsilon + n \omega_p)^2 + \Gamma^2 }
\end{equation}
Now some executable code (Python)
I have implemented the formulas above in my Python code. 
I can just run it from here., but before let me check
if my input file is correct...
End of explanation
%cd data/SF_Si_bulk/
%run ../../../../../Code/SF/sf.py
Explanation: Now I can run my script:
End of explanation
cd ../../../
Explanation: Not very elegant, I know. It's just for demo pourposes.
End of explanation
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
# plt.rcParams['figure.figsize'] = (9., 6.)
%matplotlib inline
Explanation: I have first to import a few modules/set up a few things:
End of explanation
sf_c = np.genfromtxt(
    'data/SF_Si_bulk/Spfunctions/spftot_exp_kpt_1_19_bd_1_4_s1.0_p1.0_800ev_np1.dat')
sf_gw = np.genfromtxt(
    'data/SF_Si_bulk/Spfunctions/spftot_gw_s1.0_p1.0_800ev.dat')
#!gvim spftot_exp_kpt_1_19_bd_1_4_s1.0_p1.0_800ev_np1.dat
Explanation: Next I can read the data from a local folder:
End of explanation
plt.plot(sf_c[:,0], sf_c[:,1], label='1-pole cumulant')
plt.plot(sf_gw[:,0], sf_gw[:,1], label='GW')
plt.xlim(-50, 0)
plt.ylim(0, 300)
plt.title("Bulk Si - Spectral function - ib=1, ikpt=1")
plt.xlabel("Energy (eV)")
plt.grid(); plt.legend(loc='best')
Explanation: Now I can plot the stored arrays.
End of explanation
!jupyter-nbconvert --to pdf cumulant-to-pdf.ipynb
pwd
!xpdf cumulant-to-pdf.pdf
Explanation: Creating a PDF document
I can create a PDF version of this notebook from itself, using the command line:
End of explanation
<END_TASK>