lunedì 8 febbraio 2016

Skullbasher and Scriptbasher

Then comes the time when you need to use a program (PowDog) that takes as input only file with format .qpow and you only have the .xyz files.
Moreover this program wants as inline command the atom element. So you script something with bash that transforms .xyz into .qpow and then starts the program N times with different inline command each time.

Mission accomplished.


#!/bin/bash 


for f in *.xyz; do 

   awk '{t=$1; $1=$2; $2=$3; $3=$4; $4=t; print }' $f > $f.qpowd 
done 
for f in *.qpowd; do 
#the "${f%%-*}" only takes the first 2 characters of the file's name 
   ./powdog -i $f -F form.factor -e "${f%%-*}" 
done



Nessun commento:

Posta un commento