Created
April 17, 2016 10:17
-
-
Save Asif-Iqbal-Bhatti/01882c8ba715779a5925af28b496075f to your computer and use it in GitHub Desktop.
Script for BigDFT code for extract data generated by Bader analysis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
echo " ------------------------" | |
echo " Bader analysis " | |
echo " ------------------------" | |
echo " Reading "free-Atoms/Bonds.csv/txt" from Mercury software file !!!" | |
echo " Reading "dipole.yaml" from bader output file" | |
if [[ -e charges.dat ]] ; then | |
rm -r charges.dat | |
fi | |
echo " Extracting ... " | |
echo " Reading number of atoms in the system" | |
n=`cat posinp.xyz | awk '{printf "%s\n", $1}' | tail -n +3 | sed '/^\s*$/d' | wc -l` | |
n=`cat posinp.xyz | awk '{printf "%s\n", $1}' | tail -n +3 | sed '/^\s*$/d' | wc -l` | |
awk 'BEGIN{FS=","; OFS="\t"}{print $1,$2}' free-Atoms.csv | awk '{printf "%s%d\n", $2, $1}' | tail -n +2 > ".sym" | |
#cat posinp.xyz | awk '{printf "%s\n", $1}' | tail -n +3 | sed '/^\s*$/d' > ".sym" | |
grep 'Charge core' dipole.yaml | cut -d':' -f2 | awk '{printf "%10.6f\n", $1}' | sed '/^\s*$/d' | tail -$n > ".core" | |
awk 'BEGIN{FS="Charge elec.:"; OFS="\t"}{print $2}' dipole.yaml | sed '/^\s*$/d' | awk '{printf "%12.6f\n", $1}' | tail -$n > ".elec" | |
awk 'BEGIN{FS="Charge net:"; OFS="\t"}{print $2}' dipole.yaml | sed '/^\s*$/d' | awk '{printf "%12.6f\n", $1}' | tail -$n > ".net" | |
echo " Writing to a file ... " | |
echo " Charges " >> charges.dat | |
echo " _____________________________________" >> charges.dat | |
echo "Atom" "Core" "Elec" "Net" | awk '{printf "%5s %12s %12s %12s\n", $1, $2, $3, $4}' >> charges.dat | |
paste ".sym" ".core" ".elec" ".net" | awk '{printf "%5s %12.6f %12.6f %12.6f\n", $1, $2, $3, $4}' >> charges.dat | |
rm -r .sym .core .elec .net | |
# Parsing the file separated by "," and reverse the columns | |
#awk 'BEGIN{FS=","; OFS="\t"}{print $1,$2}' free-Atoms.csv | awk '{printf "%s%d\n", $2, $1}' | |
# | |
# Bond extrction from a file and display in a standard way. | |
#awk 'BEGIN{FS=","; OFS="\t"}{print $1,$2,$3,$4}' free-Bonds.csv | awk '{printf "%5d %5s %5s %10.6f\n", $1, $2, $3, $4}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment