source: util/config2xyz.sh@ 473c2b

Last change on this file since 473c2b was a0bcf1, checked in by Frederik Heber <heber@…>, 17 years ago

-initial commit
-Minimum set of files needed from ESPACK SVN repository
-Switch to three tantamount package parts instead of all relating to pcp (as at some time Ralf's might find inclusion as well)

  • Property mode set to 100755
File size: 946 bytes
RevLine 
[a0bcf1]1#!/bin/sh
2#
3# extracts a .xyz-file from a pcp config file
4
5if [ -z "$1" ]; then
6 echo "Usage: $0 <config> [output.xyz]"
7else
8 config=$1
9 if [ ! -z "$2" ]; then
10 output=$2
11 else
12 output="$1.xyz"
13 fi
14fi
15
16echo -n "Retrieving Ion types ..."
17ions=`grep '^Ion_Type.[^_]' $config | awk -F"\t" {'print $9'}`
18ionnumber=`grep '^Ion_Type.[^_]' $config | awk -F"\t" {'print $2'}`
19OLDIFS=$IFS
20IFS='
21'
22i=1
23number=0
24declare -a types
25for ion in $ions; do
26 types[$i]=$ion
27 let i=$i+1
28done
29i=1
30for nr in $ionnumber; do
31 let number=$number+$nr
32 echo -n "${types[$i]} ($nr)"
33 let i=$i+1
34done
35IFS=$OLDIFS
36echo done
37
38echo "Converting $config to $output...done"
39# Schreibe Kopf
40echo "$number" >$output
41echo -e "\tgenerated with config2xyz from $config" >>$output
42# Fuege Ionen dran
43j=1
44while [ $j -lt $i ]; do
45 `grep ^Ion_Type${j}_ $config | awk -F" " {'print $1"\t"$2"\t"$3"\t"$4'} | sed -e "s#Ion_Type${j}_[0-9]*#${types[$j]}#" >>$output`
46 let j=$j+1
47done
48
49
50exit 0
Note: See TracBrowser for help on using the repository browser.