下面是sobEDA.sh用于编辑fragment i.gjf的命令行:
dos2unix -q fragment.txt
read nfrag < fragment.txt
echo "Number of fragments: $nfrag"
iopsh=0 #Assumed to be closed-shell
for ((i=1;i<=$nfrag;i=i+1))
do
awk 'NR==var' var=$((2*i)) fragment.txt > tmp
read chg multi < tmp
multiarr[$i]=$multi
if (( $multi != 1 )); then
iopsh=1
fi
if (( $multi < 0 )); then #Remove negative sign
multi=${multi#-}
fi
awk 'NR==var' var=$((2*i+1)) fragment.txt > tmp
read atom < tmp
echo
echo "Charge and spin multiplicity of fragment $i: $chg $multi"
echo "Indices of atoms in fragment $i: $atom"
rm -f tmp
echo "Generating Gaussian input file of fragment $i via Multiwfn (fragment$i.gjf)"
if (( $iCP == 0 )); then
$mwfn system.xyz << EOF > read.txt
gi
custom
$chg $multi
$atom
fragment.gjf
q
EOF
else
$mwfn system.xyz << EOF > read.txt
gi
Bq
$chg $multi
$atom
fragment.gjf
q
EOF
fi
echo "%chk=fragment$i.chk" > tmp.txt
cat tmp.txt fragment.gjf > fragment$i.gjf
rm -f tmp.txt fragment.gjf