forked from itamblyn/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract_dipole_different.sh
executable file
·61 lines (47 loc) · 1.35 KB
/
extract_dipole_different.sh
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
#!/bin/tcsh
# 1 D = 0.393430307 e*a_0
# 2.5417462310548435
rm -f planechg.in
ln -s ~/scripts/chg.in planechg.in
/global/home/users/itamblyn/bin/planechg.x
rm planechg.in planechg.out
mv planechg.dat chg.dat
rm -f planechg.in
ln -s ~/scripts/pot.in planechg.in
/global/home/users/itamblyn/bin/planechg.x
rm planechg.in planechg.out
mv planechg.dat pot.dat
module unload gnuplot
module load gnuplot/4.2.5-gcc-gd
set cmd="gnuplot.scr"
cat > $cmd << END
set style data lines
set xlabel "Position [A]"
set yrange [*:*]
set terminal png
set output 'chg.png'
plot "chg.dat" t "Charge density", "pot.dat" u 1:(\$2*100) t "Potential"
quit
END
gnuplot $cmd
\rm $cmd
if( ! -e trimmed.dat ) then
set parent=`pwd`
set chgdiff=~/scripts/vtstscripts/chgdiff.pl
$chgdiff CHGCAR chg/sur/CHGCAR
mv CHGCAR_diff CHGCAR.noslab
$chgdiff CHGCAR.noslab chg/mol/CHGCAR
mv CHGCAR_diff dNCAR
rm CHGCAR.noslab
rm -f planechg.in
ln -s ../dncar.in planechg.in
/global/home/users/itamblyn/nano1/butanediamine_junction/chgplane.x
rm -f planechg.in
echo
echo "Okay, now you have to trim the file planechg.dat, and call it trimmed.dat"
endif
if( -e trimmed.dat ) then
echo "Did you remember to trim both ends of the file??"
set origin=`head -1 trimmed.dat | awk '{print $2}'`
awk '\!/#/{i+=((($2 - '$origin')/0.529177)*$3*2.5417462310548435); print $2, i}' trimmed.dat | tail -1
endif