-
Notifications
You must be signed in to change notification settings - Fork 1
/
plotoptics
executable file
·76 lines (67 loc) · 1.94 KB
/
plotoptics
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /bin/bash
# Get system name
NAME=$(NAME= cat vasprun.xml | grep SYSTEM | tail -1 | sed -e 's,.*>\([^<]*\)</.*,\1,g')
mkdir $NAME
cp vasprun.xml $NAME/vasprun.xml
cd $NAME
#exctract dielectric functions from vasprun.xml
#this portion of code taken from http://cms.mpi.univie.ac.at/wiki/index.php/Dielectric_properties_of_SiC
awk 'BEGIN{i=1} /imag/,\
/\/imag/ \
{a[i]=$2 ; b[i]=$3 ; i=i+1} \
END{for (j=12;j<i-3;j++) print a[j],b[j]}' vasprun.xml > imag.dat
awk 'BEGIN{i=1} /real/,\
/\/real/ \
{a[i]=$2 ; b[i]=$3 ; i=i+1} \
END{for (j=12;j<i-3;j++) print a[j],b[j]}' vasprun.xml > real.dat
cat >plotfile<<!
# set term postscript enhanced eps colour lw 2 "Helvetica" 20
# set output "optics.eps"
plot [0:25] "imag.dat" using (\$1):(\$2) w lp, "real.dat" using (\$1):(\$2) w lp
!
usage="$(basename "$0") [-h] [-a] [-t] [-l] [-e] [-r] [-x] -- program to calculate optical properties of solids
where:
-h show this help text
-a make all plots
-t tauc plot
-l absorption plotted versus lambda
-e absorption plotted versus energy[eV]
-r reflection versus energy and lambda
-x loss function v. energy and lambda
notes:
all plots are saved to .png format
all data are saved to .dat format"
while getopts hatlerx option; do
case "$option" in
h) echo "$usage"
exit
;;
a) Rscript ../plot.R
Rscript ../plot_lambda.R
Rscript ../plot_tauc.R
Rscript ../plot_reflection.R
Rscript ../plot_loss.R
exit 1
;;
t) Rscript ../plot_tauc.R
exit 1
;;
l) Rscript ../plot_lambda.R
exit 1
;;
e) Rscript ../plot.R
exit 1
;;
r) Rscript ../plot_reflection.R
exit 1
;;
x) Rscript ../plot_loss.R
exit 1
;;
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
;;
esac
done
shift $((OPTIND - 1))