The Python Script "plot.multitask"
by Ronaldo Rodrigues Pela
Purpose: This python script is part of the excitingscripts module and is employed in all tutorials with real-time TDDFT calculations to post-process outputs and produce relevant plots. Here, we detail how this script works.
General description:
plot.multitask can be used basically to process and to plot data from one or more files. The first case is tagged in the script as a preprocess mode, because it is intended to work as a previous step followed by a new call to plot what has been processed.
Considering these two functionalities, the arguments taken by plot.multitask can be classified in 4 groups:
- mandatory arguments;
- general optional arguments, common for plotting and preprocessing;
- optional arguments for preprocessing;
- optional arguments for plotting.
Mandatory arguments:
ArgumentDescription
General optional arguments:
| Argument |
Default |
Description |
| -k |
0 1 (for each file given) |
columns to read in each file (x and y). A pair of integers must be given for each file. It is overwritten by options like: --x, or --xy |
| -s |
0 (for each file given) |
number of lines to skip (ignore), before reading the data (must be given for each file) |
| --scale |
1.0 1.0 |
two floats with a scaling factor for the data read (x and y from all files are scaled with these factors) |
| --handle_complex |
'no' |
if/how to treat the complex numbers (only for y-data). Possible choices are 'no', 'full', 'imag', 'real', and 'abs'. This can be useful e.g. when plotting the imaginary part of the dielectric function. |
Optional arguments for preprocessing:
| Argument |
Default |
Description |
| --preprocess |
|
triggers the preprocessing mode. A maximum of one of the following options can be provided: --fourier, --get_efield, --get_eps, --add, --sub. The argument --scale can also be employed |
| -o |
output.txt |
name of output |
| --add |
|
adds the data read from two files (only the columns treated as y are added) |
| --sub |
|
same as add, but subtracts, first y minus second y |
| --get_efield |
|
calculates the electric field, given a file containing the vector potential |
| --fourier |
|
obtains the fast fourier transform applying, if requested, a smoothing filter |
| --wcut |
0.0 |
broadening used for the smoothing filter |
| --get_eps |
|
obtains the dielectric function, using the first file with the vector potential and the second file with the current density. One of the following options can be given: --xx, --xy, …, --zz. Default is --xx. |
| --ab |
--xx |
ab component of the dielectric function. a and b must be x, y or z. To be used together with --get_eps. |
Optional arguments for plotting:
| Argument |
Default |
Description |
| --jind |
|
intended to be used when plotting the current density. It triggers the y-label as 'Current Density [a.u.]' and considers --x (see next option) as default |
| --x, --y, --z |
|
tag for the component to be plotted. The meaning is to set -k to 0 1, 0 2, or 0 3, respectively. If --get_efield is used, then these numbers are 0 2, 0 4, and 0 6. |
| --nexc |
|
intended to be used when plotting the number of excitations. It triggers the y-label as , considers the default of 0 2 for -k and 1 for -s. |
| --imag_eps |
|
intended to be used when plotting the imaginary part of the dielectric function. It triggers the x- and y-labels, and multiplies the x-data by 27.211396132 (conversion factor: Ha to eV) |
| --real_eps |
|
same as before, but for the real part of the dielectric function. |
| --xlim |
|
two floats as limits for the x-axes |
| --ylim |
|
two floats as limits for the y-axes |
| --xlabel |
'Time [a.u.]' |
label for the x axis |
| --ylabel |
'y' |
label for the y axis |
| -c |
name of files |
caption to be shown in the legend box (one for each file) |
| --legend_position |
'upper right' |
defines the position of the legend. Options are: 'upper right', 'lower right', 'upper left', 'lower left' |
| --hide_legend |
|
prevents the legend to be shown. Automatically set when only one file is used for plotting |
| --semilog |
|
triggers a semilog plot |