Created
May 11, 2012 10:42
-
-
Save jarvist/2658904 to your computer and use it in GitHub Desktop.
File to explode a PBC Translation Vector Gaussian .com file into separate TV molecular pair com files. Nb: Known bug of print rounding distances to whole number, breaking Gaussian.
This file contains hidden or 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/awk -f | |
#Filthy hack to project a 'pair' of molecules by reading the TV vectors from a .com file | |
#~Jarv 2012-05-10 | |
BEGIN{ | |
} | |
{ | |
if ($1=="0") | |
{ | |
getline | |
a=0 | |
tv=0 | |
while (NF==4) | |
{ | |
if ($1=="Tv") | |
{ | |
tv++ | |
tx[tv]=$2 | |
ty[tv]=$3 | |
tz[tv]=$4 | |
} | |
else { | |
a++ | |
at[a]=$1 | |
x[a]=$2 | |
y[a]=$3 | |
z[a]=$4 | |
} | |
getline | |
} | |
} | |
} | |
END{ | |
for (t=1;t<=tv;t++) { | |
print "TV: ",tx[t],ty[t],tz[t] | |
split(FILENAME,f,".") #first bit before the period | |
outfile=f[1]"_TV"t".com" | |
print outfile | |
for (k=1;k<=a;k++) { | |
print at[k], x[k], y[k], z[k] > outfile | |
} | |
for (k=1;k<=a;k++) { | |
print at[k],x[k]+tx[t],y[k]+ty[t],z[k]+tz[t] > outfile | |
} | |
print > outfile #Oh Gaussian. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment