-
Notifications
You must be signed in to change notification settings - Fork 7
/
pyfragparce.sh
108 lines (88 loc) · 3.33 KB
/
pyfragparce.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
97
98
99
100
101
102
103
104
105
106
107
108
function jobsubargue {
jobsub="$1"
while read -r line
do
if [ "$line" != "" ]; then
name="$line"
echo "$name"
fi
done < "$jobsub"
}
function pyfragargue {
pyfrag="$1"
while read -r line
do
if [ "$line" != "" ]; then
name="$line"
echo "--$name \\"
fi
done < "$pyfrag"
}
function adfargue {
adf=$*
Mark=(scf xc basis BECKEGRID EPRINT OCCUPATIONS ZLMFIT Properties IrrepOccupations)
SMark=(numericalquality relativistic symmetry unrestricted UnrestrictedFragments)
for item in ${Mark[*]}
do
grep -iA 20 "$item" $adf | grep -m 1 -iB 20 'end' | grep -iv 'end' | grep -iv "$item" > "$item".txt
if [ -s "$item".txt ]; then
argue="$item".txt
while read -r line
do
if [ "$line" != "" ]; then
option="$line"
optionarray=( $option )
echo "adf.""$item."${optionarray[0]}"="${optionarray[@]:1}
fi
done < "$argue"
fi
rm "$item".txt
done
for sitem in ${SMark[*]}
do
soption=`grep -iw "$sitem" $adf`
if [ ! -z "$soption" ]; then
soptionarray=( $soption )
if [[ ! -z ${soptionarray[@]:1} ]]; then
echo "adf."$sitem"="${soptionarray[@]:1}
else
echo "adf."$sitem"=True"
fi
fi
done
soption=`grep -iw "charge" $adf`
if [ ! -z "$soption" ]; then
soptionarray=( $soption )
if [[ ! -z ${soptionarray[@]:1} ]]; then
echo "ams.system.charge="${soptionarray[@]:1}
fi
fi
}
input=$*
SCRIPTPATH="$( cd "$(dirname "$1")" ; pwd -P )"
grep -A 200 'JOBSUB' $input | grep -B 200 'JOBSUB END' | grep -v 'JOBSUB' | grep -v 'JOBSUB END' > jobsub.txt
grep -A 200 'ADF' $input | grep -B 200 'ADF END' | grep -v 'ADF' | grep -v 'ADF END' > adf.txt
grep -A 200 'PyFrag' $input | grep -B 200 'PyFrag END' | grep -v 'PyFrag' | grep -v 'PyFrag END' > pyfrag.txt
grep -A 200 'fragment1 EXTRA' $input | grep -B 200 'fragment1 EXTRA END' | grep -v 'fragment1 EXTRA' | grep -v 'fragment1 EXTRA END' > fragment1_EXTRA.txt
grep -A 200 'fragment2 EXTRA' $input | grep -B 200 'fragment2 EXTRA END' | grep -v 'fragment2 EXTRA' | grep -v 'fragment2 EXTRA END' > fragment2_EXTRA.txt
grep -A 200 'complex EXTRA' $input | grep -B 200 'complex EXTRA END' | grep -v 'complex EXTRA' | grep -v 'complex EXTRA END' > complex_EXTRA.txt
submit="amspython \$HOSTPYFRAG/standalone/adf_new/PyFrag.py \\"
subadfinputfile="--adfinputfile "$SCRIPTPATH/"adfinputfile \\"
echo -n "" > ./sub
jobsubargue jobsub.txt >> ./sub
echo $submit >> ./sub
pyfragargue pyfrag.txt >> ./sub
echo $subadfinputfile >> ./sub
echo -n "" > ./adfinputfile
adfargue adf.txt >> ./adfinputfile
extraOption=(fragment1_EXTRA.txt fragment2_EXTRA.txt complex_EXTRA.txt)
for extraItem in ${extraOption[*]}
do
if [ -s $extraItem ]; then
echo -n "" > ./${extraItem%.txt}
adfargue $extraItem >> ./${extraItem%.txt}
subItem="--"${extraItem%.txt}" $SCRIPTPATH/${extraItem%.txt} \\"
echo $subItem >> ./sub
fi
done
rm jobsub.txt adf.txt pyfrag.txt fragment1_EXTRA.txt fragment2_EXTRA.txt complex_EXTRA.txt