-
Notifications
You must be signed in to change notification settings - Fork 2
/
EXECUTE-diamond-phonon-g.sh
executable file
·97 lines (96 loc) · 2.3 KB
/
EXECUTE-diamond-phonon-g.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
#_______________________________________________________________________________
#
EXECUTABLE=$EXCITINGROOT/bin/excitingser
#
CURRENT=$PWD
#-------------------------------------------------------------------------------
WORKDIR=workdir
if [ ${#1} -gt 0 ]; then WORKDIR=$1 ; fi
if [ ! -d "$WORKDIR" ]; then
echo ; echo "Working directory \""$WORKDIR"\" does NOT exist!!" ; echo ; exit
fi
#
RUNDIR=$CURRENT/$WORKDIR
#
if [ -d "$EXCITINGRUNDIR" ]; then
RUNDIR=$EXCITINGRUNDIR
else
len=${#EXCITINGRUNDIR}
if [ "$len" -gt 0 ]; then
mkdir $EXCITINGRUNDIR
RUNDIR=$EXCITINGRUNDIR
fi
fi
#
XCRUNDIR=xc-rundir
i=0
while [ -d "$RUNDIR/$XCRUNDIR" ]; do
i=$(($i + 1))
XCRUNDIR="$XCRUNDIR$i"
done
#-------------------------------------------------------------------------------
echo
echo "===> Output directory is \""$WORKDIR"\" <==="
echo
#-------------------------------------------------------------------------------
echo $EXECUTABLE > $CURRENT/$WORKDIR/exciting
#
OUTE=$CURRENT/$WORKDIR/energy-vs-displacement
OUTF=$CURRENT/$WORKDIR/force-vs-displacement
#
if [ -f $OUTE ] ; then
mv $OUTE $OUTE.save
fi
#
if [ -f $OUTF ] ; then
mv $OUTF $OUTF.save
fi
#
cd $WORKDIR
input_list=`ls -d input-*`
cd $RUNDIR
#
aloop=0
#
for input in $input_list ; do
echo
echo "Running exciting for file" $input "----------------------------------"
echo
#
rm -Rf $XCRUNDIR
mkdir $XCRUNDIR
cd $XCRUNDIR
cp $CURRENT/$WORKDIR/$input input.xml
#
time $EXECUTABLE | tee output.screen
#
suffix=$(echo $input | cut -c7-8)
#
uuu=$(cat $CURRENT/$WORKDIR/displ-$suffix)
tot=TOTENERGY.OUT
#
# awk -v eta="$uuu" \
# '/ / {printf "%11.8f %20.10f\n",eta,$1}' $tot | tail -n1
awk -v eta="$uuu" \
'/ / {printf "%11.8f %20.10f\n",eta,$1}' $tot | tail -n1>>$OUTE
#
grep -A12 "Forces :" INFO.OUT | tail -n1 >> dumforce
awk -v eta="$uuu" \
'/ / {printf "%11.8f %20.10f\n",eta,$4}' dumforce | tail -n1>>$OUTF
rm -f dumforce
#
cd ../
#
rm -Rf $CURRENT/$WORKDIR/rundir-$suffix
mv $XCRUNDIR $CURRENT/$WORKDIR/rundir-$suffix
cd $CURRENT/$WORKDIR
if [ $aloop = 1 ]; then PLOT-energy.py ; fi
cd $RUNDIR
echo
echo "Run completed for file" $input "-------------------------------------"
echo
aloop=1
#
done
echo